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 thetitle
trait. 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 theinput
oroutput
traits.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 theid
for the tag containing the shape's definition. Given a link idfoo
, a link to the shape's definition might look likehttps://example.com/shapes#foo
for example. If this ordefinitionFile
is 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
Modifier and TypeClassDescriptionstatic final class
Adds 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
Modifier and TypeFieldDescriptionstatic final String
A named boolean property indicating whether the symbol's definition file should have the default file extension applied.static final String
The name for a shape symbol's named property containing the string to use for the id for links to the shape.static final String
The operation that the symbol's shape is bound to.static final String
The name for a shape symbol's named property containing the shape the symbol represents. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Symbol
getDefault
(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, timestampShape
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.smithy.model.shapes.ShapeVisitor
setShape
Methods 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
input
oroutput
trait.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 theid
for the tag containing the shape's definition. Given a link idfoo
, a link to the shape's definition might look likehttps://example.com/shapes#foo
for example.If this or
definitionFile
is 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:SymbolProvider
Gets 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:
toSymbol
in interfaceSymbolProvider
- Parameters:
shape
- Shape to get the class name of.- Returns:
- Returns the generated class name.
-
serviceShape
- Specified by:
serviceShape
in interfaceShapeVisitor<Symbol>
- Overrides:
serviceShape
in classShapeVisitor.Default<Symbol>
-
resourceShape
- Specified by:
resourceShape
in interfaceShapeVisitor<Symbol>
- Overrides:
resourceShape
in classShapeVisitor.Default<Symbol>
-
operationShape
- Specified by:
operationShape
in interfaceShapeVisitor<Symbol>
- Overrides:
operationShape
in classShapeVisitor.Default<Symbol>
-
structureShape
- Specified by:
structureShape
in interfaceShapeVisitor<Symbol>
- Overrides:
structureShape
in classShapeVisitor.Default<Symbol>
-
enumShape
- Specified by:
enumShape
in interfaceShapeVisitor<Symbol>
-
intEnumShape
- Specified by:
intEnumShape
in interfaceShapeVisitor<Symbol>
-
unionShape
- Specified by:
unionShape
in interfaceShapeVisitor<Symbol>
- Overrides:
unionShape
in classShapeVisitor.Default<Symbol>
-
memberShape
- Specified by:
memberShape
in interfaceShapeVisitor<Symbol>
- Overrides:
memberShape
in classShapeVisitor.Default<Symbol>
-
getDefault
Description copied from class:ShapeVisitor.Default
Returns a value for any unhandled shape.- Specified by:
getDefault
in classShapeVisitor.Default<Symbol>
- Parameters:
shape
- Shape that is being visited.- Returns:
- Return value.
-