jfun.yan
Interface Creator<T>

All Superinterfaces:
java.io.Serializable, Typeful, Verifiable
All Known Implementing Classes:
Component, Creator2Component, DecoratingComponent, DelegatingComponent, SimpleComponent

public interface Creator<T>
extends Typeful, Verifiable, java.io.Serializable

A creator is responsible for creating component instances.

Codehaus.org.

Author:
Ben Yu

Method Summary
 T create(Dependency dep)
          Create a component instance.
 java.lang.Class getType()
          To get the compile time type of the instances created by this component.
 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.
 
Methods inherited from interface jfun.yan.Verifiable
verify
 

Method Detail

create

T create(Dependency dep)
         throws IrresolveableArgumentException,
                ParameterTypeMismatchException,
                AmbiguousComponentResolutionException,
                ComponentInstantiationException,
                YanException
Create a component instance.

Parameters:
dep - the provider that provides all dependent data.
Returns:
the component instance.
Throws:
IrresolveableArgumentException - when any of the arguments is not resolveable.
ParameterTypeMismatchException - when any of the arguments do not match the expectec type.
AmbiguousComponentResolutionException - when resolution of any of the arguments has ambiguity.
ComponentInstantiationException - The runtime exception wrapper for any error happens in the creation function.
ComponentException - error when resolving any of the arguments.
YanException - any error.

getType

java.lang.Class getType()
To get the compile time type of the instances created by this component.

A tolerant static type checking will be performed if this function returns a non-null type.

Specified by:
getType in interface Typeful
Returns:
the type.

isConcrete

boolean isConcrete()
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.


isSingleton

boolean isSingleton()
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.