Examples of LiteralTransformer


Examples of com.dooapp.gaedo.blueprints.transformers.LiteralTransformer

  public static Object createInstance(Vertex key) {
    String effectiveType = key.getProperty(Properties.type.name()).toString();
    try {
      Class effectiveClass = Class.forName(effectiveType);
      if(Literals.containsKey(effectiveClass)) {
        LiteralTransformer transformer = Literals.get(effectiveClass);
        return transformer.loadObject(effectiveClass, key);
      } else {
        return  effectiveClass.newInstance();
      }
    } catch(Exception e) {
      throw new UnableToCreateException(effectiveType, e);
View Full Code Here

Examples of com.dooapp.gaedo.blueprints.transformers.LiteralTransformer

  public static Vertex getVertexForLiteral(GraphDatabaseDriver database, Object value) {
    Vertex returned = null;
    // Now distinct behaviour between known objects and unknown ones
    Class<? extends Object> valueClass = value.getClass();
    if(Literals.containsKey(valueClass)) {
      LiteralTransformer transformer = Literals.get(valueClass);
      returned = transformer.getVertexFor(database, valueClass.cast(value));
    } else {
      throw new ObjectIsNotARealLiteralException(value, valueClass);
      // TODO do not forget to set id property
    }
    return returned;
View Full Code Here

Examples of com.dooapp.gaedo.blueprints.transformers.LiteralTransformer

    if(classLoader==null) {
      throw new UnspecifiedClassLoader();
    }
    try {
      if(Literals.containsKey(classLoader, effectiveType) && !repository.containsKey(effectiveType)) {
        LiteralTransformer transformer = Literals.get(classLoader, effectiveType);
        return transformer.loadObject(driver, classLoader, effectiveType, key);
      } else {
        Class<?> type = classLoader.loadClass(effectiveType);
        if(Tuples.containsKey(type) && !repository.containsKey(type)) {
          // Tuples are handled the object way (easier, but more dangerous
          TupleTransformer transformer = Tuples.get(type);
          return transformer.loadObject(driver, strategy, classLoader, type, key, repository, objectsBeingAccessed);
        } else {
          return  type.newInstance();
        }
      }
    } catch(Exception e) {
View Full Code Here

Examples of com.dooapp.gaedo.blueprints.transformers.LiteralTransformer

    Vertex returned = null;
    try {
      if (Literals.containsKey(valueClass)) {
        // some literals aren't so ... literal, as they can accept
        // incoming connections (like classes)
        LiteralTransformer literalTransformer = Literals.get(valueClass);
        Kind kind = literalTransformer.getKind();
        returned = database.addVertex(kind.getURIFor(vertexId, valueClass));
        if (Kind.literal.equals(kind)) {
          returned.setProperty(Properties.type.name(), TypeUtils.getType(valueClass));
        }
      } else {
View Full Code Here

Examples of com.dooapp.gaedo.blueprints.transformers.LiteralTransformer

    visitor.visit(this);
  }

  @Override
  protected boolean callMatchLiteral(Vertex currentVertex, Property finalProperty) {
    LiteralTransformer used = Literals.get(finalProperty.getGenericType());
    if(used==null) {
      throw new UnsupportedOperationException(finalProperty+" doesn't seems to store literal value. How could we check its value then ?");
    } else {
      return used.isVertexEqualsTo(getDriver(), currentVertex, getExpectedAsValue());
    }
  }
View Full Code Here

Examples of com.dooapp.gaedo.blueprints.transformers.LiteralTransformer

  public static Vertex getVertexForLiteral(GraphDatabaseDriver database, Object value, CascadeType cascade) {
    Vertex returned = null;
    // Now distinct behaviour between known objects and unknown ones
    Class<? extends Object> valueClass = value.getClass();
    if (Literals.containsKey(valueClass)) {
      LiteralTransformer transformer = Literals.get(valueClass);
      returned = transformer.getVertexFor(database, valueClass.cast(value), cascade);
    } else {
      throw new ObjectIsNotARealLiteralException(value, valueClass);
      // TODO do not forget to set id property
    }
    return returned;
View Full Code Here

Examples of com.dooapp.gaedo.blueprints.transformers.LiteralTransformer

    if (classLoader == null) {
      throw new UnspecifiedClassLoader();
    }
    try {
      if (Literals.containsKey(classLoader, effectiveType) && !repository.containsKey(effectiveType)) {
        LiteralTransformer transformer = Literals.get(classLoader, effectiveType);
        return transformer.loadObject(driver, classLoader, effectiveType, key);
      } else {
        Class<?> type = loadClass(classLoader, effectiveType);
        if (Tuples.containsKey(type) && !repository.containsKey(type)) {
          // Tuples are handled the object way (easier, but more
          // dangerous
          TupleTransformer transformer = Tuples.get(type);
          return transformer.loadObject(driver, strategy, classLoader, type, key, repository, objectsBeingAccessed);
        } else {
          return type.newInstance();
        }
      }
    } catch (Exception e) {
View Full Code Here

Examples of com.dooapp.gaedo.blueprints.transformers.LiteralTransformer

  public static Vertex getVertexForLiteral(IndexableGraph database, Object value) {
    Vertex returned = null;
    // Now distinct behaviour between known objects and unknown ones
    Class<? extends Object> valueClass = value.getClass();
    if(Literals.containsKey(valueClass)) {
      LiteralTransformer transformer = Literals.get(valueClass);
      returned = transformer.getVertexFor(database, valueClass.cast(value));
    } else {
      throw new ObjectIsNotARealLiteralException(value, valueClass);
      // TODO do not forget to set id property
    }
    return returned;
View Full Code Here

Examples of com.dooapp.gaedo.blueprints.transformers.LiteralTransformer

      throw new UnspecifiedClassLoader();
    }
    try {
      Class effectiveClass = classLoader.loadClass(effectiveType);
      if(Literals.containsKey(effectiveClass) && !repository.containsKey(effectiveClass)) {
        LiteralTransformer transformer = Literals.get(effectiveClass);
        return transformer.loadObject(effectiveClass, key);
      } else if(Tuples.containsKey(effectiveClass) && !repository.containsKey(effectiveClass)) {
        TupleTransformer transformer = Tuples.get(effectiveClass);
        return transformer.loadObject(classLoader, effectiveClass, key, repository, objectsBeingAccessed);
      } else {
        return  effectiveClass.newInstance();
      }
    } catch(Exception e) {
      throw new UnableToCreateException(effectiveType, e);
View Full Code Here

Examples of com.dooapp.gaedo.blueprints.transformers.LiteralTransformer

  public static Vertex getVertexForLiteral(GraphDatabaseDriver database, Object value, CascadeType cascade) {
    Vertex returned = null;
    // Now distinct behaviour between known objects and unknown ones
    Class<? extends Object> valueClass = value.getClass();
    if (Literals.containsKey(valueClass)) {
      LiteralTransformer transformer = Literals.get(valueClass);
      returned = transformer.getVertexFor(database, valueClass.cast(value), cascade);
    } else {
      throw new ObjectIsNotARealLiteralException(value, valueClass);
      // TODO do not forget to set id property
    }
    return returned;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.