Class Model
- All Implemented Interfaces:
- ToSmithyBuilder<Model>
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classBuilder used to create a Model.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringSpecifies the highest supported version of the IDL.
- 
Method SummaryModifier and TypeMethodDescriptionstatic ModelAssemblerAssembles and validates a Smithy model from files, nodes, and other disparate sources.static ModelAssemblerassembler(ClassLoader classLoader) Creates aModelAssemblerthat is configured to discover traits, validators, and built-in validators using the givenClassLoader.static Model.Builderbuilder()Builds an explicitly configured Smithy model.booleanexpectShape(ShapeId id) <T extends Shape>
 TexpectShape(ShapeId id, Class<T> type) Gets a set of every trait shape ID that is used in the model.Gets an immutable set of all bigDecimals in the Model.getBigDecimalShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all bigDecimals in the Model that have a specific trait.Gets an immutable set of all bigIntegers in the Model.getBigIntegerShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all bigIntegers in the Model that have a specific trait.Gets an immutable set of all blobs in the Model.getBlobShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all blobs in the Model that have a specific trait.Gets an immutable set of all booleans in the Model.getBooleanShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all booleans in the Model that have a specific trait.Gets an immutable set of all bytes in the Model.getByteShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all bytes in the Model that have a specific trait.Gets an immutable set of all documents in the Model.getDocumentShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all documents in the Model that have a specific trait.Gets an immutable set of all doubles in the Model.getDoubleShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all doubles in the Model that have a specific trait.Gets an immutable set of all enums in the Model.getEnumShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all enums in the Model that have a specific trait.Gets an immutable set of all floats in the Model.getFloatShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all floats in the Model that have a specific trait.Gets an immutable set of all integers in the Model.getIntegerShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all integers in the Model that have a specific trait.Gets an immutable set of all intEnums in the Model.getIntEnumShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all intEnums in the Model that have a specific trait.<T extends KnowledgeIndex>
 TgetKnowledge(Class<T> type) Deprecated.<T extends KnowledgeIndex>
 TgetKnowledge(Class<T> type, Function<Model, T> constructor) Gets a computed "knowledge index" of a specific type for the model and caches it for subsequent retrieval.Gets an immutable set of all lists in the Model.getListShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all lists in the Model that have a specific trait.Gets an immutable set of all longs in the Model.getLongShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all longs in the Model that have a specific trait.Gets an immutable set of all maps in the Model.getMapShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all maps in the Model that have a specific trait.Gets an immutable set of all members in the Model.getMemberShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all members in the Model that have a specific trait.getMetadataProperty(String name) Gets a metadata property by namespace and name.Gets an immutable set of all operations in the Model.getOperationShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all operations in the Model that have a specific trait.Gets an immutable set of all resources in the Model.getResourceShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all resources in the Model that have a specific trait.Gets an immutable set of all services in the Model.getServiceShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all services in the Model that have a specific trait.Deprecated.getSetShapesWithTrait(Class<? extends Trait> trait) Deprecated.Gets the immutable set ofShapeIdin the model.getShapesWithTrait(Class<? extends Trait> trait) Gets a set of shapes in the model marked with a specific trait.getShapesWithTrait(ToShapeId trait) Gets a set of shapes in the model marked with a specific trait.Gets an immutable set of all shorts in the Model.getShortShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all shorts in the Model that have a specific trait.Gets an immutable set of all strings in the Model.getStringShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all strings in the Model that have a specific trait.Gets an immutable set of all structures in the Model.getStructureShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all structures in the Model that have a specific trait.Gets an immutable set of all timestamps in the Model.getTimestampShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all timestamps in the Model that have a specific trait.getTraitDefinition(ToShapeId traitId) Gets the trait definition of a specific trait shape ID.Gets an immutable set of all unions in the Model.getUnionShapesWithTrait(Class<? extends Trait> trait) Gets an immutable set of all unions in the Model that have a specific trait.inthashCode()booleanisTraitApplied(Class<? extends Trait> trait) Returns true if the given trait shape ID was used in the model.shapes()Gets a stream ofShapes in the index.Gets a stream of shapes in the index of a specific typeT.Take this object and create a builder that contains all of the current property values of this object.toSet()Converts the model to an immutable Set of shapes.Gets an immutable Set of shapes of a specific type.
- 
Field Details- 
MODEL_VERSIONSpecifies the highest supported version of the IDL.- See Also:
 
 
- 
- 
Method Details- 
builderBuilds an explicitly configured Smithy model.Note that the builder does not validate the correctness of the model. Use the assembler()method to build and validate a model.- Returns:
- Returns a model builder.
- See Also:
 
- 
assemblerAssembles and validates a Smithy model from files, nodes, and other disparate sources.- Returns:
- Returns a model assembler.
 
- 
assemblerCreates aModelAssemblerthat is configured to discover traits, validators, and built-in validators using the givenClassLoader.- Parameters:
- classLoader- Class loader used to discover services.
- Returns:
- Returns a model assembler.
 
