Package net.sf.basedb.core.log
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 withNotLoggable
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
Fields Modifier and Type Field Description private Set<String>
notLoggableProperties
private static Map<Class<?>,EntityLogOptions>
options
private Set<String>
propertyPathProtectedProperties
private int
size
-
Constructor Summary
Constructors Modifier Constructor Description private
EntityLogOptions(Class<?> entityClass)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static EntityLogOptions
create(Class<?> entityClass)
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.
-
-
-
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
-
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 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
public boolean isPropertyPathProtected(String propertyName)
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
-
-