Search in sources :

Example 1 with MutableBeanArgument

use of org.apache.aries.blueprint.mutable.MutableBeanArgument in project aries by apache.

the class AbstractPropertyPlaceholder method processBeanMetadata.

protected Metadata processBeanMetadata(BeanMetadata component) {
    for (BeanArgument arg : component.getArguments()) {
        try {
            processingStack.add("Argument index " + arg.getIndex() + " and value type " + arg.getValueType() + "->");
            if (arg instanceof MutableBeanArgument) {
                ((MutableBeanArgument) arg).setValue(processMetadata(arg.getValue()));
            } else {
                //Say that we can't change this argument, but continue processing
                //If the value is mutable then we may be ok!
                printWarning(arg, "Constructor Argument");
                processMetadata(arg.getValue());
            }
        } finally {
            processingStack.removeLast();
        }
    }
    for (BeanProperty prop : component.getProperties()) {
        try {
            processingStack.add("Property named " + prop.getName() + "->");
            if (prop instanceof MutableBeanProperty) {
                ((MutableBeanProperty) prop).setValue(processMetadata(prop.getValue()));
            } else {
                //Say that we can't change this property, but continue processing
                //If the value is mutable then we may be ok!
                printWarning(prop, "Injection Property");
                processMetadata(prop.getValue());
            }
        } finally {
            processingStack.removeLast();
        }
    }
    Target factoryComponent = component.getFactoryComponent();
    if (factoryComponent != null) {
        try {
            if (component instanceof MutableBeanMetadata) {
                processingStack.add("Factory Component->");
                ((MutableBeanMetadata) component).setFactoryComponent((Target) processMetadata(factoryComponent));
            } else {
                printWarning(component, "Factory Component");
                processingStack.add("Factory Component->");
                processMetadata(factoryComponent);
            }
        } finally {
            processingStack.removeLast();
        }
    }
    return component;
}
Also used : MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata) MutableBeanArgument(org.apache.aries.blueprint.mutable.MutableBeanArgument) BeanArgument(org.osgi.service.blueprint.reflect.BeanArgument) Target(org.osgi.service.blueprint.reflect.Target) MutableBeanArgument(org.apache.aries.blueprint.mutable.MutableBeanArgument) MutableBeanProperty(org.apache.aries.blueprint.mutable.MutableBeanProperty) BeanProperty(org.osgi.service.blueprint.reflect.BeanProperty) MutableBeanProperty(org.apache.aries.blueprint.mutable.MutableBeanProperty)

Aggregations

MutableBeanArgument (org.apache.aries.blueprint.mutable.MutableBeanArgument)1 MutableBeanMetadata (org.apache.aries.blueprint.mutable.MutableBeanMetadata)1 MutableBeanProperty (org.apache.aries.blueprint.mutable.MutableBeanProperty)1 BeanArgument (org.osgi.service.blueprint.reflect.BeanArgument)1 BeanProperty (org.osgi.service.blueprint.reflect.BeanProperty)1 Target (org.osgi.service.blueprint.reflect.Target)1