This commit is contained in:
Redkale
2017-06-24 12:33:48 +08:00
parent 83bdb97842
commit eaa0a99933
3 changed files with 4 additions and 8 deletions

View File

@@ -135,10 +135,6 @@ public abstract class ConvertFactory<R extends Reader, W extends Writer> {
public abstract ConvertFactory createChild(boolean tiny);
public boolean isIndexSort() { //是否使用@ConvertColumn.index排序
return false;
}
public Convert getConvert() {
return convert;
}

View File

@@ -79,7 +79,7 @@ public final class ObjectDecoder<R extends Reader, T> implements Decodeable<R, T
if (ref != null && ref.ignore()) continue;
Type t = TypeToken.createClassType(field.getGenericType(), this.type);
DeMember member = new DeMember(ObjectEncoder.createAttribute(factory, clazz, field, null, null), factory.loadDecoder(t));
if (factory.isIndexSort() && ref != null) member.index = ref.getIndex();
if (ref != null) member.index = ref.getIndex();
list.add(member);
}
final boolean reversible = factory.isReversible();
@@ -104,7 +104,7 @@ public final class ObjectDecoder<R extends Reader, T> implements Decodeable<R, T
if (ref != null && ref.ignore()) continue;
Type t = TypeToken.createClassType(method.getGenericParameterTypes()[0], this.type);
DeMember member = new DeMember(ObjectEncoder.createAttribute(factory, clazz, null, null, method), factory.loadDecoder(t));
if (factory.isIndexSort() && ref != null) member.index = ref.getIndex();
if (ref != null) member.index = ref.getIndex();
list.add(member);
}
if (cps != null) { //可能存在某些构造函数中的字段名不存在setter方法

View File

@@ -70,7 +70,7 @@ public final class ObjectEncoder<W extends Writer, T> implements Encodeable<W, T
if (ref != null && ref.ignore()) continue;
Type t = TypeToken.createClassType(field.getGenericType(), this.type);
EnMember member = new EnMember(createAttribute(factory, clazz, field, null, null), factory.loadEncoder(t));
if (factory.isIndexSort() && ref != null) member.index = ref.getIndex();
if (ref != null) member.index = ref.getIndex();
list.add(member);
}
for (final Method method : clazz.getMethods()) {
@@ -95,7 +95,7 @@ public final class ObjectEncoder<W extends Writer, T> implements Encodeable<W, T
if (ref != null && ref.ignore()) continue;
Type t = TypeToken.createClassType(method.getGenericReturnType(), this.type);
EnMember member = new EnMember(createAttribute(factory, clazz, null, method, null), factory.loadEncoder(t));
if (factory.isIndexSort() && ref != null) member.index = ref.getIndex();
if (ref != null) member.index = ref.getIndex();
list.add(member);
}
this.members = list.toArray(new EnMember[list.size()]);