Package org.ops4j.pax.reflector

The Reflector API is fairly simple and a single interface represents everything that it can do.

See:
          Description

Interface Summary
ReflectorService The ReflectorService allows you to traverse object instances in a running application.
RemoteReflector The RemoteReflector is not yet ready for usage, since we have some issue in the OSGi environment.
 

Exception Summary
ReflectionException ReflectionException is thrown when the ReflectorService can not proceed with its operation.
 

Package org.ops4j.pax.reflector Description

The Reflector API is fairly simple and a single interface represents everything that it can do. See the ReflectorService for full details.

An important aspect of the Pax Reflector is the object naming using a dot-notation. The TypeHandlers are involved to parse this, fairly simple, syntax. The standard TypeHandlers uses the JavaBeans specification. Here are some translation examples;

Object NameExecuted code
abc.Def.Rst reflector.getRootObject("abc").getDef().getRst()
abc.MyMap['def'].Rst reflector.getRootObject("abc").getMyMap().get("def").getRst()
abc.SomeArray['5'] reflector.getRootObject("abc").getSomeArray()[5]
abc.SomeList['5'] reflector.getRootObject("abc").getSomeList().getAt(5)

Both getters/setters as well as public member fields in the classes are checked to resolve the object name. For instance;

Object NameExecuted code
abc.def.rst reflector.getRootObject("abc").def.rst
abc.myMap['def'].Rst reflector.getRootObject("abc").myMap().get("def").getRst()
abc.someArray['5'] reflector.getRootObject("abc").someArray[5]
abc.SomeList['5'] reflector.getRootObject("abc").someList.getAt(5)

Pax Reflector can also be enabled to directly access the private members in the classes instead of going via the getters and setters. By default this is disabled.

The single quotes on arguments within brackets are optional.



Copyright © 2006-2012 OPS4J - Open Participation Software for Java. All Rights Reserved.