com.supermap.messagequeue
Class Enum
- java.lang.Object
-
- com.supermap.messagequeue.Enum
-
- Direct Known Subclasses:
- AMQPExchangeType
public abstract class Enum extends java.lang.Object
The enum class
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description boolean
equals(java.lang.Object other)
Since the enumeration value is a static field, you can know whether the two enumerations are equal by comparing the reference.static Enum[]
getEnums(java.lang.Class type)
Gets all enumeration objectstatic java.lang.String
getNameByValue(java.lang.Class type, int value)
Gets the enumeration name according to the valuestatic java.lang.String[]
getNames(java.lang.Class type)
Gets the collection of names for the enumeration class.static int
getValueByName(java.lang.Class type, java.lang.String name)
Gets the value according to the enumeration namestatic int[]
getValues(java.lang.Class type)
Gets the value set of enumeration typeint
hashCode()
The equals method is overwritten, so hashcode must be overwrittenstatic boolean
isDefined(java.lang.Class type, int value)
Whether to define the enumeration field of the specified valuestatic boolean
isDefined(java.lang.Class type, java.lang.String name)
Whether to define the enumeration field of the specified name in the enumeration definitionjava.lang.String
name()
Gets the name of the enumeration objectstatic Enum
parse(java.lang.Class type, int value)
Returns the corresponding enumeration according to the enumstatic Enum
parse(java.lang.Class type, java.lang.String name)
Parses the enumeration according to the namejava.lang.String
toString()
The enumeration string Output the enumeration nameint
value()
Gets the value of enumeration
-
-
-
Method Detail
-
getNames
public static final java.lang.String[] getNames(java.lang.Class type)
Gets the collection of names for the enumeration class. Pay attention to derived classes implement specification- Parameters:
type
- The enum class- Returns:
- An array of names.
-
getValues
public static int[] getValues(java.lang.Class type)
Gets the value set of enumeration type- Parameters:
type
- the given enumeration class.- Returns:
- int[] Specify the name collection of the enumeration constants in enumeration class.
-
getEnums
public static Enum[] getEnums(java.lang.Class type)
Gets all enumeration object- Parameters:
type
- the given enumeration class.- Returns:
- Enum[] All the enumeration constants in the given enumeration class.
-
getNameByValue
public static java.lang.String getNameByValue(java.lang.Class type, int value)
Gets the enumeration name according to the value- Parameters:
type
- the given enumeration class.value
- the specified enumeration value.- Returns:
- the name of the enumeration constant.
-
getValueByName
public static int getValueByName(java.lang.Class type, java.lang.String name)
Gets the value according to the enumeration name- Parameters:
type
- the given enumeration class.name
- the name of the specified enumeration constant.- Returns:
- the enumeration value.
-
parse
public static Enum parse(java.lang.Class type, int value)
Returns the corresponding enumeration according to the enum- Parameters:
type
- the given enumeration class.value
- the specified enumeration value.- Returns:
- Enum The corresponding enumeration constant
-
parse
public static Enum parse(java.lang.Class type, java.lang.String name)
Parses the enumeration according to the name- Parameters:
type
- the given enumeration class.name
- the name of the specified enumeration constant.- Returns:
- Enum
-
isDefined
public static boolean isDefined(java.lang.Class type, int value)
Whether to define the enumeration field of the specified value- Parameters:
type
- the given enumeration class.value
- the specified enumeration value.- Returns:
- a boolean, true means defined; Otherwise returns false.
-
isDefined
public static boolean isDefined(java.lang.Class type, java.lang.String name)
Whether to define the enumeration field of the specified name in the enumeration definition- Parameters:
type
- the given enumeration class.name
- String the given enumeration name.- Returns:
- a boolean, true means defined; Otherwise returns false.
-
name
public final java.lang.String name()
Gets the name of the enumeration object- Returns:
- String - The name of the enumeration constant.
-
value
public final int value()
Gets the value of enumeration- Returns:
- int - The enumeration value
-
toString
public java.lang.String toString()
The enumeration string Output the enumeration name- Overrides:
toString
in classjava.lang.Object
- Returns:
- String - The name of the enumeration constant.
-
equals
public final boolean equals(java.lang.Object other)
Since the enumeration value is a static field, you can know whether the two enumerations are equal by comparing the reference.- Overrides:
equals
in classjava.lang.Object
- Parameters:
other
- the object used to compare.- Returns:
- boolean a boolean, return true if the specified object equals to this enumeration constant.
-
hashCode
public final int hashCode()
The equals method is overwritten, so hashcode must be overwritten- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- int The has code of the enumeration constant.
-
-