mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 03:15:32 -04:00
#984 extract method for annotation value check
This commit is contained in:
parent
916fba5d39
commit
5063d314a5
@ -1828,7 +1828,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
JSONPropertyName annotation = getAnnotation(method, JSONPropertyName.class);
|
JSONPropertyName annotation = getAnnotation(method, JSONPropertyName.class);
|
||||||
if (annotation != null && annotation.value() != null && !annotation.value().isEmpty()) {
|
if (annotationValueNotEmpty(annotation)) {
|
||||||
return annotation.value();
|
return annotation.value();
|
||||||
}
|
}
|
||||||
String key;
|
String key;
|
||||||
@ -1854,6 +1854,15 @@ public class JSONObject {
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks if the annotation is not null and the {@link JSONPropertyName#value()} is not null and is not empty.
|
||||||
|
* @param annotation the annotation to check
|
||||||
|
* @return true if the annotation and the value is not null and not empty, false otherwise.
|
||||||
|
*/
|
||||||
|
private static boolean annotationValueNotEmpty(JSONPropertyName annotation) {
|
||||||
|
return annotation != null && annotation.value() != null && !annotation.value().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the method is valid for the {@link #populateMap(Object, Set, JSONParserConfiguration)} use case
|
* Checks if the method is valid for the {@link #populateMap(Object, Set, JSONParserConfiguration)} use case
|
||||||
* @param method the Method to check
|
* @param method the Method to check
|
||||||
|
Loading…
x
Reference in New Issue
Block a user