Class SmithyIdlModelSerializer.Builder
- java.lang.Object
-
- software.amazon.smithy.model.shapes.SmithyIdlModelSerializer.Builder
-
- All Implemented Interfaces:
SmithyBuilder<SmithyIdlModelSerializer>
- Enclosing class:
- SmithyIdlModelSerializer
public static final class SmithyIdlModelSerializer.Builder extends java.lang.Object implements SmithyBuilder<SmithyIdlModelSerializer>
Builder used to createSmithyIdlModelSerializer
.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SmithyIdlModelSerializer.Builder
basePath(java.nio.file.Path basePath)
A base path to use for any created models.SmithyIdlModelSerializer
build()
Creates an immutable object that is created from the properties that have been set on the builder.SmithyIdlModelSerializer.Builder
componentOrder(SmithyIdlComponentOrder componentOrder)
Defines how components are sorted in the model, changing the default behavior of sorting alphabetically.SmithyIdlModelSerializer.Builder
inferInlineIoSuffixes(boolean shouldinferInlineIoSuffixes)
Determines whether the inline IO suffixes should be automatically determined.SmithyIdlModelSerializer.Builder
inlineInputSuffix(java.lang.String inlineInputSuffix)
Defines what suffixes are checked on operation input shapes to determine whether inline syntax should be used.SmithyIdlModelSerializer.Builder
inlineOutputSuffix(java.lang.String inlineOutputSuffix)
Defines what suffixes are checked on operation output shapes to determine whether inline syntax should be used.SmithyIdlModelSerializer.Builder
metadataFilter(java.util.function.Predicate<java.lang.String> metadataFilter)
Predicate that determines if a metadata is serialized.SmithyIdlModelSerializer.Builder
serializePrelude()
Enables serializing shapes in the Smithy prelude.SmithyIdlModelSerializer.Builder
shapeFilter(java.util.function.Predicate<Shape> shapeFilter)
Predicate that determines if a shape and its traits are serialized.SmithyIdlModelSerializer.Builder
shapePlacer(java.util.function.Function<Shape,java.nio.file.Path> shapePlacer)
Function that determines what output file a shape should go in.SmithyIdlModelSerializer.Builder
traitFilter(java.util.function.Predicate<Trait> traitFilter)
Sets a predicate that can be used to filter trait values from appearing in the serialized model.
-
-
-
Method Detail
-
metadataFilter
public SmithyIdlModelSerializer.Builder metadataFilter(java.util.function.Predicate<java.lang.String> metadataFilter)
Predicate that determines if a metadata is serialized.- Parameters:
metadataFilter
- Predicate that accepts a metadata key.- Returns:
- Returns the builder.
-
shapeFilter
public SmithyIdlModelSerializer.Builder shapeFilter(java.util.function.Predicate<Shape> shapeFilter)
Predicate that determines if a shape and its traits are serialized.- Parameters:
shapeFilter
- Predicate that accepts a shape.- Returns:
- Returns the builder.
-
traitFilter
public SmithyIdlModelSerializer.Builder traitFilter(java.util.function.Predicate<Trait> traitFilter)
Sets a predicate that can be used to filter trait values from appearing in the serialized model.Note that this does not filter out trait definitions. It only filters out instances of traits from being serialized on shapes.
- Parameters:
traitFilter
- Predicate that filters out trait definitions.- Returns:
- Returns the builder.
-
shapePlacer
public SmithyIdlModelSerializer.Builder shapePlacer(java.util.function.Function<Shape,java.nio.file.Path> shapePlacer)
Function that determines what output file a shape should go in.The returned paths may be absolute or relative.
NOTE: the Smithy IDL only supports one namespace per file.
- Parameters:
shapePlacer
- Function that accepts a shape and returns file path.- Returns:
- Returns the builder.
-
basePath
public SmithyIdlModelSerializer.Builder basePath(java.nio.file.Path basePath)
A base path to use for any created models.- Parameters:
basePath
- The base directory to assign models to.- Returns:
- Returns the builder.
-
serializePrelude
public SmithyIdlModelSerializer.Builder serializePrelude()
Enables serializing shapes in the Smithy prelude. Defaults to false.- Returns:
- Returns the builder.
-
componentOrder
public SmithyIdlModelSerializer.Builder componentOrder(SmithyIdlComponentOrder componentOrder)
Defines how components are sorted in the model, changing the default behavior of sorting alphabetically.You can serialize metadata, shapes, and traits in the original order they were defined by setting this to
SmithyIdlComponentOrder.SOURCE_LOCATION
.- Parameters:
componentOrder
- Change how components are sorted.- Returns:
- Returns the builder.
-
inlineInputSuffix
public SmithyIdlModelSerializer.Builder inlineInputSuffix(java.lang.String inlineInputSuffix)
Defines what suffixes are checked on operation input shapes to determine whether inline syntax should be used.This will also set the "operationInputSuffix" control statement.
- Parameters:
inlineInputSuffix
- The suffix to use for inline operation input.- Returns:
- Returns the builder.
-
inlineOutputSuffix
public SmithyIdlModelSerializer.Builder inlineOutputSuffix(java.lang.String inlineOutputSuffix)
Defines what suffixes are checked on operation output shapes to determine whether inline syntax should be used.This will also set the "operationOutputSuffix" control statement.
- Parameters:
inlineOutputSuffix
- The suffix to use for inline operation output.- Returns:
- Returns the builder.
-
inferInlineIoSuffixes
public SmithyIdlModelSerializer.Builder inferInlineIoSuffixes(boolean shouldinferInlineIoSuffixes)
Determines whether the inline IO suffixes should be automatically determined.If true, this will determine any shared IO suffixes for each file. Only the shapes present within each file will impact what that file's suffixes will be.
The suffixes set by
inlineInputSuffix(String)
andinlineOutputSuffix(String)
will be the default values.- Parameters:
shouldinferInlineIoSuffixes
- Whether inline IO suffixes should be inferred for each file.- Returns:
- Returns the builder.
-
build
public SmithyIdlModelSerializer build()
Description copied from interface:SmithyBuilder
Creates an immutable object that is created from the properties that have been set on the builder.- Specified by:
build
in interfaceSmithyBuilder<SmithyIdlModelSerializer>
- Returns:
- an instance of T
-
-