Class TraitContainer.TraitHashMap
- java.lang.Object
-
- software.amazon.smithy.model.loader.TraitContainer.TraitHashMap
-
- All Implemented Interfaces:
TraitContainer
- Enclosing interface:
- TraitContainer
public static final class TraitContainer.TraitHashMap extends java.lang.Object implements TraitContainer
The actual, mutable implementation used to aggregate traits.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface software.amazon.smithy.model.loader.TraitContainer
TraitContainer.TraitHashMap
-
-
Field Summary
-
Fields inherited from interface software.amazon.smithy.model.loader.TraitContainer
EMPTY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<ShapeId,java.util.Map<ShapeId,Trait>>
getTraitsAppliedToPrelude()
Gets all traits applied to the prelude.java.util.Map<ShapeId,Trait>
getTraitsForShape(ShapeId shape)
Gets the traits applied to a shape.void
onTrait(ShapeId target, ShapeId traitId, Node value)
Create and add a trait.void
onTrait(ShapeId target, Trait value)
Add a trait.java.util.Map<ShapeId,java.util.Map<ShapeId,Trait>>
traits()
-
-
-
Method Detail
-
traits
public java.util.Map<ShapeId,java.util.Map<ShapeId,Trait>> traits()
- Specified by:
traits
in interfaceTraitContainer
- Returns:
- Gets all traits in the value map.
-
getTraitsForShape
public java.util.Map<ShapeId,Trait> getTraitsForShape(ShapeId shape)
Description copied from interface:TraitContainer
Gets the traits applied to a shape.- Specified by:
getTraitsForShape
in interfaceTraitContainer
- Parameters:
shape
- Shape to get the traits of.- Returns:
- Returns the traits of the shape.
-
getTraitsAppliedToPrelude
public java.util.Map<ShapeId,java.util.Map<ShapeId,Trait>> getTraitsAppliedToPrelude()
Description copied from interface:TraitContainer
Gets all traits applied to the prelude.- Specified by:
getTraitsAppliedToPrelude
in interfaceTraitContainer
- Returns:
- Returns the traits applied to prelude shapes.
-
onTrait
public void onTrait(ShapeId target, Trait value)
Description copied from interface:TraitContainer
Add a trait.- Specified by:
onTrait
in interfaceTraitContainer
- Parameters:
target
- Shape to add the trait to.value
- Trait to add.
-
onTrait
public void onTrait(ShapeId target, ShapeId traitId, Node value)
Description copied from interface:TraitContainer
Create and add a trait.- Specified by:
onTrait
in interfaceTraitContainer
- Parameters:
target
- Shape to add the trait to.traitId
- Trait shape ID to create.value
- The value to assign to the trait.
-
-