Package jdk.graal.compiler.graphio
Interface GraphTypes
public interface GraphTypes
Special support for dealing with enums. Normally one can represent various
graph
enum values with real Enum
instances. In case this is not possible, the
GraphOutput.Builder
allows one to register
an implementation of this interface to treat them specially.-
Method Summary
Modifier and TypeMethodDescriptionRecognizes anenum
object.int
enumOrdinal
(Object obj) Ordinal of an enum.String[]
enumTypeValues
(Object maybeEnumClass) All possible values of an enum.Finds Java type name for a given class.
-
Method Details
-
enumClass
Recognizes anenum
object. If theenumValue
object represents an enum, then an object that represents its class shall be returned.- Parameters:
enumValue
- the value to test- Returns:
null
if the value isn't enum, otherwise its class
-
enumOrdinal
Ordinal of an enum. If theobj
represents an enum, then return its ordinal number otherwise return-1
- Parameters:
obj
- the value to test- Returns:
-1
if the obj isn't enum, otherwise its ordinal number
-
enumTypeValues
All possible values of an enum. If the providedmaybeEnumClass
object represents an enum, then compute enum value names in ordinal order and return them as a string array. Otherwise returnnull
- Parameters:
maybeEnumClass
- the class to test- Returns:
null
if the clazz isn't an enum, otherwise names of its values
-
typeName
Finds Java type name for a given class.- Parameters:
maybeClass
- object representing the class- Returns:
- the type name of the class or
null
if the parameter doesn't represent a class
-