|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.dyuproject.protostuff.runtime.IdStrategy
com.dyuproject.protostuff.runtime.DefaultIdStrategy
public final class DefaultIdStrategy
The FQCN(fully qualified class name) will serve as the id (string). Does not need any registration in the user-code (works out-of-the-box). The size of serialized representation may be not very efficient.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.dyuproject.protostuff.runtime.IdStrategy |
|---|
IdStrategy.Factory, IdStrategy.UnknownTypeException |
| Field Summary |
|---|
| Fields inherited from class com.dyuproject.protostuff.runtime.IdStrategy |
|---|
groupId, primaryGroup |
| Constructor Summary | |
|---|---|
DefaultIdStrategy()
|
|
DefaultIdStrategy(IdStrategy primaryGroup,
int groupId)
|
|
| Method Summary | ||
|---|---|---|
protected CollectionSchema.MessageFactory |
getCollectionFactory(java.lang.Class<?> clazz)
Returns the CollectionSchema.MessageFactory. |
|
|
getDelegate(java.lang.Class<? super T> typeClass)
Returns the delegate. |
|
protected EnumIO<? extends java.lang.Enum<?>> |
getEnumIO(java.lang.Class<?> enumClass)
Returns the EnumIO. |
|
protected MapSchema.MessageFactory |
getMapFactory(java.lang.Class<?> clazz)
Returns the MapSchema.MessageFactory. |
|
|
getSchemaWrapper(java.lang.Class<T> typeClass,
boolean create)
Returns the schema wrapper. |
|
boolean |
isDelegateRegistered(java.lang.Class<?> typeClass)
Returns true if there is a Delegate explicitly registered for the
typeClass. |
|
boolean |
isRegistered(java.lang.Class<?> typeClass)
Returns true if the typeClass is explicitly registered. |
|
|
map(java.lang.Class<? super T> baseClass,
java.lang.Class<T> typeClass)
Used by RuntimeSchema.map(Class, Class). |
|
boolean |
registerCollection(CollectionSchema.MessageFactory factory)
Registers a collection. |
|
|
registerDelegate(Delegate<T> delegate)
Registers a delegate. |
|
|
registerEnum(java.lang.Class<T> enumClass)
Registers an enum. |
|
boolean |
registerMap(MapSchema.MessageFactory factory)
Registers a map. |
|
|
registerPojo(java.lang.Class<T> typeClass,
Schema<T> schema)
Registers a pojo. |
|
protected java.lang.Class<?> |
resolveArrayComponentTypeFrom(Input input,
boolean mapped)
|
|
protected java.lang.Class<?> |
resolveClassFrom(Input input,
boolean mapped,
boolean array)
|
|
protected CollectionSchema.MessageFactory |
resolveCollectionFrom(Input input)
|
|
protected
|
resolveDelegateFrom(Input input)
|
|
protected EnumIO<?> |
resolveEnumFrom(Input input)
|
|
protected MapSchema.MessageFactory |
resolveMapFrom(Input input)
|
|
protected
|
resolvePojoFrom(Input input,
int fieldNumber)
|
|
protected void |
transferArrayId(Input input,
Output output,
int fieldNumber,
boolean mapped)
|
|
protected void |
transferClassId(Input input,
Output output,
int fieldNumber,
boolean mapped,
boolean array)
|
|
protected void |
transferCollectionId(Input input,
Output output,
int fieldNumber)
|
|
protected
|
transferDelegateId(Input input,
Output output,
int fieldNumber)
|
|
protected void |
transferEnumId(Input input,
Output output,
int fieldNumber)
|
|
protected void |
transferMapId(Input input,
Output output,
int fieldNumber)
|
|
protected
|
transferPojoId(Input input,
Output output,
int fieldNumber)
|
|
protected
|
tryWriteDelegateIdTo(Output output,
int fieldNumber,
java.lang.Class<T> clazz)
If this method returns null, the clazz was not registered as a delegate. |
|
protected void |
writeArrayIdTo(Output output,
java.lang.Class<?> componentType)
|
|
protected void |
writeClassIdTo(Output output,
java.lang.Class<?> componentType,
boolean array)
|
|
protected void |
writeCollectionIdTo(Output output,
int fieldNumber,
java.lang.Class<?> clazz)
|
|
protected void |
writeEnumIdTo(Output output,
int fieldNumber,
java.lang.Class<?> clazz)
|
|
protected void |
writeMapIdTo(Output output,
int fieldNumber,
java.lang.Class<?> clazz)
|
|
protected
|
writeMessageIdTo(Output output,
int fieldNumber,
Message<T> message)
|
|
protected
|
writePojoIdTo(Output output,
int fieldNumber,
java.lang.Class<T> clazz)
|
|
| Methods inherited from class com.dyuproject.protostuff.runtime.IdStrategy |
|---|
newSchema |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultIdStrategy()
public DefaultIdStrategy(IdStrategy primaryGroup,
int groupId)
| Method Detail |
|---|
public <T> boolean registerPojo(java.lang.Class<T> typeClass,
Schema<T> schema)
RuntimeSchema.register(Class, Schema).
public <T extends java.lang.Enum<T>> boolean registerEnum(java.lang.Class<T> enumClass)
public <T> boolean registerDelegate(Delegate<T> delegate)
public boolean registerCollection(CollectionSchema.MessageFactory factory)
public boolean registerMap(MapSchema.MessageFactory factory)
public <T> boolean map(java.lang.Class<? super T> baseClass,
java.lang.Class<T> typeClass)
RuntimeSchema.map(Class, Class).
public boolean isDelegateRegistered(java.lang.Class<?> typeClass)
IdStrategyDelegate explicitly registered for the
typeClass.
isDelegateRegistered in class IdStrategypublic <T> Delegate<T> getDelegate(java.lang.Class<? super T> typeClass)
IdStrategydelegate.
getDelegate in class IdStrategypublic boolean isRegistered(java.lang.Class<?> typeClass)
IdStrategytypeClass is explicitly registered.
isRegistered in class IdStrategy
public <T> HasSchema<T> getSchemaWrapper(java.lang.Class<T> typeClass,
boolean create)
IdStrategyschema wrapper.
The caller is responsible that the typeClass is a pojo (e.g not an enum/array/etc).
getSchemaWrapper in class IdStrategyprotected EnumIO<? extends java.lang.Enum<?>> getEnumIO(java.lang.Class<?> enumClass)
IdStrategyEnumIO.
The callers (internal field factories) are responsible that the class provided
is an enum class.
getEnumIO in class IdStrategyprotected CollectionSchema.MessageFactory getCollectionFactory(java.lang.Class<?> clazz)
IdStrategyCollectionSchema.MessageFactory.
The callers (internal field factories) are responsible that the class provided
implements Collection.
getCollectionFactory in class IdStrategyprotected MapSchema.MessageFactory getMapFactory(java.lang.Class<?> clazz)
IdStrategyMapSchema.MessageFactory.
The callers (internal field factories}) are responsible that the class provided
implements .
getMapFactory in class IdStrategy
protected void writeCollectionIdTo(Output output,
int fieldNumber,
java.lang.Class<?> clazz)
throws java.io.IOException
writeCollectionIdTo in class IdStrategyjava.io.IOException
protected void transferCollectionId(Input input,
Output output,
int fieldNumber)
throws java.io.IOException
transferCollectionId in class IdStrategyjava.io.IOException
protected CollectionSchema.MessageFactory resolveCollectionFrom(Input input)
throws java.io.IOException
resolveCollectionFrom in class IdStrategyjava.io.IOException
protected void writeMapIdTo(Output output,
int fieldNumber,
java.lang.Class<?> clazz)
throws java.io.IOException
writeMapIdTo in class IdStrategyjava.io.IOException
protected void transferMapId(Input input,
Output output,
int fieldNumber)
throws java.io.IOException
transferMapId in class IdStrategyjava.io.IOException
protected MapSchema.MessageFactory resolveMapFrom(Input input)
throws java.io.IOException
resolveMapFrom in class IdStrategyjava.io.IOException
protected void writeEnumIdTo(Output output,
int fieldNumber,
java.lang.Class<?> clazz)
throws java.io.IOException
writeEnumIdTo in class IdStrategyjava.io.IOException
protected void transferEnumId(Input input,
Output output,
int fieldNumber)
throws java.io.IOException
transferEnumId in class IdStrategyjava.io.IOException
protected EnumIO<?> resolveEnumFrom(Input input)
throws java.io.IOException
resolveEnumFrom in class IdStrategyjava.io.IOException
protected <T> Delegate<T> tryWriteDelegateIdTo(Output output,
int fieldNumber,
java.lang.Class<T> clazz)
throws java.io.IOException
IdStrategy
tryWriteDelegateIdTo in class IdStrategyjava.io.IOException
protected <T> Delegate<T> transferDelegateId(Input input,
Output output,
int fieldNumber)
throws java.io.IOException
transferDelegateId in class IdStrategyjava.io.IOException
protected <T> Delegate<T> resolveDelegateFrom(Input input)
throws java.io.IOException
resolveDelegateFrom in class IdStrategyjava.io.IOException
protected <T> Schema<T> writePojoIdTo(Output output,
int fieldNumber,
java.lang.Class<T> clazz)
throws java.io.IOException
writePojoIdTo in class IdStrategyjava.io.IOException
protected <T> HasSchema<T> transferPojoId(Input input,
Output output,
int fieldNumber)
throws java.io.IOException
transferPojoId in class IdStrategyjava.io.IOException
protected <T> HasSchema<T> resolvePojoFrom(Input input,
int fieldNumber)
throws java.io.IOException
resolvePojoFrom in class IdStrategyjava.io.IOException
protected <T> Schema<T> writeMessageIdTo(Output output,
int fieldNumber,
Message<T> message)
throws java.io.IOException
writeMessageIdTo in class IdStrategyjava.io.IOException
protected void writeArrayIdTo(Output output,
java.lang.Class<?> componentType)
throws java.io.IOException
writeArrayIdTo in class IdStrategyjava.io.IOException
protected void transferArrayId(Input input,
Output output,
int fieldNumber,
boolean mapped)
throws java.io.IOException
transferArrayId in class IdStrategyjava.io.IOException
protected java.lang.Class<?> resolveArrayComponentTypeFrom(Input input,
boolean mapped)
throws java.io.IOException
resolveArrayComponentTypeFrom in class IdStrategyjava.io.IOException
protected void writeClassIdTo(Output output,
java.lang.Class<?> componentType,
boolean array)
throws java.io.IOException
writeClassIdTo in class IdStrategyjava.io.IOException
protected void transferClassId(Input input,
Output output,
int fieldNumber,
boolean mapped,
boolean array)
throws java.io.IOException
transferClassId in class IdStrategyjava.io.IOException
protected java.lang.Class<?> resolveClassFrom(Input input,
boolean mapped,
boolean array)
throws java.io.IOException
resolveClassFrom in class IdStrategyjava.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||