org.apache.felix.ipojo.handlers.providedservice.strategy

## Class ErrorPrintingServiceFactoryProxy

- java.lang.Object
- - org.apache.felix.ipojo.handlers.providedservice.strategy.ErrorPrintingServiceFactoryProxy

All Implemented Interfaces:
  java.lang.reflect.InvocationHandler

    public class ErrorPrintingServiceFactoryProxy
    extends java.lang.Object
    implements java.lang.reflect.InvocationHandler

This proxy class is here to wrap an iPOJO ServiceFactory. If the consumer of this service do not call the getService or ungetService methods, it will get an Exception with an explicit error message telling him that this service is only usable through iPOJO.

Author:
  Felix Project Team

### Constructor Summary

Constructors
Constructor and Description
`ErrorPrintingServiceFactoryProxy(IPOJOServiceFactory factory)` Wraps a ServiceFactory in an InvocationHandler that will delegate only get/ungetService methods to the factory.

### Method Summary

All Methods Instance Methods Concrete Methods
`java.lang.Object` `invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)` 'Invoke' methods called when a method is called on the proxy.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ErrorPrintingServiceFactoryProxy

    public ErrorPrintingServiceFactoryProxy(IPOJOServiceFactory factory)

Wraps a ServiceFactory in an InvocationHandler that will delegate only get/ungetService methods to the factory. All other methods will be rejected with a meaningful error message.

Parameters:
  `factory` - delegating iPOJO ServiceFactory

### Method Detail

#### invoke

    public java.lang.Object invoke(java.lang.Object proxy,
                                   java.lang.reflect.Method method,
                                   java.lang.Object[] args)
                            throws java.lang.Exception

'Invoke' methods called when a method is called on the proxy.

Specified by:
  `invoke` in interface `java.lang.reflect.InvocationHandler`
Parameters:
  `proxy` - the proxy
  `method` - the method
  `args` - the arguments
Returns:
  the result
Throws:
  `java.lang.Exception` - if something wrong happens
See Also:
  `InvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])`