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.
Creates traits using trait data from a model.
-
Method Summary
Modifier and TypeMethodDescriptionstatic TraitFactory
Creates a TraitFactory that discovers TraitService providers using the Thread context class loader.static TraitFactory
createServiceFactory
(ClassLoader classLoader) Creates a TraitFactory that discovers TraitService providers using the given ClassLoader.static TraitFactory
createServiceFactory
(Iterable<TraitService> services) Creates a TraitFactory that uses a List of TraitService provider instances.createTrait
(ShapeId id, ShapeId target, Node value) Creates and configures a trait using model trait data.
-
Method Details
-
createTrait
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.RuntimeException
- if an error occurs while creating the trait.
-
createServiceFactory
Creates a TraitFactory that uses a List of TraitService provider instances.- Parameters:
services
- List of TraitService provider instances.- Returns:
- Returns the created TraitFactory.
-
createServiceFactory
Creates a TraitFactory that discovers TraitService providers using the Thread context class loader.- Returns:
- Returns the created TraitFactory.
-
createServiceFactory
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.
-