Class DocSymbolProvider
- All Implemented Interfaces:
SymbolProvider,ShapeVisitor<Symbol>
These symbols contain many important pieces of metadata. Particularly important are:
name: The name of the symbol will be used as the title for its definition section. For services, this defaults to the value of thetitletrait. For other shapes, it defaults to the shape name including any renames from the attached service.definitionFile: The file in which the documentation for this shape should be written. By default these are all written to a single flat directory. If this is empty, the shape does not have its own definition section and cannot be linked to.SHAPE_PROPERTY: A named Shape property containing the shape that the symbol represents. Decorators provided bySmithyIntegration.decorateSymbolProvider(software.amazon.smithy.model.Model, S, software.amazon.smithy.codegen.core.SymbolProvider)MUST set or preserve this property.OPERATION_PROPERTY: A named OperationShape property containing the operation shape that the shape is bound to. This will only be present on structure shapes that have theinputoroutputtraits.LINK_ID_PROPERTY: A named String property containing the string to use for the id for links to the shape. In HTML, this would be theidfor the tag containing the shape's definition. Given a link idfoo, a link to the shape's definition might look likehttps://example.com/shapes#foofor example. If this ordefinitionFileis empty, it is not possible to link to the shape.ENABLE_DEFAULT_FILE_EXTENSION: A named boolean property indicating whether the symbol's definition file should have the default file extension applied. If not present or set tofalse, the file extension will not be applied.
Decorators provided by SmithyIntegration.decorateSymbolProvider(software.amazon.smithy.model.Model, S, software.amazon.smithy.codegen.core.SymbolProvider) MUST set
these properties or preserve
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAdds file extensions to symbol definition files.Nested classes/interfaces inherited from interface software.amazon.smithy.model.shapes.ShapeVisitor
ShapeVisitor.DataShapeVisitor<R>, ShapeVisitor.Default<R> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA named boolean property indicating whether the symbol's definition file should have the default file extension applied.static final StringThe name for a shape symbol's named property containing the string to use for the id for links to the shape.static final StringThe operation that the symbol's shape is bound to.static final StringThe name for a shape symbol's named property containing the shape the symbol represents. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SymbolgetDefault(Shape shape) Returns a value for any unhandled shape.intEnumShape(IntEnumShape shape) memberShape(MemberShape shape) operationShape(OperationShape shape) resourceShape(ResourceShape shape) serviceShape(ServiceShape shape) structureShape(StructureShape shape) Gets the symbol to define for the given shape.unionShape(UnionShape shape) Methods inherited from class software.amazon.smithy.model.shapes.ShapeVisitor.Default
bigDecimalShape, bigIntegerShape, blobShape, booleanShape, byteShape, documentShape, doubleShape, floatShape, integerShape, listShape, longShape, mapShape, shortShape, stringShape, timestampShapeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.smithy.model.shapes.ShapeVisitor
setShapeMethods inherited from interface software.amazon.smithy.codegen.core.SymbolProvider
toMemberName
-
Field Details
-
SHAPE_PROPERTY
The name for a shape symbol's named property containing the shape the symbol represents.Decorators provided by
SmithyIntegration.decorateSymbolProvider(software.amazon.smithy.model.Model, S, software.amazon.smithy.codegen.core.SymbolProvider)MUST preserve this property.Use
symbol.expectProperty(SHAPE_PROPERTY, Shape.class)to access this property.- See Also:
-
OPERATION_PROPERTY
The operation that the symbol's shape is bound to.This property will only be present on structures that have either the
inputoroutputtrait.Use
symbol.getProperty(OPERATION_PROPERTY, OperationShape.class)to access this property.- See Also:
-
LINK_ID_PROPERTY
The name for a shape symbol's named property containing the string to use for the id for links to the shape. In HTML, this would be theidfor the tag containing the shape's definition. Given a link idfoo, a link to the shape's definition might look likehttps://example.com/shapes#foofor example.If this or
definitionFileis empty, it is not possible to link to the shape.Use
symbol.getProperty(LINK_ID_PROPERTY, String.class)to access this property.- See Also:
-
ENABLE_DEFAULT_FILE_EXTENSION
A named boolean property indicating whether the symbol's definition file should have the default file extension applied. If not present or set tofalse, the file extension will not be applied.Use
symbol.getProperty(LINK_ID_PROPERTY, Boolean.class)to access this property.- See Also:
-
-
Constructor Details
-
DocSymbolProvider
Constructor.- Parameters:
model- The model to provide symbols for.docSettings- Settings used to customize symbol creation.
-
-
Method Details
-
toSymbol
Description copied from interface:SymbolProviderGets the symbol to define for the given shape.A "symbol" represents the qualified name of a type in a target programming language.
- When given a structure, union, resource, or service shape, this method should provide the namespace and name of the type to generate.
- When given a simple type like a string, number, or timestamp, this method should return the language-specific type of the shape.
- When given a member shape, this method should return the language specific type to use as the target of the member.
- When given a list, set, or map, this method should return the language specific type to use for the shape (e.g., a map shape for a Python code generator might return "dict".
- Specified by:
toSymbolin interfaceSymbolProvider- Parameters:
shape- Shape to get the class name of.- Returns:
- Returns the generated class name.
-
serviceShape
- Specified by:
serviceShapein interfaceShapeVisitor<Symbol>- Overrides:
serviceShapein classShapeVisitor.Default<Symbol>
-
resourceShape
- Specified by:
resourceShapein interfaceShapeVisitor<Symbol>- Overrides:
resourceShapein classShapeVisitor.Default<Symbol>
-
operationShape
- Specified by:
operationShapein interfaceShapeVisitor<Symbol>- Overrides:
operationShapein classShapeVisitor.Default<Symbol>
-
structureShape
- Specified by:
structureShapein interfaceShapeVisitor<Symbol>- Overrides:
structureShapein classShapeVisitor.Default<Symbol>
-
enumShape
- Specified by:
enumShapein interfaceShapeVisitor<Symbol>
-
intEnumShape
- Specified by:
intEnumShapein interfaceShapeVisitor<Symbol>
-
unionShape
- Specified by:
unionShapein interfaceShapeVisitor<Symbol>- Overrides:
unionShapein classShapeVisitor.Default<Symbol>
-
memberShape
- Specified by:
memberShapein interfaceShapeVisitor<Symbol>- Overrides:
memberShapein classShapeVisitor.Default<Symbol>
-
getDefault
Description copied from class:ShapeVisitor.DefaultReturns a value for any unhandled shape.- Specified by:
getDefaultin classShapeVisitor.Default<Symbol>- Parameters:
shape- Shape that is being visited.- Returns:
- Return value.
-