Package net.sf.basedb.core.log
Class EntityLogOptions
java.lang.Object
net.sf.basedb.core.log.EntityLogOptions
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 Summary
Modifier and TypeFieldDescriptionprivate static final Map<Class<?>,
EntityLogOptions> private final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canLogValues
(String propertyName) Check if it is allowed to log the old and new values of a modified property.private static EntityLogOptions
static EntityLogOptions
getEntityLogOptions
(Object entity) Get the logging options for the given entity.static EntityLogOptions
getEntityLogOptionsForClass
(Class<?> entityClass) Get the logging options for the given class of entities.private String
getPropertyName
(String methodName) Convert a method name into a property name.boolean
isNotLoggable
(String propertyName) Check if the method corresponding to the given property name has been annotated with theNotLoggable
annotation or not.boolean
isPropertyPathProtected
(String propertyName) Check if the method corresponding to the given property name has been annotated with thePropertyPathProtected
annotation or not.private void
merge
(EntityLogOptions other) Merge log options from the other object into this object.
-
Field Details
-
options
-
notLoggableProperties
-
propertyPathProtectedProperties
-
loggableWithoutValues
-
size
private final int size
-
-
Constructor Details
-
EntityLogOptions
-
-
Method Details
-
getEntityLogOptions
Get the logging options for the given entity.- Returns:
- Logging options or null if there are no options
-
getEntityLogOptionsForClass
Get the logging options for the given class of entities.- Returns:
- Logging options or null if there are no options
-
create
-
merge
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
Convert a method name into a property name. Typically remove 'get', 'set' or 'is' prefix and then lowercase the first letter. -
isNotLoggable
Check if the method corresponding to the given property name has been annotated with theNotLoggable
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
Check if the method corresponding to the given property name has been annotated with thePropertyPathProtected
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
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 withLoggableWithoutValues
.- Since:
- 3.19.9
-