object/src/main/java/com/orientechnologies/orient/object/enhancement/field/ODocumentSimpleFieldHandlingStrategy.java
protected OType deriveFieldType(ODocument iRecord, String fieldName, OType requestedFieldType) {

    // Schema defined types can not be ignored
    if (iRecord.getSchemaClass().existsProperty(fieldName)) {
      return iRecord.getSchemaClass().getProperty(fieldName).getType();
    }

    // New type
    if (requestedFieldType != null) {
      return requestedFieldType;
    }

    // Existing type (not fixed by the schema)
    return iRecord.fieldType(fieldName);
  }
protected OType deriveFieldType(ODocument iRecord, String fieldName, OType requestedFieldType) {

    // Schema defined types can not be ignored
    if (iRecord.getSchemaClass().existsProperty(fieldName)) {
      return iRecord.getSchemaClass().getProperty(fieldName).getType();
    }

    // New type
    if (requestedFieldType != null) {
      return requestedFieldType;
    }

    // Existing type (not fixed by the schema)
    return iRecord.fieldType(fieldName);
  }
Derives the type of a field in a document.

@param iRecord
@param fieldName
@param requestedFieldType
@return derived field type