List of usage examples for org.apache.commons.lang3 JavaVersion JAVA_1_5
JavaVersion JAVA_1_5
To view the source code for org.apache.commons.lang3 JavaVersion JAVA_1_5.
Click Source Link
From source file:com.google.code.jconfig.ConfigurationManager.java
private ConfigurationManager(Map<String, IConfigurationChangeListener> listeners, String filepath) { logger.debug("Running on machine with Java version: " + SystemUtils.JAVA_RUNTIME_VERSION); if (!SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5)) { logger.fatal("Current Java version: " + SystemUtils.JAVA_RUNTIME_VERSION + " - NEEDED " + JavaVersion.JAVA_1_5 + " or above."); throw new RuntimeException("You must have at leat Java 1.5 using this library."); }//w w w . ja v a2s . com logger.info("******* ConfigurationManager initialization *******"); logger.info(" -> configuration: " + filepath); logger.info(" -> registered listeners: " + listeners); logger.info("***************************************************"); this.filepath = filepath; activeListeners = listeners; currentConfigurationInfo = new ConfigurationInfo(); }
From source file:objenome.util.ClassUtils.java
/** * <p>Checks if an array of Classes can be assigned to another array of Classes.</p> * * <p>This method calls {@link #isAssignable(Class, Class) isAssignable} for each * Class pair in the input arrays. It can be used to check if a set of arguments * (the first parameter) are suitably compatible with a set of method parameter types * (the second parameter).</p>//from w ww . j a va 2 s . c om * * <p>Unlike the {@link Class#isAssignableFrom(Class)} method, this * method takes into account widenings of primitive classes and * {@code null}s.</p> * * <p>Primitive widenings allow an int to be assigned to a {@code long}, * {@code float} or {@code double}. This method returns the correct * result for these cases.</p> * * <p>{@code Null} may be assigned to any reference type. This method will * return {@code true} if {@code null} is passed in and the toClass is * non-primitive.</p> * * <p>Specifically, this method tests whether the type represented by the * specified {@code Class} parameter can be converted to the type * represented by this {@code Class} object via an identity conversion * widening primitive or widening reference conversion. See * <em><a href="http://docs.oracle.com/javase/specs/">The Java Language Specification</a></em>, * sections 5.1.1, 5.1.2 and 5.1.4 for details.</p> * * <p><strong>Since Lang 3.0,</strong> this method will default behavior for * calculating assignability between primitive and wrapper types <em>corresponding * to the running Java version</em>; i.e. autoboxing will be the default * behavior in VMs running Java versions > 1.5.</p> * * @param classArray the array of Classes to check, may be {@code null} * @param toClassArray the array of Classes to try to assign into, may be {@code null} * @return {@code true} if assignment possible */ public static boolean isAssignable(Class<?>[] classArray, Class<?>... toClassArray) { return isAssignable(classArray, toClassArray, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5)); }
From source file:objenome.util.ClassUtils.java
/** * <p>Checks if one {@code Class} can be assigned to a variable of * another {@code Class}.</p>//from w ww.j av a2 s . c o m * * <p>Unlike the {@link Class#isAssignableFrom(Class)} method, * this method takes into account widenings of primitive classes and * {@code null}s.</p> * * <p>Primitive widenings allow an int to be assigned to a long, float or * double. This method returns the correct result for these cases.</p> * * <p>{@code Null} may be assigned to any reference type. This method * will return {@code true} if {@code null} is passed in and the * toClass is non-primitive.</p> * * <p>Specifically, this method tests whether the type represented by the * specified {@code Class} parameter can be converted to the type * represented by this {@code Class} object via an identity conversion * widening primitive or widening reference conversion. See * <em><a href="http://docs.oracle.com/javase/specs/">The Java Language Specification</a></em>, * sections 5.1.1, 5.1.2 and 5.1.4 for details.</p> * * <p><strong>Since Lang 3.0,</strong> this method will default behavior for * calculating assignability between primitive and wrapper types <em>corresponding * to the running Java version</em>; i.e. autoboxing will be the default * behavior in VMs running Java versions > 1.5.</p> * * @param cls the Class to check, may be null * @param toClass the Class to try to assign into, returns false if null * @return {@code true} if assignment possible */ public static boolean isAssignable(Class<?> cls, Class<?> toClass) { return isAssignable(cls, toClass, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5)); }