diff options
author | Jim Hahn <jrh3@att.com> | 2019-02-12 13:17:09 -0500 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-02-12 13:45:41 -0500 |
commit | 3cc17f964e46578f8ff6275072d1c77dafa551dd (patch) | |
tree | 6d6184907913d03686fecf4c41b93e49b0a6b2b6 /gson/src/main/java/org/onap/policy/common/gson/internal/Adapter.java | |
parent | 13ca63c40a379f95539cb4882ec2b645cd0c2a48 (diff) |
Add jackson behavior for methods
Added classes to make gson treat methods as jackson does.
Remove unneeded "forGetter" parameter from constructors.
Fixed sonar issue with too long "if" test.
Corrected comment about annotation names.
Adjusted error message.
Removed unused constant.
Removed trailing spaces.
Change-Id: I3a4fc92193737a0dc89f1218e70f093aedbdb152
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'gson/src/main/java/org/onap/policy/common/gson/internal/Adapter.java')
-rw-r--r-- | gson/src/main/java/org/onap/policy/common/gson/internal/Adapter.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/gson/src/main/java/org/onap/policy/common/gson/internal/Adapter.java b/gson/src/main/java/org/onap/policy/common/gson/internal/Adapter.java index b4ef53f7..bb8672bb 100644 --- a/gson/src/main/java/org/onap/policy/common/gson/internal/Adapter.java +++ b/gson/src/main/java/org/onap/policy/common/gson/internal/Adapter.java @@ -86,12 +86,11 @@ public class Adapter { * * @param gson Gson object providing type adapters * @param accessor method used to access the item from within an object - * @param forGetter {@code true} if the name is for a "getter" method, {@code false} - * if for a "setter" * @param valueType the class of value on which this operates */ - public Adapter(Gson gson, Method accessor, boolean forGetter, Type valueType) { - this.propName = (forGetter ? detmGetterPropName(accessor) : detmSetterPropName(accessor)); + public Adapter(Gson gson, Method accessor, Type valueType) { + boolean forSetter = (accessor.getReturnType() == void.class); + this.propName = (forSetter ? detmSetterPropName(accessor) : detmGetterPropName(accessor)); this.reader = new ConvInfo(TypeToken.get(valueType)); this.gson = gson; this.fullName = getQualifiedName(accessor); |