This commit is contained in:
@@ -36,7 +36,7 @@ public abstract class Convert<R extends Reader, W extends Writer> {
|
||||
return writer;
|
||||
}
|
||||
|
||||
protected <S extends W> S fieldFunc(S writer, BiFunction<Attribute, Object, Object> objFieldFunc, Function<Object, EnFieldObject[]> objExtFunc) {
|
||||
protected <S extends W> S fieldFunc(S writer, BiFunction<Attribute, Object, Object> objFieldFunc, Function<Object, EnFieldValue[]> objExtFunc) {
|
||||
writer.objFieldFunc = objFieldFunc;
|
||||
writer.objExtFunc = objExtFunc;
|
||||
return writer;
|
||||
@@ -44,7 +44,7 @@ public abstract class Convert<R extends Reader, W extends Writer> {
|
||||
|
||||
public abstract Convert<R, W> newConvert(final BiFunction<Attribute, Object, Object> objFieldFunc);
|
||||
|
||||
public abstract Convert<R, W> newConvert(final BiFunction<Attribute, Object, Object> objFieldFunc, Function<Object, EnFieldObject[]> objExtFunc);
|
||||
public abstract Convert<R, W> newConvert(final BiFunction<Attribute, Object, Object> objFieldFunc, Function<Object, EnFieldValue[]> objExtFunc);
|
||||
|
||||
public abstract boolean isBinary();
|
||||
|
||||
|
||||
@@ -170,10 +170,10 @@ public class ObjectEncoder<W extends Writer, T> implements Encodeable<W, T> {
|
||||
out.writeObjectField(member, value);
|
||||
}
|
||||
if (out.objExtFunc != null) {
|
||||
EnFieldObject[] extFields = out.objExtFunc.apply(value);
|
||||
EnFieldValue[] extFields = out.objExtFunc.apply(value);
|
||||
if (extFields != null) {
|
||||
Encodeable<W, ?> anyEncoder = factory.getAnyEncoder();
|
||||
for (EnFieldObject en : extFields) {
|
||||
for (EnFieldValue en : extFields) {
|
||||
if (en == null) continue;
|
||||
maxPosition++;
|
||||
out.writeObjectField(en.getName(), en.getType(), Math.max(en.getPosition(), maxPosition), anyEncoder, en.getValue());
|
||||
|
||||
@@ -29,7 +29,7 @@ public abstract class Writer {
|
||||
protected BiFunction<Attribute, Object, Object> objFieldFunc;
|
||||
|
||||
//对某个对象进行动态扩展字段值处理
|
||||
protected Function<Object, EnFieldObject[]> objExtFunc;
|
||||
protected Function<Object, EnFieldValue[]> objExtFunc;
|
||||
|
||||
/**
|
||||
* 设置specify
|
||||
|
||||
@@ -65,7 +65,7 @@ public class BsonConvert extends BinaryConvert<BsonReader, BsonWriter> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BsonConvert newConvert(final BiFunction<Attribute, Object, Object> fieldFunc, Function<Object, EnFieldObject[]> objExtFunc) {
|
||||
public BsonConvert newConvert(final BiFunction<Attribute, Object, Object> fieldFunc, Function<Object, EnFieldValue[]> objExtFunc) {
|
||||
return new BsonConvert(getFactory(), tiny) {
|
||||
@Override
|
||||
protected <S extends BsonWriter> S configWrite(S writer) {
|
||||
|
||||
@@ -52,7 +52,7 @@ public class JsonConvert extends TextConvert<JsonReader, JsonWriter> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonConvert newConvert(final BiFunction<Attribute, Object, Object> fieldFunc, Function<Object, EnFieldObject[]> objExtFunc) {
|
||||
public JsonConvert newConvert(final BiFunction<Attribute, Object, Object> fieldFunc, Function<Object, EnFieldValue[]> objExtFunc) {
|
||||
return new JsonConvert(getFactory(), tiny) {
|
||||
@Override
|
||||
protected <S extends JsonWriter> S configWrite(S writer) {
|
||||
|
||||
Reference in New Issue
Block a user