IntelliJ Inspect various improvements

This commit is contained in:
Rob Bygrave committed 2022-08-27 22:37:48 +12:00
1 parent 81ef967d9f
commit 0c2ab729bc
5 files changed
+5 -20

No files matched your search

@@ -780,6 +780,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
}
}
@SuppressWarnings("unchecked")
@Override
public void jsonRead(SpiJsonReader readJson, EntityBean bean) throws IOException {
if (jsonDeserialize && targetDescriptor != null) {
@@ -106,10 +106,7 @@ final class ReadAnnotationConfig {
if (javaxValidation != null && javaxValidation.isValidationNotNull(property)) {
return true;
}
if (jakartaValidation != null && jakartaValidation.isValidationNotNull(property)) {
return true;
}
return false;
return jakartaValidation != null && jakartaValidation.isValidationNotNull(property);
}
/**
@@ -122,7 +122,6 @@ public final class DJsonContext implements SpiJsonContext {
@Override
public <T> T toBean(Class<T> cls, JsonParser parser, JsonReadOptions options) throws JsonIOException {
BeanDescriptor<T> desc = getDescriptor(cls);
try {
return desc.jsonRead(new ReadJson(desc, parser, options, determineObjectMapper(options), false), null, null);
@@ -156,9 +155,9 @@ public final class DJsonContext implements SpiJsonContext {
toBean(target, parser, null);
}
@SuppressWarnings("unchecked")
@Override
public <T> void toBean(T target, JsonParser parser, JsonReadOptions options) throws JsonIOException {
BeanDescriptor<T> desc = (BeanDescriptor<T>) getDescriptor(target.getClass());
try {
desc.jsonRead(new ReadJson(desc, parser, options, determineObjectMapper(options), target != null), null, target);
@@ -169,14 +168,12 @@ public final class DJsonContext implements SpiJsonContext {
@Override
public <T> DJsonBeanReader<T> createBeanReader(Class<T> cls, JsonParser parser, JsonReadOptions options) throws JsonIOException {
BeanDescriptor<T> desc = getDescriptor(cls);
return new DJsonBeanReader<>(desc, new ReadJson(desc, parser, options, determineObjectMapper(options), false));
}
@Override
public <T> DJsonBeanReader<T> createBeanReader(BeanType<T> beanType, JsonParser parser, JsonReadOptions options) throws JsonIOException {
BeanDescriptor<T> desc = (BeanDescriptor<T>) beanType;
SpiJsonReader readJson = new ReadJson(desc, parser, options, determineObjectMapper(options), false);
return new DJsonBeanReader<>(desc, readJson);
@@ -209,7 +206,6 @@ public final class DJsonContext implements SpiJsonContext {
@Override
public <T> List<T> toList(Class<T> cls, JsonParser src, JsonReadOptions options) throws JsonIOException {
BeanDescriptor<T> desc = getDescriptor(cls);
SpiJsonReader readJson = new ReadJson(desc, src, options, determineObjectMapper(options), false);
try {
@@ -241,19 +237,16 @@ public final class DJsonContext implements SpiJsonContext {
@Override
public Object toObject(Type genericType, String json) throws JsonIOException {
return toObject(genericType, createParser(new StringReader(json)));
}
@Override
public Object toObject(Type genericType, Reader json) throws JsonIOException {
return toObject(genericType, createParser(json));
}
@Override
public Object toObject(Type genericType, JsonParser jsonParser) throws JsonIOException {
TypeInfo info = ParamTypeHelper.getTypeInfo(genericType);
ManyType manyType = info.getManyType();
switch (manyType) {
@@ -362,7 +355,6 @@ public final class DJsonContext implements SpiJsonContext {
@SuppressWarnings("unchecked")
private void toJsonInternal(Object value, JsonGenerator gen, JsonWriteOptions options) throws IOException {
if (value == null) {
gen.writeNull();
} else if (value instanceof Number) {
@@ -392,7 +384,6 @@ public final class DJsonContext implements SpiJsonContext {
@Override
public SpiJsonReader createJsonRead(BeanType<?> beanType, String json) {
BeanDescriptor<?> desc = (BeanDescriptor<?>) beanType;
JsonParser parser = createParser(new StringReader(json));
return new ReadJson(desc, parser, null, defaultObjectMapper, false);
@@ -415,7 +406,6 @@ public final class DJsonContext implements SpiJsonContext {
}
private <T> void toJsonFromCollection(Collection<T> collection, String key, JsonGenerator gen, JsonWriteOptions options) throws IOException {
if (key != null) {
gen.writeFieldName(key);
}
@@ -429,7 +419,6 @@ public final class DJsonContext implements SpiJsonContext {
}
private void toJsonFromMap(Map<Object, Object> map, JsonGenerator gen, JsonWriteOptions options) throws IOException {
Set<Entry<Object, Object>> entrySet = map.entrySet();
Iterator<Entry<Object, Object>> it = entrySet.iterator();
@@ -480,10 +480,8 @@ public final class OrmQueryDetail implements Serializable {
if (create && props == null) {
props = new OrmQueryProperties(path);
fetch(props);
return props;
} else {
return props;
}
return props;
}
/**
@@ -161,7 +161,7 @@ class ScalarTypeArrayList extends ScalarTypeArrayBase<List> implements ScalarTyp
/**
* Convert from the json types to the proper scalar types (uuid, enum, double etc)
*/
@SuppressWarnings("rawtypes")
@SuppressWarnings({"rawtypes", "unchecked"})
private List convert(List<Object> rawList) {
List list = new ArrayList(rawList.size());
for (Object rawVal : rawList) {