public final class PlatformSpecific extends Object
RequiresJdk8
: animal-sniffer will not scan the annotated class or methods
for Java 6 API compatibility, so use this annotation at the smallest possible scope
createXYZ
public static method in PlatformSpecific
utility
classPlatformSpecific.createXYZ
whenever you need a new instance
public static <S> MethodProbe createLongMethodProbe(Method method, Probe probe, int type) {
if (JavaVersion.isAtLeast(JAVA_1_8)) {
return new LongMethodProbeJdk8<S>(method, probe, type);
} else {
return new MethodProbe.LongMethodProbe<S>(method, probe, type);
}
}
This should be tested in two separate tests, to ensure the proper instance is created
depending on Java runtime version, like this:
{@code
Copyright © 2020 Hazelcast, Inc.. All Rights Reserved.