Class InternalKlumBuilder<M>
java.lang.Object
groovy.lang.GroovyObjectSupport
com.blackbuild.klum.ast.runtime.internal.InternalKlumBuilder<M>
- All Implemented Interfaces:
KlumBuilder<M>,groovy.lang.GroovyObject,Serializable
- Direct Known Subclasses:
GeneratedKlumBuilder
public abstract class InternalKlumBuilder<M>
extends groovy.lang.GroovyObjectSupport
implements KlumBuilder<M>, Serializable
Mutable construction-time counterpart of a DSL Object.
Generated Builders inherit this internal support base and own every mutable value until the graph is materialized. A completed model never retains its Builder.
The public KlumBuilder capability deliberately exposes no runtime
operations. Generated implementations use this class internally.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void$assignMaterializedRelationship(String fieldName) Internal Builder hook that assigns one completed relationship without exposing a model mutator.protected voidAssigns relationship fields after every object in the graph was allocated.final voidInternal hook used byPhaseDriver; the token remains opaque to clients.final voidInternal hook used byPhaseDriverwhen the owning root lifecycle ends.final KlumObjectCompanion$createCompanion(groovy.lang.GroovyObject model) Creates the internal companion retained by a generated DSL Object.final booleanInternal hook used byPhaseDriverto keep Builder adapters in their owning session.final Object$materializeRelationship(String fieldName) Called by generated internal relationship assignment code.Identifies the generated model implementation.final Object$snapshotField(String fieldName) Called by generated model constructors for non-relationship fields.final voidaddElementsFromScriptsToCollection(String fieldName, Class<? extends groovy.lang.Script>... scripts) final voidaddElementsFromScriptsToMap(String fieldName, Class<? extends groovy.lang.Script>... scripts) voidaddElementsToCollection(String fieldName, Iterable<?> elements) Adds one or more existing '{{singleElementName}}' values to the Builder's '{{fieldName}}' collection.voidaddElementsToCollection(String fieldName, Object... elements) Adds one or more existing '{{singleElementName}}' values to the Builder's '{{fieldName}}' collection.<V> voidaddElementsToMap(String fieldName, Iterable<V> values) voidaddElementsToMap(String fieldName, Object... values) <K,V> void addElementsToMap(String fieldName, Map<K, V> values) <T> TaddElementToCollection(String fieldName, T element) Adds an existing '{{singleElementName}}' to the Builder's '{{fieldName}}' collection.<T> TaddElementToCollectionViaConverter(String fieldOrMethodName, Class<?> converterType, String converterMethod, Object... args) <K,V> V addElementToMap(String fieldName, K key, V value) <K,V> V addElementToMapViaConverter(String fieldOrMethodName, Class<?> converterType, String converterMethod, K key, Object... args) addNewDslElementToCollection(Map<String, Object> namedParams, String collectionName, KlumFactory.BuilderFactoryProvider<?, ?> factory, String key, groovy.lang.Closure<?> body) Adds an owned collection child selected by its generated factory in the current session.<T> TaddNewDslElementToCollection(Map<String, Object> namedParams, String collectionName, Class<? extends T> type, boolean explicitType, String key, groovy.lang.Closure<T> body) Creates a new '{{singleElementName}}' Builder {{param:type?with the given type}} and adds it to the Builder's '{{fieldName}}' collection.addNewDslElementToMap(Map<String, Object> namedParams, String mapName, KlumFactory.BuilderFactoryProvider<?, ?> factory, String key, groovy.lang.Closure<?> body) Adds an owned map child selected by its generated factory in the current session.<T> TaddNewDslElementToMap(Map<String, Object> namedParams, String mapName, Class<? extends T> type, boolean explicitType, String key, groovy.lang.Closure<T> body) Creates a new '{{singleElementName}}' Builder {{param:type?with the given type}} and adds it to the Builder's '{{fieldName}}' map.<C extends Collection<?>>
CaddProjectedBuildersFromCollectionToCollection(String fieldName, C builders) Attaches a projected batch of child Builders and returns the producer's original container.<C extends Collection<?>>
CaddProjectedBuildersFromCollectionToMap(String fieldName, C builders) Attaches a projected collection to a keyed relationship and returns the producer's original collection.<T extends Map<?,?>>
TaddProjectedBuildersFromMapToCollection(String fieldName, T builders) Attaches the values of a projected map to a collection relationship and returns the same map.<T extends Map<?,?>>
TaddProjectedBuildersFromMapToMap(String fieldName, T builders) Attaches a projected map of child Builders, preserving its keys, then returns that same map.apply(groovy.lang.Closure<?> body) Applies named values and a configuration closure to this Builder.voidapplyLater(KlumPhase phase, groovy.lang.Closure<?> closure) voidapplyLater(groovy.lang.Closure<?> closure) voidapplyLater(Integer number, groovy.lang.Closure<?> closure) voidvoidcleanup()voidCopies all non-null/non-empty recipe values from the template to this Builder.voidcopyFromRecipe(Object template) Internal target used by generated typed copyFrom overloads.voidcreateSingleChild(Map<String, Object> namedParams, String fieldOrMethodName, KlumFactory.BuilderFactoryProvider<?, ?> factory, String key, groovy.lang.Closure<?> body) Creates an owned child selected by its generated factory without opening a root lifecycle.<T> TcreateSingleChild(Map<String, Object> namedParams, String fieldOrMethodName, Class<T> type, boolean explicitType, String key, groovy.lang.Closure<T> body) Creates a new '{{fieldName}}' Builder {{param:type?with the given type}} or configures the existing Builder.voidexecuteApplyLaterClosures(int phase) final M<T> TgetInstanceAttribute(String attributeName) <T> TgetInstanceAttributeOrGetter(String attributeName) getInstanceProperty(String name) getModelField(String name) voidfinal booleanisSealed()final boolean<T> TAdds an aggregation fallback during@AutoLinkprocessing without replacing configured values.final voidstatic ObjectInternal adapter hook that materializes a value-only Template graph without lifecycle phases.resolveKeyForFieldFromAnnotation(String name, AnnotatedElement field) voidscheduleApplyLater(KlumPhase phase, groovy.lang.Closure<?> closure) voidscheduleApplyLater(groovy.lang.Closure<?> closure) voidscheduleApplyLater(Integer number, groovy.lang.Closure<?> closure) final voidvoidsetBreadcrumbPath(String breadcrumbPath) voidsetCurrentTemplates(Map<Class<?>, Object> currentTemplates) voidsetInstanceAttribute(String name, Object value) voidsetModelPath(String path) <T> TsetSingleField(String fieldOrMethodName, T value) Sets '{{fieldName}}' on this Builder, or calls a Builder method with that name.<T> TsetSingleFieldViaConverter(String fieldOrMethodName, Class<?> converterType, String converterMethod, Object... args) Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClassMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface groovy.lang.GroovyObject
getProperty, invokeMethod, setProperty
-
Field Details
-
ADD_NEW_DSL_ELEMENT_TO_COLLECTION
- See Also:
-
ADD_ELEMENTS_FROM_SCRIPTS_TO_COLLECTION
- See Also:
-
ADD_ELEMENTS_FROM_SCRIPTS_TO_MAP
- See Also:
-
-
Constructor Details
-
InternalKlumBuilder
-
-
Method Details
-
$attachConstructionSession
Internal hook used byPhaseDriver; the token remains opaque to clients. -
$completeConstructionSession
Internal hook used byPhaseDriverwhen the owning root lifecycle ends. -
$isInActiveConstructionSession
Internal hook used byPhaseDriverto keep Builder adapters in their owning session. -
getModelType
-
isSealed
public final boolean isSealed() -
isTemplate
public final boolean isTemplate() -
markAsTemplate
public final void markAsTemplate() -
getCompletedModel
-
sealTo
-
$modelImplementationType
Identifies the generated model implementation. Allocation remains private to graph materialization. -
$assignRelationships
protected void $assignRelationships()Assigns relationship fields after every object in the graph was allocated. -
materializeTemplateForImport
Internal adapter hook that materializes a value-only Template graph without lifecycle phases. -
$assignMaterializedRelationship
Internal Builder hook that assigns one completed relationship without exposing a model mutator. -
$snapshotField
Called by generated model constructors for non-relationship fields. -
$materializeRelationship
Called by generated internal relationship assignment code. -
$createCompanion
Creates the internal companion retained by a generated DSL Object. Public visibility exists only for generated constructors in arbitrary packages. -
getInstanceAttribute
-
getInstanceAttributeOrGetter
-
getInstanceProperty
-
setInstanceAttribute
-
getField
-
getModelField
-
apply
Applies named values and a configuration closure to this Builder.- Parameters:
values- named values translated into Builder method callsbody- closure executed against this Builder- Returns:
- this Builder
-
apply
-
apply
-
applyOnly
-
copyFrom
Copies all non-null/non-empty recipe values from the template to this Builder.- Parameters:
template- the recipe to apply
-
copyFromRecipe
Internal target used by generated typed copyFrom overloads. -
getNullableKey
-
getSingleOwner
-
getOwners
-
createSingleChild
public <T> T createSingleChild(Map<String, Object> namedParams, String fieldOrMethodName, Class<T> type, boolean explicitType, String key, groovy.lang.Closure<T> body) Creates a new '{{fieldName}}' Builder {{param:type?with the given type}} or configures the existing Builder. The resulting Builder is configured by the optional values and closure.- Type Parameters:
T- the generated Builder type- Parameters:
namedParams- the optional parametersfieldOrMethodName- the name of the field to set or Builder method to calltype- the model type of the new Builderkey- the key to use for the new Builderbody- the closure used to configure the Builder- Returns:
- the newly created or existing Builder
-
createSingleChild
public Object createSingleChild(Map<String, Object> namedParams, String fieldOrMethodName, KlumFactory.BuilderFactoryProvider<?, ?> factory, String key, groovy.lang.Closure<?> body) Creates an owned child selected by its generated factory without opening a root lifecycle.The provider exposes the factory's active-session view. Its selected public Builder type is preserved for generated static signatures while this method keeps the existing child creation and materialization path.
-
setSingleField
Sets '{{fieldName}}' on this Builder, or calls a Builder method with that name.- Type Parameters:
T- the value type- Parameters:
fieldOrMethodName- the field or method namevalue- the value to set- Returns:
- the supplied value
-
link
Adds an aggregation fallback during@AutoLinkprocessing without replacing configured values. The target must already be a completed model or a Builder claimed by another composition relationship. -
setSingleFieldViaConverter
-
addElementToCollection
Adds an existing '{{singleElementName}}' to the Builder's '{{fieldName}}' collection.- Type Parameters:
T- the element type- Parameters:
fieldName- the collection field nameelement- the element to add- Returns:
- the added element
-
addElementToCollectionViaConverter
-
addNewDslElementToCollection
public <T> T addNewDslElementToCollection(Map<String, Object> namedParams, String collectionName, Class<? extends T> type, boolean explicitType, String key, groovy.lang.Closure<T> body) Creates a new '{{singleElementName}}' Builder {{param:type?with the given type}} and adds it to the Builder's '{{fieldName}}' collection. The newly created Builder is configured by the optional values and closure.- Type Parameters:
T- the generated Builder type- Parameters:
namedParams- the optional parameterscollectionName- the collection field nametype- the model type of the new Builderkey- the key to use for the new Builderbody- the closure used to configure the Builder- Returns:
- the newly created Builder
-
addNewDslElementToCollection
public Object addNewDslElementToCollection(Map<String, Object> namedParams, String collectionName, KlumFactory.BuilderFactoryProvider<?, ?> factory, String key, groovy.lang.Closure<?> body) Adds an owned collection child selected by its generated factory in the current session. -
addElementsToCollection
Adds one or more existing '{{singleElementName}}' values to the Builder's '{{fieldName}}' collection.- Parameters:
fieldName- the collection field nameelements- the elements to add
-
addElementsToCollection
Adds one or more existing '{{singleElementName}}' values to the Builder's '{{fieldName}}' collection.- Parameters:
fieldName- the collection field nameelements- the elements to add
-
addProjectedBuildersFromCollectionToCollection
public <C extends Collection<?>> C addProjectedBuildersFromCollectionToCollection(String fieldName, C builders) Attaches a projected batch of child Builders and returns the producer's original container. -
addProjectedBuildersFromMapToCollection
public <T extends Map<?,?>> T addProjectedBuildersFromMapToCollection(String fieldName, T builders) Attaches the values of a projected map to a collection relationship and returns the same map. -
addElementsToMap
-
addProjectedBuildersFromMapToMap
Attaches a projected map of child Builders, preserving its keys, then returns that same map. -
addProjectedBuildersFromCollectionToMap
public <C extends Collection<?>> C addProjectedBuildersFromCollectionToMap(String fieldName, C builders) Attaches a projected collection to a keyed relationship and returns the producer's original collection. -
addElementsToMap
-
addElementsToMap
-
addNewDslElementToMap
public <T> T addNewDslElementToMap(Map<String, Object> namedParams, String mapName, Class<? extends T> type, boolean explicitType, String key, groovy.lang.Closure<T> body) Creates a new '{{singleElementName}}' Builder {{param:type?with the given type}} and adds it to the Builder's '{{fieldName}}' map. The newly created Builder is configured by the optional values and closure.- Type Parameters:
T- the generated Builder type- Parameters:
namedParams- the optional parametersmapName- the map field nametype- the model type of the new Builderkey- the key to use for the new Builderbody- the closure used to configure the Builder- Returns:
- the newly created Builder
-
addNewDslElementToMap
public Object addNewDslElementToMap(Map<String, Object> namedParams, String mapName, KlumFactory.BuilderFactoryProvider<?, ?> factory, String key, groovy.lang.Closure<?> body) Adds an owned map child selected by its generated factory in the current session. -
addElementToMap
-
addElementToMapViaConverter
-
addElementsFromScriptsToCollection
@SafeVarargs public final void addElementsFromScriptsToCollection(String fieldName, Class<? extends groovy.lang.Script>... scripts) -
addElementsFromScriptsToMap
@SafeVarargs public final void addElementsFromScriptsToMap(String fieldName, Class<? extends groovy.lang.Script>... scripts) -
copyFromTemplate
public void copyFromTemplate() -
resolveKeyForFieldFromAnnotation
-
getBreadcrumbPath
-
setBreadcrumbPath
-
increaseBreadcrumbQuantifier
public void increaseBreadcrumbQuantifier() -
setCurrentTemplates
-
getCurrentTemplates
-
applyLater
public void applyLater(groovy.lang.Closure<?> closure) -
scheduleApplyLater
public void scheduleApplyLater(groovy.lang.Closure<?> closure) -
applyLater
-
scheduleApplyLater
-
applyLater
-
scheduleApplyLater
-
executeApplyLaterClosures
public void executeApplyLaterClosures(int phase) -
cleanup
public void cleanup() -
setModelPath
-
getModelPath
-