Class EnumShape

    • Method Detail

      • getEnumValues

        public java.util.Map<java.lang.String,​java.lang.String> getEnumValues()
        Gets a map of enum member names to their corresponding values.
        Returns:
        A map of member names to enum values.
      • getAllMembers

        public java.util.Map<java.lang.String,​MemberShape> getAllMembers()
        Gets the members of the shape, including mixin members.
        Overrides:
        getAllMembers in class Shape
        Returns:
        Returns the immutable member map.
      • findTrait

        public java.util.Optional<Trait> findTrait​(ShapeId id)
        Description copied from class: Shape
        Attempts to find a trait applied to the shape by name.
        Overrides:
        findTrait in class Shape
        Parameters:
        id - The trait shape ID.
        Returns:
        Returns the optionally found trait.
      • accept

        public <R> R accept​(ShapeVisitor<R> cases)
        Description copied from class: Shape
        Dispatches the shape to the appropriate ShapeVisitor method.
        Overrides:
        accept in class StringShape
        Type Parameters:
        R - Return type of the accept.
        Parameters:
        cases - ShapeVisitor to use.
        Returns:
        Returns the result.
      • fromStringShape

        public static java.util.Optional<EnumShape> fromStringShape​(StringShape shape,
                                                                    boolean synthesizeNames)
        Converts a base StringShape to an EnumShape if possible. The result will be empty if the given shape doesn't have the EnumTrait, if the enum doesn't have names and name synthesization is disabled, or if a name cannot be synthesized.
        Parameters:
        shape - A base StringShape to convert.
        synthesizeNames - Whether names should be synthesized if possible.
        Returns:
        Optionally returns an EnumShape equivalent of the given shape.
      • fromStringShape

        public static java.util.Optional<EnumShape> fromStringShape​(StringShape shape)
        Converts a base StringShape to an EnumShape if possible. The result will be empty if the given shape doesn't have the EnumTrait or if the enum definitions don't have names.
        Parameters:
        shape - A base StringShape to convert.
        Returns:
        Optionally returns an EnumShape equivalent of the given shape.
      • canConvertToEnum

        public static boolean canConvertToEnum​(StringShape shape,
                                               boolean synthesizeEnumNames)
        Determines whether a given string shape can be converted to an enum shape.
        Parameters:
        shape - The string shape to be converted.
        synthesizeEnumNames - Whether synthesizing enum names should be accounted for.
        Returns:
        Returns true if the string shape can be converted to an enum shape.
      • getType

        public ShapeType getType()
        Description copied from class: Shape
        Gets the type of the shape.
        Overrides:
        getType in class StringShape
        Returns:
        Returns the type;