// If this annotation is not present on the class in question, no action must be taken.
if (annotation != null)
{
// Create a UIOutput instance by passing javax.faces.Output. to
// Application.createComponent(java.lang.String).
UIOutput output = (UIOutput) createComponent(UIOutput.COMPONENT_TYPE);
// Get the annotation instance from the class and obtain the values of the name, library, and
// target attributes.
String name = annotation.name();
if (name != null && name.length() > 0)
{
name = ELText.parse(getExpressionFactory(), context.getELContext(), name).toString(context.getELContext());
}
// Obtain the renderer-type for the resource name by passing name to
// ResourceHandler.getRendererTypeForResourceName(java.lang.String).
// (note that we can not use this.getResourceHandler(), because the Application might be wrapped)
String rendererType = context.getApplication().getResourceHandler().getRendererTypeForResourceName(name);
// Call setRendererType on the UIOutput instance, passing the renderer-type.
output.setRendererType(rendererType);
// Obtain the Map of attributes from the UIOutput component by calling UIComponent.getAttributes().
Map<String, Object> attributes = output.getAttributes();
// Store the name into the attributes Map under the key "name".
attributes.put("name", name);
// If library is the empty string, let library be null.