Class 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 Detail

      • notLoggableProperties

        private final Set<String> notLoggableProperties
      • propertyPathProtectedProperties

        private final Set<String> propertyPathProtectedProperties
      • size

        private final int size
    • Constructor Detail

      • EntityLogOptions

        private EntityLogOptions​(Class<?> entityClass)
    • Method Detail

      • 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
      • 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