Use isAssignableFrom instead 41/101541/1
authorDavid Brilla <david.brilla@tieto.com>
Tue, 11 Feb 2020 14:32:52 +0000 (15:32 +0100)
committerDavid Brilla <david.brilla@tieto.com>
Tue, 11 Feb 2020 16:02:16 +0000 (17:02 +0100)
Change from class -> string -> equals to isAssignableFrom

Issue-ID: AAI-2786
Change-Id: I0f48ad5b7ad5728b397c54bfa883fea9431dd0a5
Signed-off-by: David Brilla <david.brilla@tieto.com>
aai-core/src/main/java/org/onap/aai/introspection/Introspector.java

index 9e599a6..11e6233 100644 (file)
@@ -177,7 +177,7 @@ public abstract class Introspector implements Cloneable {
         if (obj != null) {
 
             try {
-                if (!obj.getClass().getName().equals(nameClass.getName())) {
+                if (!nameClass.isAssignableFrom(obj.getClass())) {
                     if (nameClass.isPrimitive()) {
                         nameClass = ClassUtils.primitiveToWrapper(nameClass);
                         result = nameClass.getConstructor(String.class).newInstance(obj.toString());
@@ -349,7 +349,7 @@ public abstract class Introspector implements Cloneable {
     /**
      * This will returned the generic parameterized type of the underlying
      * object if it exists
-     * 
+     *
      * @param name
      * @return the generic type of the java class of the underlying object
      */
@@ -414,7 +414,7 @@ public abstract class Introspector implements Cloneable {
 
     /**
      * Is this type not a Java String or primitive
-     * 
+     *
      * @param name
      * @return
      */