if (objectFactory == null) {
Class<?> type = resource.getElement().getType();
if (ComponentContext.class.isAssignableFrom(type)) {
objectFactory = new JavaComponentContextFactory(componentContextProvider);
} else if (RequestContext.class.equals(type)) {
objectFactory = new RequestContextObjectFactory(requestContextFactory, componentContextProvider.getComponent());
} else if (String.class.equals(type)) {
objectFactory = new JavaComponentNameFactory(componentContextProvider);
} else {
boolean optional = resource.isOptional();
String mappedName = resource.getMappedName();