Class TypeUtils


  • public class TypeUtils
    extends Object
    Utilities for parsing Java type descriptors and type signatures.
    Author:
    lukehutch
    • Constructor Detail

      • TypeUtils

        public TypeUtils()
    • Method Detail

      • getIdentifierToken

        public static boolean getIdentifierToken​(Parser parser,
                                                 char separator,
                                                 char separatorReplace)
                                          throws Parser.ParseException
        Parse a Java identifier with the given separator ('.' or '/'). Potentially replaces the separator with a different character. Appends the identifier to the token buffer in the parser.
        Parameters:
        parser - The parser.
        separator - The separator character.
        separatorReplace - The character to replace the separator with.
        Returns:
        true if at least one identifier character was parsed.
        Throws:
        Parser.ParseException - If the parser ran out of input.
      • getIdentifierToken

        public static boolean getIdentifierToken​(Parser parser)
                                          throws Parser.ParseException
        Parse a Java identifier part (between separators and other non-alphanumeric characters). Appends the identifier to the token buffer in the parser.
        Parameters:
        parser - The parser.
        Returns:
        true if at least one identifier character was parsed.
        Throws:
        Parser.ParseException - If the parser ran out of input.