Package restx.factory

Class Factory.LocalMachines

java.lang.Object
restx.factory.Factory.LocalMachines
Enclosing class:
Factory

public static class Factory.LocalMachines extends Object
  • Method Details

    • overrideComponents

      public static Factory.LocalMachines overrideComponents()
      An alias for threadLocal() which makes the intention of using it to override components clearer.

      It's usually used like this: overrideComponents().set("componentName", "componentValue");

      Note that it doesn't do anything special to actually override components: they will be used only in Factory relying on threadLocal() LocalMachines is built after the call.

      Returns:
      LocalMachines associated with current thread.
    • threadLocal

      public static Factory.LocalMachines threadLocal()
      Returns a LocalMachines associated with current thread.

      This is often used when building a Factory, the Factory.newInstance() use it for instance.

      Thanks to client affinity, it can also be shared between client and server.

      Returns:
      a LocalMachines associated with current thread.
    • threadLocalFrom

      public static Factory.LocalMachines threadLocalFrom(String id)
      Return LocalMachines associated with another thread, by id.

      You must know the id of the threadlocal from the other thread to be able to access it.

      From the other thread do Factory.LocalMachines.threadLocal().getId()

      Parameters:
      id - the other thread threadLocal() LocalMachines id
      Returns:
      the LocalMachines associated with the other thread, or an empty LocalMachines which is not automatically registered if none is found.
    • contextLocal

      public static Factory.LocalMachines contextLocal(String ctxName)
      Returns a LocalMachines associated with given context name.
      Parameters:
      ctxName - the context name
      Returns:
      a LocalMachines associated with given context name.
    • addMachine

      public Factory.LocalMachines addMachine(FactoryMachine machine)
    • removeMachine

      public Factory.LocalMachines removeMachine(FactoryMachine machine)
    • clear

      public void clear()
    • getId

      public String getId()
    • set

      public Factory.LocalMachines set(String name, Object component)
    • set

      public Factory.LocalMachines set(int priority, String name, Object component)
    • set

      public <T> Factory.LocalMachines set(Class<T> clazz, String name, T component)
    • set

      public <T> Factory.LocalMachines set(int priority, Class<T> clazz, String name, T component)
    • set

      public <T> Factory.LocalMachines set(NamedComponent<T> namedComponent)
    • set

      public <T> Factory.LocalMachines set(int priority, NamedComponent<T> namedComponent)