|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fudgemsg.mapping.FudgeBuilderFactoryAdapter
public class FudgeBuilderFactoryAdapter
Implementation of a FudgeBuilderFactory
that can delegate to another
instance for unrecognized classes. This pattern is to allow factories to be
chained together.
Constructor Summary | |
---|---|
protected |
FudgeBuilderFactoryAdapter(FudgeBuilderFactory delegate)
Creates a new FudgeBuilderFactoryAdapter . |
Method Summary | ||
---|---|---|
|
addGenericBuilder(Class<T> clazz,
FudgeBuilder<T> builder)
Registers a generic builder with the factory that may be returned as a FudgeObjectBuilder for
the class, or as a FudgeMessageBuilder for any sub-classes of the class. |
|
|
createMessageBuilder(Class<T> clazz)
Creates a new FudgeMessageBuilder for encoding objects of the given class into Fudge messages. |
|
|
createObjectBuilder(Class<T> clazz)
Creates a new FudgeObjectBuilder for deserializing Fudge messages into the given class. |
|
protected FudgeBuilderFactory |
getDelegate()
Returns the delegate instance to pass method calls to. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected FudgeBuilderFactoryAdapter(FudgeBuilderFactory delegate)
FudgeBuilderFactoryAdapter
.
delegate
- instance to pass non-overridden method calls toMethod Detail |
---|
protected FudgeBuilderFactory getDelegate()
FudgeBuilderFactory
delegatepublic <T> void addGenericBuilder(Class<T> clazz, FudgeBuilder<T> builder)
FudgeObjectBuilder
for
the class, or as a FudgeMessageBuilder
for any sub-classes of the class. After calling this, a
factory may choose to return an alternative builder, but may not return null
for a class which
the generic builder has been registered for.
addGenericBuilder
in interface FudgeBuilderFactory
T
- the generic type (probably an interface) the builder is forclazz
- the generic type (probably an interface) the builder is forbuilder
- the builder to registerpublic <T> FudgeMessageBuilder<T> createMessageBuilder(Class<T> clazz)
FudgeMessageBuilder
for encoding objects of the given class into Fudge messages.
createMessageBuilder
in interface FudgeBuilderFactory
T
- the class the builder should create messages fromclazz
- the class the builder should create messages from
null
if none is availablepublic <T> FudgeObjectBuilder<T> createObjectBuilder(Class<T> clazz)
FudgeObjectBuilder
for deserializing Fudge messages into the given class.
createObjectBuilder
in interface FudgeBuilderFactory
T
- the class the builder should create objects ofclazz
- the class the builder should create objects of
null
if none is available
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |