This commit is contained in:
@@ -26,6 +26,8 @@ public final class DeMember<R extends Reader, T, F> {
|
||||
|
||||
protected int position; //从1开始
|
||||
|
||||
protected int tag; //主要给protobuf使用
|
||||
|
||||
protected final Attribute<T, F> attribute;
|
||||
|
||||
protected Decodeable<R, F> decoder;
|
||||
@@ -84,6 +86,10 @@ public final class DeMember<R extends Reader, T, F> {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
public int getTag() {
|
||||
return this.tag;
|
||||
}
|
||||
|
||||
public int compareTo(boolean fieldSort, DeMember<R, T, F> o) {
|
||||
if (o == null) return -1;
|
||||
if (this.position != o.position) return (this.position == 0 ? Integer.MAX_VALUE : this.position) - (o.position == 0 ? Integer.MAX_VALUE : o.position);
|
||||
|
||||
@@ -178,6 +178,7 @@ public class ObjectDecoder<R extends Reader, T> implements Decodeable<R, T> {
|
||||
while (pos.contains(++pidx));
|
||||
member.position = pidx;
|
||||
}
|
||||
initForEachDeMember(factory, member);
|
||||
}
|
||||
Arrays.sort(this.members, (a, b) -> a.compareTo(factory.isFieldSort(), b));
|
||||
|
||||
@@ -205,6 +206,13 @@ public class ObjectDecoder<R extends Reader, T> implements Decodeable<R, T> {
|
||||
}
|
||||
}
|
||||
|
||||
protected void initForEachDeMember(ConvertFactory factory, DeMember member) {
|
||||
}
|
||||
|
||||
protected void setTag(DeMember member, int tag) {
|
||||
member.tag = tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对象格式: [0x1][short字段个数][字段名][字段值]...[0x2]
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user