Class OutputWriteSettings
Settings for how to write output, including default writers.
It is very important that initialize(org.anchoranalysis.bean.BeanInstanceMap)
is run before using the bean. This normally
occurs from checkMisconfigured() that is called automatically from the bean-loading framework
However, if the bean is not loaded through this mechanism, please call initialize(org.anchoranalysis.bean.BeanInstanceMap)
explicitly before usage.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkMisconfigured
(BeanInstanceMap defaultInstances) Checks that a bean's properties conform to expectations.The default color-scheme used for outputs, if no other scheme is specified.<T> Optional
<T> getWriterInstance
(Class<? extends T> writerFamilyType) Gets a writer-instance for a particularwriterParentClass
.Specifies a writer bean instance for a particular type of writer (identified by the writer bean class)boolean
Whether the methodinitialize(org.anchoranalysis.bean.BeanInstanceMap)
has been called yet?void
initialize
(BeanInstanceMap defaultInstances) This method should be called once on this object before further callinggetWriterInstance(java.lang.Class<? extends T>)
.void
setDefaultColors
(ColorScheme defaultColors) The default color-scheme used for outputs, if no other scheme is specified.void
setWriters
(List<NamedBean<?>> writers) Specifies a writer bean instance for a particular type of writer (identified by the writer bean class)Methods inherited from class org.anchoranalysis.bean.AnchorBean
describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
OutputWriteSettings
public OutputWriteSettings()
-
-
Method Details
-
checkMisconfigured
Description copied from class:AnchorBean
Checks that a bean's properties conform to expectations.- Overrides:
checkMisconfigured
in classAnchorBean<OutputWriteSettings>
- Parameters:
defaultInstances
- all available default instances if theDefaultInstance
annotation is used- Throws:
BeanMisconfiguredException
- if the bean has not been configured properly as XML
-
initialize
This method should be called once on this object before further callinggetWriterInstance(java.lang.Class<? extends T>)
.It will setup internally a state mapping different types of writers to instances, using default values where appropriate.
- Parameters:
defaultInstances
- a map indicating defaults of different instance types.- Throws:
BeanMisconfiguredException
- if an error occurs creating any type of writer.
-
hasBeenInitialized
public boolean hasBeenInitialized()Whether the methodinitialize(org.anchoranalysis.bean.BeanInstanceMap)
has been called yet?- Returns:
- true if the above method has been called at least once, false otherwise.
-
getWriterInstance
Gets a writer-instance for a particularwriterParentClass
.1. First, it looks for a match among the bean-field 'writers' 2. If no match is found, then it looks among the general default-instances 3. If no match is found, then it returns null.
When a writer is returned, it will always inherits from type c.
- Parameters:
writerFamilyType
- the class identifying which type of writer is sought- Returns:
- a matching writer, or null.
-
getDefaultColors
The default color-scheme used for outputs, if no other scheme is specified. -
getWriters
Specifies a writer bean instance for a particular type of writer (identified by the writer bean class) -
setWriters
Specifies a writer bean instance for a particular type of writer (identified by the writer bean class)
-