Get the foreign field that references this record.
There can be more than one, so supply an index until you get a null.
@param iCount The index of the reference to retrieve
@return The referenced field
339815
public BaseField getReferencedField(int iIndex)
    {
        if (m_recordMain != null)
            return m_recordMain.getKeyArea().getField(iIndex);
        if (iIndex == 0)
            return m_fldMainFile;
        if (iIndex == 1)
            return m_fldMainFile2;
        if (iIndex == 2)
            return m_fldMainFile3;
        return null;
    }
620369
private static Field recordIdFieldIn(Class klass) {
        for (Field field : klass.getDeclaredFields()) {
            if (field.isAnnotationPresent(RecordId.class)) {
                return field;
            }
        }
        Class superclass = klass.getSuperclass();
        if (superclass != null) {
            return recordIdFieldIn(superclass);
        }
        throw new RecordIdNotFoundException(klass);
    }
187871
@SuppressWarnings("unchecked")
	public static <T> T getValueOf(Field field, Object reference, Class<?> referenceClazz, Class<T> valueType) {
		try {
			field.setAccessible(true);
			Object toReturn = (T) field.get(reference);
			if (String.class.isInstance(valueType.getClass()) && !String.class.isInstance(toReturn.getClass())) {
				toReturn = toReturn.toString();
			}
			return (T) toReturn;
		} catch (Exception e) {
			log.warning(e.getClass().getSimpleName() + ": " + e.getMessage());
			return null;
		}
	}
1237629
public LoadStoreCount getLoadStoreCount(XField field) {
        LoadStoreCount loadStoreCount = loadStoreCountMap.get(field);
        if (loadStoreCount == null) {
            loadStoreCount = new LoadStoreCount();
            loadStoreCountMap.put(field, loadStoreCount);
        }
        return loadStoreCount;
    }
973055
protected function getValueFromReferencedEntity(FieldInterface $field)
    {
        $references = $this->model->referredIn($field->name());
        foreach ($references as $foreign => $reference) {
            $entity = $this->accessor->getPropertyValue($this->instance, $reference->container());

            if ($entity === null) {
                continue;
            }

            $value = $this->accessor->getPropertyValue($entity, $foreign);
            $this->accessor->setPropertyValue($this->instance, $field->name(), $value);
            break;
        }
    }
1000437
public static Object getValue(final Object iObject, final int iIndex) {
    if (iObject == null)
      return null;

    if (!isMultiValue(iObject))
      return null;

    if (iIndex > getSize(iObject))
      return null;

    try {
      if (iObject instanceof List<?>)
        return ((List<?>) iObject).get(iIndex);
      else if (iObject instanceof Set<?>) {
        int i = 0;
        for (Object o : ((Set<?>) iObject)) {
          if (i++ == iIndex) {
            return o;
          }
        }
      } else if (iObject instanceof Map<?, ?>) {
        int i = 0;
        for (Object o : ((Map<?, ?>) iObject).values()) {
          if (i++ == iIndex) {
            return o;
          }
        }
      } else if (iObject.getClass().isArray())
        return Array.get(iObject, 0);
    } catch (Exception e) {
      // IGNORE IT
      OLogManager.instance().debug(iObject, "Error on reading the first item of the Multi-value field '%s'", iObject);
    }
    return null;
  }
1267168
public int getRecordCount(Rec record)
    {
        int iRecordCount = 1;
        if ((this.getNodeType() == MessageRecordDesc.NON_UNIQUE_NODE)
            && (!this.isSingleDetail(record)))
                iRecordCount = Integer.MAX_VALUE;   // Until EOF
        return iRecordCount;
    }
