Interface Trait

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      static <S extends Shape,​T extends Trait>
      java.util.stream.Stream<Pair<S,​T>>
      flatMapStream​(S shape, java.lang.Class<T> traitClass)
      Used in a stream flatMapStream to return a Stream with a Pair of Shape and Trait if the trait is present on the given shape.
      static java.lang.String getIdiomaticTraitName​(java.lang.String traitName)
      Gets the idiomatic name of a prelude trait by stripping off the smithy.api# prefix.
      static java.lang.String getIdiomaticTraitName​(ToShapeId id)
      Gets the idiomatic name of a prelude trait by stripping off the smithy.api# prefix.
      static java.lang.String makeAbsoluteName​(java.lang.String traitName)
      Makes the given trait name absolute if it is relative.
      static java.lang.String makeAbsoluteName​(java.lang.String traitName, java.lang.String defaultNamespace)
      Makes the given trait name absolute if it is relative.
      ShapeId toShapeId()
      Gets the shape ID of the trait.
      • Methods inherited from interface software.amazon.smithy.model.node.ToNode

        toNode
    • Method Detail

      • toShapeId

        ShapeId toShapeId()
        Gets the shape ID of the trait.
        Specified by:
        toShapeId in interface ToShapeId
        Returns:
        Returns the fully-qualified shape ID of the trait.
      • flatMapStream

        static <S extends Shape,​T extends Trait> java.util.stream.Stream<Pair<S,​T>> flatMapStream​(S shape,
                                                                                                              java.lang.Class<T> traitClass)
        Used in a stream flatMapStream to return a Stream with a Pair of Shape and Trait if the trait is present on the given shape.
        Type Parameters:
        S - Shape
        T - Trait
        Parameters:
        shape - Shape to query for the trait.
        traitClass - Trait to retrieve.
        Returns:
        Returns the Stream of the found trait or an empty stream.
      • getIdiomaticTraitName

        static java.lang.String getIdiomaticTraitName​(java.lang.String traitName)
        Gets the idiomatic name of a prelude trait by stripping off the smithy.api# prefix. This is used in various error messages.
        Parameters:
        traitName - Trait name to make idiomatic.
        Returns:
        Returns the idiomatic trait name.
      • getIdiomaticTraitName

        static java.lang.String getIdiomaticTraitName​(ToShapeId id)
        Gets the idiomatic name of a prelude trait by stripping off the smithy.api# prefix. This is used in various error messages.
        Parameters:
        id - Trait name to make idiomatic.
        Returns:
        Returns the idiomatic trait name.
      • makeAbsoluteName

        static java.lang.String makeAbsoluteName​(java.lang.String traitName)
        Makes the given trait name absolute if it is relative.

        The namespace used to resolve with the trait name is the prelude namespace, smithy.api.

        Parameters:
        traitName - Trait name to make absolute.
        Returns:
        Returns the absolute trait name.
      • makeAbsoluteName

        static java.lang.String makeAbsoluteName​(java.lang.String traitName,
                                                 java.lang.String defaultNamespace)
        Makes the given trait name absolute if it is relative.
        Parameters:
        traitName - Trait name to make absolute.
        defaultNamespace - Namespace to use if the name is relative.
        Returns:
        Returns the absolute trait name.