Class SymbolicValue.SymEnum
- java.lang.Object
-
- net.sourceforge.pmd.lang.java.symbols.SymbolicValue.SymEnum
-
- All Implemented Interfaces:
SymbolicValue
- Enclosing interface:
- SymbolicValue
public static final class SymbolicValue.SymEnum extends Object implements SymbolicValue
Symbolic representation of an enum constant.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.sourceforge.pmd.lang.java.symbols.SymbolicValue
SymbolicValue.SymAnnot, SymbolicValue.SymArray, SymbolicValue.SymClass, SymbolicValue.SymEnum, SymbolicValue.SymValue
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Returns true if this value is equal to the other one.static SymbolicValue.SymEnum
fromBinaryName(TypeSystem ts, String enumBinaryName, String enumConstName)
static SymbolicValue
fromEnum(TypeSystem ts, Enum<?> value)
Returns the symbolic value for the given enum constant.static SymbolicValue.SymEnum
fromTypeDescriptor(TypeSystem ts, String enumTypeDescriptor, String enumConstName)
int
hashCode()
<E extends Enum<E>>
@Nullable EtoEnum(Class<E> enumClass)
If this enum constant is declared in the given enum class, returns its value.String
toString()
boolean
valueEquals(Object o)
Returns true if this symbolic value represents the same value as the given object.
-
-
-
Method Detail
-
toEnum
public <E extends Enum<E>> @Nullable E toEnum(Class<E> enumClass)
If this enum constant is declared in the given enum class, returns its value. Otherwise returns null.- Type Parameters:
E
- Return type- Parameters:
enumClass
- Class of an enum
-
fromEnum
public static SymbolicValue fromEnum(TypeSystem ts, Enum<?> value)
Returns the symbolic value for the given enum constant.- Parameters:
ts
- Type systemvalue
- An enum constant- Throws:
NullPointerException
- if the parameter is null
-
fromBinaryName
public static SymbolicValue.SymEnum fromBinaryName(TypeSystem ts, String enumBinaryName, String enumConstName)
- Parameters:
ts
- Type systemenumBinaryName
- A binary name, egcom.MyEnum
enumConstName
- Simple name of the enum constant- Throws:
NullPointerException
- if any parameter is null
-
fromTypeDescriptor
public static SymbolicValue.SymEnum fromTypeDescriptor(TypeSystem ts, String enumTypeDescriptor, String enumConstName)
- Parameters:
ts
- Type systemenumTypeDescriptor
- The type descriptor, egLcom/MyEnum;
enumConstName
- Simple name of the enum constant
-
valueEquals
public boolean valueEquals(Object o)
Description copied from interface:SymbolicValue
Returns true if this symbolic value represents the same value as the given object. If the parameter is null, returns false.- Specified by:
valueEquals
in interfaceSymbolicValue
-
equals
public boolean equals(Object o)
Description copied from interface:SymbolicValue
Returns true if this value is equal to the other one. The parameter must be aSymbolicValue
of the same type. UseSymbolicValue.valueEquals(Object)
to compare to a java object.- Specified by:
equals
in interfaceSymbolicValue
- Overrides:
equals
in classObject
-
-