Interface Trait

    • 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

        @Deprecated
        static <S extends Shape,​T extends Trait> java.util.stream.Stream<Pair<S,​T>> flatMapStream​(S shape,
                                                                                                              java.lang.Class<T> traitClass)
        Deprecated.
        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.

        This method is deprecated because it generally results in harder to read code using unnamed tuples. Use Shape.hasTrait(Class) and Shape.expectTrait(Class) instead.

        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.