public static Component create(InputStream xml, Object controller,
AttributeFilter... attributeFilters) {
Binder binder = new Binder();
// Inflate the XML to a component (tree).
LayoutInflater inflater = new LayoutInflater();
if (attributeFilters != null) {
for (AttributeFilter filter : attributeFilters) {
inflater.addAttributeFilter(filter);
}
}
Component result = inflater.inflate(xml,
binder.getAlreadyAssignedFields(controller));
// Bind to controller.
binder.bind(result, controller);
return result;