Class OutputWriteSettings
Object
org.anchoranalysis.bean.AnchorBean<OutputWriteSettings>
org.anchoranalysis.io.output.bean.OutputWriteSettings
public class OutputWriteSettings extends org.anchoranalysis.bean.AnchorBean<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 Constructor Description OutputWriteSettings() -
Method Summary
Modifier and Type Method Description voidcheckMisconfigured(org.anchoranalysis.bean.BeanInstanceMap defaultInstances)ColorSchemegetDefaultColors()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.List<org.anchoranalysis.bean.NamedBean<?>>getWriters()Specifies a writer bean instance for a particular type of writer (identified by the writer bean class)booleanhasBeenInitialized()Whether the methodinitialize(org.anchoranalysis.bean.BeanInstanceMap)has been called yet?voidinitialize(org.anchoranalysis.bean.BeanInstanceMap defaultInstances)This method should be called once on this object before further callinggetWriterInstance(java.lang.Class<? extends T>).voidsetDefaultColors(ColorScheme defaultColors)The default color-scheme used for outputs, if no other scheme is specified.voidsetWriters(List<org.anchoranalysis.bean.NamedBean<?>> writers)Specifies a writer bean instance for a particular type of writer (identified by the writer bean class)
-
Constructor Details
-
OutputWriteSettings
public OutputWriteSettings()
-
-
Method Details
-
checkMisconfigured
public void checkMisconfigured(org.anchoranalysis.bean.BeanInstanceMap defaultInstances) throws org.anchoranalysis.bean.exception.BeanMisconfiguredException- Overrides:
checkMisconfiguredin classorg.anchoranalysis.bean.AnchorBean<OutputWriteSettings>- Throws:
org.anchoranalysis.bean.exception.BeanMisconfiguredException
-
initialize
public void initialize(org.anchoranalysis.bean.BeanInstanceMap defaultInstances) throws org.anchoranalysis.bean.exception.BeanMisconfiguredExceptionThis 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:
org.anchoranalysis.bean.exception.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. -
setDefaultColors
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)
-