Class AnchorBean<F>
- Type Parameters:
F- family-type, the type returned theduplicateBean()method is called
- Direct Known Subclasses:
AddCriteriaPair,AnnotationBackground,AnnotationComparisonAssigner,AnnotationLabel,AnnotatorStrategy,BlurStrategy,BoundRotation,BoxAligner,Cell,ChannelAggregator,ChannelConvertStyle,ChannelMapCreator,CheckParsedFilePathBag,ColorScheme,CombineObjectsForFeatures,ComparableSource,ConvertChannelToWithHistogram,CopyFilesMethod,CopyFilesNaming,CreateMarkFromPoints,DecodeInstanceSegmentation,Define,DefineAdderBean,DefineOutputter,DerivePath,DirectionVectorBean,DoubleList,DoubleSet,DrawObject,Experiment,ExperimentIdentifier,ExportFeaturesStyle,FeatureList,FeatureSource,FileNamer,FilePath,FilePathMatcher,FilePathParser,FilesProvider,FromStacks,GrayscaleReconstructionByErosion,Grouper,HeaderFormat,HOGParameters,ImageLabeller,ImageMetadataReader,IndexedChannel,InitializableBean,InputManager,IntegerList,IntegerSet,Interpolator,JobProcessor,LoggingDestination,MarkBounds,MarkFactory,MarkRegion,MinimaImposition,MorphologicalIterations,MultipleComparer,OutputEnabled,OutputEnabledRules,OutputManager,OutputWriteSettings,Padding,PathPrefixer,PermuteProperty,RandomCollection,RandomNumberGeneratorBean,ReadOptions,ReduceElements,RegEx,RegionMap,RegionMembership,RelationBean,RelationToThreshold,RequireArguments,ResolvedBound,RGBColorBean,RootPath,SequenceInteger,SizeXY,StackArranger,StackDisplayer,StackReader,StackWriter,StringList,StringMap,StringMapItem,StringSet,Summarizer,Task,TextStyle,ThumbnailFromObjects,ThumbnailFromStack,TimestampPattern,UnitValueDistance,UnitValueExtent
The family-type exists as a templated parameter <F> to return a sensibly-typed object
when duplicateBean() is called. Typically, this is either the type of the class itself, or
an abstract base class representing a family of similar classes. A bean must always be assignable
from (i.e. be equal to or inherit from) the family-type it is associated with.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckMisconfigured(BeanInstanceMap defaultInstances) Checks that a bean's properties conform to expectations.A (maybe longer) description identifying the bean and perhaps its key parameters.protected StringGenerates a string describing the children of the current bean.Creates a new bean that deep-copies every property value.fields()A list of all bean-fields that are associated with this bean directly (fields of children are not checked).<T extends AnchorBean<?>>
List<T> findFieldsOfClass(Class<?> match) Finds all bean-fields that are instances of a certain class.final StringA short-name identifying a bean (by default the name of the class associated with the bean).A local path on the file-system, optionally associated with this bean.voidCalled once after the bean is created, localising the bean to a path on the filesystem.toString()By default, we usedescribeBean()as the string representation of the bean.
-
Constructor Details
-
AnchorBean
public AnchorBean()
-
-
Method Details
-
getBeanName
A short-name identifying a bean (by default the name of the class associated with the bean).- Returns:
- the short-name of the bean
-
describeBean
A (maybe longer) description identifying the bean and perhaps its key parameters.By default, it returns the same as
getBeanName()but beans can optionally override it- Returns:
- either the short-name of the bean, or a longer description
-
getLocalPath
A local path on the file-system, optionally associated with this bean.The association is usually established when a bean is loaded (deserialized) from a file.
- Returns:
- the local-path, if defined.
-
toString
By default, we usedescribeBean()as the string representation of the bean. -
localise
Called once after the bean is created, localising the bean to a path on the filesystem.It is sometimes useful to override this method so as to include other files.
- Parameters:
path- a path on the filesystem which is associated with the bean (can be null, indicating no localization)- Throws:
BeanMisconfiguredException- if a relative-path is passed
-
checkMisconfigured
Checks that a bean's properties conform to expectations.- Parameters:
defaultInstances- all available default instances if theDefaultInstanceannotation is used- Throws:
BeanMisconfiguredException- if the bean has not been configured properly as XML
-
duplicateBean
Creates a new bean that deep-copies every property value.Any state that is not a
BeanFieldis ignored.- Returns:
- the newly created bean
-
describeChildren
Generates a string describing the children of the current bean.- Returns:
- a string describing the children.
-
findFieldsOfClass
public <T extends AnchorBean<?>> List<T> findFieldsOfClass(Class<?> match) throws BeanMisconfiguredException Finds all bean-fields that are instances of a certain class.All immediate children are checked, and any items in immediate lists.
- Type Parameters:
T- the type of bean returned in the list- Parameters:
match- the class that a field must be assignable from (equal to or inherit from)- Returns:
- a list of all bean-fields that match the criteria
- Throws:
BeanMisconfiguredException- if we discover the bean has been misconfigured
-
fields
A list of all bean-fields that are associated with this bean directly (fields of children are not checked).This operation is cached as the necessary reflection calls are costly.
- Returns:
- a list of bean-fields associated with the current bean
-