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 Details

  • Method Details

    • checkMisconfigured

      public void checkMisconfigured​(org.anchoranalysis.bean.BeanInstanceMap defaultInstances) throws org.anchoranalysis.bean.exception.BeanMisconfiguredException
      Overrides:
      checkMisconfigured in class org.anchoranalysis.bean.AnchorBean<OutputWriteSettings>
      Throws:
      org.anchoranalysis.bean.exception.BeanMisconfiguredException
    • initialize

      public void initialize​(org.anchoranalysis.bean.BeanInstanceMap defaultInstances) throws org.anchoranalysis.bean.exception.BeanMisconfiguredException
      This method should be called once on this object before further calling getWriterInstance(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 method initialize(org.anchoranalysis.bean.BeanInstanceMap) has been called yet?
      Returns:
      true if the above method has been called at least once, false otherwise.
    • getWriterInstance

      public <T> Optional<T> getWriterInstance​(Class<? extends T> writerFamilyType)
      Gets a writer-instance for a particular writerParentClass.

      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

      public ColorScheme getDefaultColors()
      The default color-scheme used for outputs, if no other scheme is specified.
    • setDefaultColors

      public void setDefaultColors​(ColorScheme defaultColors)
      The default color-scheme used for outputs, if no other scheme is specified.
    • getWriters

      public List<org.anchoranalysis.bean.NamedBean<?>> getWriters()
      Specifies a writer bean instance for a particular type of writer (identified by the writer bean class)
    • setWriters

      public void setWriters​(List<org.anchoranalysis.bean.NamedBean<?>> writers)
      Specifies a writer bean instance for a particular type of writer (identified by the writer bean class)