Class GenericClassSignatureParser


  • public class GenericClassSignatureParser
    extends java.lang.Object
    The GenericClassSignatureParser is a convenience class for the parsing of generic signature and the creation of the corresponding CQL DataTypes, namely, GenericClassType and GenericClassProfileType. The former is used to capture the declaration of a GenericClass such as List<T>. The latter is used to capture a new type such as 'IntegerList' formed by binding types to generic parameters such as List<Integer>.
    • Field Detail

      • OPEN_BRACKET

        public static final java.lang.CharSequence OPEN_BRACKET
      • CLOSE_BRACKET

        public static final java.lang.CharSequence CLOSE_BRACKET
    • Constructor Detail

      • GenericClassSignatureParser

        public GenericClassSignatureParser​(java.lang.String genericSignature,
                                           java.lang.String baseType,
                                           java.lang.String boundGenericTypeName,
                                           java.util.Map<java.lang.String,​DataType> resolvedTypes)
      • GenericClassSignatureParser

        public GenericClassSignatureParser​(java.lang.String genericSignature,
                                           java.util.Map<java.lang.String,​DataType> resolvedTypes)
    • Method Detail

      • getGenericSignature

        public java.lang.String getGenericSignature()
      • setGenericSignature

        public void setGenericSignature​(java.lang.String genericSignature)
      • getBaseType

        public java.lang.String getBaseType()
      • setBaseType

        public void setBaseType​(java.lang.String baseType)
      • getBoundGenericTypeName

        public java.lang.String getBoundGenericTypeName()
      • setBoundGenericTypeName

        public void setBoundGenericTypeName​(java.lang.String boundGenericTypeName)
      • parseGenericSignature

        public ClassType parseGenericSignature()
        Parses a generic type declaration such as Map<K,V>.
        Returns:
        Generic class constructed from this definition.
      • handleParameterDeclaration

        protected TypeParameter handleParameterDeclaration​(java.lang.String parameterString)
        Method handles a generic parameter declaration such as T, or T extends MyType.
        Parameters:
        parameterString -
        Returns:
        Type parameter for this parameter for this string declaration.
      • resolveTypeName

        protected DataType resolveTypeName​(java.lang.String parameterType)
        Identifies the data type for the named type. If the argument is null, the return type will be null.
        Parameters:
        parameterType -
        Returns:
        The parameter's type
      • handleBoundType

        protected DataType handleBoundType​(java.lang.String boundGenericSignature)
        Method resolves bound type if it exists or else creates it and adds it to the resolved type index.
        Parameters:
        boundGenericSignature -
        Returns:
        The bound type created or resolved
      • isValidGenericSignature

        public boolean isValidGenericSignature()
        Returns true if the generic signature assigned to this object is well-formed.
        Returns:
        True if the generic signature is valid
      • isValidGenericSignature

        public boolean isValidGenericSignature​(java.lang.String genericSignature)
        Returns true if the generic signature passed as an argument is well-formed.
        Parameters:
        genericSignature -
        Returns:
        True if the generic signature is valid