Dear Felix Team,

we came across an unsupported feature we would like to use, while using iPOJO service injection. When defining a service via the @Requires annotation it is possible to define a fallback service at the same time ("defaultclass" being a Class object). When this property is left out, iPOJO provides a default service using a Java Proxy (org.apache.felix.ipojo.handlers.dependency.NullableObject). This proxy delivers hard-coded default values (0 or false) according to the requested return type.

Our goal is to use a custom Proxy as fallback service. This proxy can generically handle methods for different use cases. This would be great, for example, for services that are not able to provide certain aspects of their functionality by throwing an exception, whereas other aspects can be implemented by returning a default value different to 0 or false.

One idea to achieve this, could be by implementing a new iPOJO interface extending InvocationHandler (with org.apache.felix.ipojo.handlers.dependency.NullableObject being a subclass of). Another idea would be by defining another property for the @Requires annotation, which will be checked and handled inside org.apache.felix.ipojo.handlers.dependency.Dependency.start().

Maybe you guys came across this request before and came up with a solution already. Or mabye you have different ideas to achieve this feature. We would be more than happy to discuss this idea with you or implement this feature ourselves.

Best regards,
Hendrik Nunner

Reply via email to