Interface TraitFactory
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface TraitFactory
Creates traits using trait data from a model.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static TraitFactory
createServiceFactory()
Creates a TraitFactory that discovers TraitService providers using the Thread context class loader.static TraitFactory
createServiceFactory(java.lang.ClassLoader classLoader)
Creates a TraitFactory that discovers TraitService providers using the given ClassLoader.static TraitFactory
createServiceFactory(java.lang.Iterable<TraitService> services)
Creates a TraitFactory that uses a List of TraitService provider instances.java.util.Optional<Trait>
createTrait(ShapeId id, ShapeId target, Node value)
Creates and configures a trait using model trait data.
-
-
-
Method Detail
-
createTrait
java.util.Optional<Trait> createTrait(ShapeId id, ShapeId target, Node value)
Creates and configures a trait using model trait data.- Parameters:
id
- Shape ID of the trait.target
- Shape that the trait is applied on.value
- The Node value of the trait.- Returns:
- Returns the created trait wrapped in an Optional.
- Throws:
SourceException
- on configuration error.java.lang.RuntimeException
- if an error occurs while creating the trait.
-
createServiceFactory
static TraitFactory createServiceFactory(java.lang.Iterable<TraitService> services)
Creates a TraitFactory that uses a List of TraitService provider instances.- Parameters:
services
- List of TraitService provider instances.- Returns:
- Returns the created TraitFactory.
-
createServiceFactory
static TraitFactory createServiceFactory()
Creates a TraitFactory that discovers TraitService providers using the Thread context class loader.- Returns:
- Returns the created TraitFactory.
-
createServiceFactory
static TraitFactory createServiceFactory(java.lang.ClassLoader classLoader)
Creates a TraitFactory that discovers TraitService providers using the given ClassLoader.- Parameters:
classLoader
- Class loader used to find TraitService providers.- Returns:
- Returns the created TraitFactory.
-
-