Class 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 Detail

      • 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.
      • genericType

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

        protected String genericClassName
        The generic class name.
      • clz

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

      • 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 Detail

      • 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.
      • 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.
      • 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