Package net.sf.basedb.util.annotations
Class InheritSpecification
java.lang.Object
net.sf.basedb.util.annotations.InheritSpecification
- All Implemented Interfaces:
Filter<AnnotationSnapshot>
Class for holding rules for how annotations should be inherited from
parent items. If
getRemove()
is set, it override all other
settings and all inherited annotation for the specified annotation type
are removed.- Since:
- 3.5
- Author:
- nicklas
-
Field Summary
Modifier and TypeFieldDescriptionprivate final AnnotationType
private final int
private boolean
private boolean
private boolean
private boolean
private boolean
private ItemSubtype
-
Constructor Summary
ConstructorDescriptionInheritSpecification
(AnnotationType annotationType) Creates a new specification for the given annotation type. -
Method Summary
Modifier and TypeMethodDescriptionboolean
evaluate
(AnnotationSnapshot snapshot) Evaluate if the given object should pass the filter or not.boolean
getClone()
boolean
boolean
boolean
boolean
(package private) boolean
isAcceptableParent
(Annotatable parent) Checks if the parent item has a subtype matching the subtype (if any) in this specification.void
setClone
(boolean clone) Set a flag to inherit annotations by cloning the original values.void
setItemSubtype
(ItemSubtype subtype) Set the subtype a parent item must have if annotations should be inherited from it.void
setNoDuplicates
(boolean noDuplicates) If this flag is set (default=true), only one annotation of the specified annotation type can be inherited.void
setRemove
(boolean remove) Set a flag to remove all inherited annotations of the specified annotation type.void
setReplaceExisting
(boolean replaceExisting) If this flag is set (default=false), existing inherited annotations of the specified annotation type are removed before inheriting new ones.void
setResyncCloned
(boolean resync)
-
Field Details
-
annotationTypeId
private final int annotationTypeId -
annotationType
-
remove
private boolean remove -
clone
private boolean clone -
resync
private boolean resync -
subtype
-
noDuplicates
private boolean noDuplicates -
replaceExisting
private boolean replaceExisting
-
-
Constructor Details
-
InheritSpecification
Creates a new specification for the given annotation type.
-
-
Method Details
-
getAnnotationType
-
setRemove
public void setRemove(boolean remove) Set a flag to remove all inherited annotations of the specified annotation type. Note that if this setting is enabled, it override all other settings. -
getRemove
public boolean getRemove() -
setClone
public void setClone(boolean clone) Set a flag to inherit annotations by cloning the original values. Use this if you do not want changes to the original annotation to be reflected in the inherited (=cloned) annotations.- Since:
- 3.6
-
getClone
public boolean getClone() -
setResyncCloned
public void setResyncCloned(boolean resync) -
getResync
public boolean getResync() -
setItemSubtype
Set the subtype a parent item must have if annotations should be inherited from it. Set to null to inherit from any parent. -
getItemSubtype
-
setNoDuplicates
public void setNoDuplicates(boolean noDuplicates) If this flag is set (default=true), only one annotation of the specified annotation type can be inherited. -
getNoDuplicates
public boolean getNoDuplicates() -
setReplaceExisting
public void setReplaceExisting(boolean replaceExisting) If this flag is set (default=false), existing inherited annotations of the specified annotation type are removed before inheriting new ones. Note that existing annotations are only replaced if a new annotation is found. -
getReplaceExisting
public boolean getReplaceExisting() -
isAcceptableParent
Checks if the parent item has a subtype matching the subtype (if any) in this specification. If the parent item is aBioPlate
we check the subtype of bioplate type (BioPlateType.getItemSubtype()
)- Returns:
- TRUE if the subtype matches or if this specification doesn't set any subtype
-
evaluate
Description copied from interface:Filter
Evaluate if the given object should pass the filter or not.- Specified by:
evaluate
in interfaceFilter<AnnotationSnapshot>
- Parameters:
snapshot
- The object to evaluate- Returns:
- TRUE if the object passes the filter, FALSE otherwise
-