Cnt
- The connection typePS
- The prepared statement@Internal public abstract class AbstractRepositoryOperations<Cnt,PS> extends java.lang.Object implements io.micronaut.context.ApplicationContextProvider, OpContext<Cnt,PS>
Modifier and Type | Field and Description |
---|---|
protected AttributeConverterRegistry |
attributeConverterRegistry |
protected DataConversionService<?> |
conversionService |
protected DateTimeProvider |
dateTimeProvider |
protected EntityEventListener<java.lang.Object> |
entityEventRegistry |
protected io.micronaut.http.codec.MediaTypeCodec |
jsonCodec |
protected RuntimeEntityRegistry |
runtimeEntityRegistry |
Modifier | Constructor and Description |
---|---|
protected |
AbstractRepositoryOperations(java.util.List<io.micronaut.http.codec.MediaTypeCodec> codecs,
DateTimeProvider<java.lang.Object> dateTimeProvider,
RuntimeEntityRegistry runtimeEntityRegistry,
DataConversionService<?> conversionService,
AttributeConverterRegistry attributeConverterRegistry)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkOptimisticLocking(int expected,
int received)
Compare the expected modifications and the received rows count.
|
java.lang.Object |
convert(java.lang.Class<?> converterClass,
Cnt connection,
java.lang.Object value,
io.micronaut.core.type.Argument<?> argument)
Convert the property value if needed.
|
java.lang.Object |
convert(Cnt connection,
java.lang.Object value,
RuntimePersistentProperty<?> property)
Convert the property value if needed.
|
protected abstract io.micronaut.core.convert.ConversionContext |
createTypeConversionContext(Cnt connection,
RuntimePersistentProperty<?> property,
io.micronaut.core.type.Argument<?> argument)
Creates implementation specific conversion context.
|
io.micronaut.context.ApplicationContext |
getApplicationContext() |
DataConversionService<?> |
getConversionService() |
<T> RuntimePersistentEntity<T> |
getEntity(java.lang.Class<T> type)
Get persistent entity by type.
|
protected RuntimePersistentProperty<java.lang.Object> |
getIdReader(java.lang.Object o)
Obtain an ID reader for the given object.
|
RuntimeEntityRegistry |
getRuntimeEntityRegistry()
Get runtime entity registry.
|
protected boolean |
isOnlySingleEndedJoins(RuntimePersistentEntity<?> rootPersistentEntity,
java.util.Set<JoinPath> joinFetchPaths)
Check if joined associated are all single ended (Can produce only one result).
|
int |
shiftIndex(int i)
Used to define the index whether it is 1 based (JDBC) or 0 based (R2DBC).
|
protected <T> T |
triggerPostLoad(T entity,
RuntimePersistentEntity<T> pe,
io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
Trigger the post load event.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setStatementParameter
protected final io.micronaut.http.codec.MediaTypeCodec jsonCodec
protected final EntityEventListener<java.lang.Object> entityEventRegistry
protected final DateTimeProvider dateTimeProvider
protected final RuntimeEntityRegistry runtimeEntityRegistry
protected final DataConversionService<?> conversionService
protected final AttributeConverterRegistry attributeConverterRegistry
protected AbstractRepositoryOperations(java.util.List<io.micronaut.http.codec.MediaTypeCodec> codecs, DateTimeProvider<java.lang.Object> dateTimeProvider, RuntimeEntityRegistry runtimeEntityRegistry, DataConversionService<?> conversionService, AttributeConverterRegistry attributeConverterRegistry)
codecs
- The media type codecsdateTimeProvider
- The date time providerruntimeEntityRegistry
- The entity registryconversionService
- The conversion serviceattributeConverterRegistry
- The attribute converter registrypublic DataConversionService<?> getConversionService()
public io.micronaut.context.ApplicationContext getApplicationContext()
getApplicationContext
in interface io.micronaut.context.ApplicationContextProvider
@NonNull public final <T> RuntimePersistentEntity<T> getEntity(@NonNull java.lang.Class<T> type)
OpContext
public RuntimeEntityRegistry getRuntimeEntityRegistry()
OpContext
getRuntimeEntityRegistry
in interface OpContext<Cnt,PS>
protected <T> T triggerPostLoad(@NonNull T entity, RuntimePersistentEntity<T> pe, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
T
- The generic typeentity
- The entitype
- The persistent entityannotationMetadata
- The annotation metadatapublic int shiftIndex(int i)
shiftIndex
in interface OpContext<Cnt,PS>
i
- The index to shift@NonNull protected final RuntimePersistentProperty<java.lang.Object> getIdReader(@NonNull java.lang.Object o)
o
- The objectprotected void checkOptimisticLocking(int expected, int received)
OptimisticLockException
.expected
- The expected valuereceived
- THe received valueprotected boolean isOnlySingleEndedJoins(RuntimePersistentEntity<?> rootPersistentEntity, java.util.Set<JoinPath> joinFetchPaths)
rootPersistentEntity
- The root entityjoinFetchPaths
- The join pathspublic java.lang.Object convert(Cnt connection, java.lang.Object value, RuntimePersistentProperty<?> property)
OpContext
public java.lang.Object convert(java.lang.Class<?> converterClass, Cnt connection, java.lang.Object value, @Nullable io.micronaut.core.type.Argument<?> argument)
OpContext
protected abstract io.micronaut.core.convert.ConversionContext createTypeConversionContext(Cnt connection, @Nullable RuntimePersistentProperty<?> property, @Nullable io.micronaut.core.type.Argument<?> argument)
connection
- The connectionproperty
- The propertyargument
- The argumentConversionContext