You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by gn...@apache.org on 2018/01/31 21:47:01 UTC

svn commit: r1822838 - in /aries/trunk/blueprint: blueprint-core/src/main/java/org/apache/aries/blueprint/container/ blueprint-core/src/main/java/org/apache/aries/blueprint/ext/impl/ blueprint-core/src/main/java/org/apache/aries/blueprint/utils/ bluepr...

Author: gnodet
Date: Wed Jan 31 21:47:01 2018
New Revision: 1822838

URL: http://svn.apache.org/viewvc?rev=1822838&view=rev
Log:
[ARIES-1106] Injection to support fluent setter methods

Added:
    aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/NonStandardSettersTest.java
    aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/NonStandardSetter.java
    aries/trunk/blueprint/blueprint-core/src/test/resources/test-non-standard-setters.xml
    aries/trunk/blueprint/blueprint-noosgi/dependency-reduced-pom.xml
Modified:
    aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java
    aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/RecipeBuilder.java
    aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java
    aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/ReflectionUtils.java
    aries/trunk/blueprint/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.6.0.xsd
    aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/container/BeanRecipeTest.java
    aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/utils/ReflectionUtilsTest.java
    aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/ExtendedBeanMetadata.java
    aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableBeanMetadata.java
    aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/reflect/BeanMetadataImpl.java

Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java?rev=1822838&r1=1822837&r2=1822838&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java Wed Jan 31 21:47:01 2018
@@ -35,7 +35,6 @@ import org.apache.aries.blueprint.BeanPr
 import org.apache.aries.blueprint.ComponentDefinitionRegistry;
 import org.apache.aries.blueprint.Interceptor;
 import org.apache.aries.blueprint.di.AbstractRecipe;
-import org.apache.aries.blueprint.di.ExecutionContext;
 import org.apache.aries.blueprint.di.Recipe;
 import org.apache.aries.blueprint.proxy.CollaboratorFactory;
 import org.apache.aries.blueprint.proxy.ProxyUtils;
@@ -132,17 +131,19 @@ public class BeanRecipe extends Abstract
     private List<Object> arguments;
     private List<String> argTypes;
     private boolean reorderArguments;
-    private final boolean allowsFieldInjection;
-    private final boolean allowsRawConversion;
+    private final boolean allowFieldInjection;
+    private final boolean allowRawConversion;
+    private final boolean allowNonStandardSetters;
     private BeanMetadata interceptorLookupKey;
     
 
