Class EntityLogOptions

java.lang.Object
net.sf.basedb.core.log.EntityLogOptions

public class EntityLogOptions extends Object
This class collect some static information related to logging for entities. Currently, it will scan all entity classes (lazily) for methods annotated with NotLoggable so that the logging implementation quickly can check if changes to a given property should be ignored or not.
Since:
3.3
Author:
Nicklas
Last modified
$Date$
  • Field Details

    • options

      private static final Map<Class<?>,EntityLogOptions> options
    • notLoggableProperties

      private final Set<String> notLoggableProperties
    • propertyPathProtectedProperties

      private final Set<String> propertyPathProtectedProperties
    • loggableWithoutValues

      private final Set<String> loggableWithoutValues
    • size

      private final int size
  • Constructor Details

    • EntityLogOptions

      private EntityLogOptions(Class<?> entityClass)
  • Method Details

    • getEntityLogOptions

      public static EntityLogOptions getEntityLogOptions(Object entity)
      Get the logging options for the given entity.
      Returns:
      Logging options or null if there are no options
    • getEntityLogOptionsForClass

      public static EntityLogOptions getEntityLogOptionsForClass(Class<?> entityClass)
      Get the logging options for the given class of entities.
      Returns:
      Logging options or null if there are no options
    • create

      private static EntityLogOptions create(Class<?> entityClass)
    • merge

      private void merge(EntityLogOptions other)
      Merge log options from the other object into this object. Merging is usually performed due to the other options object representing the log options for a superclass or implemented interface.
    • getPropertyName

      private String getPropertyName(String methodName)
      Convert a method name into a property name. Typically remove 'get', 'set' or 'is' prefix and then lowercase the first letter.
    • isNotLoggable

      public boolean isNotLoggable(String propertyName)
      Check if the method corresponding to the given property name has been annotated with the NotLoggable annotation or not.
      Parameters:
      propertyName - The name of the property, not including 'get', 'set' or 'is' prefix
      Returns:
      TRUE if the NotLoggable annotation is present, FALSE otherwise
    • isPropertyPathProtected

      public boolean isPropertyPathProtected(String propertyName)
      Check if the method corresponding to the given property name has been annotated with the PropertyPathProtected annotation or not.
      Parameters:
      propertyName - The name of the property, not including 'get', 'set' or 'is' prefix
      Returns:
      TRUE if the PropertyPathProtected annotation is present, FALSE otherwise
    • canLogValues

      public boolean canLogValues(String propertyName)
      Check if it is allowed to log the old and new values of a modified property. This is normally allowed unless the property has been annotated with LoggableWithoutValues.
      Since:
      3.19.9