diff options
author | Instrumental <jonathan.gathman@att.com> | 2018-10-19 04:33:21 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2018-10-19 04:35:28 -0500 |
commit | f20e40368fa73dc7951044e05c6fd39a06bf86f5 (patch) | |
tree | 0de203623de0b0b976cf1aac2903c0c9c987974b /cadi | |
parent | e18eecbea001562d1e1a19cdccfe1684b3da05f7 (diff) |
GUI fixes
Issue-ID: AAF-578,AAF-579
Change-Id: I579876777815b2e9f0693e08cc57e5b17c74cf9b
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'cadi')
-rw-r--r-- | cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java | 24 |
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"); } |