Class EnumType

  • All Implemented Interfaces:
    Type

    public final class EnumType
    extends java.lang.Object
    implements Type
    An enumerated type declaration.
    • Field Detail

      • name

        private final java.lang.String name
      • fqname

        private final java.lang.String fqname
      • documentation

        private final java.lang.String documentation
      • options

        private final java.util.List<Option> options
      • allowAlias

        private final boolean allowAlias
    • Constructor Detail

      • EnumType

        public EnumType​(java.lang.String name,
                        java.lang.String fqname,
                        java.lang.String documentation,
                        java.util.List<Option> options,
                        java.util.List<EnumType.Value> values)
    • Method Detail

      • validateTagUniqueness

        private static void validateTagUniqueness​(java.lang.String type,
                                                  java.util.List<EnumType.Value> values)
      • parseAllowAlias

        private static boolean parseAllowAlias​(java.util.List<Option> options)
      • validateValueUniquenessInScope

        static void validateValueUniquenessInScope​(java.lang.String type,
                                                   java.util.List<Type> nestedTypes)
        Though not mentioned in the spec, enum names use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface Type
      • getFullyQualifiedName

        public java.lang.String getFullyQualifiedName()
        Specified by:
        getFullyQualifiedName in interface Type
      • getDocumentation

        public java.lang.String getDocumentation()
        Specified by:
        getDocumentation in interface Type
      • getOptions

        public java.util.List<Option> getOptions()
        Specified by:
        getOptions in interface Type
      • allowAlias

        public boolean allowAlias()
        True if allowing multiple values to have the same tag.
      • getNestedTypes

        public java.util.List<Type> getNestedTypes()
        Specified by:
        getNestedTypes in interface Type
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object