- 
getMetadataPropertyGets a metadata property by namespace and name.- Parameters:
- name- Name of the property to retrieve.
- Returns:
- Returns the optional property.
 
- 
getMetadata- Returns:
- Gets the unmodifiable metadata of the model across all namespaces.
 
- 
getTraitDefinitionGets the trait definition of a specific trait shape ID.- Parameters:
- traitId- ID of the shape to get the trait definition of.
- Returns:
- Returns the optionally found trait definition.
 
- 
getShapesWithTraitGets a set of shapes in the model marked with a specific trait.- Parameters:
- trait- Trait shape ID to look for on shapes.
- Returns:
- Returns the immutable set of matching shapes.
 
- 
getShapeIdsGets the immutable set ofShapeIdin the model.- Returns:
- Returns the shape IDs.
 
- 
getShapesWithTraitGets a set of shapes in the model marked with a specific trait.The result is an exact match on trait classes and does not utilize any kind of polymorphic instance of checks. - Parameters:
- trait- Trait class to look for on shapes.
- Returns:
- Returns the immutable set of matching shapes.
 
- 
getBigDecimalShapesGets an immutable set of all bigDecimals in the Model.- Returns:
- Returns the Set of bigDecimalss.
 
- 
getBigDecimalShapesWithTraitGets an immutable set of all bigDecimals in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of bigdecimals that have a specific trait.
 
- 
getBigIntegerShapesGets an immutable set of all bigIntegers in the Model.- Returns:
- Returns the Set of bigIntegerss.
 
- 
getBigIntegerShapesWithTraitGets an immutable set of all bigIntegers in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of bigIntegerss that have a specific trait.
 
- 
getBlobShapesGets an immutable set of all blobs in the Model.- Returns:
- Returns the Set of blobs.
 
- 
getBlobShapesWithTraitGets an immutable set of all blobs in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of blobs that have a specific trait.
 
- 
getBooleanShapesGets an immutable set of all booleans in the Model.- Returns:
- Returns the Set of booleans.
 
- 
getBooleanShapesWithTraitGets an immutable set of all booleans in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of booleans that have a specific trait.
 
- 
getByteShapesGets an immutable set of all bytes in the Model.- Returns:
- Returns the Set of bytes.
 
- 
getByteShapesWithTraitGets an immutable set of all bytes in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of bytes that have a specific trait.
 
- 
getDocumentShapesGets an immutable set of all documents in the Model.- Returns:
- Returns the Set of documents.
 
- 
getDocumentShapesWithTraitGets an immutable set of all documents in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of documents that have a specific trait.
 
- 
getDoubleShapesGets an immutable set of all doubles in the Model.- Returns:
- Returns the Set of doubles.
 
- 
getDoubleShapesWithTraitGets an immutable set of all doubles in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of doubles that have a specific trait.
 
- 
getFloatShapesGets an immutable set of all floats in the Model.- Returns:
- Returns the Set of floats.
 
- 
getFloatShapesWithTraitGets an immutable set of all floats in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of floats that have a specific trait.
 
- 
getIntegerShapesGets an immutable set of all integers in the Model.- Returns:
- Returns the Set of integers.
 
- 
getIntegerShapesWithTraitGets an immutable set of all integers in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of integers that have a specific trait.
 
- 
getIntEnumShapesGets an immutable set of all intEnums in the Model.- Returns:
- Returns the Set of intEnums.
 
- 
getIntEnumShapesWithTraitGets an immutable set of all intEnums in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of intEnums that have a specific trait.
 
- 
getListShapesGets an immutable set of all lists in the Model.- Returns:
- Returns the Set of lists.
 
- 
getListShapesWithTraitGets an immutable set of all lists in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of lists that have a specific trait.
 
- 
getLongShapesGets an immutable set of all longs in the Model.- Returns:
- Returns the Set of longs.
 
- 
getLongShapesWithTraitGets an immutable set of all longs in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of longs that have a specific trait.
 
- 
getMapShapesGets an immutable set of all maps in the Model.- Returns:
- Returns the Set of maps.
 
- 
getMapShapesWithTraitGets an immutable set of all maps in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of maps that have a specific trait.
 
- 
getMemberShapesGets an immutable set of all members in the Model.- Returns:
- Returns the Set of members.
 
- 
getMemberShapesWithTraitGets an immutable set of all members in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of members that have a specific trait.
 
- 
getOperationShapesGets an immutable set of all operations in the Model.- Returns:
- Returns the Set of operations.
 
- 
getOperationShapesWithTraitGets an immutable set of all operations in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of operations that have a specific trait.
 
- 
getResourceShapesGets an immutable set of all resources in the Model.- Returns:
- Returns the Set of resources.
 
- 
getResourceShapesWithTraitGets an immutable set of all resources in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of resources that have a specific trait.
 
- 
getServiceShapesGets an immutable set of all services in the Model.- Returns:
- Returns the Set of services.
 
