diff options
Diffstat (limited to 'branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java')
-rw-r--r-- | branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java b/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java index 695722be18..ada0c94a8d 100644 --- a/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java +++ b/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java @@ -138,16 +138,26 @@ public final class SDOContextHelper { } try { Type type = helperContext.getTypeHelper().getType(javaType); - if (type != null && (!type.isDataType())) { + return register(helperContext, type); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public static boolean register(HelperContext helperContext, Type type) { + if (type != null && (!type.isDataType())) { + try { Method method = type.getClass().getMethod("getEPackage"); Object factory = method.invoke(type, new Object[] {}); method = factory.getClass().getMethod("register", HelperContext.class); method.invoke(factory, new Object[] {helperContext}); return true; + } catch (Exception e) { + e.printStackTrace(); + return false; } + } else { return false; - } catch (Exception e) { - throw new TransformationException(e); } } |