Interface TraitContainer
- All Known Implementing Classes:
TraitContainer.TraitHashMap
,TraitContainer.VersionAwareTraitContainer
public interface TraitContainer
Aggregates, merges, and creates traits.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final class
The actual, mutable implementation used to aggregate traits.static final class
Performs version-specific validation on traits as they are added. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
clearTraitsForShape
(ShapeId shape) Clears the traits applied to a shape.Gets all traits applied to the prelude.getTraitsForShape
(ShapeId shape) Gets the traits applied to a shape.void
Create and add a trait.void
Add a trait.traits()
-
Field Details
-
EMPTY
Shared empty, immutable instance.
-
-
Method Details
-
traits
- Returns:
- Gets all traits in the value map.
-
getTraitsForShape
Gets the traits applied to a shape.- Parameters:
shape
- Shape to get the traits of.- Returns:
- Returns the traits of the shape.
-
clearTraitsForShape
Clears the traits applied to a shape.This is useful in the event of errors that occur while attempting to create a shape so that validation events about traits applied to shapes that couldn't be created are not emitted.
- Parameters:
shape
- Shape to clear the traits for.
-
getTraitsAppliedToPrelude
Gets all traits applied to the prelude.- Returns:
- Returns the traits applied to prelude shapes.
-
onTrait
Add a trait.- Parameters:
target
- Shape to add the trait to.value
- Trait to add.
-
onTrait
Create and add a trait.- Parameters:
target
- Shape to add the trait to.traitId
- Trait shape ID to create.value
- The value to assign to the trait.
-