|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.management.oss.impl.AttributeAccessImpl
Implemtation of AttributeAccess. Uses a HashMap to store the attributes. The class has generic methods for setting arbitrary attributes. As long as all attributes are initialized to null in the constructor (of any sub-class) all methods in this class are generic and do not have to be overridden. Like for instance the isFullyPopulated() method. Note, clone() need to be overriden if new class members are added that need "deep-copy".
Constructor Summary | |
AttributeAccessImpl()
Creates a new attribute acccess. |
Method Summary | |
java.lang.Object |
clone()
|
java.util.Map |
getAllPopulatedAttributes()
Get all populated attribute values. |
java.lang.String[] |
getAttributeNames()
Return all attribute names, which are available in this value object. |
java.lang.Object |
getAttributeValue(java.lang.String attributeName)
Return the value of the specified attribute. |
java.util.Map |
getAttributeValues(java.lang.String[] attributeNames)
Get multiple attribute values given an array of attribute names. |
java.lang.String[] |
getPopulatedAttributeNames()
Get the names of all populated attributes. |
java.lang.String[] |
getSupportedOptionalAttributeNames()
Provide run-time support for the discovery of optional attributes. |
java.lang.String[] |
getSupportedSerializerTypes()
Return all the serializer types than can be created by this factory. |
boolean |
isFullyPopulated()
Return true, if all attributes in this value object are populated. |
boolean |
isPopulated(java.lang.String name)
Check if a specific attribute is populated. |
Serializer |
makeSerializer(java.lang.String serializerType)
Manufacture a Serializer for the object type inheriting the interface. |
void |
setAttributeValue(java.lang.String attributeName,
java.lang.Object value)
Assign a new value to an attribute. |
void |
setAttributeValues(java.util.Map attributeNamesAndValuePairs)
Set multiple attribute values. |
void |
unpopulateAllAttributes()
Reset all the attributes to unpopulated. |
void |
unpopulateAttribute(java.lang.String attr_name)
Mark a single attribute as unpopulated. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AttributeAccessImpl()
Method Detail |
public java.lang.Object clone()
public java.util.Map getAttributeValues(java.lang.String[] attributeNames) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
AttributeAccess
getAttributeValues
in interface AttributeAccess
attributeNames
-
java.lang.IllegalStateException
- (if one of the attributes is not populated)
java.lang.IllegalArgumentException
- (if null array is provided or if one of the attributes is not recognized)public void setAttributeValues(java.util.Map attributeNamesAndValuePairs) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
AttributeAccess
setAttributeValues
in interface AttributeAccess
attributeNamesAndValuePairs
-
java.lang.IllegalArgumentException
- (one of the attributes is not well formed or unrecognized)
java.lang.IllegalStateException
public java.util.Map getAllPopulatedAttributes() throws java.lang.IllegalStateException
AttributeAccess
getAllPopulatedAttributes
in interface AttributeAccess
java.lang.IllegalStateException
public java.lang.Object getAttributeValue(java.lang.String attributeName) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
AttributeAccess
getAttributeValue
in interface AttributeAccess
attributeName
- the attribute's name
java.lang.IllegalStateException
- (the attribute is not populated)
java.lang.IllegalArgumentException
- (the attribute name is null or is not recognized)public void setAttributeValue(java.lang.String attributeName, java.lang.Object value) throws java.lang.IllegalArgumentException
AttributeAccess
Even though some attributes
may be read-only in the server implementation, they can be set here nonetheless.
This is because value objects are also used as templates for a "query by template".
To see which attributes can be set in the server implementation, the client needs to call
getSettableAttributeNames()
.
setAttributeValue
in interface AttributeAccess
attributeName
- The attribute's name which shall be changedvalue
- The attribute's new value. This can either be:
attributeName
Integer
wrapping an int
java.lang.IllegalArgumentException
- (the attribute name is null or is not recognized, or the value is bad)public java.lang.String[] getAttributeNames()
AttributeAccess
The returned names may be used as arguments to the generic methods getAttributeValue(...)
and setAttributeValue(...)
.
This method may be used by generic clients to obtain information on the attributes. It does not say anything about the state of an attribute, i.e. if it is populated or not.
getAttributeNames
in interface AttributeAccess
public java.lang.String[] getPopulatedAttributeNames()
AttributeAccess
Although an attribute is populated, it can be null
!
getPopulatedAttributeNames
in interface AttributeAccess
getAttributeNames()
.public boolean isPopulated(java.lang.String name) throws java.lang.IllegalArgumentException
AttributeAccess
isPopulated
in interface AttributeAccess
name
- the name of the attribute which is to be checked for population.
java.lang.IllegalArgumentException
- when there is no attribute with this name.AttributeAccess.isFullyPopulated()
public boolean isFullyPopulated()
AttributeAccess
isFullyPopulated
in interface AttributeAccess
AttributeAccess.isPopulated(String attribute)
public void unpopulateAllAttributes()
AttributeAccess
unpopulateAllAttributes
in interface AttributeAccess
public void unpopulateAttribute(java.lang.String attr_name) throws java.lang.IllegalArgumentException
AttributeAccess
unpopulateAttribute
in interface AttributeAccess
attr_name
- name of the attribute to be unpopulated.
java.lang.IllegalArgumentException
- if this is not a valid attribute name.AttributeAccess.unpopulateAllAttributes()
public java.lang.String[] getSupportedOptionalAttributeNames()
AttributeAccess
getSupportedOptionalAttributeNames
in interface AttributeAccess
public java.lang.String[] getSupportedSerializerTypes()
SerializerFactory
getSupportedSerializerTypes
in interface SerializerFactory
public Serializer makeSerializer(java.lang.String serializerType) throws java.lang.IllegalArgumentException
SerializerFactory
makeSerializer
in interface SerializerFactory
serializerType
- the class name of the serializer interface that must
be created. For example XmlSerializer.getClass().getName()
java.lang.IllegalArgumentException
- if no serializer can be created matching
the provided Serializer Type.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |