org.openpermis.editor.policy.beans
Class PropertyAccess

java.lang.Object
  extended by org.openpermis.editor.policy.beans.PropertyAccess

public class PropertyAccess
extends Object

Helper class that provides access to Java Bean properties.

Since:
0.1.0

Field Summary
private  Object bean
          The bean this support class operates on.
private static org.slf4j.Logger LOGGER
          The logger object of this class.
 
Constructor Summary
PropertyAccess(Object bean)
          Creates a bean property access object for the specified Java Bean.
 
Method Summary
 boolean canGetProperty(String property)
          Check if the bean has a property that can be read.
 boolean canGetSetProperty(String property)
          Check if the bean has a property that can be read and written.
 boolean canSetProperty(String property)
          Check if the bean has a property that can be written.
private  void checkProperty(String property)
          Checks if the property is valid.
 Object get(String property)
          Calls the getter of the property of the bean bound to this access object.
 void set(String property, Object value)
          Calls the setter of the property of the bean bound to this access object.
protected  void warn(String message, Throwable cause)
          Logs a warning with the specified message and cause.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final org.slf4j.Logger LOGGER
The logger object of this class.

Since:
0.1.0

bean

private final Object bean
The bean this support class operates on.

Since:
0.1.0
Constructor Detail

PropertyAccess

public PropertyAccess(Object bean)
Creates a bean property access object for the specified Java Bean.

Parameters:
bean - the Java Bean to operate on, must not be null.
Since:
0.1.0
Method Detail

warn

protected void warn(String message,
                    Throwable cause)
Logs a warning with the specified message and cause.

Parameters:
message - the message to log.
cause - the cause.
Since:
0.1.0

checkProperty

private void checkProperty(String property)
Checks if the property is valid.

Parameters:
property - the property to check.
Throws:
IllegalArgumentException - if the property is invalid.
Since:
0.1.0

canGetProperty

public boolean canGetProperty(String property)
Check if the bean has a property that can be read.

Parameters:
property - the property to check.
Returns:
true if the bean has the property and it can be read.
Since:
0.1.0

canSetProperty

public boolean canSetProperty(String property)
Check if the bean has a property that can be written.

Parameters:
property - the property to check.
Returns:
true if the bean has the property and it can be written.
Since:
0.1.0

canGetSetProperty

public boolean canGetSetProperty(String property)
Check if the bean has a property that can be read and written.

Parameters:
property - the property to check.
Returns:
true if the bean has the property and it can be read and written.
Since:
0.1.0

set

public void set(String property,
                Object value)
Calls the setter of the property of the bean bound to this access object.

Parameters:
property - the property to set, must not be null or empty.
value - the value to set at the bean, may (of course) be null.
Throws:
IllegalArgumentException - if the bean does not have the property or the value specified is of an incompatible type.
IllegalStateException - if the bean reports an error.
Since:
0.1.0

get

public Object get(String property)
Calls the getter of the property of the bean bound to this access object.

Parameters:
property - the property to request the value for, must not be null or empty.
Returns:
the property value requested.
Throws:
IllegalArgumentException - if the bean does not have the property.
IllegalStateException - if the bean reports an error.
Since:
0.1.0


PERMIS Role Based Access Control 0.3.0 (Build 14)
2009/05/08 09:06:48
Copyright (c) 2002-2007 Ergon Informatik AG