Class PersistentEntityUtils
java.lang.Object
io.micronaut.data.model.PersistentEntityUtils
Persistent entity utils.
- Since:
- 3.5.0
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescriptionstatic intcountPersistentProperties(PersistentProperty property) Count possible embedded properties.static intcountPersistentProperties(List<Association> associations, PersistentProperty property) Count possible embedded properties.getPersistentPropertyPath(PersistentEntity entity, String path) Computes a dot separated property path for the given camel case path.static booleanisAccessibleWithoutJoin(Association association, PersistentProperty persistentProperty) Check if the property is stored on the owning side, and so can be accessed without a join.static voidtraverse(PersistentPropertyPath propertyPath, Consumer<PersistentPropertyPath> consumer) static voidtraversePersistentProperties(PersistentEntity persistentEntity, boolean includeIdentity, boolean includeVersion, BiConsumer<List<Association>, PersistentProperty> consumer) Traverses properties that should be persisted.static voidtraversePersistentProperties(PersistentEntity persistentEntity, BiConsumer<List<Association>, PersistentProperty> consumer) Traverses properties that should be persisted.static voidtraversePersistentProperties(PersistentPropertyPath propertyPath, boolean traverseEmbedded, BiConsumer<List<Association>, PersistentProperty> consumerProperty) static voidtraversePersistentProperties(PersistentPropertyPath propertyPath, BiConsumer<List<Association>, PersistentProperty> consumerProperty) static voidtraversePersistentProperties(PersistentProperty property, BiConsumer<List<Association>, PersistentProperty> consumer) Traverses properties that should be persisted.static voidtraversePersistentProperties(List<Association> associations, PersistentProperty property, boolean traverseEmbedded, BiConsumer<List<Association>, PersistentProperty> consumerProperty) Traverses the properties that should be persisted for the given property.static voidtraversePersistentProperties(List<Association> associations, PersistentProperty property, BiConsumer<List<Association>, PersistentProperty> consumerProperty)
-
Method Details
-
isAccessibleWithoutJoin
public static boolean isAccessibleWithoutJoin(Association association, PersistentProperty persistentProperty) Check if the property is stored on the owning side, and so can be accessed without a join. This does not mirrortraversePersistentProperties(List, PersistentProperty, boolean, BiConsumer), which also descends through non-foreign-key associations: a leaf several associations deep has to be checked one association at a time.- Parameters:
association- The associationpersistentProperty- The association's property- Returns:
- true if can be accessed
- Since:
- 4.2.0
-
traversePersistentProperties
public static void traversePersistentProperties(PersistentProperty property, BiConsumer<List<Association>, PersistentProperty> consumer) Traverses properties that should be persisted.- Parameters:
property- The property to start traversing fromconsumer- The function to invoke on every property
-
traversePersistentProperties
public static void traversePersistentProperties(PersistentEntity persistentEntity, BiConsumer<List<Association>, PersistentProperty> consumer) Traverses properties that should be persisted.- Parameters:
persistentEntity- The persistent entityconsumer- The function to invoke on every property
-
traversePersistentProperties
public static void traversePersistentProperties(PersistentEntity persistentEntity, boolean includeIdentity, boolean includeVersion, BiConsumer<List<Association>, PersistentProperty> consumer) Traverses properties that should be persisted.- Parameters:
persistentEntity- The persistent entityincludeIdentity- Should be identifier includedincludeVersion- Should be version includedconsumer- The function to invoke on every property
-
countPersistentProperties
Count possible embedded properties.- Parameters:
property- The property- Returns:
- the count
-
countPersistentProperties
public static int countPersistentProperties(List<Association> associations, PersistentProperty property) Count possible embedded properties.- Parameters:
associations- The associationsproperty- The property- Returns:
- the count
-
traversePersistentProperties
public static void traversePersistentProperties(List<Association> associations, PersistentProperty property, BiConsumer<List<Association>, PersistentProperty> consumerProperty) -
traversePersistentProperties
public static void traversePersistentProperties(PersistentPropertyPath propertyPath, BiConsumer<List<Association>, PersistentProperty> consumerProperty) -
traverse
public static void traverse(PersistentPropertyPath propertyPath, Consumer<PersistentPropertyPath> consumer) -
traversePersistentProperties
public static void traversePersistentProperties(PersistentPropertyPath propertyPath, boolean traverseEmbedded, BiConsumer<List<Association>, PersistentProperty> consumerProperty) -
traversePersistentProperties
public static void traversePersistentProperties(List<Association> associations, PersistentProperty property, boolean traverseEmbedded, BiConsumer<List<Association>, PersistentProperty> consumerProperty) Traverses the properties that should be persisted for the given property. An association contributes the columns the owning side stores for it: its identity properties, or, when the target has no identity, its own properties, as a document store stores such a target inline.- Parameters:
associations- The associations traversed so far, prefixed to every emitted leafproperty- The property to traversetraverseEmbedded- Whether to descend into an embedded property or emit it wholeconsumerProperty- The function to invoke on every leaf property
-
getPersistentPropertyPath
Computes a dot separated property path for the given camel case path.- Parameters:
entity- the persistent entitypath- The camel case path, can contain underscore to indicate how we should traverse entity properties- Returns:
- The dot separated version or null if it cannot be computed
-