-    public BeanRecipe(String name, ExtendedBlueprintContainer blueprintContainer, Object type, boolean allowsFieldInjection, boolean allowsRawConversion) {
+    public BeanRecipe(String name, ExtendedBlueprintContainer blueprintContainer, Object type, boolean allowFieldInjection, boolean allowRawConversion, boolean allowNonStandardSetters) {
         super(name);
         this.blueprintContainer = blueprintContainer;
         this.type = type;
-        this.allowsFieldInjection = allowsFieldInjection;
-        this.allowsRawConversion = allowsRawConversion;
+        this.allowFieldInjection = allowFieldInjection;
+        this.allowRawConversion = allowRawConversion;
+        this.allowNonStandardSetters = allowNonStandardSetters;
     }
 
     public Object getProperty(String name) {
@@ -420,7 +421,7 @@ public class BeanRecipe extends Abstract
     }
 
     protected Object convert(Object obj, Type from, Type to) throws Exception {
-        if (allowsRawConversion
+        if (allowRawConversion
                 && (from instanceof ParameterizedType || to instanceof ParameterizedType)
                 && GenericType.getConcreteClass(from) == GenericType.getConcreteClass(to)) {
             boolean assignable = true;
@@ -825,7 +826,7 @@ public class BeanRecipe extends Abstract
     }
 
     private ReflectionUtils.PropertyDescriptor getPropertyDescriptor(Class<?> clazz, String name) {
-        for (ReflectionUtils.PropertyDescriptor pd : ReflectionUtils.getPropertyDescriptors(clazz, allowsFieldInjection)) {
+        for (ReflectionUtils.PropertyDescriptor pd : ReflectionUtils.getPropertyDescriptors(clazz, allowFieldInjection, allowNonStandardSetters)) {
             if (pd.getName().equals(name)) {
                 return pd;
             }

Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/RecipeBuilder.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/RecipeBuilder.java?rev=1822838&r1=1822837&r2=1822838&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/RecipeBuilder.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/RecipeBuilder.java Wed Jan 31 21:47:01 2018
@@ -230,27 +230,35 @@ public class RecipeBuilder {
         return beanMetadata.getClassName();        
     }
 
-    private boolean allowsFieldInjection(BeanMetadata beanMetadata) {
+    private boolean allowFieldInjection(BeanMetadata beanMetadata) {
         if (beanMetadata instanceof ExtendedBeanMetadata) {
             return ((ExtendedBeanMetadata) beanMetadata).getFieldInjection();
         }
         return false;
     }
 
-    private boolean allowsRawConversion(BeanMetadata beanMetadata) {
+    private boolean allowRawConversion(BeanMetadata beanMetadata) {
         if (beanMetadata instanceof ExtendedBeanMetadata) {
             return ((ExtendedBeanMetadata) beanMetadata).getRawConversion();
         }
         return false;
     }
 
+    private boolean allowNonStandardSetters(BeanMetadata beanMetadata) {
+        if (beanMetadata instanceof ExtendedBeanMetadata) {
+            return ((ExtendedBeanMetadata) beanMetadata).getNonStandardSetters();
+        }
+        return false;
+    }
+
     private BeanRecipe createBeanRecipe(BeanMetadata beanMetadata) {
         BeanRecipe recipe = new BeanRecipe(
                 getName(beanMetadata.getId()),
                 blueprintContainer,
                 getBeanClass(beanMetadata),
-                allowsFieldInjection(beanMetadata),
-                allowsRawConversion(beanMetadata));
+                allowFieldInjection(beanMetadata),
+                allowRawConversion(beanMetadata),
+                allowNonStandardSetters(beanMetadata));
         // Create refs for explicit dependencies
         recipe.setExplicitDependencies(getDependencies(beanMetadata));
         recipe.setPrototype(MetadataUtil.isPrototypeScope(beanMetadata) || MetadataUtil.isCustomScope(beanMetadata));
@@ -288,7 +296,7 @@ public class RecipeBuilder {
     }
 
     private Recipe createRecipe(RegistrationListener listener) {
-        BeanRecipe recipe = new BeanRecipe(getName(null), blueprintContainer, ServiceListener.class, false, false);
+        BeanRecipe recipe = new BeanRecipe(getName(null), blueprintContainer, ServiceListener.class, false, false, false);
         recipe.setProperty("listener", getValue(listener.getListenerComponent(), null));
         if (listener.getRegistrationMethod() != null) {
             recipe.setProperty("registerMethod", listener.getRegistrationMethod());
@@ -301,7 +309,7 @@ public class RecipeBuilder {
     }
 
     private Recipe createRecipe(ReferenceListener listener) {
-        BeanRecipe recipe = new BeanRecipe(getName(null), blueprintContainer, AbstractServiceReferenceRecipe.Listener.class, false, false);
+        BeanRecipe recipe = new BeanRecipe(getName(null), blueprintContainer, AbstractServiceReferenceRecipe.Listener.class, false, false, false);
         recipe.setProperty("listener", getValue(listener.getListenerComponent(), null));
         recipe.setProperty("metadata", listener);
         recipe.setProperty("blueprintContainer", blueprintContainer);

Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java?rev=1822838&r1=1822837&r2=1822838&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java Wed Jan 31 21:47:01 2018
@@ -95,6 +95,8 @@ public class ExtNamespaceHandler impleme
     
     public static final String FIELD_INJECTION_ATTRIBUTE = "field-injection";
     
+    public static final String NON_STANDARD_SETTERS_ATTRIBUTE = "non-standard-setters";
+
     public static final String DEFAULT_REFERENCE_BEAN = "default";
 
     public static final String FILTER_ATTRIBUTE = "filter";
@@ -182,6 +184,8 @@ public class ExtNamespaceHandler impleme
             return decorateRole(node, component, context);
         } else if (node instanceof Attr && nodeNameEquals(node, FIELD_INJECTION_ATTRIBUTE)) {
             return decorateFieldInjection(node, component, context);
+        } else if (node instanceof Attr && nodeNameEquals(node, NON_STANDARD_SETTERS_ATTRIBUTE)) {
+            return decorateNonStandardSetters(node, component, context);
         } else if (node instanceof Attr && nodeNameEquals(node, DEFAULT_REFERENCE_BEAN)) {
             return decorateDefaultBean(node, component, context);
         } else if (node instanceof Attr && nodeNameEquals(node, FILTER_ATTRIBUTE)) {
@@ -262,6 +266,20 @@ public class ExtNamespaceHandler impleme
         return component;
     }
 
+    private ComponentMetadata decorateNonStandardSetters(Node node, ComponentMetadata component, ParserContext context) {
+        if (!(component instanceof BeanMetadata)) {
+            throw new ComponentDefinitionException("Attribute " + node.getNodeName() + " can only be used on a <bean> element");
+        }
+
+        if (!(component instanceof MutableBeanMetadata)) {
+            throw new ComponentDefinitionException("Expected an instanceof MutableBeanMetadata");
+        }
+
+        String value = ((Attr) node).getValue();
+        ((MutableBeanMetadata) component).setNonStandardSetters("true".equals(value) || "1".equals(value));
+        return component;
+    }
+
     private ComponentMetadata decorateRole(Node node, ComponentMetadata component, ParserContext context) {
         if (!(component instanceof BeanMetadata)) {
             throw new ComponentDefinitionException("Attribute " + node.getNodeName() + " can only be used on a <bean> element");

Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/ReflectionUtils.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/ReflectionUtils.java?rev=1822838&r1=1822837&r2=1822838&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/ReflectionUtils.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/ReflectionUtils.java Wed Jan 31 21:47:01 2018
@@ -201,11 +201,15 @@ public class ReflectionUtils {
     }
 
     public static PropertyDescriptor[] getPropertyDescriptors(Class clazz, boolean allowFieldInjection) {
+        return getPropertyDescriptors(clazz, allowFieldInjection, false);
+    }
+
+    public static PropertyDescriptor[] getPropertyDescriptors(Class clazz, boolean allowFieldInjection, boolean allowNonStandardSetters) {
         PropertyDescriptor[][] properties = beanInfos.get(clazz);
-        int index = allowFieldInjection ? 0 : 1;
+        int index = (allowFieldInjection ? 0 : 2) + (allowNonStandardSetters ? 0 : 1);
         
         if (properties == null) {
-            properties = new PropertyDescriptor[2][];
+            properties = new PropertyDescriptor[4][];
             beanInfos.put(clazz, properties);
         }
         
@@ -216,33 +220,61 @@ public class ReflectionUtils {
             Set<String> illegalProperties = new HashSet<String>();
             
             for (Method method : getPublicMethods(clazz)) {
-                if (Modifier.isStatic(method.getModifiers()) || method.isBridge()) continue;
-                
+                if (Modifier.isStatic(method.getModifiers()) || method.isBridge()) {
+                    continue;
+                }
+
                 String name = method.getName();
                 Class<?> argTypes[] = method.getParameterTypes();
                 Class<?> resultType = method.getReturnType();
                 
                 if (name.length() > 3 && name.startsWith("set") && resultType == Void.TYPE && argTypes.length == 1) {
                     name = decapitalize(name.substring(3));
-                    if (!!!setters.containsKey(name)) setters.put(name, new ArrayList<Method>());
+                    if (!setters.containsKey(name)) {
+                        setters.put(name, new ArrayList<Method>());
+                    }
                     setters.get(name).add(method);
                     propertyNames.add(name);
                 } else if (name.length() > 3 && name.startsWith("get") && resultType != Void.TYPE && argTypes.length == 0) {
                     name = decapitalize(name.substring(3));
-
-                    if (getters.containsKey(name)) illegalProperties.add(name);
-                    else propertyNames.add(name);
-                    
-                    getters.put(name, method);                    
+                    if (getters.containsKey(name)) {
+                        illegalProperties.add(name);
+                    } else {
+                        propertyNames.add(name);
+                    }
+                    getters.put(name, method);
                 } else if (name.length() > 2 && name.startsWith("is") && argTypes.length == 0 && resultType == boolean.class) {
                     name = decapitalize(name.substring(2));
+                    if (getters.containsKey(name)) {
+                        illegalProperties.add(name);
+                    } else {
+                        propertyNames.add(name);
+                    }
+                    getters.put(name, method);
+                }
+            }
+
+            if (allowNonStandardSetters) {
+                for (Method method : getPublicMethods(clazz)) {
+                    if (Modifier.isStatic(method.getModifiers()) || method.isBridge()) {
+                        continue;
+                    }
 
-                    if (getters.containsKey(name)) illegalProperties.add(name);
-                    else propertyNames.add(name);
-                    
-                    getters.put(name, method);                    
+                    String name = method.getName();
+                    Class<?> argTypes[] = method.getParameterTypes();
+                    Class<?> resultType = method.getReturnType();
+
+                    if (!name.startsWith("get") && resultType != Void.TYPE && argTypes.length == 0 && !getters.containsKey(name)) {
+                        getters.put(name, method);
+                        propertyNames.add(name);
+                    } else if (!name.startsWith("set") && resultType == clazz && argTypes.length == 1) {
+                        if (!setters.containsKey(name)) {
+                            setters.put(name, new ArrayList<Method>());
+                        }
+                        setters.get(name).add(method);
+                        propertyNames.add(name);
+                    }
                 }
-                
             }
 
             Map<String, PropertyDescriptor> props = new HashMap<String, PropertyDescriptor>();

Modified: aries/trunk/blueprint/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.6.0.xsd
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.6.0.xsd?rev=1822838&r1=1822837&r2=1822838&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.6.0.xsd (original)
+++ aries/trunk/blueprint/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.6.0.xsd Wed Jan 31 21:47:01 2018
@@ -117,6 +117,8 @@
     
     <xsd:attribute default="false" name="field-injection" type="xsd:boolean"/>
 
+    <xsd:attribute default="false" name="non-standard-setters" type="xsd:boolean"/>
+
     <!-- Default reference bean -->
     <xsd:attribute name="default" type="bp:Tidref"/>
 

Added: aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/NonStandardSettersTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/NonStandardSettersTest.java?rev=1822838&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/NonStandardSettersTest.java (added)
+++ aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/NonStandardSettersTest.java Wed Jan 31 21:47:01 2018
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint;
+
+import org.apache.aries.blueprint.di.Repository;
+import org.apache.aries.blueprint.parser.ComponentDefinitionRegistryImpl;
+import org.apache.aries.blueprint.pojos.NonStandardSetter;
+import org.junit.Test;
+
+public class NonStandardSettersTest extends AbstractBlueprintTest {
+
+    @Test
+    public void testNonStandardSetters() throws Exception {
+        ComponentDefinitionRegistryImpl registry = parse("/test-non-standard-setters.xml");
+        Repository repository = new TestBlueprintContainer(registry).getRepository();
+        NonStandardSetter nss = (NonStandardSetter) repository.create("nss");
+        assertNotNull(nss);
+        assertEquals("value", nss.a());
+    }
+}

Modified: aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/container/BeanRecipeTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/container/BeanRecipeTest.java?rev=1822838&r1=1822837&r2=1822838&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/container/BeanRecipeTest.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/container/BeanRecipeTest.java Wed Jan 31 21:47:01 2018
@@ -147,7 +147,7 @@ public class BeanRecipeTest {
     @Test
     public void parameterWithGenerics() throws Exception {
         BlueprintContainerImpl container = new BlueprintContainerImpl(null, null, null, null, null, null, null, null, null, null);
-        BeanRecipe recipe = new BeanRecipe("example", container, ExampleService.class, false, false);
+        BeanRecipe recipe = new BeanRecipe("example", container, ExampleService.class, false, false, false);
         recipe.setArguments(Arrays.<Object>asList(new ExampleImpl()));
         recipe.setArgTypes(Arrays.<String>asList((String) null));
         ExecutionContext.Holder.setContext(new BlueprintRepository(container));
@@ -157,7 +157,7 @@ public class BeanRecipeTest {
     @Test
     public void parameterWithComplexGenerics1() throws Exception {
         BlueprintContainerImpl container = new BlueprintContainerImpl(null, null, null, null, null, null, null, null, null, null);
-        BeanRecipe recipe = new BeanRecipe("example", container, MyService.class, false, false);
+        BeanRecipe recipe = new BeanRecipe("example", container, MyService.class, false, false, false);
         recipe.setArguments(Arrays.<Object>asList(new MyClass()));
         recipe.setArgTypes(Arrays.<String>asList((String) null));
         ExecutionContext.Holder.setContext(new BlueprintRepository(container));
@@ -167,7 +167,7 @@ public class BeanRecipeTest {
     @Test
     public void parameterWithComplexGenerics2() throws Exception {
         BlueprintContainerImpl container = new BlueprintContainerImpl(null, null, null, null, null, null, null, null, null, null);
-        BeanRecipe recipe = new BeanRecipe("example", container, MyService.class, false, false);
+        BeanRecipe recipe = new BeanRecipe("example", container, MyService.class, false, false, false);
         recipe.setArguments(Arrays.<Object>asList(new MyClass3()));
         recipe.setArgTypes(Arrays.<String>asList((String) null));
         ExecutionContext.Holder.setContext(new BlueprintRepository(container));
@@ -177,7 +177,7 @@ public class BeanRecipeTest {
     @Test
     public void constructorWithGenerics() throws Exception {
         BlueprintContainerImpl container = new BlueprintContainerImpl(null, null, null, null, null, null, null, null, null, null);
-        BeanRecipe recipe = new BeanRecipe("example", container, MessageDriven.class, false, false);
+        BeanRecipe recipe = new BeanRecipe("example", container, MessageDriven.class, false, false, false);
         recipe.setArguments(Arrays.<Object>asList(new DummySequentialPolicy()));
         recipe.setArgTypes(Arrays.<String>asList((String) null));
         ExecutionContext.Holder.setContext(new BlueprintRepository(container));
@@ -187,7 +187,7 @@ public class BeanRecipeTest {
     @Test
     public void constructorWithVarArg() throws Exception {
         BlueprintContainerImpl container = new BlueprintContainerImpl(null, null, null, null, null, null, null, null, null, null);
-        BeanRecipe recipe = new BeanRecipe("example", container, VarArg.class, false, false);
+        BeanRecipe recipe = new BeanRecipe("example", container, VarArg.class, false, false, false);
         recipe.setArguments(Arrays.<Object>asList(Arrays.asList("-web")));
         recipe.setArgTypes(Arrays.<String>asList((String) null));
         ExecutionContext.Holder.setContext(new BlueprintRepository(container));
@@ -262,25 +262,25 @@ public class BeanRecipeTest {
     @Test
     public void protectedClassAccess() throws Exception {
         BlueprintContainerImpl container = new BlueprintContainerImpl(null, null, null, null, null, null, null, null, null, null);
-        BeanRecipe recipe = new BeanRecipe("a", container, null, false, false);
+        BeanRecipe recipe = new BeanRecipe("a", container, null, false, false, false);
         recipe.setFactoryComponent(new PassThroughRecipe("factory", new Factory().create()));
         recipe.setFactoryMethod("getA");
         ExecutionContext.Holder.setContext(new BlueprintRepository(container));
         assertNotNull(recipe.create());
 
-        recipe = new BeanRecipe("b", container, null, false, false);
+        recipe = new BeanRecipe("b", container, null, false, false, false);
         recipe.setFactoryComponent(new PassThroughRecipe("factory", new Factory().create()));
         recipe.setFactoryMethod("getB");
         ExecutionContext.Holder.setContext(new BlueprintRepository(container));
         assertNotNull(recipe.create());
 
-        recipe = new BeanRecipe("c", container, null, false, false);
+        recipe = new BeanRecipe("c", container, null, false, false, false);
         recipe.setFactoryComponent(new PassThroughRecipe("factory", new Factory().create()));
         recipe.setFactoryMethod("getC");
         ExecutionContext.Holder.setContext(new BlueprintRepository(container));
         assertNotNull(recipe.create());
 
-        recipe = new BeanRecipe("d", container, null, false, false);
+        recipe = new BeanRecipe("d", container, null, false, false, false);
         recipe.setFactoryComponent(new PassThroughRecipe("factory", new Factory().create()));
         recipe.setFactoryMethod("getD");
         ExecutionContext.Holder.setContext(new BlueprintRepository(container));
@@ -291,28 +291,28 @@ public class BeanRecipeTest {
             // ok
         }
 
-        recipe = new BeanRecipe("a", container, null, false, false);
+        recipe = new BeanRecipe("a", container, null, false, false, false);
         recipe.setFactoryComponent(new PassThroughRecipe("factory", new Factory()));
         recipe.setFactoryMethod("create");
         recipe.setProperty("a", "a");
         ExecutionContext.Holder.setContext(new BlueprintRepository(container));
         assertNotNull(recipe.create());
 
-        recipe = new BeanRecipe("b", container, null, false, false);
+        recipe = new BeanRecipe("b", container, null, false, false, false);
         recipe.setFactoryComponent(new PassThroughRecipe("factory", new Factory()));
         recipe.setFactoryMethod("create");
         recipe.setProperty("b", "b");
         ExecutionContext.Holder.setContext(new BlueprintRepository(container));
         assertNotNull(recipe.create());
 
-        recipe = new BeanRecipe("c", container, null, false, false);
+        recipe = new BeanRecipe("c", container, null, false, false, false);
         recipe.setFactoryComponent(new PassThroughRecipe("factory", new Factory()));
         recipe.setFactoryMethod("create");
         recipe.setProperty("c", "c");
         ExecutionContext.Holder.setContext(new BlueprintRepository(container));
         assertNotNull(recipe.create());
 
-        recipe = new BeanRecipe("d", container, null, false, false);
+        recipe = new BeanRecipe("d", container, null, false, false, false);
         recipe.setFactoryComponent(new PassThroughRecipe("factory", new Factory()));
         recipe.setFactoryMethod("create");
         recipe.setProperty("d", "d");
@@ -324,7 +324,7 @@ public class BeanRecipeTest {
             // ok
         }
 
-        recipe = new BeanRecipe("a", container, null, false, false);
+        recipe = new BeanRecipe("a", container, null, false, false, false);
         recipe.setFactoryComponent(new PassThroughRecipe("factory", new Factory()));
         recipe.setFactoryMethod("create");
         recipe.setInitMethod("init");

Added: aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/NonStandardSetter.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/NonStandardSetter.java?rev=1822838&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/NonStandardSetter.java (added)
+++ aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/NonStandardSetter.java Wed Jan 31 21:47:01 2018
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.pojos;
+
+public class NonStandardSetter {
+
+    private String a;
+    private String b;
+
+    public NonStandardSetter() {
+    }
+
+    public String a() {
+        return this.a;
+    }
+
+    public NonStandardSetter a(String a) {
+        this.a = a;
+        return this;
+    }
+
+    public String b() {
+        return this.b;
+    }
+
+    public NonStandardSetter b(String b) {
+        this.b = b;
+        return this;
+    }
+
+
+
+}

Modified: aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/utils/ReflectionUtilsTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/utils/ReflectionUtilsTest.java?rev=1822838&r1=1822837&r2=1822838&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/utils/ReflectionUtilsTest.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/utils/ReflectionUtilsTest.java Wed Jan 31 21:47:01 2018
@@ -103,7 +103,7 @@ public class ReflectionUtilsTest {
     
     @Test
     public void testGetterOnly() throws Exception {
-        loadProps(GetterOnly.class, true);
+        loadProps(GetterOnly.class, true, false);
         
         assertEquals(2, sut.length);
         assertEquals("class", sut[0].getName());
@@ -124,7 +124,7 @@ public class ReflectionUtilsTest {
     
     @Test
     public void testSetterOnly() throws Exception {
-        loadProps(SetterOnly.class, false);
+        loadProps(SetterOnly.class, false, false);
         
         assertEquals(2, sut.length);
         assertEquals("field", sut[1].getName());
@@ -146,7 +146,7 @@ public class ReflectionUtilsTest {
     
     @Test
     public void testSetterAndGetter() throws Exception {
-        loadProps(SetterAndGetter.class, false);
+        loadProps(SetterAndGetter.class, false, false);
         
         assertEquals(2, sut.length);
         assertEquals("field", sut[1].getName());
@@ -166,7 +166,7 @@ public class ReflectionUtilsTest {
     
     @Test
     public void testDuplicateGetter() {
-        loadProps(DuplicateGetter.class, false);
+        loadProps(DuplicateGetter.class, false, false);
         
         assertEquals(1, sut.length);
         assertEquals("class", sut[0].getName());
@@ -181,7 +181,7 @@ public class ReflectionUtilsTest {
     
     @Test
     public void testFieldsAndProps() throws Exception {
-        loadProps(FieldsAndProps.class, true);
+        loadProps(FieldsAndProps.class, true, false);
         
         assertEquals(3, sut.length);
         
@@ -213,7 +213,7 @@ public class ReflectionUtilsTest {
     
     @Test
     public void testOverloadedSetters() throws Exception {
-        loadProps(OverloadedSetters.class, false);
+        loadProps(OverloadedSetters.class, false, false);
         
         OverloadedSetters os = new OverloadedSetters();
 
@@ -230,7 +230,7 @@ public class ReflectionUtilsTest {
     
     @Test(expected=ComponentDefinitionException.class)
     public void testApplicableSetter() throws Exception {
-        loadProps(OverloadedSetters.class, false);
+        loadProps(OverloadedSetters.class, false, false);
         
         sut[1].set(new OverloadedSetters(), new Inconvertible(), mockBlueprint);
     }
@@ -242,7 +242,7 @@ public class ReflectionUtilsTest {
     
     @Test(expected=ComponentDefinitionException.class)
     public void testMultipleMatchesByConversion() throws Exception {
-        loadProps(MultipleMatchesByConversion.class, false);
+        loadProps(MultipleMatchesByConversion.class, false, false);
         
         sut[1].set(new MultipleMatchesByConversion(), new HashSet<String>(), mockBlueprint);
     }
@@ -259,14 +259,14 @@ public class ReflectionUtilsTest {
     
     @Test(expected=ComponentDefinitionException.class)
     public void testMultipleSettersMatchByType() throws Exception {
-        loadProps(MultipleMatchesByType.class, false);
+        loadProps(MultipleMatchesByType.class, false, false);
         
         sut[1].set(new MultipleMatchesByType(), new LinkedList<String>(), mockBlueprint);
     }
     
     @Test
     public void testDisambiguationByHierarchy() throws Exception {
-        loadProps(MultipleMatchesByType.class, false);
+        loadProps(MultipleMatchesByType.class, false, false);
         
         sut[2].set(new MultipleMatchesByType(), new ArrayList<String>(), mockBlueprint);
         assertEquals(2, MultipleMatchesByType.field);
@@ -281,16 +281,16 @@ public class ReflectionUtilsTest {
     
     @Test
     public void testNullDisambiguation() throws Exception {
-        loadProps(NullSetterDisambiguation.class, false);
+        loadProps(NullSetterDisambiguation.class, false, false);
         
         sut[1].set(new NullSetterDisambiguation(), null, mockBlueprint);
         assertEquals(-1, NullSetterDisambiguation.field);
     }
     
-    private void loadProps(Class<?> clazz, boolean allowsFieldInjection)
+    private void loadProps(Class<?> clazz, boolean allowFieldInjection, boolean allowNonStandardSetters)
     {
         List<PropertyDescriptor> props = new ArrayList<PropertyDescriptor>(
-                Arrays.asList(ReflectionUtils.getPropertyDescriptors(clazz, allowsFieldInjection)));
+                Arrays.asList(ReflectionUtils.getPropertyDescriptors(clazz, allowFieldInjection, allowNonStandardSetters)));
         
         Collections.sort(props, new Comparator<PropertyDescriptor>() {
             public int compare(PropertyDescriptor o1, PropertyDescriptor o2) {

Added: aries/trunk/blueprint/blueprint-core/src/test/resources/test-non-standard-setters.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/test/resources/test-non-standard-setters.xml?rev=1822838&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/test/resources/test-non-standard-setters.xml (added)
+++ aries/trunk/blueprint/blueprint-core/src/test/resources/test-non-standard-setters.xml Wed Jan 31 21:47:01 2018
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.6.0">
+
+    <bean id="nss" class="org.apache.aries.blueprint.pojos.NonStandardSetter" ext:non-standard-setters="true">
+        <property name="a" value="value"/>
+    </bean>
+
+</blueprint>
\ No newline at end of file

Added: aries/trunk/blueprint/blueprint-noosgi/dependency-reduced-pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/dependency-reduced-pom.xml?rev=1822838&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/dependency-reduced-pom.xml (added)
+++ aries/trunk/blueprint/blueprint-noosgi/dependency-reduced-pom.xml Wed Jan 31 21:47:01 2018
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>parent</artifactId>
+    <groupId>org.apache.aries</groupId>
+    <version>2.0.1</version>
+    <relativePath>../../parent/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.aries.blueprint</groupId>
+  <artifactId>org.apache.aries.blueprint.noosgi</artifactId>
+  <name>Apache Aries Blueprint no-OSGI</name>
+  <version>1.1.3-SNAPSHOT</version>
+  <description>This jar contains everything needed to run Blueprint outside OSGi.</description>
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/blueprint/blueprint-noosgi</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/blueprint/blueprint-noosgi</developerConnection>
+    <url>http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi</url>
+  </scm>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-shade-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <filters>
+                <filter>
+                  <artifact>org.apache.aries.blueprint:org.apache.aries.blueprint.core</artifact>
+                  <excludes>
+                    <exclude>org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe*.class</exclude>
+                    <exclude>org/apache/aries/blueprint/container/BlueprintContainerImpl*.class</exclude>
+                    <exclude>org/apache/aries/blueprint/container/BlueprintEventDispatcher*.class</exclude>
+                    <exclude>org/apache/aries/blueprint/container/BlueprintExtender*.class</exclude>
+                    <exclude>org/apache/aries/blueprint/container/BlueprintQuiesceParticipant*.class</exclude>
+                    <exclude>org/apache/aries/blueprint/container/BlueprintThreadFactory*.class</exclude>
+                    <exclude>org/apache/aries/blueprint/container/GenericType*.class</exclude>
+                    <exclude>org/apache/aries/blueprint/container/NamespaceHandlerRegistry*.class</exclude>
+                    <exclude>org/apache/aries/blueprint/container/ParserServiceImpl*.class</exclude>
+                    <exclude>org/apache/aries/blueprint/container/QuiesceInterceptor*.class</exclude>
+                    <exclude>org/apache/aries/blueprint/container/ReferenceListRecipe*.class</exclude>
+                    <exclude>org/apache/aries/blueprint/container/ReferenceRecipe*.class</exclude>
+                    <exclude>org/apache/aries/blueprint/container/SatisfiableRecipe*.class</exclude>
+                    <exclude>org/apache/aries/blueprint/container/ServiceRecipe*.class</exclude>
+                    <exclude>org/apache/aries/blueprint/ext/AbstractPropertyPlaceholder$LateBindingValueMetadata.class</exclude>
+                    <exclude>org/apache/aries/blueprint/ext/AbstractPropertyPlaceholder.class</exclude>
+                    <exclude>org/apache/aries/blueprint/services/ExtendedBlueprintContainer.class</exclude>
+                    <exclude>org/apache/aries/blueprint/namespace/**</exclude>
+                    <exclude>org/apache/aries/blueprint/utils/ServiceListener.class</exclude>
+                    <exclude>org/apache/aries/blueprint/utils/threading/**</exclude>
+                  </excludes>
+                </filter>
+                <filter>
+                  <artifact>org.apache.aries.proxy:org.apache.aries.proxy.api</artifact>
+                  <excludes>
+                    <exclude>org/apache/aries/proxy/weavinghook/**</exclude>
+                  </excludes>
+                </filter>
+              </filters>
+              <createSourcesJar>${createSourcesJar}</createSourcesJar>
+              <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+              <createDependencyReducedPom>true</createDependencyReducedPom>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <profiles>
+    <profile>
+      <id>dev</id>
+      <properties>
+        <blueprint.core.version>1.8.4-SNAPSHOT</blueprint.core.version>
+        <blueprint.api.version>1.0.2-SNAPSHOT</blueprint.api.version>
+        <blueprint.parser.version>1.5.0-SNAPSHOT</blueprint.parser.version>
+      </properties>
+    </profile>
+    <profile>
+      <id>apache-release</id>
+      <properties>
+        <createSourcesJar>true</createSourcesJar>
+      </properties>
+    </profile>
+  </profiles>
+  <properties>
+    <blueprint.core.version>1.4.3</blueprint.core.version>
+    <blueprint.api.version>1.0.1</blueprint.api.version>
+    <proxy.impl.version>1.0.3</proxy.impl.version>
+    <blueprint.parser.version>1.3.1</blueprint.parser.version>
+  </properties>
+</project>
+

Modified: aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/ExtendedBeanMetadata.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/ExtendedBeanMetadata.java?rev=1822838&r1=1822837&r2=1822838&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/ExtendedBeanMetadata.java (original)
+++ aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/ExtendedBeanMetadata.java Wed Jan 31 21:47:01 2018
@@ -53,4 +53,10 @@ public interface ExtendedBeanMetadata ex
      * @return The type of conversion.
      */
     boolean getRawConversion();
+
+    /**
+     * Whether setters returning non void types can be used or not.
+     * @return a boolean allowing the used of non standard setters
+     */
+    boolean getNonStandardSetters();
 }

Modified: aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableBeanMetadata.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableBeanMetadata.java?rev=1822838&r1=1822837&r2=1822838&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableBeanMetadata.java (original)
+++ aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableBeanMetadata.java Wed Jan 31 21:47:01 2018
@@ -63,4 +63,5 @@ public interface MutableBeanMetadata ext
 
     void setRawConversion(boolean rawConversion);
 
+    void setNonStandardSetters(boolean nonStandardSetters);
 }

Modified: aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/reflect/BeanMetadataImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/reflect/BeanMetadataImpl.java?rev=1822838&r1=1822837&r2=1822838&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/reflect/BeanMetadataImpl.java (original)
+++ aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/reflect/BeanMetadataImpl.java Wed Jan 31 21:47:01 2018
@@ -52,6 +52,7 @@ public class BeanMetadataImpl extends Co
     private boolean processor;
     private boolean fieldInjection;
     private boolean rawConversion;
+    private boolean nonStandardSetters;
     
     public BeanMetadataImpl() {
         this.fieldInjection = false;
@@ -77,9 +78,11 @@ public class BeanMetadataImpl extends Co
             this.runtimeClass = ((ExtendedBeanMetadata) source).getRuntimeClass();
             this.fieldInjection = ((ExtendedBeanMetadata) source).getFieldInjection();
             this.rawConversion = ((ExtendedBeanMetadata) source).getRawConversion();
+            this.nonStandardSetters = ((ExtendedBeanMetadata) source).getNonStandardSetters();
         } else {
             this.fieldInjection = false;
             this.rawConversion = false;
+            this.nonStandardSetters = false;
         }
     }
     
@@ -225,6 +228,15 @@ public class BeanMetadataImpl extends Co
         this.rawConversion = rawConversion;
     }
 
+    public boolean getNonStandardSetters() {
+        return nonStandardSetters;
+    }
+
+    @Override
+    public void setNonStandardSetters(boolean nonStandardSetters) {
+        this.nonStandardSetters = nonStandardSetters;
+    }
+
     @Override
     public String toString() {
         return "BeanMetadata[" +