Instrument a single reference field, using the ConfigReferenceHolder to fetch the real
reference from the cache and replace it with a real object.
352178
private void instrument(CtClass proxy, final SchemaPropertyRef ref) throws Exception {
        final Schema schema = schemas.get(ref.getSchemaName());
        checkNotNull(schema, "Schema not found for SchemaPropertyRef ["+ref+"]");
        final String fieldName = ref.getFieldName();
        // for help on javassist syntax, see chapter around javassist.expr.FieldAccess at
        // http://www.csg.ci.i.u-tokyo.ac.jp/~chiba/javassist/tutorial/tutorial2.html#before
        proxy.instrument(new ExprEditor() {
            public void edit(FieldAccess f) throws CannotCompileException {
                if (f.getFieldName().equals(ref.getFieldName())) {
                    StringBuilder code = new StringBuilder();
                    code.append("{");
                    code.append("$_=("+schema.getType()+") this."+PROXY_FIELD_NAME+".getObjectReference(\""+fieldName+"\", \""+schema.getName()+"\");");
                    code.append("}");
                    f.replace(code.toString());
                }
            }
        });
    }
338868
function PropertyReference(parentReference, propertyKey) {
      _classCallCheck(this, PropertyReference);

      _CachedReference.call(this);

      var parentReferenceTag = parentReference.tag;
      var parentObjectTag = new _glimmerReference.UpdatableTag(_glimmerReference.CURRENT_TAG);

      this.tag = _glimmerReference.combine([parentReferenceTag, parentObjectTag]);
      this._parentReference = parentReference;
      this._parentObjectTag = parentObjectTag;
      this._propertyKey = propertyKey;
    }
673699
def resolve_reference(target_reference, project):
    
    # Separate target name from properties override
    assert isinstance(target_reference, basestring)
    assert isinstance(project, ProjectTarget)
    split = _re_separate_target_from_properties.match (target_reference)
    if not split:
        raise BaseException ("Invalid reference: '%s'" % target_reference)

    id = split.group (1)

    sproperties = []

    if split.group (3):
        sproperties = property.create_from_strings(feature.split(split.group(3)))
        sproperties = feature.expand_composites(sproperties)

    # Find the target
    target = project.find (id)

    return (target, property_set.create(sproperties))
468254
protected int storeReference(Object obj) {
        int newRefId = refId.getAndIncrement();
        //log.trace("storeReference - ref id: {} obj: {}", newRefId, obj);
        refMap.put(Integer.valueOf(newRefId), obj);
        return newRefId;
    }
1018810
def _add_referencer(registry):
    
    referencer = registry.queryUtility(IReferencer)
    if referencer is not None:
        return referencer
    ref = registry.settings['urireferencer.referencer']
    url = registry.settings['urireferencer.registry_url']
    r = DottedNameResolver()
    registry.registerUtility(r.resolve(ref)(url), IReferencer)
    return registry.queryUtility(IReferencer)
363544
function resolveReference(x, isModule) {
	if (x instanceof TReference) {
        if (isBuiltin(x.name))
            return new TBuiltin(x.name)
		if (x.resolution)
			return x.resolution
		if (x.resolving)
			throw new TypeError("Cyclic reference involving " + x)
		x.resolving = true
		var t = lookupInScope(x.scope, x.name, isModule)
		if (!t) {
            t = new TQualifiedReference(x.name) // XXX: for now assume global reference
			// throw new TypeError("Unresolved type: " + x.name)
		}
		t = resolveReference(t, isModule)
		x.resolution = t;
		return t;
	} else if (x instanceof TMember) {
		if (x.resolution)
			return x.resolution
		if (x.resolving)
			throw new TypeError("Cyclic reference involving " + x)
		x.resolving = true
		var base = resolveReference(x.base, true)
		var t = resolveReference(lookupInType(base, x.name, isModule), isModule)
		x.resolution = t
		return t;
    } else if (x instanceof TTypeQuery) {
        if (x.resolution)
            return x.resolution;
        if (x.resolving)
            throw new TypeError("Cyclic reference involving " + x)
        x.resolving = true
        var t = lookupPrtyInScope(x.scope, x.names[0])
        if (!t)
            throw new TypeError("Name not found: " + x.names[0])
        t = resolveReference(t)
        for (var i=1; i<x.names.length; i++) {
            var prty = t.properties.get(x.names[i])
            var module = t.modules.get(x.names[i])
            var t = prty ? prty.type : module;
            if (!t)
                throw new TypeError("Name not found: " + x.names.slice(0,i).join('.'))
            t = resolveReference(t)
        }
        if (t instanceof TObject && !t.qname) {
            t = synthesizeName(t) // don't create aliasing
        }
        x.resolution = t;
        return t;
	} else {
		return x;
	}
}
592137
public static Object getValueOfField(Field field, Object ref) {
		field.setAccessible(true);
		Object value = null;
		try {
			value = field.get(ref);
		} catch (IllegalArgumentException e) {
		} catch (IllegalAccessException e) {
		}
		return value;
	}