1203251
public BaseField setupField(int iFieldSeq)
    {
        BaseField field = null;
        //if (iFieldSeq == 0)
        //{
        //  field = new CounterField(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        //  field.setHidden(true);
        //}
        //if (iFieldSeq == 1)
        //{
        //  field = new RecordChangedField(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null, null);
        //  field.setHidden(true);
        //}
        //if (iFieldSeq == 2)
        //{
        //  field = new BooleanField(this, DELETED, Constants.DEFAULT_FIELD_LENGTH, null, new Boolean(false));
        //  field.setHidden(true);
        //}
        if (iFieldSeq == 3)
            field = new StringField(this, DESCRIPTION, 30, null, null);
        if (iFieldSeq == 4)
            field = new StringField(this, CODE, 15, null, null);
        if (iFieldSeq == 5)
            field = new ShortField(this, LEVEL, Constants.DEFAULT_FIELD_LENGTH, null, new Short((short)1));
        if (iFieldSeq == 6)
            field = new ContactTypeField(this, PARENT_CONTACT_TYPE_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        if (iFieldSeq == 7)
            field = new ImageField(this, ICON, Constants.DEFAULT_FIELD_LENGTH, null, null);
        if (iFieldSeq == 8)
            field = new StringField(this, RECORD_CLASS, 128, null, null);
        if (field == null)
            field = super.setupField(iFieldSeq);
        return field;
    }
337260
def get_referenced_object(self):
        

        if self._TabUsageSingle is not None:
            return self._TabUsageSingle

        if self._TabUsageMultiple is not None:
            return self._TabUsageMultiple

        raise exception.BunqException(self._ERROR_NULL_FIELDS)
1357341
public BaseField getField(int iKeyFieldSeq)
    {
        if (this.getKeyField(iKeyFieldSeq) == null)
            return null;
        return this.getKeyField(iKeyFieldSeq).getField(DBConstants.FILE_KEY_AREA);
    }
779274
@SuppressWarnings("static-method")
	public Integer findIntValue(JvmAnnotationReference reference) {
		assert reference != null;
		for (final JvmAnnotationValue value : reference.getValues()) {
			if (value instanceof JvmIntAnnotationValue) {
				for (final Integer intValue : ((JvmIntAnnotationValue) value).getValues()) {
					if (intValue != null) {
						return intValue;
					}
				}
			}
		}
		return null;
	}
658316
public BaseField getField(String strTableName, int iFieldSeq)   // Lookup this field
    {
        if (this.getRecord(strTableName) != this)
            return null;
        return this.getField(iFieldSeq);
    }
1192865
public int getRecordCount(FieldTable table)
    {
        int iKeyOrder = table.getRecord().getDefaultOrder();
        if (iKeyOrder == -1)
            iKeyOrder = Constants.MAIN_KEY_AREA;
        return this.getPKeyArea(iKeyOrder).getRecordCount();
    }
1165924
public FieldInfo getField(int iKeyFieldSeq)
    {
        if (iKeyFieldSeq >= m_vKeyFieldList.size())
            return null;
        return (FieldInfo)m_vKeyFieldList.elementAt(iKeyFieldSeq);
    }
1247742
public AccrueType getAccrueType(int field)
   {
      AccrueType result;

      if ((field < m_fields.length) && (m_fields[field].length() != 0))
      {
         result = AccrueTypeUtility.getInstance(m_fields[field], m_locale);
      }
      else
      {
         result = null;
      }

      return (result);
   }
644841
public BaseField setupField(int iFieldSeq)
    {
        BaseField field = null;
        //if (iFieldSeq == 0)
        //{
        //  field = new CounterField(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        //  field.setHidden(true);
        //}
        //if (iFieldSeq == 1)
        //{
        //  field = new RecordChangedField(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null, null);
        //  field.setHidden(true);
        //}
        //if (iFieldSeq == 2)
        //{
        //  field = new BooleanField(this, DELETED, Constants.DEFAULT_FIELD_LENGTH, null, new Boolean(false));
        //  field.setHidden(true);
        //}
        if (iFieldSeq == 3)
        {
            field = new ResourceField(this, RESOURCE_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
            field.setNullable(false);
        }
        if (iFieldSeq == 4)
            field = new StringField(this, CODE, 40, null, null);
        if (iFieldSeq == 5)
        {
            field = new StringField(this, LANGUAGE, 2, null, null);
            field.setNullable(false);
        }
        if (iFieldSeq == 6)
        {
            field = new StringField(this, LOCALE, 2, null, null);
            field.setNullable(false);
        }
        if (iFieldSeq == 7)
            field = new StringField(this, KEY_VALUE, 80, null, null);
        if (iFieldSeq == 8)
            field = new MemoField(this, OBJECT_VALUE, Constants.DEFAULT_FIELD_LENGTH, null, null);
        if (field == null)
            field = super.setupField(iFieldSeq);
        return field;
    }
1212842
public IndexDoc getNextDoc(String field, int previousDocId) {
    if (fieldReferences.containsKey(field)) {
      FieldReferences fr = fieldReferences.get(field);
      try {
        if (previousDocId < 0) {
          return new IndexDoc(fr.refIndexDoc);
        } else {
          int nextDocId = previousDocId + 1;
          IndexInput inIndexDocId = indexInputList.get("indexDocId");
          ArrayList<MtasTreeHit<?>> list = CodecSearchTree.advanceMtasTree(
              nextDocId, inIndexDocId, fr.refIndexDocId, fr.refIndexDoc);
          if (list.size() == 1) {
            IndexInput inDoc = indexInputList.get("doc");
            inDoc.seek(list.get(0).ref);
            return new IndexDoc(inDoc.getFilePointer());
          }
        }
      } catch (IOException e) {
        log.debug(e);
        return null;
      }
    }
    return null;
  }