graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientVertex.java
private List<OTriple<String, Direction, String>> getConnectionFields(final Direction iDirection, String... iClassNames) {
    final ODocument doc = getRecord();
    List<OTriple<String, Direction, String>> result = new ArrayList<>();

    if (settings.isUseVertexFieldsForEdgeLabels()) {
      if (iClassNames == null || iClassNames.length == 0 || (iClassNames.length == 1 && iClassNames[0].equalsIgnoreCase("E"))) {
        for (String fieldName : doc.fieldNames()) {
          final OPair<Direction, String> connection = getConnection(iDirection, fieldName, iClassNames);
          if (connection != null)
            result.add(new OTriple<String, Direction, String>(fieldName, connection.getKey(), connection.getValue()));
        }
      } else {
        OSchema schema = getGraph().getRawGraph().getMetadata().getSchema();

        Set<String> allClassNames = new HashSet<String>();
        for (String className : iClassNames) {
          allClassNames.add(className);
          OClass clazz = schema.getClass(className);
          if (clazz != null) {
            Collection<OClass> subClasses = clazz.getAllSubclasses();
            for (OClass subClass : subClasses) {
              allClassNames.add(subClass.getName());
            }
          }
        }

        for (String className : allClassNames) {
          switch (iDirection) {
          case OUT:
            result.add(new OTriple<String, Direction, String>(CONNECTION_OUT_PREFIX + className, Direction.OUT, className));
            break;
          case IN:
            result.add(new OTriple<String, Direction, String>(CONNECTION_IN_PREFIX + className, Direction.IN, className));
            break;
          case BOTH:
            result.add(new OTriple<String, Direction, String>(CONNECTION_OUT_PREFIX + className, Direction.OUT, className));
            result.add(new OTriple<String, Direction, String>(CONNECTION_IN_PREFIX + className, Direction.IN, className));
            break;
          }
        }
      }
    } else {
      if (iDirection == Direction.OUT)
        result.add(new OTriple<String, Direction, String>(OrientBaseGraph.CONNECTION_OUT, Direction.OUT, null));
      else if (iDirection == Direction.IN)
        result.add(new OTriple<String, Direction, String>(OrientBaseGraph.CONNECTION_IN, Direction.IN, null));
      else {
        result.add(new OTriple<String, Direction, String>(OrientBaseGraph.CONNECTION_OUT, Direction.OUT, null));
        result.add(new OTriple<String, Direction, String>(OrientBaseGraph.CONNECTION_IN, Direction.IN, null));
      }
    }

    // EARLY FETCH ALL THE FIELDS THAT MATTERS
    String[] fieldNames = new String[result.size()];
    int i = 0;
    for (OTriple<String, Direction, String> connectionField : result)
      fieldNames[i++] = connectionField.getKey();
    doc.deserializeFields(fieldNames);

    return result;
  }
private List<OTriple<String, Direction, String>> getConnectionFields(final Direction iDirection, String... iClassNames) {
    final ODocument doc = getRecord();
    List<OTriple<String, Direction, String>> result = new ArrayList<>();

    if (settings.isUseVertexFieldsForEdgeLabels()) {
      if (iClassNames == null || iClassNames.length == 0 || (iClassNames.length == 1 && iClassNames[0].equalsIgnoreCase("E"))) {
        for (String fieldName : doc.fieldNames()) {
          final OPair<Direction, String> connection = getConnection(iDirection, fieldName, iClassNames);
          if (connection != null)
            result.add(new OTriple<String, Direction, String>(fieldName, connection.getKey(), connection.getValue()));
        }
      } else {
        OSchema schema = getGraph().getRawGraph().getMetadata().getSchema();

        Set<String> allClassNames = new HashSet<String>();
        for (String className : iClassNames) {
          allClassNames.add(className);
          OClass clazz = schema.getClass(className);
          if (clazz != null) {
            Collection<OClass> subClasses = clazz.getAllSubclasses();
            for (OClass subClass : subClasses) {
              allClassNames.add(subClass.getName());
            }
          }
        }

        for (String className : allClassNames) {
          switch (iDirection) {
          case OUT:
            result.add(new OTriple<String, Direction, String>(CONNECTION_OUT_PREFIX + className, Direction.OUT, className));
            break;
          case IN:
            result.add(new OTriple<String, Direction, String>(CONNECTION_IN_PREFIX + className, Direction.IN, className));
            break;
          case BOTH:
            result.add(new OTriple<String, Direction, String>(CONNECTION_OUT_PREFIX + className, Direction.OUT, className));
            result.add(new OTriple<String, Direction, String>(CONNECTION_IN_PREFIX + className, Direction.IN, className));
            break;
          }
        }
      }
    } else {
      if (iDirection == Direction.OUT)
        result.add(new OTriple<String, Direction, String>(OrientBaseGraph.CONNECTION_OUT, Direction.OUT, null));
      else if (iDirection == Direction.IN)
        result.add(new OTriple<String, Direction, String>(OrientBaseGraph.CONNECTION_IN, Direction.IN, null));
      else {
        result.add(new OTriple<String, Direction, String>(OrientBaseGraph.CONNECTION_OUT, Direction.OUT, null));
        result.add(new OTriple<String, Direction, String>(OrientBaseGraph.CONNECTION_IN, Direction.IN, null));
      }
    }

    // EARLY FETCH ALL THE FIELDS THAT MATTERS
    String[] fieldNames = new String[result.size()];
    int i = 0;
    for (OTriple<String, Direction, String> connectionField : result)
      fieldNames[i++] = connectionField.getKey();
    doc.deserializeFields(fieldNames);

    return result;
  }
Returns all the possible fields names to look for.

@param iDirection  Direction to check
@param iClassNames Optional array of class names

@return The array of field names