- 
getServiceShapesWithTraitGets an immutable set of all services in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of services that have a specific trait.
 
- 
getSetShapesDeprecated.Gets an immutable set of all sets in the Model.- Returns:
- Returns the Set of sets.
 
- 
getSetShapesWithTraitDeprecated.Gets an immutable set of all sets in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of sets that have a specific trait.
 
- 
getShortShapesGets an immutable set of all shorts in the Model.- Returns:
- Returns the Set of shorts.
 
- 
getShortShapesWithTraitGets an immutable set of all shorts in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of shorts that have a specific trait.
 
- 
getStringShapesGets an immutable set of all strings in the Model.- Returns:
- Returns the Set of strings.
 
- 
getStringShapesWithTraitGets an immutable set of all strings in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of strings that have a specific trait.
 
- 
getEnumShapesGets an immutable set of all enums in the Model.- Returns:
- Returns the Set of enums.
 
- 
getEnumShapesWithTraitGets an immutable set of all enums in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of enums that have a specific trait.
 
- 
getStructureShapesGets an immutable set of all structures in the Model.- Returns:
- Returns the Set of structures.
 
- 
getStructureShapesWithTraitGets an immutable set of all structures in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of structures that have a specific trait.
 
- 
getTimestampShapesGets an immutable set of all timestamps in the Model.- Returns:
- Returns the Set of timestamps.
 
- 
getTimestampShapesWithTraitGets an immutable set of all timestamps in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of timestamps that have a specific trait.
 
- 
getUnionShapesGets an immutable set of all unions in the Model.- Returns:
- Returns the Set of unions.
 
- 
getUnionShapesWithTraitGets an immutable set of all unions in the Model that have a specific trait.- Parameters:
- trait- The exact trait class to look for on shapes.
- Returns:
- Returns the set of unions that have a specific trait.
 
- 
getAppliedTraitsGets a set of every trait shape ID that is used in the model.- Returns:
- Returns the shape IDs of traits used in the model.
 
- 
isTraitAppliedReturns true if the given trait shape ID was used in the model.- Parameters:
- trait- The trait class to check.
- Returns:
- Returns true if the trait was used in the model.
 
- 
getShape- Parameters:
- id- Shape to retrieve by ID.
- Returns:
- Returns the optional shape.
 
- 
expectShape- Parameters:
- id- Shape to retrieve by ID.
- Returns:
- Returns the shape.
- Throws:
- ExpectationNotMetException- if the shape is not found.
 
- 
expectShapeAttempts to retrieve aShapebyShapeIdand throws if not found or if the shape is not of the expected type.- Type Parameters:
- T- Expected shape type.
- Parameters:
- id- Shape to retrieve by ID.
- type- Shape type to expect and convert to.
- Returns:
- Returns the shape.
- Throws:
- ExpectationNotMetException- if the shape is not found or is not the expected type.
 
- 
shapesGets a stream ofShapes in the index.- Returns:
- Returns a stream of shapes.
 
- 
shapesGets a stream of shapes in the index of a specific typeT.The provided shapeType class must exactly match the class of a shape in the model in order to be returned from this method; that is, the provided class must be a concrete subclass of Shapeand not an abstract class likeNumberShape.- Type Parameters:
- T- Shape type to stream from the index.
- Parameters:
- shapeType- Shape type- Tto retrieve.
- Returns:
- A stream of shapes of TmatchingshapeType.
 
- 
toSetGets an immutable Set of shapes of a specific type.- Type Parameters:
- T- Shape type to get from the index.
- Parameters:
- shapeType- Type of shape to get a set of.
- Returns:
- Returns an unmodifiable set of shapes.
 
- 
toSetConverts the model to an immutable Set of shapes.- Returns:
- Returns an unmodifiable set of shapes.
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toBuilderDescription copied from interface:ToSmithyBuilderTake this object and create a builder that contains all of the current property values of this object.- Specified by:
- toBuilderin interface- ToSmithyBuilder<Model>
- Returns:
- a builder for type T
 
- 
getKnowledgeDeprecated.This method is deprecated. Use theofmethod of theKnowledgeIndexyou wish to create instead.- Type Parameters:
- T- The type of knowledge index to retrieve.
- Parameters:
- type- Type of knowledge index to retrieve.
- Returns:
- Returns the computed knowledge index.
 
- 
getKnowledgeGets a computed "knowledge index" of a specific type for the model and caches it for subsequent retrieval.This method should not typically be called directly because KnowledgeIndex classes should all provide a public static ofmethod that accepts aModeland returns an instance of the index by invokinggetKnowledge.If a KnowledgeIndexof the given type has not yet been computed, one will be created using the providedconstructorfunction that accepts aModel. Computed knowledge indexes are cached and returned on subsequent retrievals.- Type Parameters:
- T- The type of knowledge index to retrieve.
- Parameters:
- type- Type of knowledge index to retrieve.
- constructor- The method used to create- type.
- Returns:
- Returns the computed knowledge index.
 
 
-