Class BasePropertySet
- java.lang.Object
-
- com.oracle.webservices.api.message.BasePropertySet
-
- All Implemented Interfaces:
PropertySet
- Direct Known Subclasses:
AdditionalResponses
,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
Nested Classes Modifier and Type Class Description protected static interface
BasePropertySet.Accessor
Represents a typed property defined on aPropertySet
.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
Constructors Modifier Constructor Description protected
BasePropertySet()
Creates a new instance of TypedMap.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Map<String,Object>
asMap()
Creates a modifiableMap
view of thisPropertySet
.boolean
containsKey(Object key)
protected void
createEntrySet(Set<Map.Entry<String,Object>> core)
Map<String,Object>
createMapView()
Deprecated.use newer implementationPropertySet.asMap()
which produces readwriteMap
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 withPropertySet.Property
.protected boolean
mapAllowsAdditionalProperties()
Used when constructing theBasePropertySet.MapView
for this object - it controls if theBasePropertySet.MapView
servers only to access strongly typed values or allows also different valuesprotected static BasePropertySet.PropertyMap
parse(Class<?> clazz)
This method parses a class for fields and methods withPropertySet.Property
.protected static BasePropertySet.PropertyMap
parse(Class<?> clazz, MethodHandles.Lookup caller)
This method parses a class for fields and methods withPropertySet.Property
.Object
put(String key, Object value)
Sets a property.Object
remove(Object key)
boolean
supports(Object key)
Checks if thisPropertySet
supports a property of the given name.
-
-
-
Method Detail
-
getPropertyMap
protected abstract BasePropertySet.PropertyMap getPropertyMap()
Map representing the Fields and Methods annotated withPropertySet.Property
. Model ofPropertySet
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; }
or if the implementation is in different Java module.private static final PropertyMap model; static { model = parse(MyDerivedClass.class, MethodHandles.lookup()); } protected PropertyMap getPropertyMap() { return model; }
- Returns:
- the map of strongly-typed known properties keyed by property names
-
parse
protected static BasePropertySet.PropertyMap parse(Class<?> clazz)
This method parses a class for fields and methods withPropertySet.Property
.- Parameters:
clazz
- Class to be parsed- Returns:
- the map of strongly-typed known properties keyed by property names
- See Also:
parse(java.lang.Class, java.lang.invoke.MethodHandles.Lookup)
-
parse
protected static BasePropertySet.PropertyMap parse(Class<?> clazz, MethodHandles.Lookup caller)
This method parses a class for fields and methods withPropertySet.Property
.- Parameters:
clazz
- Class to be parsedcaller
- the caller lookup object- Returns:
- the map of strongly-typed known properties keyed by property names
- Throws:
NullPointerException
- ifclazz
orcaller
isnull
SecurityException
- if denied by the security managerRuntimeException
- if any of the other access checks specified above fails- Since:
- 3.0.1
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interfacePropertySet
-
get
public Object get(Object key)
Gets the name of the property.- Specified by:
get
in interfacePropertySet
- Parameters:
key
- This field is typed asObject
to follow theMap.get(Object)
convention, but if anything butString
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 interfacePropertySet
- 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:
PropertySet.Property
-
supports
public boolean supports(Object key)
Checks if thisPropertySet
supports a property of the given name.- Specified by:
supports
in interfacePropertySet
-
remove
public Object remove(Object key)
- Specified by:
remove
in interfacePropertySet
-
createMapView
@Deprecated public final Map<String,Object> createMapView()
Deprecated.use newer implementationPropertySet.asMap()
which produces readwriteMap
Creates aMap
view of thisPropertySet
.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 interfacePropertySet
- Returns:
- always non-null valid instance.
-
asMap
public Map<String,Object> asMap()
Creates a modifiableMap
view of thisPropertySet
.
Changes done on thisMap
or onPropertySet
object work in both directions - values made toMap
are reflected toPropertySet
and changes done using getters/setters onPropertySet
object are automatically reflected in thisMap
.
If necessary, it also can hold other values (not present onPropertySet
) - seemapAllowsAdditionalProperties()
- Specified by:
asMap
in interfacePropertySet
- Returns:
- always non-null valid instance.
-
mapAllowsAdditionalProperties
protected boolean mapAllowsAdditionalProperties()
Used when constructing theBasePropertySet.MapView
for this object - it controls if theBasePropertySet.MapView
servers only to access strongly typed values or allows also different values- Returns:
- true if
Map
should allow also properties not defined as strongly typed fields
-
-