< prev index next >

jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/Constants.java

Print this page




 840     public static Enumeration getSAXProperties() {
 841         return fgSAXProperties.length > 0
 842         ? new ArrayEnumeration(fgSAXProperties) : fgEmptyEnumeration;
 843     } // getSAXProperties():Enumeration
 844 
 845     // xerces
 846 
 847     /** Returns an enumeration of the Xerces features. */
 848     public static Enumeration getXercesFeatures() {
 849         return fgXercesFeatures.length > 0
 850         ? new ArrayEnumeration(fgXercesFeatures) : fgEmptyEnumeration;
 851     } // getXercesFeatures():Enumeration
 852 
 853     /** Returns an enumeration of the Xerces properties. */
 854     public static Enumeration getXercesProperties() {
 855         return fgXercesProperties.length > 0
 856         ? new ArrayEnumeration(fgXercesProperties) : fgEmptyEnumeration;
 857     } // getXercesProperties():Enumeration
 858 
 859     /*
 860      * Check the version of the current JDK against that specified in the
 861      * parameter
 862      *
 863      * There is a proposal to change the java version string to:
 864      * MAJOR.MINOR.FU.CPU.PSU-BUILDNUMBER_BUGIDNUMBER_OPTIONAL
 865      * This method would work with both the current format and that proposed
 866      *
 867      * @param compareTo a JDK version to be compared to
 868      * @return true if the current version is the same or above that represented
 869      * by the parameter
 870      */
 871     public static boolean isJavaVersionAtLeast(int compareTo) {
 872         String javaVersion = SecuritySupport.getSystemProperty("java.version");
 873         String versions[] = javaVersion.split("\\.", 3);
 874         if (Integer.parseInt(versions[0]) >= compareTo ||
 875             Integer.parseInt(versions[1]) >= compareTo) {
 876             return true;
 877         }
 878         return false;
 879     }
 880 
 881     //
 882     // Classes
 883     //
 884 
 885     /**
 886      * An array enumeration.
 887      *
 888      * @author Andy Clark, IBM
 889      */
 890     static class ArrayEnumeration
 891     implements Enumeration {
 892 
 893         //
 894         // Data
 895         //
 896 
 897         /** Array. */
 898         private Object[] array;




 840     public static Enumeration getSAXProperties() {
 841         return fgSAXProperties.length > 0
 842         ? new ArrayEnumeration(fgSAXProperties) : fgEmptyEnumeration;
 843     } // getSAXProperties():Enumeration
 844 
 845     // xerces
 846 
 847     /** Returns an enumeration of the Xerces features. */
 848     public static Enumeration getXercesFeatures() {
 849         return fgXercesFeatures.length > 0
 850         ? new ArrayEnumeration(fgXercesFeatures) : fgEmptyEnumeration;
 851     } // getXercesFeatures():Enumeration
 852 
 853     /** Returns an enumeration of the Xerces properties. */
 854     public static Enumeration getXercesProperties() {
 855         return fgXercesProperties.length > 0
 856         ? new ArrayEnumeration(fgXercesProperties) : fgEmptyEnumeration;
 857     } // getXercesProperties():Enumeration
 858 
 859     /*
 860      * Check the major version of the current JDK against that specified
 861      * in the parameter
 862      *
 863      * In JDK9 the java version string was changed to comply with JEP-223
 864      * so this method was modified to handle that new format as well

 865      *
 866      * @param compareTo a JDK major version to be compared to
 867      * @return true if the current major version is the same or above
 868      * that represented by the parameter
 869      */
 870     public static boolean isJavaVersionAtLeast(int compareTo) {
 871         String javaVersion = SecuritySupport.getSystemProperty("java.version");
 872         javaVersion = (javaVersion.matches("[1-9][0-9]*(\\.(0|[1-9][0-9]*))*\\-.*")) ? 
 873                           javaVersion.split("-|\\.")[0] :
 874                           javaVersion.split("\\.", 3)[1];
 875         return Integer.parseInt(javaVersion) >= compareTo;


 876     }
 877     
 878     //
 879     // Classes
 880     //
 881 
 882     /**
 883      * An array enumeration.
 884      *
 885      * @author Andy Clark, IBM
 886      */
 887     static class ArrayEnumeration
 888     implements Enumeration {
 889 
 890         //
 891         // Data
 892         //
 893 
 894         /** Array. */
 895         private Object[] array;


< prev index next >