Package com.orientechnologies.orient.core.metadata.schema

Examples of com.orientechnologies.orient.core.metadata.schema.OType


    final OBinarySerializerFactory factory = OBinarySerializerFactory.getInstance();
    for (int i = 0; i < keys.size(); i++) {
      final Object key = keys.get(i);

      final OType type;
      if (types.length > i)
        type = types[i];
      else
        type = OType.getTypeByClass(key.getClass());
View Full Code Here


    } else if (OObjectEntitySerializer.isEmbeddedField(iClass, fieldName)) {
      return OType.EMBEDDED;
    } else if (Date.class.isAssignableFrom(f.getType())) {
      return OType.DATETIME;
    } else {
      OType res = OType.getTypeByClass(f.getType());
      if (res != null) {
        return res;
      }
      return OType.getTypeByClass(OObjectEntitySerializer.getBoundClassTarget(f.getType()));
    }
View Full Code Here

        if (isSerializedType(p))
          fieldValue = serializeFieldValue(p.getType(), fieldValue);

        schemaProperty = schemaClass != null ? schemaClass.getProperty(fieldName) : null;
        OType fieldType = schemaProperty != null ? schemaProperty.getType() : getTypeByClass(currentClass, fieldName);

        if (fieldValue != null) {
          if (isEmbeddedObject(p)) {
            // AUTO CREATE SCHEMA CLASS
            if (iRecord.getSchemaClass() == null) {
View Full Code Here

          iType = OType.LINKMAP;
      }
    }

    Object result = iMultiValue;
    final OType linkedType;

    // CREATE THE RETURN MULTI VALUE OBJECT BASED ON DISCOVERED TYPE
    if (iType.equals(OType.EMBEDDEDSET) || iType.equals(OType.LINKSET)) {
      if (isToSerialize(firstValue.getClass()))
        result = new HashSet<Object>();
View Full Code Here

          continue;
        Field f = OObjectEntitySerializer.getField(field, iClass);
        if (f.getType().equals(Object.class) || f.getType().equals(ODocument.class) || f.getType().equals(ORecordBytes.class)) {
          continue;
        }
        OType t = OObjectEntitySerializer.getTypeByClass(iClass, field, f);
        if (t == null) {
          if (f.getType().isEnum())
            t = OType.STRING;
          else {
            t = OType.LINK;
View Full Code Here

  protected Object getDocFieldValue(final Object self, final String fieldName) {
    if (doc.getSchemaClass().existsProperty(fieldName))
      return doc.field(fieldName);
    else {
      OType expected = OObjectEntitySerializer.getTypeByClass(self.getClass(), fieldName);
      if (doc.fieldType(fieldName) != expected)
        doc.field(fieldName, doc.field(fieldName), expected);

      return doc.field(fieldName);
    }
View Full Code Here

    } else if (genericType != null && genericType.isEnum()) {
      Map<Object, Object> map = new HashMap<Object, Object>();
      setDocFieldValue(f.getName(), map, OType.EMBEDDEDMAP);
      value = new OObjectEnumLazyMap(genericType, doc, map, (Map<Object, Object>) value);
    } else if (!(value instanceof OObjectLazyMultivalueElement)) {
      OType type = OObjectEntitySerializer.isEmbeddedField(self.getClass(), f.getName()) ? OType.EMBEDDEDMAP : OType.LINKMAP;
      if (doc.fieldType(f.getName()) != type)
        doc.field(f.getName(), doc.field(f.getName()), type);
      Map<Object, OIdentifiable> docMap = doc.field(f.getName(), type);
      if (docMap == null) {
        docMap = new ORecordLazyMap(doc);
View Full Code Here

        value = new OObjectEnumLazySet(genericType, doc, set, (Set<Object>) value);
      }
    } else if (!(value instanceof OObjectLazyMultivalueElement)) {
      boolean embedded = OObjectEntitySerializer.isEmbeddedField(self.getClass(), f.getName());
      if (value instanceof List) {
        OType type = embedded ? OType.EMBEDDEDLIST : OType.LINKLIST;
        List<OIdentifiable> docList = doc.field(f.getName(), type);
        if (docList == null) {
          docList = new ORecordLazyList(doc);
          setDocFieldValue(f.getName(), docList, type);
        } else if (isFieldUpdate) {
          docList.clear();
        }
        value = new OObjectLazyList(self, docList, value,
            OObjectEntitySerializer.isCascadeDeleteField(self.getClass(), f.getName()));
      } else if (value instanceof Set) {
        OType type = embedded ? OType.EMBEDDEDSET : OType.LINKSET;
        Set<OIdentifiable> docSet = doc.field(f.getName(), type);
        if (docSet == null) {
          docSet = new ORecordLazySet(doc);
          setDocFieldValue(f.getName(), docSet, type);
        } else if (isFieldUpdate) {
View Full Code Here

    return fieldValue;
  }

  public static Object parseStringNumber(final String iValue) {
    final OType t = ORecordSerializerCSVAbstract.getType(iValue);

    if (t == OType.INTEGER)
      return Integer.parseInt(iValue);
    else if (t == OType.LONG)
      return Long.parseLong(iValue);
View Full Code Here

    final boolean updateMode = fieldWalker.updateMode();

    final OClass clazz = document.getSchemaClass();
    for (String fieldName : document.fieldNames()) {

      final OType concreteType = document.fieldType(fieldName);
      OType fieldType = concreteType;

      OType linkedType = null;
      if (fieldType == null && clazz != null) {
        OProperty property = clazz.getProperty(fieldName);
        if (property != null) {
          fieldType = property.getType();
          linkedType = property.getLinkedType();
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.metadata.schema.OType

Copyright © 2018 www.massapicom. 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.