org.openliberty.openaz.pep
Interface JavaObjectMapper

All Known Implementing Classes:
SimpleJavaObjectMapper, SimpleJavaPermissionMapper

public interface JavaObjectMapper

JavaObjectMapper is responsible for converting a POJO into an AzWrapperRequestObject. The conversion for the most part consists of setting attributes of the object. Basically mapping the information in the native Java Object to a set of simple name-value pairs. JavaObjectMapper are configured for each of the AzWrapperRequestObjectFactory instances associated with the PepRequestFactory. This allows for each category (Subject,Action,Resource and Environment ) to have their own mappers.

Author:
Josh Bregman, Rich Levinson, Prateek Mishra
See Also:
AzWrapperRequestObject

Method Summary
 boolean canMapObject(java.lang.Object obj)
          Returns true if the Mapper can map the Object that is passed in as the parameter to this method, false otherwise.
 java.util.Set<java.lang.Class> getSupportedClasses()
          Returns a Set of all the classes that are supported by the Mapper that implements this interface.
<T extends java.lang.Enum<T>>
AzWrapperRequestObject<T>
map(java.lang.Object javaObject, AzWrapperRequestObject<T> azWrapperObject)
          Performs the mapping of a Object to an AzWrapperRequestObject.
 

Method Detail

canMapObject

boolean canMapObject(java.lang.Object obj)
Returns true if the Mapper can map the Object that is passed in as the parameter to this method, false otherwise.

Parameters:
obj - Java Object (ex: Permission) which needs to be mapped to an AzWrapperRequestObject
Returns:
true if this JavaObjectMapper can map the obj, false otherwise

map

<T extends java.lang.Enum<T>> AzWrapperRequestObject<T> map(java.lang.Object javaObject,
                                                            AzWrapperRequestObject<T> azWrapperObject)
                                                        throws PepException
Performs the mapping of a Object to an AzWrapperRequestObject. The reason for returning the AzWrapperRequestObject is to allow for a mapper to simply reuse some existing state, like a cached AzEntity. The JavaObjectMapper simply needs to get the AzEntity from the Object and instantiate a new AzWrapperRequestObject from it.

Parameters:
javaObject -
azWrapperObject -
Returns:
Throws:
PepException

getSupportedClasses

java.util.Set<java.lang.Class> getSupportedClasses()
Returns a Set of all the classes that are supported by the Mapper that implements this interface.

Returns:
a set of class objects