Class PropertyTypeName
java.lang.Object
org.gcube.informationsystem.types.PropertyTypeName
Represents the type name of a property, including its base type and any
generic parameters.
- Author:
- Luca Frosini (ISTI - CNR)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe fundamental data types for properties.static enumGroups of base types. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Map<Class<?>,PropertyTypeName.BaseType> A map of base types, keyed by class.protected PropertyTypeName.BaseTypeThe base type.protected Class<?>The class of the property.protected PropertyTypeName.BaseTypeThe generic base type.protected StringThe generic class name.protected booleanA flag indicating whether the type is generic.A map of regex patterns for string representations of classes.A map of regex patterns for string representations of classes, keyed by class name.static final StringA regex for validating URIs.static final StringA regex for validating URLs.static final StringA regex for validating UUIDs. -
Constructor Summary
ConstructorsConstructorDescriptionPropertyTypeName(Class<?> clz) Constructs aPropertyTypeNamefrom aClass.PropertyTypeName(Method method) Constructs aPropertyTypeNamefrom aMethod's return type.PropertyTypeName(String type) Constructs aPropertyTypeNamefrom a string representation. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the base type of this property.static PropertyTypeName.BaseTypegetBaseTypeByClass(Class<?> clazz) Determines the correspondingPropertyTypeName.BaseTypefor a given class.Returns the generic base type of this property, if applicable.Returns the simple name of the generic class of this property, if applicable.static StringgetRegexByClass(Class<?> clz) Returns a regular expression for validating the string representation of a given class.static StringgetRegexByClassname(String className) Returns a regular expression for validating the string representation of a given class name.getType()Returns the string representation of this type name.inthashCode()booleanChecks if this property type is generic.voidSets the type from a string representation.toString()
-
Field Details
-
BASE_PROPERTY_TYPES_BY_CLASS
A map of base types, keyed by class. -
REGEX_BY_CLASS_MAPPED_AS_STRING
A map of regex patterns for string representations of classes. -
REGEX_BY_CLASS_MAPPED_AS_STRING_BY_CLASS_NAME
A map of regex patterns for string representations of classes, keyed by class name. -
URI_REGEX
A regex for validating URIs. -
URL_REGEX
A regex for validating URLs. -
UUID_REGEX
A regex for validating UUIDs.- See Also:
-
baseType
The base type. -
genericType
protected boolean genericTypeA flag indicating whether the type is generic. -
genericBaseType
The generic base type. -
genericClassName
The generic class name. -
clz
The class of the property.
-
-
Constructor Details
-
PropertyTypeName
Constructs aPropertyTypeNamefrom a string representation.- Parameters:
type- The string representation of the type (e.g., "String", "List<Integer>").
-
PropertyTypeName
Constructs aPropertyTypeNamefrom aClass.- Parameters:
clz- The class of the property.
-
PropertyTypeName
Constructs aPropertyTypeNamefrom aMethod's return type.- Parameters:
method- The method.
-
-
Method Details
-
getRegexByClass
Returns a regular expression for validating the string representation of a given class.- Parameters:
clz- The class.- Returns:
- The validation regex, or
nullif none is defined.
-
getRegexByClassname
Returns a regular expression for validating the string representation of a given class name.- Parameters:
className- The simple name of the class.- Returns:
- The validation regex, or
nullif none is defined.
-
getBaseTypeByClass
Determines the correspondingPropertyTypeName.BaseTypefor a given class.- Parameters:
clazz- The class to check.- Returns:
- The corresponding
BaseType, ornull.
-
setType
Sets the type from a string representation.- Parameters:
type- The string representation of the type.
-
getType
Returns the string representation of this type name.- Returns:
- The type name as a string.
-
toString
-
getBaseType
Returns the base type of this property.- Returns:
- The base type.
-
isGenericType
public boolean isGenericType()Checks if this property type is generic.- Returns:
trueif the type is generic.
-
getGenericBaseType
Returns the generic base type of this property, if applicable.- Returns:
- The generic base type, or
null.
-
getGenericClassName
Returns the simple name of the generic class of this property, if applicable.- Returns:
- The generic class name, or
null.
-
hashCode
public int hashCode() -
equals
-