org.progeeks.util
Class TypedPropertyAccess

java.lang.Object
  extended by org.progeeks.util.TypedPropertyAccess
All Implemented Interfaces:
PropertyAccess

public class TypedPropertyAccess
extends java.lang.Object
implements PropertyAccess

Looks up an appropriate PropertyAccess object using instanceof checks on the target object. PropertyAccess objects can be registered in the order that they should be searched.

Version:
$Revision: 1.3 $
Author:
Paul Speed

Nested Class Summary
protected static class TypedPropertyAccess.AccessEntry
           
 
Constructor Summary
TypedPropertyAccess()
           
TypedPropertyAccess(PropertyAccess defaultAccess)
           
 
Method Summary
 boolean addPropertyChangeListener(java.lang.Object object, java.beans.PropertyChangeListener listener)
          Adds the specified property change listener to the specified object using whatever implementation specific way is most friendly.
 boolean addPropertyChangeListener(java.lang.Object object, java.lang.String property, java.beans.PropertyChangeListener listener)
          Adds the specified property change listener to the specified object using whatever implementation specific way is most friendly.
protected  PropertyAccess getAccess(java.lang.Object target)
           
 PropertyAccess getDefaultPropertyAccess()
           
protected  TypedPropertyAccess.AccessEntry[] getEntries()
           
 java.lang.Object getProperty(java.lang.Object object, java.lang.String property)
          Returns the specified property from the specified object in whatever implementation specific way is most friendly.
 java.lang.Class getPropertyClass(java.lang.Object object, java.lang.String property)
          Returns the Java type for the specified property on the specified object.
 boolean hasProperty(java.lang.Object object, java.lang.String property)
          Returns true if the specified object appears to have the specified property.
 void registerType(java.lang.Class type, PropertyAccess access)
           
 boolean removePropertyChangeListener(java.lang.Object object, java.beans.PropertyChangeListener listener)
          Removes a previously registered property change listener from the specified object using whatever implementation specific way is most friendly.
 boolean removePropertyChangeListener(java.lang.Object object, java.lang.String property, java.beans.PropertyChangeListener listener)
          Removes a previously registered property change listener from the specified object using whatever implementation specific way is most friendly.
 void setDefaultPropertyAccess(PropertyAccess defaultAccess)
           
 void setProperty(java.lang.Object object, java.lang.String property, java.lang.Object value)
          Sets the specified property on the specified object to the specified value using whatever implementation specific way is most friendly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypedPropertyAccess

public TypedPropertyAccess()

TypedPropertyAccess

public TypedPropertyAccess(PropertyAccess defaultAccess)
Method Detail

setDefaultPropertyAccess

public void setDefaultPropertyAccess(PropertyAccess defaultAccess)

getDefaultPropertyAccess

public PropertyAccess getDefaultPropertyAccess()

registerType

public void registerType(java.lang.Class type,
                         PropertyAccess access)

getEntries

protected TypedPropertyAccess.AccessEntry[] getEntries()

getAccess

protected PropertyAccess getAccess(java.lang.Object target)

getProperty

public java.lang.Object getProperty(java.lang.Object object,
                                    java.lang.String property)
Returns the specified property from the specified object in whatever implementation specific way is most friendly.

Specified by:
getProperty in interface PropertyAccess

hasProperty

public boolean hasProperty(java.lang.Object object,
                           java.lang.String property)
Returns true if the specified object appears to have the specified property.

Specified by:
hasProperty in interface PropertyAccess

setProperty

public void setProperty(java.lang.Object object,
                        java.lang.String property,
                        java.lang.Object value)
Sets the specified property on the specified object to the specified value using whatever implementation specific way is most friendly.

Specified by:
setProperty in interface PropertyAccess

getPropertyClass

public java.lang.Class getPropertyClass(java.lang.Object object,
                                        java.lang.String property)
Returns the Java type for the specified property on the specified object.

Specified by:
getPropertyClass in interface PropertyAccess

addPropertyChangeListener

public boolean addPropertyChangeListener(java.lang.Object object,
                                         java.beans.PropertyChangeListener listener)
Adds the specified property change listener to the specified object using whatever implementation specific way is most friendly. This method will attempt to find the property change listener methods but will not fail if it doesn't find them.

Specified by:
addPropertyChangeListener in interface PropertyAccess
Returns:
true if the addPropertyChangeListener() method was found and executed successfully. false otherwise.

addPropertyChangeListener

public boolean addPropertyChangeListener(java.lang.Object object,
                                         java.lang.String property,
                                         java.beans.PropertyChangeListener listener)
Adds the specified property change listener to the specified object using whatever implementation specific way is most friendly. This method will attempt to find the property change listener methods but will not fail if it doesn't find them.

Specified by:
addPropertyChangeListener in interface PropertyAccess
Returns:
true if the addPropertyChangeListener() method was found and executed successfully. false otherwise.

removePropertyChangeListener

public boolean removePropertyChangeListener(java.lang.Object object,
                                            java.beans.PropertyChangeListener listener)
Removes a previously registered property change listener from the specified object using whatever implementation specific way is most friendly. This method will attempt to find the property change listener methods but will not fail if it doesn't find them.

Specified by:
removePropertyChangeListener in interface PropertyAccess
Returns:
true if the removePropertyChangeListener() method was found and executed successfully. false otherwise.

removePropertyChangeListener

public boolean removePropertyChangeListener(java.lang.Object object,
                                            java.lang.String property,
                                            java.beans.PropertyChangeListener listener)
Removes a previously registered property change listener from the specified object using whatever implementation specific way is most friendly. This method will attempt to find the property change listener methods but will not fail if it doesn't find them.

Specified by:
removePropertyChangeListener in interface PropertyAccess
Returns:
true if the removePropertyChangeListener() method was found and executed successfully. false otherwise.


Copyright © 2002-2003 Paul Speed. All Rights Reserved.