Enum Class GObjectRegistry
- All Implemented Interfaces:
Serializable,Comparable<GObjectRegistry>,Constable
Defines the main registry for checking for GObjects, primarily used by these subsystems:
CommandParser/TaggedArgUtil/Command/TypingHintsfor command parsing, usage parsing, typed hints and etc-
PropertiesUIfor showing properties of these objects - And overall just decentralisation of making these objects.
- Author:
- Lehlogonolo Poole
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionThe actual classprivate final EngineObject.Typeprivate final StringThe simple name, usually the exact same name used in command usage strings and by the properties menu.private final CmdToken.Typethe command token type associated with this gobject. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateGObjectRegistry(Class<? extends GObject> clazz, String simpleName, CmdToken.Type type, EngineObject.Type engineObjectType) -
Method Summary
Modifier and TypeMethodDescriptionstatic voidforEach(Consumer<GObjectRegistry> consumer) static GObjectRegistryRetrieves aGObjectRegistryentry based on its associatedGObjectclass.static booleanfuzzyMatch(String input) Performs a fuzzy match to check if the input string contains the simple name of any registered GObject.getClazz()Returns the simple name of the GObject, typically used in command usage strings and property menus.static StringgetSimpleName(Class<?> clazz) Retrieves the simple name for a givenGObjectclass.getType()Retrieves the command token type associated with this GObject.static booleanisGObject(EngineObject.Type type) static booleanChecks if the given class is one of the registeredGObjecttypes.static booleantHintsUsageStringTypeMatch(String letters) Checks if the given string matches a specific pattern derived from the simple name of a registered GObject.static GObjectRegistryReturns the enum constant of this class with the specified name.static GObjectRegistry[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
POINT
a point. -
LINE
a curve -
TRI
a triangle -
CURVE
a curve
-
-
Field Details
-
clazz
The actual class -
simpleName
The simple name, usually the exact same name used in command usage strings and by the properties menu. -
type
the command token type associated with this gobject. -
engineObjectType
-
-
Constructor Details
-
GObjectRegistry
private GObjectRegistry(Class<? extends GObject> clazz, String simpleName, CmdToken.Type type, EngineObject.Type engineObjectType)
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getClasses
-
forEach
-
getClazz
-
getSimpleName
Returns the simple name of the GObject, typically used in command usage strings and property menus.- Returns:
- The simple name of the GObject.
-
getType
Retrieves the command token type associated with this GObject.- Returns:
- The command token type.
-
fromClass
Retrieves aGObjectRegistryentry based on its associatedGObjectclass.- Parameters:
clazz- The class to look up.- Returns:
- The corresponding
GObjectRegistryentry, ornullif not found.
-
isGObject
Checks if the given class is one of the registeredGObjecttypes.- Parameters:
clazz- The class to check.- Returns:
trueif the class is a registered GObject,falseotherwise.
-
getSimpleName
Retrieves the simple name for a givenGObjectclass.- Parameters:
clazz- The class for which to get the simple name.- Returns:
- The simple name string, or
nullif the class is not a registered GObject.
-
fuzzyMatch
Performs a fuzzy match to check if the input string contains the simple name of any registered GObject.- Parameters:
input- The string to check against registered GObject simple names.- Returns:
trueif the input string contains any GObject's simple name,falseotherwise.
-
tHintsUsageStringTypeMatch
Checks if the given string matches a specific pattern derived from the simple name of a registered GObject. The pattern is formed by repeating the first two characters of the simple name twice (e.g., "curve" -> "cucu", "line" -> "lili"). This is primarily used for typing hints in command line interfaces.- Parameters:
letters- The string to match.- Returns:
trueif the string matches the pattern for any registered GObject,falseotherwise.- See Also:
-
isGObject
-