Class PersistentEntityUtils

java.lang.Object
io.micronaut.data.model.PersistentEntityUtils

@Internal public final class PersistentEntityUtils extends Object
Persistent entity utils.
Since:
3.5.0
Author:
Denis Stepanov
  • Method Details

    • isAccessibleWithoutJoin

      public static boolean isAccessibleWithoutJoin(Association association, PersistentProperty persistentProperty)
      Check if the property is an association ID that can be accessed without join. In a case it's not an ID stored outside the associated table.
      Parameters:
      association - The association
      persistentProperty - 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 from
      consumer - 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 entity
      consumer - 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 entity
      includeIdentity - Should be identifier included
      includeVersion - Should be version included
      consumer - The function to invoke on every property
    • countPersistentProperties

      public static int countPersistentProperties(PersistentProperty property)
      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:
      property - The property
      associations - The associations
      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)
    • getPersistentPropertyPath

      public static Optional<String> getPersistentPropertyPath(PersistentEntity entity, String path)
      Computes a dot separated property path for the given camel case path.
      Parameters:
      path - The camel case path, can contain underscore to indicate how we should traverse entity properties
      entity - the persistent entity
      Returns:
      The dot separated version or null if it cannot be computed