com.bradmcevoy.property
Class BeanPropertySource

java.lang.Object
  extended by com.bradmcevoy.property.BeanPropertySource
All Implemented Interfaces:
PropertySource

public class BeanPropertySource
extends java.lang.Object
implements PropertySource

A read/write source of properties which uses getter/setter style properties on the resource class. This is similar in concept to form variable binding in web frameworks like struts and MVC.

Author:
brad

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.bradmcevoy.property.PropertySource
PropertySource.PropertyAccessibility, PropertySource.PropertyMetaData, PropertySource.PropertySetException
 
Constructor Summary
BeanPropertySource()
           
 
Method Summary
 void clearProperty(javax.xml.namespace.QName name, Resource r)
          Remove the given property.
 java.util.List<javax.xml.namespace.QName> getAllPropertyNames(Resource r)
           
 java.lang.Object getProperty(javax.xml.namespace.QName name, Resource r)
           
 PropertySource.PropertyMetaData getPropertyMetaData(javax.xml.namespace.QName name, Resource r)
          Check to see if the property is known, and if it is writable.
 void setProperty(javax.xml.namespace.QName name, java.lang.Object value, Resource r)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanPropertySource

public BeanPropertySource()
Method Detail

getProperty

public java.lang.Object getProperty(javax.xml.namespace.QName name,
                                    Resource r)
                             throws NotAuthorizedException
Specified by:
getProperty in interface PropertySource
Throws:
NotAuthorizedException

setProperty

public void setProperty(javax.xml.namespace.QName name,
                        java.lang.Object value,
                        Resource r)
                 throws NotAuthorizedException,
                        PropertySource.PropertySetException
Specified by:
setProperty in interface PropertySource
Throws:
NotAuthorizedException
PropertySource.PropertySetException

getPropertyMetaData

public PropertySource.PropertyMetaData getPropertyMetaData(javax.xml.namespace.QName name,
                                                           Resource r)
Description copied from interface: PropertySource
Check to see if the property is known, and if it is writable. The returned value also contains a class which is the most specific known class of the values which can be contained in this property. This class must be sufficient to locate a ValueWriter to parse the textual representation sent in PROPPATCH requests.

Specified by:
getPropertyMetaData in interface PropertySource
Parameters:
name - - the qualified name of the property
r - - the resource which might contain the property
Returns:
- never null, contains an enum value indicating if the property is known to this source, and if it is writable, and a class indicating the type of the property.

clearProperty

public void clearProperty(javax.xml.namespace.QName name,
                          Resource r)
                   throws NotAuthorizedException
Description copied from interface: PropertySource
Remove the given property. There may be a semantic difference in some cases between setting a property to a null value vs removing the property. Generally this should completely the remove the property if possible.

Specified by:
clearProperty in interface PropertySource
Throws:
NotAuthorizedException

getAllPropertyNames

public java.util.List<javax.xml.namespace.QName> getAllPropertyNames(Resource r)
Specified by:
getAllPropertyNames in interface PropertySource
Parameters:
r - - the resource which may contain properties
Returns:
- all properties known by this source on the given resource. This list should be exclusive. Ie only return properties not returned by any other source


Copyright © 2011. All Rights Reserved.