| Home >> All >> org >> apache >> commons >> lang >> [ enums Javadoc ] |
org.apache.commons.lang.enums: Javadoc index of package org.apache.commons.lang.enums.
Package Samples:
org.apache.commons.lang.enums
Classes:
Enum: Abstract superclass for type-safe enums. One feature of the C programming language lacking in Java is enumerations. The C implementation based on ints was poor and open to abuse. The original Java recommendation and most of the JDK also uses int constants. It has been recognised however that a more robust type-safe class-based solution can be designed. This class follows the basic Java type-safe enumeration pattern. NOTE: Due to the way in which Java ClassLoaders work, comparing Enum objects should always be done using equals() , not == . The equals() method will try == first so in most cases the ...
ValuedEnum: Abstract superclass for type-safe enums with integer values suitable for use in switch statements. NOTE: Due to the way in which Java ClassLoaders work, comparing Enum objects should always be done using the equals() method, not == . The equals() method will try == first so in most cases the effect is the same. To use this class, it must be subclassed. For example: public final class JavaVersionEnum extends ValuedEnum { //standard enums for version of JVM public static final int JAVA1_0_VALUE = 100; public static final int JAVA1_1_VALUE = 110; public static final int JAVA1_2_VALUE = 120; public ...
NestLinked: Color enumeration which demonstrates how to define the constants in a different class to the Enum. The extra static{} block is needed to ensure that the enum constants are created before the static methods on the ColorEnum are used. The class loader sees the two classes here as independent - the enum class is nested, not an inner class. The static block thus forces the class load of the outer class, which is needed to initialise the enums.
NestBroken: Color enumeration which demonstrates how to break the enum system. The class loader sees the two classes here as independent - the enum class is nested, not an inner class. Calling getEnumList() on ColorEnum will return an empty list, unless and until the NestBroken class is referenced.
NestReferenced: Color enumeration which demonstrates how to provide a view of the constants in a different class to the Enum. This technique is the safest, however it is obviously inconvenient as it involves defining two sets of constants. See NestedLinked for an alternative.
EnumEqualsTest: Test cases for the EnumEqualsTest.CarColorEnum class equals method.
EnumUtils: Utility class for accessing and manipulating Enum s.
Nest: Color enumeration demonstrating a normal simple nesting case. All is well here as the nested enum class is really no different to any other class.
EnumTest: Test cases for the Enum class.
EnumUtilsTest: Test cases for the Enum class.
ValuedEnumTest: Test cases for the Enum class.
Broken5OperationEnum: Broken Operator enumeration, getEnumClass() is not an Enum class.
Broken4OperationEnum: Broken Operator enumeration, getEnumClass() is ValuedEnum.class.
Broken2OperationEnum: Broken Operator enumeration, getEnumClass() not superclass.
Broken3OperationEnum: Broken Operator enumeration, getEnumClass() is Enum.class.
Broken1OperationEnum: Broken Operator enumeration, null class.
EnumTestSuite: Test suite for the Enum package.
DummyEnum: Dummy enumeration - no values.
Extended1Enum: Base extended enumeration.
Broken1Enum: Broken color enumeration.
Broken2Enum: Broken color enumeration.
Broken3Enum: Broken color enumeration.
Extended2Enum: Extended enumeration.
Extended3Enum: Extended enumeration.
| Home | Contact Us | Privacy Policy | Terms of Service |