Interface TraitContainer
-
- All Known Implementing Classes:
TraitContainer.TraitHashMap
public interface TraitContainer
Aggregates, merges, and creates traits.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
TraitContainer.TraitHashMap
The actual, mutable implementation used to aggregate traits.
-
Field Summary
Fields Modifier and Type Field Description static TraitContainer
EMPTY
Shared empty, immutable instance.
-
Method Summary
All Methods Instance Methods Abstract 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()
-
-
-
Field Detail
-
EMPTY
static final TraitContainer EMPTY
Shared empty, immutable instance.
-
-
Method Detail
-
traits
java.util.Map<ShapeId,java.util.Map<ShapeId,Trait>> traits()
- Returns:
- Gets all traits in the value map.
-
getTraitsForShape
java.util.Map<ShapeId,Trait> getTraitsForShape(ShapeId shape)
Gets the traits applied to a shape.- Parameters:
shape
- Shape to get the traits of.- Returns:
- Returns the traits of the shape.
-
getTraitsAppliedToPrelude
java.util.Map<ShapeId,java.util.Map<ShapeId,Trait>> getTraitsAppliedToPrelude()
Gets all traits applied to the prelude.- Returns:
- Returns the traits applied to prelude shapes.
-
onTrait
void onTrait(ShapeId target, Trait value)
Add a trait.- Parameters:
target
- Shape to add the trait to.value
- Trait to add.
-
-