Class StructureShape.Builder

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected BuilderRef<java.util.Map<java.lang.String,​MemberShape>> members  
    • Constructor Summary

      Constructors 
      Constructor Description
      Builder()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      B addMember​(java.lang.String memberName, ShapeId target)
      Adds a member to the builder.
      B addMember​(java.lang.String memberName, ShapeId target, java.util.function.Consumer<MemberShape.Builder> memberUpdater)
      Adds a member to the builder.
      B addMember​(MemberShape member)
      Adds a member to the shape IFF the shape supports members.
      B addMixin​(Shape shape)
      Adds a mixin to the shape.
      StructureShape build()
      Creates an immutable object that is created from the properties that have been set on the builder.
      B clearMembers()
      Removes all members from the builder.
      B flattenMixins()
      Removes mixins from a shape and flattens them into the shape.
      java.util.Optional<MemberShape> getMember​(java.lang.String memberName)
      Gets the optional member with the given name.
      ShapeType getShapeType()
      Gets the type of shape being built.
      B id​(ShapeId shapeId)
      Sets the shape ID of the shape.
      B members​(java.util.Collection<MemberShape> members)
      Replaces the members of the builder.
      B removeMember​(java.lang.String member)
      Removes a member by name.
      B removeMixin​(ToShapeId shape)
      Removes a mixin from the shape by shape or ID.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • build

        public StructureShape build()
        Description copied from interface: SmithyBuilder
        Creates an immutable object that is created from the properties that have been set on the builder.
        Returns:
        an instance of T
      • getMember

        public java.util.Optional<MemberShape> getMember​(java.lang.String memberName)
        Description copied from class: AbstractShapeBuilder
        Gets the optional member with the given name.
        Overrides:
        getMember in class AbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,​S>,​S extends Shape>
        Returns:
        Returns the optional member with the given name.
      • id

        public final B id​(ShapeId shapeId)
        Description copied from class: AbstractShapeBuilder
        Sets the shape ID of the shape.
        Overrides:
        id in class AbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,​S>,​S extends Shape>
        Parameters:
        shapeId - Shape ID to set.
        Returns:
        Returns the builder.
      • members

        public B members​(java.util.Collection<MemberShape> members)
        Replaces the members of the builder.
        Parameters:
        members - Members to add to the builder.
        Returns:
        Returns the builder.
      • clearMembers

        public B clearMembers()
        Description copied from class: AbstractShapeBuilder
        Removes all members from the builder.
        Overrides:
        clearMembers in class AbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,​S>,​S extends Shape>
        Returns:
        Returns the builder.
      • addMember

        public B addMember​(MemberShape member)
        Description copied from class: AbstractShapeBuilder
        Adds a member to the shape IFF the shape supports members.
        Overrides:
        addMember in class AbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,​S>,​S extends Shape>
        Parameters:
        member - Member to add to the shape.
        Returns:
        Returns the builder.
      • addMember

        public B addMember​(java.lang.String memberName,
                           ShapeId target)
        Adds a member to the builder.
        Parameters:
        memberName - Member name to add.
        target - Target of the member.
        Returns:
        Returns the builder.
      • addMember

        public B addMember​(java.lang.String memberName,
                           ShapeId target,
                           java.util.function.Consumer<MemberShape.Builder> memberUpdater)
        Adds a member to the builder.
        Parameters:
        memberName - Member name to add.
        target - Target of the member.
        memberUpdater - Consumer that can update the created member shape.
        Returns:
        Returns the builder.
      • removeMember

        public B removeMember​(java.lang.String member)
        Removes a member by name.

        Note that removing a member that was added by a mixin results in an inconsistent model. It's best to use ModelTransform to ensure that the model remains consistent when removing members.

        Parameters:
        member - Member name to remove.
        Returns:
        Returns the builder.
      • addMixin

        public B addMixin​(Shape shape)
        Description copied from class: AbstractShapeBuilder
        Adds a mixin to the shape.
        Overrides:
        addMixin in class AbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,​S>,​S extends Shape>
        Parameters:
        shape - Mixin to add.
        Returns:
        Returns the builder.
      • removeMixin

        public B removeMixin​(ToShapeId shape)
        Description copied from class: AbstractShapeBuilder
        Removes a mixin from the shape by shape or ID.
        Overrides:
        removeMixin in class AbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,​S>,​S extends Shape>
        Parameters:
        shape - Shape or shape ID to remove.
        Returns:
        Returns the builder.
      • flattenMixins

        public B flattenMixins()
        Description copied from class: AbstractShapeBuilder
        Removes mixins from a shape and flattens them into the shape.

        Flattening a mixin into a shape copies the traits and members of a mixin onto the shape, effectively resulting in the same shape but with no trace of the mixin relationship.

        Overrides:
        flattenMixins in class AbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,​S>,​S extends Shape>
        Returns:
        Returns the updated builder.