com.oracle.webservices.api.message
Class BasePropertySet

java.lang.Object
  extended by com.oracle.webservices.api.message.BasePropertySet
All Implemented Interfaces:
PropertySet
Direct Known Subclasses:
AddressingPropertySet, BaseDistributedPropertySet, InboundAccepted, OutboundDelivered, PropertySet, ThrowableContainerPropertySet, TransactionPropertySet, WsaPropertyBag, WSDLProperties, WSHTTPConnection, XMLPropertyBag

public abstract class BasePropertySet
extends Object
implements PropertySet

A set of "properties" that can be accessed via strongly-typed fields as well as reflexibly through the property name.

Author:
Kohsuke Kawaguchi

Nested Class Summary
protected static interface BasePropertySet.Accessor
          Represents a typed property defined on a PropertySet.
protected static class BasePropertySet.PropertyMap
          Represents the list of strongly-typed known properties (keyed by property names.)
static class BasePropertySet.PropertyMapEntry
          PropertyMapEntry represents a Map.Entry in the PropertyMap with more efficient access.
 
Nested classes/interfaces inherited from interface com.oracle.webservices.api.message.PropertySet
PropertySet.Property
 
Constructor Summary
protected BasePropertySet()
          Creates a new instance of TypedMap.
 
Method Summary
 Map<String,Object> asMap()
          Creates a modifiable BasePropertySet.PropertyMap view of this PropertySet.
 boolean containsKey(Object key)
           
protected  void createEntrySet(Set<Map.Entry<String,Object>> core)
           
 Map<String,Object> createMapView()
          Deprecated. use newer implementation PropertySet.asMap() which produces readwrite BasePropertySet.PropertyMap
protected  Map<String,Object> createView()
           
 Object get(Object key)
          Gets the name of the property.
protected abstract  BasePropertySet.PropertyMap getPropertyMap()
          Map representing the Fields and Methods annotated with PropertySet.Property.
protected  boolean mapAllowsAdditionalProperties()
          Used when constructing the MapView for this object - it controls if the MapView servers only to access strongly typed values or allows also different values
protected static BasePropertySet.PropertyMap parse(Class clazz)
          This method parses a class for fields and methods with PropertySet.Property.
 Object put(String key, Object value)
          Sets a property.
 Object remove(Object key)
           
 boolean supports(Object key)
          Checks if this PropertySet supports a property of the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasePropertySet

protected BasePropertySet()
Creates a new instance of TypedMap.

Method Detail

getPropertyMap

protected abstract BasePropertySet.PropertyMap getPropertyMap()
Map representing the Fields and Methods annotated with PropertySet.Property. Model of PropertySet class.

At the end of the derivation chain this method just needs to be implemented as:

 private static final PropertyMap model;
 static {
   model = parse(MyDerivedClass.class);
 }
 protected PropertyMap getPropertyMap() {
   return model;
 }
 


parse

protected static BasePropertySet.PropertyMap parse(Class clazz)
This method parses a class for fields and methods with PropertySet.Property.


containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface PropertySet

get

public Object get(Object key)
Gets the name of the property.

Specified by:
get in interface PropertySet
Parameters:
key - This field is typed as Object to follow the HashMap.get(Object) convention, but if anything but String is passed, this method just returns null.

put

public Object put(String key,
                  Object value)
Sets a property.

Implementation Note

This method is slow. Code inside JAX-WS should define strongly-typed fields in this class and access them directly, instead of using this.

Specified by:
put in interface PropertySet
Throws:
ReadOnlyPropertyException - if the given key is an alias of a strongly-typed field, and if the name object given is not assignable to the field.
See Also:
Property

supports

public boolean supports(Object key)
Checks if this PropertySet supports a property of the given name.

Specified by:
supports in interface PropertySet

remove

public Object remove(Object key)
Specified by:
remove in interface PropertySet

createMapView

@Deprecated
public final Map<String,Object> createMapView()
Deprecated. use newer implementation PropertySet.asMap() which produces readwrite BasePropertySet.PropertyMap

Creates a BasePropertySet.PropertyMap view of this PropertySet.

This map is partially live, in the sense that values you set to it will be reflected to PropertySet.

However, this map may not pick up changes made to PropertySet after the view is created.

Specified by:
createMapView in interface PropertySet
Returns:
always non-null valid instance.

asMap

public Map<String,Object> asMap()
Creates a modifiable BasePropertySet.PropertyMap view of this PropertySet.

Changes done on this BasePropertySet.PropertyMap or on PropertySet object work in both directions - values made to BasePropertySet.PropertyMap are reflected to PropertySet and changes done using getters/setters on PropertySet object are automatically reflected in this BasePropertySet.PropertyMap.

If necessary, it also can hold other values (not present on PropertySet) - PropertySet#mapAllowsAdditionalProperties

Specified by:
asMap in interface PropertySet
Returns:
always non-null valid instance.

createView

protected Map<String,Object> createView()

mapAllowsAdditionalProperties

protected boolean mapAllowsAdditionalProperties()
Used when constructing the MapView for this object - it controls if the MapView servers only to access strongly typed values or allows also different values

Returns:
true if BasePropertySet.PropertyMap should allow also properties not defined as strongly typed fields

createEntrySet

protected void createEntrySet(Set<Map.Entry<String,Object>> core)


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.