Class StringTrait
- java.lang.Object
-
- software.amazon.smithy.model.traits.AbstractTrait
-
- software.amazon.smithy.model.traits.StringTrait
-
- All Implemented Interfaces:
FromSourceLocation
,ToNode
,ToShapeId
,Trait
- Direct Known Subclasses:
DocumentationTrait
,ErrorTrait
,ExternalDocumentationTrait
,HttpHeaderTrait
,HttpPrefixHeadersTrait
,HttpQueryTrait
,JsonNameTrait
,MediaTypeTrait
,PatternTrait
,ResourceIdentifierTrait
,SinceTrait
,TimestampFormatTrait
,TitleTrait
,XmlNameTrait
public abstract class StringTrait extends AbstractTrait
Abstract trait class for traits that contain only a string value.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StringTrait.Provider<T extends StringTrait>
Trait provider that expects a string value.
-
Constructor Summary
Constructors Constructor Description StringTrait(ShapeId id, java.lang.String value, FromSourceLocation sourceLocation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Node
createNode()
The result of toNode is used for hashCodes and equality.java.lang.String
getValue()
-
Methods inherited from class software.amazon.smithy.model.traits.AbstractTrait
equals, getSourceLocation, hashCode, toNode, toShapeId, toString
-
-
-
-
Constructor Detail
-
StringTrait
public StringTrait(ShapeId id, java.lang.String value, FromSourceLocation sourceLocation)
- Parameters:
id
- The ID of the trait being created.value
- The string value of the trait.sourceLocation
- Where the trait was defined.
-
-
Method Detail
-
getValue
public java.lang.String getValue()
- Returns:
- Get the trait value.
-
createNode
protected final Node createNode()
Description copied from class:AbstractTrait
The result of toNode is used for hashCodes and equality. Subclasses must implement createNode to turn the trait into a Node. This is then cached for subsequent retrievals.- Specified by:
createNode
in classAbstractTrait
- Returns:
- Returns the trait as a node.
-
-