Class FactoryClaim<C,T>

java.lang.Object
org.refcodes.decoupling.Claim
org.refcodes.decoupling.FactoryClaim<C,T>
Type Parameters:
C - The type of the Dependency claimed for fabricating instances of the given type.
T - The type of the instance to be created.
All Implemented Interfaces:
Comparable<Claim>, org.refcodes.factory.ContextTypeFactory<T,C>, org.refcodes.mixin.AliasAccessor, org.refcodes.mixin.Schemable, org.refcodes.mixin.TypeAccessor

public class FactoryClaim<C,T> extends Claim implements org.refcodes.factory.ContextTypeFactory<T,C>
A FactoryClaim extends a Claim and uses a Function upon a Dependency to create (fabricate) an instance.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.refcodes.mixin.AliasAccessor

    org.refcodes.mixin.AliasAccessor.AliasBuilder<B extends org.refcodes.mixin.AliasAccessor.AliasBuilder<B>>, org.refcodes.mixin.AliasAccessor.AliasMutator, org.refcodes.mixin.AliasAccessor.AliasProperty

    Nested classes/interfaces inherited from interface org.refcodes.mixin.TypeAccessor

    org.refcodes.mixin.TypeAccessor.TypeBuilder<T extends Object,B extends org.refcodes.mixin.TypeAccessor.TypeBuilder<T,B>>, org.refcodes.mixin.TypeAccessor.TypeMutator<T extends Object>, org.refcodes.mixin.TypeAccessor.TypeProperty<T extends Object>
  • Field Summary

    Fields inherited from class org.refcodes.decoupling.Claim

    _alias, _type
  • Constructor Summary

    Constructors
    Constructor
    Description
    FactoryClaim(Class<C> aType, Function<C,T> aFactory)
    Creates a new FactoryClaim.
    FactoryClaim(Class<C> aType, Function<C,T> aFactory, String aAlias)
    Creates a new FactoryClaim.
  • Method Summary

    Modifier and Type
    Method
    Description
    create(C aClaim)
    Fabricates (creates) the provided instance.
    Returns the type of the Dependency required by this FactoryClaim instance when invoking create(Object).

    Methods inherited from class org.refcodes.decoupling.Claim

    compareTo, equals, getAlias, hashCode, isClaim, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.refcodes.factory.ContextTypeFactory

    create
  • Constructor Details

  • Method Details

    • create

      public T create(C aClaim)
      Fabricates (creates) the provided instance.
      Specified by:
      create in interface org.refcodes.factory.ContextTypeFactory<C,T>
      Parameters:
      aClaim - The Dependency declaration required for fabrication.
      Returns:
      The fabricated instance.
    • getType

      public Class<C> getType()
      Returns the type of the Dependency required by this FactoryClaim instance when invoking create(Object).
      Specified by:
      getType in interface org.refcodes.mixin.TypeAccessor<C>
      Overrides:
      getType in class Claim
      Returns:
      The according type.
    • toSchema

      public DependencySchema toSchema()
      Specified by:
      toSchema in interface org.refcodes.mixin.Schemable
      Overrides:
      toSchema in class Claim