Class SymbolicValue.SymEnum
java.lang.Object
net.sourceforge.pmd.lang.java.symbols.SymbolicValue.SymEnum
- All Implemented Interfaces:
SymbolicValue
- Enclosing interface:
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
Modifier and TypeMethodDescriptionboolean
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 EIf this enum constant is declared in the given enum class, returns its value.toString()
boolean
Returns true if this symbolic value represents the same value as the given object.
-
Method Details
-
toEnum
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
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
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
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
-
hashCode
public int hashCode() -
toString
-