Object reference;
if (URL.class.equals(type)) {
reference = new URLReference(referenceInfo.resourceID);
} else if (type.isAnnotationPresent(ManagedBean.class)) {
ManagedBean managed = type.getAnnotation(ManagedBean.class);
String name = managed.value().length() == 0 ? type.getSimpleName() : managed.value();
reference = new LinkRef("module/" + name);
} else if (Request.class.equals(type)) {
reference = new ObjectReference(ThreadLocalContextManager.REQUEST);
} else if (UriInfo.class.equals(type)) {
reference = new ObjectReference(ThreadLocalContextManager.URI_INFO);