Package org.cyclos.impl
Class EntityLogDescriptor<B extends Bean>
- java.lang.Object
-
- org.cyclos.impl.EntityLogDescriptor<B>
-
public class EntityLogDescriptor<B extends Bean> extends Object
Describes how an entity should be logged as anEntityLog. All properties in the Bean (B) type should be either mapped withproperty(Property, MessageKey)or ignored withignore(Property), otherwise an error will be raised We can't restrict to subclasses of EntityDTO because it's used for nested beans (not being DTOs)
-
-
Constructor Summary
Constructors Constructor Description EntityLogDescriptor(Class<B> beanType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Bean>
EntityLogDescriptor<T>addNested()If this descriptor is for a nested bean then validate it and add all its properties to the parent container.<T extends B>
EntityLogDescriptor<T>cast()Generic type downcasting.EntityLogDescriptor<B>customField(CustomField<?,?,?> customField, CustomFieldValueHandler handler)Registers a custom field for logEntityLogDescriptor<B>customFields(Iterable<? extends CustomField<?,?,?>> customFields, CustomFieldValueHandler customFieldValueHandler)Registers all the given custom fields for logSet<String>getMissingProperties()List<PropertyLogDescriptor<B>>getProperties()EntityLogDescriptor<B>ignore(String propertyName)Marks the given property name as ignored for logEntityLogDescriptor<B>ignore(Property<?,? super B> property)Marks the given property as ignored for logbooleanisIgnored(Property<?,?> property)<N extends Bean>
EntityLogDescriptor<N>nested(Property<N,? super B> property)Only one nested level is supported.<N extends Bean>
EntityLogDescriptor<N>nested(Property<N,? super B> property, MessageKey nestedKey)Returns a new instance ofEntityLogDescriptorfor the nested type linked to this (parent) descriptor.<N extends Bean>
EntityLogDescriptor<N>nested(Property<N,? super B> property, MessageKey nestedKey, Function<Property<?,?>,PropertyAccess> accessMapper)Only one nested level is supported.EntityLogDescriptor<B>property(PropertyAccess access, MessageKey key)EntityLogDescriptor<B>property(Property<?,? super B> property, MessageKey key)Registers a bean property for logEntityLogDescriptor<B>propertyOrIgnore(Property<?,? super B> property, MessageKey key, boolean enabled)Depending on the enabled flag, either add or ignore the given property<R extends EntityDTO>
TablePropertyLogDescriptor<R,B>tableProperty(com.querydsl.core.types.dsl.CollectionPathBase<?,?,?> collectionPath, Object label)A boolean table with a nested table for each row (e.gProduct.getMyRecordTypes())<R extends EntityDTO>
TablePropertyLogDescriptor<R,B>tableProperty(PropertyAccess tablePropertyAccess, Object label)<R extends EntityDTO>
TablePropertyLogDescriptor<R,B>tableProperty(IterableProperty<R,?,? super B> tableProperty, Object label)voidvalidate()Check that all Bean properties are correctly mapped
-
-
-
Method Detail
-
addNested
public <T extends Bean> EntityLogDescriptor<T> addNested()
If this descriptor is for a nested bean then validate it and add all its properties to the parent container. Otherwise it's a no-op.- Returns:
- this descriptor instance or the parent if it's a nested descriptor.
-
cast
public <T extends B> EntityLogDescriptor<T> cast()
Generic type downcasting.
-
customField
public EntityLogDescriptor<B> customField(CustomField<?,?,?> customField, CustomFieldValueHandler handler)
Registers a custom field for log
-
customFields
public EntityLogDescriptor<B> customFields(Iterable<? extends CustomField<?,?,?>> customFields, CustomFieldValueHandler customFieldValueHandler)
Registers all the given custom fields for log
-
getProperties
public List<PropertyLogDescriptor<B>> getProperties()
-
ignore
public EntityLogDescriptor<B> ignore(Property<?,? super B> property)
Marks the given property as ignored for log
-
ignore
public EntityLogDescriptor<B> ignore(String propertyName)
Marks the given property name as ignored for log
-
isIgnored
public boolean isIgnored(Property<?,?> property)
-
nested
public <N extends Bean> EntityLogDescriptor<N> nested(Property<N,? super B> property)
Only one nested level is supported.
-
nested
public <N extends Bean> EntityLogDescriptor<N> nested(Property<N,? super B> property, MessageKey nestedKey)
Returns a new instance ofEntityLogDescriptorfor the nested type linked to this (parent) descriptor. After add all mappings theaddNested()method must be invoked to add it the the parent descriptor. Only one nested level is supported.
-
nested
public <N extends Bean> EntityLogDescriptor<N> nested(Property<N,? super B> property, MessageKey nestedKey, Function<Property<?,?>,PropertyAccess> accessMapper)
Only one nested level is supported.
-
property
public EntityLogDescriptor<B> property(Property<?,? super B> property, MessageKey key)
Registers a bean property for log
-
property
public EntityLogDescriptor<B> property(PropertyAccess access, MessageKey key)
-
propertyOrIgnore
public EntityLogDescriptor<B> propertyOrIgnore(Property<?,? super B> property, MessageKey key, boolean enabled)
Depending on the enabled flag, either add or ignore the given property
-
tableProperty
public <R extends EntityDTO> TablePropertyLogDescriptor<R,B> tableProperty(com.querydsl.core.types.dsl.CollectionPathBase<?,?,?> collectionPath, Object label)
A boolean table with a nested table for each row (e.gProduct.getMyRecordTypes())
-
tableProperty
public <R extends EntityDTO> TablePropertyLogDescriptor<R,B> tableProperty(IterableProperty<R,?,? super B> tableProperty, Object label)
-
tableProperty
public <R extends EntityDTO> TablePropertyLogDescriptor<R,B> tableProperty(PropertyAccess tablePropertyAccess, Object label)
-
validate
public void validate()
Check that all Bean properties are correctly mapped
-
-