Exemplo n.º 1
0
  public AbsObject externalizeSpecialType(
      Object obj, ObjectSchema schema, Class javaClass, Ontology referenceOnto)
      throws OntologyException {
    try {
      AbsObject abs = schema.newInstance();

      Introspectable intro = (Introspectable) obj;
      intro.externalise(abs, referenceOnto);
      return abs;
    } catch (OntologyException oe) {
      // Just forward the exception
      throw oe;
    } catch (ClassCastException cce) {
      throw new OntologyException("Object " + obj + " is not Introspectable");
    } catch (Throwable t) {
      throw new OntologyException("Schema and Java class do not match", t);
    }
  }
Exemplo n.º 2
0
  public Object internalizeSpecialType(
      AbsObject abs, ObjectSchema schema, Class javaClass, Ontology referenceOnto)
      throws OntologyException {
    try {
      Object obj = javaClass.newInstance();
      // DEBUG System.out.println("Object created");

      Introspectable intro = (Introspectable) obj;
      intro.internalise(abs, referenceOnto);
      return intro;
    } catch (OntologyException oe) {
      // Just forward the exception
      throw oe;
    } catch (ClassCastException cce) {
      throw new OntologyException("Class for type " + abs.getTypeName() + " is not Introspectable");
    } catch (Throwable t) {
      throw new OntologyException("Schema and Java class do not match", t);
    }
  }