Class GeneratorRuleBuilderImpl<S,T>
- java.lang.Object
-
- org.palladiosimulator.textual.commons.generator.rules.impl.GeneratorRuleBuilderImpl<S,T>
-
- All Implemented Interfaces:
GeneratorRuleBuilder<S,T>
public class GeneratorRuleBuilderImpl<S,T> extends Object implements GeneratorRuleBuilder<S,T>
-
-
Constructor Summary
Constructors Constructor Description GeneratorRuleBuilderImpl(Class<S> source, Class<T> target)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExecutableRule<S,T>
build()
Build the resulting rule.<PS,PT>
ValueApplierRule<PT,T>map(Function<S,PS> contentProvider)
Defines a transformation for a child element.<PS,PT>
ValueApplierRule<PT,T>map(Function<S,PS> contentProvider, Class<PT> target)
Defines a transformation for a child element.<PS,PT>
ValueApplierRule<List<PT>,T>mapAll(Function<S,? extends List<PS>> contentProvider)
Defines a transformation for child elements.<PS,PT>
ValueApplierRule<List<PT>,T>mapAll(Function<S,? extends List<PS>> contentProvider, Class<PT> target)
Defines a transformation for child elements.void
setAfter(Consumer<T> callback)
(Optional) Defines what to do after all child element transformations have finished.void
setCreate(Function<S,T> factory)
(Required) Defines how the target object can be created from the given source.void
setWhen(Predicate<S> guard)
(Optional) Defines a predicate for this transformation.
-
-
-
Method Detail
-
map
public <PS,PT> ValueApplierRule<PT,T> map(Function<S,PS> contentProvider)
Description copied from interface:GeneratorRuleBuilder
Defines a transformation for a child element.- Specified by:
map
in interfaceGeneratorRuleBuilder<S,T>
- Parameters:
contentProvider
- Provider for how get this element from the source element- See Also:
ValueApplierConfigurer
-
mapAll
public <PS,PT> ValueApplierRule<List<PT>,T> mapAll(Function<S,? extends List<PS>> contentProvider)
Description copied from interface:GeneratorRuleBuilder
Defines a transformation for child elements.- Specified by:
mapAll
in interfaceGeneratorRuleBuilder<S,T>
- Parameters:
contentProvider
- Provider for how get these elements from the source element- See Also:
ValueApplierConfigurer
-
setCreate
public void setCreate(Function<S,T> factory)
Description copied from interface:GeneratorRuleBuilder
(Required) Defines how the target object can be created from the given source.- Specified by:
setCreate
in interfaceGeneratorRuleBuilder<S,T>
-
setWhen
public void setWhen(Predicate<S> guard)
Description copied from interface:GeneratorRuleBuilder
(Optional) Defines a predicate for this transformation. This makes sure that the transformation only happens, if the predicate defined here tests successfully.- Specified by:
setWhen
in interfaceGeneratorRuleBuilder<S,T>
-
map
public <PS,PT> ValueApplierRule<PT,T> map(Function<S,PS> contentProvider, Class<PT> target)
Description copied from interface:GeneratorRuleBuilder
Defines a transformation for a child element.- Specified by:
map
in interfaceGeneratorRuleBuilder<S,T>
- Parameters:
contentProvider
- Provider for how get this element from the source elementtarget
- The desired target type for these elements- See Also:
ValueApplierConfigurer
-
mapAll
public <PS,PT> ValueApplierRule<List<PT>,T> mapAll(Function<S,? extends List<PS>> contentProvider, Class<PT> target)
Description copied from interface:GeneratorRuleBuilder
Defines a transformation for child elements.- Specified by:
mapAll
in interfaceGeneratorRuleBuilder<S,T>
- Parameters:
contentProvider
- Provider for how get these elements from the source elementtarget
- The desired target type for these elements- See Also:
ValueApplierConfigurer
-
setAfter
public void setAfter(Consumer<T> callback)
Description copied from interface:GeneratorRuleBuilder
(Optional) Defines what to do after all child element transformations have finished.- Specified by:
setAfter
in interfaceGeneratorRuleBuilder<S,T>
-
build
public ExecutableRule<S,T> build()
Description copied from interface:GeneratorRuleBuilder
Build the resulting rule.- Specified by:
build
in interfaceGeneratorRuleBuilder<S,T>
-
-