Package me.ahoo.cosid.spring.data.jdbc
Class CosIdBeforeConvertCallback
java.lang.Object
me.ahoo.cosid.spring.data.jdbc.CosIdBeforeConvertCallback
- All Implemented Interfaces:
org.springframework.data.mapping.callback.EntityCallback<Object>,org.springframework.data.relational.core.mapping.event.BeforeConvertCallback<Object>
public class CosIdBeforeConvertCallback
extends Object
implements org.springframework.data.relational.core.mapping.event.BeforeConvertCallback<Object>
Fills the ids of a Spring Data JDBC aggregate before it is converted for an insert: its
CosId fields through the runtime's IdFiller, then its @Id property, when
still unset, from the idGenerator (as 4.x did with the shared generator). The @Id goes through Spring
Data's property accessor, so an immutable aggregate (a record, a wither) comes back as a new instance.
An unset id is null, a number <= 0 or an empty string; long, int and String
ids are supported, other id types are left to the application.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCosIdBeforeConvertCallback(me.ahoo.cosid.runtime.CosIdRuntime runtime, org.springframework.data.relational.core.mapping.RelationalMappingContext mappingContext) A callback that fills@Idproperties from thedefaultgenerator.CosIdBeforeConvertCallback(me.ahoo.cosid.runtime.CosIdRuntime runtime, org.springframework.data.relational.core.mapping.RelationalMappingContext mappingContext, String idGenerator) A callback. -
Method Summary
-
Field Details
-
DEFAULT_ID_GENERATOR
The generator of@Idproperties by default.- See Also:
-
-
Constructor Details
-
CosIdBeforeConvertCallback
public CosIdBeforeConvertCallback(me.ahoo.cosid.runtime.CosIdRuntime runtime, org.springframework.data.relational.core.mapping.RelationalMappingContext mappingContext) A callback that fills@Idproperties from thedefaultgenerator.- Parameters:
runtime- the runtimemappingContext- the mapping context of the aggregates
-
CosIdBeforeConvertCallback
public CosIdBeforeConvertCallback(me.ahoo.cosid.runtime.CosIdRuntime runtime, org.springframework.data.relational.core.mapping.RelationalMappingContext mappingContext, String idGenerator) A callback.- Parameters:
runtime- the runtimemappingContext- the mapping context of the aggregatesidGenerator- the generator of@Idproperties
-
-
Method Details
-
onBeforeConvert
- Specified by:
onBeforeConvertin interfaceorg.springframework.data.relational.core.mapping.event.BeforeConvertCallback<Object>
-