This commit is contained in:
redkale
2024-09-29 12:15:23 +08:00
parent f42ff13824
commit bc4b3ab17f
3 changed files with 4 additions and 9 deletions

View File

@@ -699,7 +699,7 @@ public final class ApiDocCommand {
factory, factory,
logger, logger,
componentsMap, componentsMap,
((SimpledCoder) member.getEncoder()).getType(), TypeToken.typeToClass(((SimpledCoder) member.getEncoder()).getType()),
((SimpledCoder) member.getEncoder()).getType(), ((SimpledCoder) member.getEncoder()).getType(),
new LinkedHashMap<>(), new LinkedHashMap<>(),
true); true);
@@ -756,7 +756,7 @@ public final class ApiDocCommand {
} }
return sb + (array ? "_Array" : "_Collection"); return sb + (array ? "_Array" : "_Collection");
} else if (encodeable instanceof SimpledCoder) { } else if (encodeable instanceof SimpledCoder) {
Class stype = ((SimpledCoder) encodeable).getType(); Class stype = TypeToken.typeToClass(((SimpledCoder) encodeable).getType());
if (stype.isPrimitive() if (stype.isPrimitive()
|| stype == Boolean.class || stype == Boolean.class
|| Number.class.isAssignableFrom(stype) || Number.class.isAssignableFrom(stype)

View File

@@ -110,9 +110,4 @@ public class OptionalCoder<R extends Reader, W extends Writer, T> extends Simple
} }
return Optional.ofNullable(this.decoder.convertFrom(in)); return Optional.ofNullable(this.decoder.convertFrom(in));
} }
@Override
public Class getType() {
return Optional.class;
}
} }

View File

@@ -32,7 +32,7 @@ public abstract class SimpledCoder<R extends Reader, W extends Writer, T>
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public Class<T> getType() { public Type getType() {
if (type == null) { if (type == null) {
Type[] ts = ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments(); Type[] ts = ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments();
type = ts[ts.length - 1]; type = ts[ts.length - 1];
@@ -40,7 +40,7 @@ public abstract class SimpledCoder<R extends Reader, W extends Writer, T>
throw new ConvertException(type + " is not class"); throw new ConvertException(type + " is not class");
} }
} }
return (Class<T>) type; return type;
} }
@Override @Override