Class PropertyTypeName

java.lang.Object
org.gcube.informationsystem.types.PropertyTypeName

public class PropertyTypeName extends Object
Represents the type name of a property, including its base type and any generic parameters.
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • BASE_PROPERTY_TYPES_BY_CLASS

      protected static final Map<Class<?>,PropertyTypeName.BaseType> BASE_PROPERTY_TYPES_BY_CLASS
      A map of base types, keyed by class.
    • REGEX_BY_CLASS_MAPPED_AS_STRING

      protected static final Map<Class<?>,String> 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

      protected static final Map<String,String> 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

      public static final String URI_REGEX
      A regex for validating URIs.
    • URL_REGEX

      public static final String URL_REGEX
      A regex for validating URLs.
    • UUID_REGEX

      public static final String UUID_REGEX
      A regex for validating UUIDs.
      See Also:
    • baseType

      protected PropertyTypeName.BaseType baseType
      The base type.
    • genericType

      protected boolean genericType
      A flag indicating whether the type is generic.
    • genericBaseType

      protected PropertyTypeName.BaseType genericBaseType
      The generic base type.
    • genericClassName

      protected String genericClassName
      The generic class name.
    • clz

      protected Class<?> clz
      The class of the property.
  • Constructor Details

    • PropertyTypeName

      public PropertyTypeName(String type)
      Constructs a PropertyTypeName from a string representation.
      Parameters:
      type - The string representation of the type (e.g., "String", "List<Integer>").
    • PropertyTypeName

      public PropertyTypeName(Class<?> clz)
      Constructs a PropertyTypeName from a Class.
      Parameters:
      clz - The class of the property.
    • PropertyTypeName

      public PropertyTypeName(Method method)
      Constructs a PropertyTypeName from a Method's return type.
      Parameters:
      method - The method.
  • Method Details

    • getRegexByClass

      public static String getRegexByClass(Class<?> clz)
      Returns a regular expression for validating the string representation of a given class.
      Parameters:
      clz - The class.
      Returns:
      The validation regex, or null if none is defined.
    • getRegexByClassname

      public static String getRegexByClassname(String className)
      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 null if none is defined.
    • getBaseTypeByClass

      public static PropertyTypeName.BaseType getBaseTypeByClass(Class<?> clazz)
      Determines the corresponding PropertyTypeName.BaseType for a given class.
      Parameters:
      clazz - The class to check.
      Returns:
      The corresponding BaseType, or null.
    • setType

      public void setType(String type)
      Sets the type from a string representation.
      Parameters:
      type - The string representation of the type.
    • getType

      public String getType()
      Returns the string representation of this type name.
      Returns:
      The type name as a string.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getBaseType

      public PropertyTypeName.BaseType getBaseType()
      Returns the base type of this property.
      Returns:
      The base type.
    • isGenericType

      public boolean isGenericType()
      Checks if this property type is generic.
      Returns:
      true if the type is generic.
    • getGenericBaseType

      public PropertyTypeName.BaseType getGenericBaseType()
      Returns the generic base type of this property, if applicable.
      Returns:
      The generic base type, or null.
    • getGenericClassName

      public String 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()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object