1223768
def resolving(self, ref: str):
        
        new_uri = urlparse.urljoin(self.resolution_scope, ref)
        uri, fragment = urlparse.urldefrag(new_uri)

        if normalize(uri) in self.store:
            schema = self.store[normalize(uri)]
        elif not uri or uri == self.base_uri:
            schema = self.schema
        else:
            schema = resolve_remote(uri, self.handlers)
            if self.cache:
                self.store[normalize(uri)] = schema

        old_base_uri, old_schema = self.base_uri, self.schema
        self.base_uri, self.schema = uri, schema
        try:
            with self.in_scope(uri):
                yield resolve_path(schema, fragment)
        finally:
            self.base_uri, self.schema = old_base_uri, old_schema
319554
private Object resolve(FieldData fieldData) {
        Object value;
        if (fieldData.metaData.isThisReference()) {
            // The field is a @This reference
            value = convertThisResourceToFieldType(fieldData);
        } else if (fieldData.metaData.isChildrenAnnotationPresent()) {
            // The field is a collection of @Children
            value = resolveChildren(fieldData);
        } else if (fieldData.metaData.isReference()) {
            // The field is a @Reference
            value = resolveReferenceValueOfField(fieldData);
        } else if (fieldData.metaData.isPropertyType()) {
            // The field points to a property of the resource
            value = resolvePropertyTypedValue(fieldData);
        } else {
            // The field points to another resource
            value = resolveResource(fieldData.path, fieldData.metaData.getType());
        }
        return value;
    }
779522
private void resolveCurrentclassFieldDependencies(final Object reference) {
        for (final FieldInjectionPoint injectionPoint : fieldInjectionPoints) {
            final Object injection = beanManager.getInjectableReference(injectionPoint);
            final Field field = injectionPoint.getAnnotated().getJavaMember();

            try {
                final Field declaredField = proxyClass.getDeclaredField(field.getName());

                if (declaredField.isAnnotationPresent(Inject.class)) {
                    try {
                        declaredField.set(reference, injection);
                    } catch (final Exception e) {
                        throw new RuntimeException(e);
                    }
                }
            } catch (final NoSuchFieldException ex) {
                try {
                    field.set(reference, injection);
                } catch (final Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }
291126
protected void clearReference (DObject reffer, String field, int reffedOid)
    {
        // look up the reference vector for the referenced object
        Reference[] refs = _refs.get(reffedOid);
        Reference ref = null;

        if (refs != null) {
            for (int ii = 0; ii < refs.length; ii++) {
                if (refs[ii].equals(reffer.getOid(), field)) {
                    ref = refs[ii];
                    refs[ii] = null;
                    break;
                }
            }
        }

        // if a referred object and referring object are both destroyed without allowing the
        // referred object destruction to process the ObjectRemoved event which is auto-generated,
        // the subsequent destruction of the referring object will attempt to clear the reference
        // to the referred object which no longer exists; so we don't complain about non- existent
        // references if the referree is already destroyed
        if (ref == null && _objects.containsKey(reffedOid)) {
            log.warning("Requested to clear out non-existent reference",
                        "refferOid", reffer.getOid(), "field", field, "reffedOid", reffedOid);

//        } else {
//            log.info("Cleared out reference " + ref + ".");
        }
    }
287207
public ValueReference getValueReference(ELContext context) {
        // Expected to be over-ridden by implementation
        context.notifyBeforeEvaluation(getExpressionString());
        context.notifyAfterEvaluation(getExpressionString());
        return null;
    }
1207845
public static <T> T convert(TypeReference<T> reference, Object value) throws ConvertException{
		return convert(reference.getType(), value, null);
	}
1337632
public AdvancedModelWrapper loadReferencedModel(Field field, ModelRegistry modelRegistry,
            EngineeringDatabaseService edbService, EDBConverter edbConverter) {
        try {
            ModelDescription description = getModelDescriptionFromField(field);
            String modelKey = (String) FieldUtils.readField(field, model, true);
            if (modelKey == null) {
                return null;
            }
            modelKey = appendContextId(modelKey);
            Class<?> sourceClass = modelRegistry.loadModel(description);
            Object model = edbConverter.convertEDBObjectToModel(sourceClass,
                edbService.getObject(modelKey));
            return new AdvancedModelWrapper((OpenEngSBModel) model);
        } catch (SecurityException e) {
            throw new EKBException(generateErrorMessage(field), e);
        } catch (IllegalArgumentException e) {
            throw new EKBException(generateErrorMessage(field), e);
        } catch (IllegalAccessException e) {
            throw new EKBException(generateErrorMessage(field), e);
        } catch (ClassNotFoundException e) {
            throw new EKBException(generateErrorMessage(field), e);
        }
    }
140204
def update_local_reference(self, index, ref):
        """"""
        self._references[index] = ref
        self.cache()
584953
@Override
    public synchronized T refer() {
        if (proxyIns != null) {
            return proxyIns;
        }

        referenceConfig = new ReferenceConfig<T>();
        covert(consumerConfig, referenceConfig);

        proxyIns = referenceConfig.get();

        return proxyIns;
    }
1354686
public static Object getThis(Object ref) {
        Object thisValue = null;

        // FIXME: We can probably remove this check for IRJSFunctions since we will not be using references
        if (ref instanceof Reference) {
            if (((Reference) ref).isPropertyReference()) {
                thisValue = ((Reference) ref).getBase();
            } else {
                thisValue = ((EnvironmentRecord) ((Reference) ref).getBase()).implicitThisValue();
            }
        }
        return thisValue;
    }