优化注释
This commit is contained in:
@@ -93,6 +93,7 @@ public class ArrayDecoder<T> implements Decodeable<Reader, T[]> {
|
||||
try {
|
||||
condition.await();
|
||||
} catch (Exception e) {
|
||||
//do nothing
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
@@ -90,6 +90,7 @@ public class ArrayEncoder<T> implements Encodeable<Writer, T[]> {
|
||||
try {
|
||||
condition.await();
|
||||
} catch (Exception e) {
|
||||
//do nothing
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
@@ -98,6 +98,7 @@ public class CollectionDecoder<T> implements Decodeable<Reader, Collection<T>> {
|
||||
try {
|
||||
condition.await();
|
||||
} catch (Exception e) {
|
||||
//do nothing
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ public class CollectionEncoder<T> implements Encodeable<Writer, Collection<T>> {
|
||||
try {
|
||||
condition.await();
|
||||
} catch (Exception e) {
|
||||
//do nothing
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class Convert<R extends Reader, W extends Writer> {
|
||||
}
|
||||
|
||||
protected <S extends W> S fieldFunc(S writer, BiFunction<Attribute, Object, Object> objFieldFunc,
|
||||
BiFunction<Object, Object, Object> mapFieldFunc, Function<Object, ConvertField[]> objExtFunc) {
|
||||
BiFunction mapFieldFunc, Function<Object, ConvertField[]> objExtFunc) {
|
||||
writer.mapFieldFunc = mapFieldFunc;
|
||||
writer.objFieldFunc = objFieldFunc;
|
||||
writer.objExtFunc = objExtFunc;
|
||||
@@ -58,7 +58,7 @@ public abstract class Convert<R extends Reader, W extends Writer> {
|
||||
return newConvert(objFieldFunc, null, null);
|
||||
}
|
||||
|
||||
public Convert<R, W> newConvert(BiFunction<Attribute, Object, Object> objFieldFunc, BiFunction<Object, Object, Object> mapFieldFunc) {
|
||||
public Convert<R, W> newConvert(BiFunction<Attribute, Object, Object> objFieldFunc, BiFunction mapFieldFunc) {
|
||||
return newConvert(objFieldFunc, mapFieldFunc, null);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public abstract class Convert<R extends Reader, W extends Writer> {
|
||||
}
|
||||
|
||||
public abstract Convert<R, W> newConvert(BiFunction<Attribute, Object, Object> objFieldFunc,
|
||||
BiFunction<Object, Object, Object> mapFieldFunc, Function<Object, ConvertField[]> objExtFunc);
|
||||
BiFunction mapFieldFunc, Function<Object, ConvertField[]> objExtFunc);
|
||||
|
||||
public abstract boolean isBinary();
|
||||
|
||||
|
||||
@@ -175,6 +175,7 @@ public class ObjectDecoder<R extends Reader, T> implements Decodeable<R, T> {
|
||||
continue;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//do nothing
|
||||
}
|
||||
if (f == null) {
|
||||
boolean is = method.getParameterTypes()[0] == boolean.class || method.getParameterTypes()[0] == Boolean.class;
|
||||
@@ -184,6 +185,7 @@ public class ObjectDecoder<R extends Reader, T> implements Decodeable<R, T> {
|
||||
continue;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -326,6 +328,7 @@ public class ObjectDecoder<R extends Reader, T> implements Decodeable<R, T> {
|
||||
try {
|
||||
condition.await();
|
||||
} catch (Exception e) {
|
||||
//do nothing
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@ import org.redkale.util.*;
|
||||
@SuppressWarnings("unchecked")
|
||||
public class ObjectEncoder<W extends Writer, T> implements Encodeable<W, T> {
|
||||
|
||||
static final Type[] TYPEZERO = new Type[0];
|
||||
|
||||
protected final Type type;
|
||||
|
||||
protected final Class typeClass;
|
||||
@@ -162,6 +160,7 @@ public class ObjectEncoder<W extends Writer, T> implements Encodeable<W, T> {
|
||||
small = f.getAnnotation(ConvertSmallString.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//do nothing
|
||||
}
|
||||
}
|
||||
Field maybeField = ConvertFactory.readGetSetField(method);
|
||||
@@ -206,6 +205,7 @@ public class ObjectEncoder<W extends Writer, T> implements Encodeable<W, T> {
|
||||
try {
|
||||
dissorts.add(new EnMember(createAttribute(factory, type, clazz, f, null, null), null, f, null)); //虚构
|
||||
} catch (RuntimeException e) {
|
||||
//do nothing
|
||||
}
|
||||
} catch (NoSuchFieldException nsfe) { //不存在field, 可能存在getter方法
|
||||
char[] fs = constructorField.toCharArray();
|
||||
@@ -221,6 +221,7 @@ public class ObjectEncoder<W extends Writer, T> implements Encodeable<W, T> {
|
||||
try {
|
||||
dissorts.add(new EnMember(createAttribute(factory, type, clazz, null, getter, null), null, null, null)); //虚构
|
||||
} catch (RuntimeException e) {
|
||||
//do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -275,6 +276,7 @@ public class ObjectEncoder<W extends Writer, T> implements Encodeable<W, T> {
|
||||
try {
|
||||
condition.await();
|
||||
} catch (Exception e) {
|
||||
//do nothing
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class BsonConvert extends BinaryConvert<BsonReader, BsonWriter> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BsonConvert newConvert(final BiFunction<Attribute, Object, Object> objFieldFunc, BiFunction<Object, Object, Object> mapFieldFunc) {
|
||||
public BsonConvert newConvert(final BiFunction<Attribute, Object, Object> objFieldFunc, BiFunction mapFieldFunc) {
|
||||
return newConvert(objFieldFunc, mapFieldFunc, null);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class BsonConvert extends BinaryConvert<BsonReader, BsonWriter> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BsonConvert newConvert(final BiFunction<Attribute, Object, Object> fieldFunc, BiFunction<Object, Object, Object> mapFieldFunc, Function<Object, ConvertField[]> objExtFunc) {
|
||||
public BsonConvert newConvert(final BiFunction<Attribute, Object, Object> fieldFunc, BiFunction mapFieldFunc, Function<Object, ConvertField[]> objExtFunc) {
|
||||
return new BsonConvert(getFactory(), features) {
|
||||
@Override
|
||||
protected <S extends BsonWriter> S configWrite(S writer) {
|
||||
|
||||
@@ -69,12 +69,12 @@ public class JsonConvert extends TextConvert<JsonReader, JsonWriter> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonConvert newConvert(final BiFunction<Attribute, Object, Object> objFieldFunc, BiFunction<Object, Object, Object> mapFieldFunc) {
|
||||
public JsonConvert newConvert(final BiFunction<Attribute, Object, Object> objFieldFunc, BiFunction mapFieldFunc) {
|
||||
return newConvert(objFieldFunc, mapFieldFunc, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonConvert newConvert(final BiFunction<Attribute, Object, Object> objFieldFunc, BiFunction<Object, Object, Object> mapFieldFunc, Function<Object, ConvertField[]> objExtFunc) {
|
||||
public JsonConvert newConvert(final BiFunction<Attribute, Object, Object> objFieldFunc, BiFunction mapFieldFunc, Function<Object, ConvertField[]> objExtFunc) {
|
||||
return new JsonConvert(getFactory(), features) {
|
||||
@Override
|
||||
protected <S extends JsonWriter> S configWrite(S writer) {
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ProtobufConvert extends BinaryConvert<ProtobufReader, ProtobufWrite
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtobufConvert newConvert(final BiFunction<Attribute, Object, Object> objFieldFunc, BiFunction<Object, Object, Object> mapFieldFunc) {
|
||||
public ProtobufConvert newConvert(final BiFunction<Attribute, Object, Object> objFieldFunc, BiFunction mapFieldFunc) {
|
||||
return newConvert(objFieldFunc, mapFieldFunc, null);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class ProtobufConvert extends BinaryConvert<ProtobufReader, ProtobufWrite
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtobufConvert newConvert(final BiFunction<Attribute, Object, Object> fieldFunc, BiFunction<Object, Object, Object> mapFieldFunc, Function<Object, ConvertField[]> objExtFunc) {
|
||||
public ProtobufConvert newConvert(final BiFunction<Attribute, Object, Object> fieldFunc, BiFunction mapFieldFunc, Function<Object, ConvertField[]> objExtFunc) {
|
||||
return new ProtobufConvert(getFactory(), features) {
|
||||
@Override
|
||||
protected <S extends ProtobufWriter> S configWrite(S writer) {
|
||||
|
||||
@@ -8,6 +8,7 @@ package org.redkale.convert.protobuf;
|
||||
import java.lang.reflect.Type;
|
||||
import org.redkale.convert.*;
|
||||
import org.redkale.util.Attribute;
|
||||
import org.redkale.util.Utility;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -22,6 +23,9 @@ public class ProtobufObjectDecoder<T> extends ObjectDecoder<ProtobufReader, T> {
|
||||
|
||||
@Override
|
||||
protected void initForEachDeMember(ConvertFactory factory, DeMember member) {
|
||||
if(member.getIndex() < 1) {
|
||||
throw new ConvertException(Utility.orElse(member.getField(), member.getMethod()) + " not found @" + ConvertColumn.class.getSimpleName() + ".index");
|
||||
}
|
||||
Attribute attr = member.getAttribute();
|
||||
setTag(member, ProtobufFactory.getTag(attr.field(), attr.genericType(), member.getPosition(), ((ProtobufFactory) factory).enumtostring));
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ package org.redkale.convert.protobuf;
|
||||
import java.lang.reflect.Type;
|
||||
import org.redkale.convert.*;
|
||||
import org.redkale.util.Attribute;
|
||||
import org.redkale.util.Utility;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -21,6 +22,9 @@ public class ProtobufObjectEncoder<T> extends ObjectEncoder<ProtobufWriter, T> {
|
||||
|
||||
@Override
|
||||
protected void initForEachEnMember(ConvertFactory factory, EnMember member) {
|
||||
if (member.getIndex() < 1) {
|
||||
throw new ConvertException(Utility.orElse(member.getField(), member.getMethod()) + " not found @" + ConvertColumn.class.getSimpleName() + ".index");
|
||||
}
|
||||
Attribute attr = member.getAttribute();
|
||||
setTag(member, ProtobufFactory.getTag(attr.field(), attr.genericType(), member.getPosition(), ((ProtobufFactory) factory).enumtostring));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user