jfun.yan
Class Creator2Component<T>

java.lang.Object
  extended by jfun.yan.Component<T>
      extended by jfun.yan.Creator2Component<T>
All Implemented Interfaces:
java.io.Serializable, Creator<T>, Stateful, Typeful, Verifiable

public class Creator2Component<T>
extends Component<T>

To adapt a Creator object to Component.

See Also:
Serialized Form

Constructor Summary
Creator2Component(Creator<T> creator)
           
 
Method Summary
 T create(Dependency dep)
          Create a component instance.
 boolean equals(java.lang.Object other)
           
protected  Creator<T> getCreator()
          Gets the Creator object adapted.
 java.lang.Class<T> getType()
          Get the type of instances that this component is responsible to create.
 int hashCode()
           
 boolean isConcrete()
          To determine if the type returned by getType() is the concrete type of the real instance.
 boolean isSingleton()
          Determines if the component always return the same instance and has no side-effect that causes difference when called the second time.
 java.lang.String toString()
           
 java.lang.Class<T> verify(Dependency dep)
          Verifies that the component's dependencies are satisfiable.
 
Methods inherited from class jfun.yan.Component
bean, bean, bean, bind, bind, bindArgument, bindArguments, bindProperties, bindProperty, cast, factory, factory, factory, factory, factory, field, field, field, followedBy, followedBy, followedBy, fromArguments, fromProperties, getState, getter, getter, guard, ifelse, ignoreProperty, incomplete, label, label, map, method, method, method, method, method, mutate, option, optional, optionalParameter, optionalParameters, optionalProperties, optionalProperty, proxy, proxy, proxy, recover, repeat, seal, seq, setter, setter, singleton, singleton, subsume, synchronize, withArgument, withArgument, withArguments, withArguments, withDefaultArgument, withDefaultProperty, withProperties, withProperties, withProperties, withProperty, withProperty, withState
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Creator2Component

public Creator2Component(Creator<T> creator)
Method Detail

isConcrete

public boolean isConcrete()
Description copied from interface: Creator
To determine if the type returned by getType() is the concrete type of the real instance.

A strict static type check will be performed on concrete types.


create

public T create(Dependency dep)
Description copied from interface: Creator
Create a component instance.

Parameters:
dep - the provider that provides all dependent data.
Returns:
the component instance.

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

getType

public java.lang.Class<T> getType()
Description copied from class: Component
Get the type of instances that this component is responsible to create. null is returned if the type of the component cannot be determined at the time. This is typically for components that utilize late-binding strategy where the actual component type is resolved at creation time.

Specified by:
getType in interface Creator<T>
Specified by:
getType in interface Typeful
Specified by:
getType in class Component<T>
Returns:
the type of the component.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

verify

public java.lang.Class<T> verify(Dependency dep)
Description copied from interface: Verifiable
Verifies that the component's dependencies are satisfiable.

Parameters:
dep - the provider that provides all dependent information.

getCreator

protected final Creator<T> getCreator()
Gets the Creator object adapted.

Returns:
the Creator object.

isSingleton

public boolean isSingleton()
Description copied from interface: Creator
Determines if the component always return the same instance and has no side-effect that causes difference when called the second time.

This information may be useful to certain optimizations.

Returns:
true if it always return the same instance. False if not singleton or non-determinable.