Class AbstractSingletonFactory<Input,Output>

java.lang.Object
org.opensaml.core.xml.util.AbstractSingletonFactory<Input,Output>
Type Parameters:
Input - the factory input class type
Output - the factory output class type
All Implemented Interfaces:
SingletonFactory<Input,Output>
Direct Known Subclasses:
AbstractSimpleSingletonFactory, AbstractWrappedSingletonFactory

public abstract class AbstractSingletonFactory<Input,Output> extends Object implements SingletonFactory<Input,Output>
An abstract Template design pattern implementation of SingletonFactory.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final org.slf4j.Logger
    Class logger.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract Output
    Create a new instance of the output class based on the input class instance.
    protected abstract Output
    get(Input input)
    Get the output instance currently associated with the input instance.
    Obtain an instance of the output class based on an input class instance.
    protected abstract void
    put(Input input, Output output)
    Store the input and output instance association.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • log

      private final org.slf4j.Logger log
      Class logger.
  • Constructor Details

    • AbstractSingletonFactory

      public AbstractSingletonFactory()
  • Method Details

    • getInstance

      public Output getInstance(Input input)
      Obtain an instance of the output class based on an input class instance.
      Specified by:
      getInstance in interface SingletonFactory<Input,Output>
      Parameters:
      input - the input class instance
      Returns:
      an output class instance
    • get

      protected abstract Output get(Input input)
      Get the output instance currently associated with the input instance.
      Parameters:
      input - the input instance key
      Returns:
      the output instance which corresponds to the input instance, or null if not present
    • put

      protected abstract void put(Input input, Output output)
      Store the input and output instance association.
      Parameters:
      input - the input instance key
      output - the output instance value
    • createNewInstance

      protected abstract Output createNewInstance(Input input)
      Create a new instance of the output class based on the input class instance.
      Parameters:
      input - the input class instance
      Returns:
      an output class instance