|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.util.beans.BinderFactory
public class BinderFactory
Factory of Binder.
newBinder(XXX) methods.
For example to obtain a mirrored binder (same source and target type) which
will be able to copy all accepting properties, use this code :
Binderbinder = BinderFactory.newBinder(BeanA.class);
BinderThis is usefull when you register your own binder model in the factory (see next section) to bind different things from the same type of objects...binder = BinderFactory.newBinder(BeanA.class, "mycontext");
registerBinderModel(XXX).
More documentation will come soon, yu can see the package info javadoc or
unit tests...
| Nested Class Summary | |
|---|---|
static class |
BinderFactory.BindelModelEntryMap
|
static class |
BinderFactory.BinderModelEntry
Definition of an binder model entry (source and target types + context name). |
| Field Summary | |
|---|---|
protected static BinderFactory.BindelModelEntryMap |
binderModels
Cache of registred binders indexed by their unique entry |
| Constructor Summary | |
|---|---|
BinderFactory()
|
|
| Method Summary | ||
|---|---|---|
static void |
clear()
Clear the cache of registred binder models. |
|
protected static BinderFactory.BindelModelEntryMap |
getBinderModels()
|
|
static
|
getCachedBinderModel(Class<S> sourceType,
Class<T> targetType,
String contextName)
Obtain a cached binder model. |
|
static
|
isBinderModelExists(Class<S> sourceType,
Class<T> targetType,
String contextName)
Tells if there is a cached binder model for the given parameters. |
|
static
|
newBinder(Binder.BinderModel<S,T> model,
Class<B> binderType)
Given a model and a binderType, instanciate a new binder
and returns it. |
|
static
|
newBinder(Class<S> sourceType)
Gets the registred mirror binder (source type = target type) with no context name specified. |
|
static
|
newBinder(Class<S> sourceType,
Class<T> targetType)
Gets the registred binder given his types with no context name. |
|
static
|
newBinder(Class<S> sourceType,
Class<T> targetType,
String contextName)
Gets the registred binder given his types with no context name. |
|
static
|
newBinder(Class<S> sourceType,
Class<T> targetType,
String contextName,
Class<B> binderType)
Gets the registred binder given his types and his context's name. |
|
static
|
newBinder(Class<S> sourceType,
String contextName)
Gets the registred mirror binder (source type = target type) with the given context name. |
|
protected static
|
newBinder0(Class<S> sourceType,
Class<T> targetType,
String contextName,
Class<B> binderType)
Instanciate a new binder given his types and his context's name. |
|
static
|
registerBinderModel(Binder.BinderModel<S,T> model)
|
|
static
|
registerBinderModel(Binder.BinderModel<S,T> model,
String contextName)
|
|
static
|
registerBinderModel(Binder<S,T> binder)
|
|
static
|
registerBinderModel(Binder<S,T> binder,
String contextName)
|
|
static
|
registerBinderModel(BinderModelBuilder<S,T> binderModelBuilder)
|
|
static
|
registerBinderModel(BinderModelBuilder<S,T> binderModelBuilder,
String contextName)
|
|
protected static String |
toString(Binder.BinderModel<?,?> model,
String contextName)
|
|
protected static String |
toString(Class<?> sourceType,
Class<?> targetType,
String contextName)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static BinderFactory.BindelModelEntryMap binderModels
| Constructor Detail |
|---|
public BinderFactory()
| Method Detail |
|---|
public static <S> Binder<S,S> newBinder(Class<S> sourceType)
S - the type of source and targetsourceType - the type of source and target
null if not found.
public static <S> Binder<S,S> newBinder(Class<S> sourceType,
String contextName)
S - the type of source and targetsourceType - the type of source and targetcontextName - the context's name of the searched binder
null if not found.
public static <S,T> Binder<S,T> newBinder(Class<S> sourceType,
Class<T> targetType)
S - the type of sourceT - the type of targetsourceType - the type of sourcetargetType - the type of target
null if not found.
public static <S,T> Binder<S,T> newBinder(Class<S> sourceType,
Class<T> targetType,
String contextName)
S - the type of sourceT - the type of targetsourceType - the type of sourcetargetType - the type of targetcontextName - the context's name of the searched binder
null if not found.
public static <S,T,B extends Binder<S,T>> B newBinder(Class<S> sourceType,
Class<T> targetType,
String contextName,
Class<B> binderType)
S - the type of sourceT - the type of targetsourceType - the type of sourcetargetType - the type of targetcontextName - the context's name of the searched binderbinderType - type of binder required
public static <S,T> Binder.BinderModel<S,T> registerBinderModel(BinderModelBuilder<S,T> binderModelBuilder)
throws IllegalArgumentException
IllegalArgumentException
public static <S,T> Binder.BinderModel<S,T> registerBinderModel(Binder<S,T> binder)
throws IllegalArgumentException
IllegalArgumentException
public static <S,T> Binder.BinderModel<S,T> registerBinderModel(Binder.BinderModel<S,T> model)
throws IllegalArgumentException
IllegalArgumentException
public static <S,T> Binder.BinderModel<S,T> registerBinderModel(BinderModelBuilder<S,T> binderModelBuilder,
String contextName)
throws IllegalArgumentException
IllegalArgumentException
public static <S,T> Binder.BinderModel<S,T> registerBinderModel(Binder<S,T> binder,
String contextName)
throws IllegalArgumentException
IllegalArgumentException
public static <S,T> Binder.BinderModel<S,T> registerBinderModel(Binder.BinderModel<S,T> model,
String contextName)
throws IllegalArgumentException
IllegalArgumentException
public static <S,T,B extends Binder<S,T>> B newBinder(Binder.BinderModel<S,T> model,
Class<B> binderType)
model and a binderType, instanciate a new binder
and returns it.
Note: This method will NOT register
the model in the factory. If you want to reuse your model, please use
one of the registerBinderModel(XXX) method.
S - the source typeT - the target typeB - the type of the bindermodel - the model used by the binderbinderType - the type of the binder
public static void clear()
public static <S,T> boolean isBinderModelExists(Class<S> sourceType,
Class<T> targetType,
String contextName)
S - the type of sourceT - the type of targetsourceType - the type of sourcetargetType - the type of targetcontextName - the context's name of the searched binder
true if there is a cached binder model for the given
parameters, false otherwise.
public static <S,T> Binder.BinderModel<S,T> getCachedBinderModel(Class<S> sourceType,
Class<T> targetType,
String contextName)
S - the type of sourceT - the type of targetsourceType - the type of sourcetargetType - the type of targetcontextName - the context's name of the searched binder
null if not found.protected static BinderFactory.BindelModelEntryMap getBinderModels()
protected static String toString(Binder.BinderModel<?,?> model,
String contextName)
protected static String toString(Class<?> sourceType,
Class<?> targetType,
String contextName)
protected static <S,T,B extends Binder<S,T>> Binder<S,T> newBinder0(Class<S> sourceType,
Class<T> targetType,
String contextName,
Class<B> binderType)
BinderModelBuilder.newDefaultBuilder(Class, Class) method).
S - the type of sourceT - the type of targetsourceType - the type of sourcetargetType - the type of targetcontextName - the context's name of the searched binderbinderType - type of binder required
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||