X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=aai-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fintrospection%2FIntrospector.java;fp=aai-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fintrospection%2FIntrospector.java;h=21299f79d9dc7994d740616150ca97e49fbd65cc;hb=86115147f09f2f2a0702a82c1895e13ff7f37131;hp=269d6330f1b140c6534284b977b8535dd34d0e9a;hpb=08c1bd4d78a0504e7531876869a7ae0cd9c448df;p=aai%2Faai-common.git diff --git a/aai-core/src/main/java/org/onap/aai/introspection/Introspector.java b/aai-core/src/main/java/org/onap/aai/introspection/Introspector.java index 269d6330..21299f79 100644 --- a/aai-core/src/main/java/org/onap/aai/introspection/Introspector.java +++ b/aai-core/src/main/java/org/onap/aai/introspection/Introspector.java @@ -24,9 +24,12 @@ import com.att.eelf.configuration.EELFManager; import com.google.common.base.CaseFormat; import org.apache.commons.lang.ClassUtils; import org.eclipse.persistence.exceptions.DynamicException; +import org.onap.aai.config.SpringContextAware; import org.onap.aai.introspection.exceptions.AAIUnknownObjectException; import org.onap.aai.logging.ErrorLogHelper; import org.onap.aai.logging.LogFormatTools; +import org.onap.aai.nodes.CaseFormatStore; +import org.onap.aai.nodes.NodeIngestor; import org.onap.aai.restcore.MediaType; import org.onap.aai.schema.enums.ObjectMetadata; import org.onap.aai.schema.enums.PropertyMetadata; @@ -50,13 +53,26 @@ public abstract class Introspector implements Cloneable { private Set uniqueProperties = null; private Set indexedProperties = null; private Set allKeys = null; + + protected CaseFormatStore caseFormatStore = null; + protected NodeIngestor nodeIngestor; + protected Introspector(Object obj) { + this.nodeIngestor = SpringContextAware.getBean(NodeIngestor.class); + this.caseFormatStore = nodeIngestor.getCaseFormatStore(); } public abstract boolean hasProperty(String name); protected String convertPropertyName (String name) { - return CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, name); + return caseFormatStore + .fromLowerHyphenToLowerCamel(name) + .orElseGet( + () -> { + LOGGER.debug("Unable to find {} in the store from lower hyphen to lower camel", name); + return CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, name); + } + ); } protected abstract Object get(String name); @@ -198,7 +214,7 @@ public abstract class Introspector implements Cloneable { * @param obj the value to be set * @return */ - public void setValue(String name, Object obj) throws IllegalArgumentException { + public void setValue(String name, Object obj) { Object box = this.castValueAccordingToSchema(name, obj); name = convertPropertyName(name); @@ -558,8 +574,6 @@ public abstract class Introspector implements Cloneable { public abstract String marshal(MarshallerProperties properties); - public abstract Object clone(); - public abstract Object getUnderlyingObject(); public String marshal(boolean formatted) {