- java.lang.Object
-
- org.redkale.convert.ConvertFactory<R,W>
-
- 类型参数:
R
- Reader输入的子类W
- Writer输出的子类
- 直接已知子类:
JsonFactory
,ProtobufFactory
public abstract class ConvertFactory<R extends Reader,W extends Writer> extends Object
序列化模块的工厂类,用于注册自定义的序列化类型,获取Convert详情见: https://redkale.org
- 作者:
- zhangjx
-
-
构造器概要
构造器 限定符 构造器 说明 protected
ConvertFactory(ConvertFactory<R,W> parent, int features)
-
方法概要
所有方法 静态方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected <F extends ConvertFactory<R,W>>
FaddFeature(int feature)
static boolean
checkNullableFeature(int features)
static boolean
checkTinyFeature(int features)
protected <E> Decodeable<R,E>
createArrayDecoder(Type type)
protected <E> Encodeable<W,E>
createArrayEncoder(Type type)
abstract ConvertFactory
createChild()
abstract ConvertFactory
createChild(int features)
protected <E> Decodeable<R,E>
createCollectionDecoder(Type type)
protected <E> Encodeable<W,E>
createCollectionEncoder(Type type)
<E> Decodeable<R,E>
createDecoder(Type type)
<E> Decodeable<R,E>
createDecoder(Type type, boolean skipCustomMethod)
protected <E> Encodeable<W,E>
createDyncEncoder(Type type)
<E> Encodeable<W,E>
createEncoder(Type type)
<E> Encodeable<W,E>
createEncoder(Type type, boolean skipCustomMethod)
protected SimpledCoder
createEnumSimpledCoder(Class enumClass)
protected Type
createGenericListType(Type componentType)
protected <E> Decodeable<R,E>
createMapDecoder(Type type)
protected <E> Encodeable<W,E>
createMapEncoder(Type type)
protected <E> Decodeable<R,E>
createMultiImplDecoder(Class[] types)
protected ObjectDecoder
createObjectDecoder(Type type)
protected <E> ObjectEncoder<W,E>
createObjectEncoder(Type type)
protected <E> Decodeable<R,E>
createStreamDecoder(Type type)
protected <E> Encodeable<W,E>
createStreamEncoder(Type type)
static Convert
findConvert(ConvertType type)
<T> Creator<T>
findCreator(Class<T> type)
<E> Decodeable<R,E>
findDecoder(Type type)
<E> Encodeable<W,E>
findEncoder(Type type)
<E> SimpledCoder<R,W,E>
findFieldCoder(Type clazz, String field)
<C extends BiFunction>
BiFunctionfindFieldFunc(Class<C> type)
ConvertColumnEntry
findRef(Class clazz, AccessibleObject element)
protected Type
formatObjectType(Type type)
<E> Encodeable<W,E>
getAnyEncoder()
protected Type
getCollectionComponentType(Type type)
Convert
getConvert()
abstract ConvertType
getConvertType()
int
getFeatures()
protected Type
getStreamionComponentType(Type type)
protected static int
getSystemPropertyInt(String key, String parentkey, boolean defvalue, int feature)
protected boolean
isCollectionType(Type type)
boolean
isConvertDisabled(AccessibleObject element)
abstract boolean
isFieldSort()
abstract boolean
isReversible()
boolean
isSimpleMemberType(Class declaringClass, Type type, Class clazz)
protected boolean
isStreamType(Type type)
<T> Creator<T>
loadCreator(Class<T> type)
<E> Decodeable<R,E>
loadDecoder(Type type)
<E> Encodeable<W,E>
loadEncoder(Type type)
ConvertFactory
parent()
String
readConvertFieldName(Class clazz, AccessibleObject element)
String
readGetSetFieldName(AccessibleObject element)
<C extends BiFunction>
voidregister(Class<C> clazz, C columnHandler)
<E> void
register(Class<E> clazz, Creator<? extends E> creator)
void
register(Class type, boolean ignore, String... columns)
void
register(Class type, boolean ignore, Collection<String> columns)
boolean
register(Class type, String column, String alias)
boolean
register(Class type, String column, ConvertColumnEntry entry)
<E> void
register(Class clazz, String field, SimpledCoder<R,W,E> coder)
boolean
register(AccessibleObject field, ConvertColumnEntry entry)
<E> void
register(Type clazz, Decodeable<R,E> decoder)
<E> void
register(Type clazz, Decodeable<R,E> decoder, Encodeable<W,E> encoder)
<E> void
register(Type clazz, Encodeable<W,E> encoder)
<E> void
register(Type clazz, SimpledCoder<R,W,E> coder)
void
registerFieldFuncConsumer(Consumer<BiFunction> consumer)
设置ColumnHandler初始化的处理函数void
registerIgnoreAll(Class type, String... excludeColumns)
屏蔽指定类所有字段,仅仅保留指定字段
注意: 该配置优先级高于skipAllIgnore和ConvertColumnEntry配置void
registerIgnoreAll(Class type, Collection<String> excludeColumns)
void
registerSkipAllIgnore(boolean skipIgnore)
使所有类的所有被声明为ConvertColumn.ignore = true 的字段或方法变为ConvertColumn.ignore = falsevoid
registerSkipIgnore(Class type)
使该类所有被声明为ConvertColumn.ignore = true 的字段或方法变为ConvertColumn.ignore = falsevoid
reloadCoder(Type type)
void
reloadCoder(Type type, Class clazz)
protected <F extends ConvertFactory<R,W>>
FremoveFeature(int feature)
protected abstract ConvertFactory
rootFactory()
ConvertFactory<R,W>
skipAllIgnore(boolean skipIgnore)
使所有类的所有被声明为ConvertColumn.ignore = true 的字段或方法变为ConvertColumn.ignore = falsevoid
sortFieldIndex(Class clazz, List<AccessibleObject> members)
protected <F extends ConvertFactory<R,W>>
FwithFeatures(int features)
protected <F extends ConvertFactory<R,W>>
FwithNullableFeature(boolean nullable)
protected <F extends ConvertFactory<R,W>>
FwithTinyFeature(boolean tiny)
-
-
-
构造器详细资料
-
ConvertFactory
protected ConvertFactory(ConvertFactory<R,W> parent, int features)
-
-
方法详细资料
-
parent
public ConvertFactory parent()
-
findConvert
public static Convert findConvert(ConvertType type)
-
getSystemPropertyInt
protected static int getSystemPropertyInt(String key, String parentkey, boolean defvalue, int feature)
-
getConvertType
public abstract ConvertType getConvertType()
-
isReversible
public abstract boolean isReversible()
-
isFieldSort
public abstract boolean isFieldSort()
-
createChild
public abstract ConvertFactory createChild()
-
createChild
public abstract ConvertFactory createChild(int features)
-
rootFactory
protected abstract ConvertFactory rootFactory()
-
createEnumSimpledCoder
protected SimpledCoder createEnumSimpledCoder(Class enumClass)
-
isCollectionType
protected boolean isCollectionType(Type type)
-
isStreamType
protected boolean isStreamType(Type type)
-
createDyncEncoder
protected <E> Encodeable<W,E> createDyncEncoder(Type type)
-
createObjectDecoder
protected ObjectDecoder createObjectDecoder(Type type)
-
createMultiImplDecoder
protected <E> Decodeable<R,E> createMultiImplDecoder(Class[] types)
-
createObjectEncoder
protected <E> ObjectEncoder<W,E> createObjectEncoder(Type type)
-
createMapDecoder
protected <E> Decodeable<R,E> createMapDecoder(Type type)
-
createMapEncoder
protected <E> Encodeable<W,E> createMapEncoder(Type type)
-
createArrayDecoder
protected <E> Decodeable<R,E> createArrayDecoder(Type type)
-
createArrayEncoder
protected <E> Encodeable<W,E> createArrayEncoder(Type type)
-
createCollectionDecoder
protected <E> Decodeable<R,E> createCollectionDecoder(Type type)
-
createCollectionEncoder
protected <E> Encodeable<W,E> createCollectionEncoder(Type type)
-
createStreamDecoder
protected <E> Decodeable<R,E> createStreamDecoder(Type type)
-
createStreamEncoder
protected <E> Encodeable<W,E> createStreamEncoder(Type type)
-
getConvert
public Convert getConvert()
-
getFeatures
public final int getFeatures()
-
withFeatures
protected <F extends ConvertFactory<R,W>> F withFeatures(int features)
-
addFeature
protected <F extends ConvertFactory<R,W>> F addFeature(int feature)
-
removeFeature
protected <F extends ConvertFactory<R,W>> F removeFeature(int feature)
-
withTinyFeature
protected <F extends ConvertFactory<R,W>> F withTinyFeature(boolean tiny)
-
withNullableFeature
protected <F extends ConvertFactory<R,W>> F withNullableFeature(boolean nullable)
-
checkTinyFeature
public static boolean checkTinyFeature(int features)
-
checkNullableFeature
public static boolean checkNullableFeature(int features)
-
isConvertDisabled
public boolean isConvertDisabled(AccessibleObject element)
-
findRef
public ConvertColumnEntry findRef(Class clazz, AccessibleObject element)
-
readConvertFieldName
public String readConvertFieldName(Class clazz, AccessibleObject element)
-
readGetSetFieldName
public String readGetSetFieldName(AccessibleObject element)
-
sortFieldIndex
public void sortFieldIndex(Class clazz, List<AccessibleObject> members)
-
registerFieldFuncConsumer
public final void registerFieldFuncConsumer(Consumer<BiFunction> consumer)
设置ColumnHandler初始化的处理函数- 参数:
consumer
- ColumnHandler处理函数
-
registerSkipAllIgnore
public final void registerSkipAllIgnore(boolean skipIgnore)
使所有类的所有被声明为ConvertColumn.ignore = true 的字段或方法变为ConvertColumn.ignore = false- 参数:
skipIgnore
- 是否忽略Ignore注解
-
skipAllIgnore
public ConvertFactory<R,W> skipAllIgnore(boolean skipIgnore)
使所有类的所有被声明为ConvertColumn.ignore = true 的字段或方法变为ConvertColumn.ignore = false- 参数:
skipIgnore
- 忽略ignore- 返回:
- 自身
-
registerSkipIgnore
public final void registerSkipIgnore(Class type)
使该类所有被声明为ConvertColumn.ignore = true 的字段或方法变为ConvertColumn.ignore = false- 参数:
type
- 指定的类
-
registerIgnoreAll
public final void registerIgnoreAll(Class type, String... excludeColumns)
屏蔽指定类所有字段,仅仅保留指定字段
注意: 该配置优先级高于skipAllIgnore和ConvertColumnEntry配置- 参数:
type
- 指定的类excludeColumns
- 需要排除的字段名
-
registerIgnoreAll
public final void registerIgnoreAll(Class type, Collection<String> excludeColumns)
-
register
public final void register(Class type, boolean ignore, Collection<String> columns)
-
register
public final boolean register(Class type, String column, ConvertColumnEntry entry)
-
register
public final boolean register(AccessibleObject field, ConvertColumnEntry entry)
-
reloadCoder
public final void reloadCoder(Type type)
-
findFieldFunc
public final <C extends BiFunction> BiFunction findFieldFunc(Class<C> type)
-
getAnyEncoder
public final <E> Encodeable<W,E> getAnyEncoder()
-
register
public final <C extends BiFunction> void register(Class<C> clazz, C columnHandler)
-
register
public final <E> void register(Type clazz, SimpledCoder<R,W,E> coder)
-
register
public final <E> void register(Type clazz, Decodeable<R,E> decoder, Encodeable<W,E> encoder)
-
register
public final <E> void register(Type clazz, Decodeable<R,E> decoder)
-
register
public final <E> void register(Type clazz, Encodeable<W,E> encoder)
-
register
public final <E> void register(Class clazz, String field, SimpledCoder<R,W,E> coder)
-
findFieldCoder
public final <E> SimpledCoder<R,W,E> findFieldCoder(Type clazz, String field)
-
findDecoder
public final <E> Decodeable<R,E> findDecoder(Type type)
-
findEncoder
public final <E> Encodeable<W,E> findEncoder(Type type)
-
loadDecoder
public final <E> Decodeable<R,E> loadDecoder(Type type)
-
createDecoder
public final <E> Decodeable<R,E> createDecoder(Type type)
-
createDecoder
public final <E> Decodeable<R,E> createDecoder(Type type, boolean skipCustomMethod)
-
loadEncoder
public final <E> Encodeable<W,E> loadEncoder(Type type)
-
createEncoder
public final <E> Encodeable<W,E> createEncoder(Type type)
-
createEncoder
public final <E> Encodeable<W,E> createEncoder(Type type, boolean skipCustomMethod)
-
-