package org.onap.aai.introspection;
+import com.google.common.base.CaseFormat;
+
import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.CaseFormat;
-
public abstract class Introspector implements Cloneable {
private static final Logger LOGGER = LoggerFactory.getLogger(Introspector.class);
Class<?> clazz = this.getClass(name);
if (this.isListType(name) && result == null) {
try {
- this.set(convertedName, clazz.newInstance());
+ this.set(convertedName, clazz.getDeclaredConstructor().newInstance());
result = this.get(convertedName);
- } catch (DynamicException | InstantiationException | IllegalAccessException e) {
+ } catch (DynamicException | InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException | NoSuchMethodException | SecurityException e) {
LOGGER.warn(e.getMessage(), e);
}
}
Class<?> clazz = this.getClass(name);
if (this.isListType(name) && value == null) {
try {
- this.set(convertedName, clazz.newInstance());
+ this.set(convertedName, clazz.getDeclaredConstructor().newInstance());
value = this.get(convertedName);
- } catch (DynamicException | InstantiationException | IllegalAccessException e) {
+ } catch (DynamicException | InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException | NoSuchMethodException | SecurityException e) {
LOGGER.warn(e.getMessage(), e);
}
}
Class<?> clazz = this.getClass(name);
if (isListType && value == null) {
try {
- this.set(convertedName, clazz.newInstance());
+ this.set(convertedName, clazz.getDeclaredConstructor().newInstance());
value = this.get(convertedName);
- } catch (DynamicException | InstantiationException | IllegalAccessException e) {
+ } catch (DynamicException | InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException | NoSuchMethodException | SecurityException e) {
LOGGER.warn(e.getMessage(), e);
}
}
if (obj != null) {
try {
- if (! (obj.getClass().getCanonicalName().equals(nameClass.getCanonicalName()))) {
+ if (!(obj.getClass().getCanonicalName().equals(nameClass.getCanonicalName()))) {
if (nameClass.isPrimitive()) {
nameClass = ClassUtils.primitiveToWrapper(nameClass);
result = nameClass.getConstructor(String.class).newInstance(obj.toString());
String indexedKeys = this.getMetadata(ObjectMetadata.INDEXED_PROPS);
if (dslKeys != null) {
Arrays.stream(dslKeys.split(",")).forEach(result::add);
- }
- else if(indexedKeys != null){
+ } else if (indexedKeys != null) {
Arrays.stream(indexedKeys.split(",")).forEach(result::add);
}
this.dslStartNodeProperties = Collections.unmodifiableSet(result);