summaryrefslogtreecommitdiffstats
path: root/cadi
diff options
context:
space:
mode:
authorvarun gudisena <vg411h@att.com>2018-10-19 09:49:08 +0000
committerGerrit Code Review <gerrit@onap.org>2018-10-19 09:49:08 +0000
commitc3726105c664d089158f095d3a353815d1c3de00 (patch)
tree39933e2e870436a758e35258e962f54dc1b5d627 /cadi
parent0ac6c16a32316de9d561888f17c7f7626b2f19c7 (diff)
parentf20e40368fa73dc7951044e05c6fd39a06bf86f5 (diff)
Merge "GUI fixes"
Diffstat (limited to 'cadi')
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java24
1 files changed, 17 insertions, 7 deletions
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java
index 70ca577a..7f419433 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java
@@ -99,16 +99,26 @@ public class Examples {
version = "v2_0";
}
- Class<?> cls;
- try {
- cls = Examples.class.getClassLoader().loadClass("aaf."+version+'.'+className);
- } catch (ClassNotFoundException e) {
- throw new APIException(e);
- }
+ Class<?> cls=null;
+ int minorIdx = version.indexOf('_');
+ if(minorIdx<0) {
+ throw new APIException("Invalid Interface Version " + version);
+ }
+ int minor = Integer.parseInt(version.substring(minorIdx+1));
+ String vprefix=version.substring(0, minorIdx+1);
+ while(cls==null && minor>=0) {
+ try {
+ cls = Examples.class.getClassLoader().loadClass("aaf."+vprefix+minor+'.'+className);
+ } catch (ClassNotFoundException e) {
+ if(--minor<0) {
+ throw new APIException("No Example for Version " + version + " found.");
+ }
+ }
+ }
Method meth;
try {
- meth = Examples.class.getDeclaredMethod("new"+cls.getSimpleName()+version,boolean.class);
+ meth = Examples.class.getDeclaredMethod("new"+cls.getSimpleName()+vprefix+minor,boolean.class);
} catch (Exception e) {
throw new APIException("ERROR: " + cls.getName() + " does not have an Example in Code. Request from AAF Developers");
}