Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.management.oss.impl.pm.measurement.xml
Class PmXmlSerializerImpl

    java.lang.Object
      com.sun.management.oss.impl.pm.measurement.xml.PmXmlSerializerImpl

All Implemented Interfaces:
  java.io.Serializable, Serializer, XmlSerializer

public class PmXmlSerializerImpl
extends java.lang.Object
implements XmlSerializer

See Also:
  Serialized Form

Constructor Summary
`PmXmlSerializerImpl(java.lang.String type)` Get all the encoding styles supported by this Serializer.

Method Summary
`java.lang.Object` | `fromXml(org.w3c.dom.Element element)` Deserialize the XML DOM element subtree into the Java object.
`java.lang.String` | `getDefaultEncodingStyle()` Returns the default encoding that is the encoding style used by the Serializer when it is created.
`java.lang.String` | `getEncodingStyle()` The encoding style associated with this Serializer.
`java.lang.String[]` | `getSupportedEncodingStyles()` Get all the encoding styles supported by this Serializer.
`java.lang.String` | `getType()` Returns the type of object that this Serializer can marshall and unmarshall from and to XML, for example `com.sun.management.oss.TroubleTicketValue`
`void` | `setEncodingStyle(java.lang.String encodingStyle)` Set the encoding style associated with this Serializer.
`java.lang.String` | `toXml(java.lang.Object object, java.lang.String elementName)` Serialize this Java object as an XML element.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PmXmlSerializerImpl

    public PmXmlSerializerImpl(java.lang.String type)

  Get all the encoding styles supported by this Serializer. This may return an empty array, in case no serializer is implemented

Method Detail

### getSupportedEncodingStyles

    public java.lang.String[] getSupportedEncodingStyles()

  Get all the encoding styles supported by this Serializer. This may return an empty array, in case no serializer is implemented

  Specified by:
    `getSupportedEncodingStyles` in interface `Serializer`
  Returns:
    An Array of EncodingStyle strings.

### getDefaultEncodingStyle

    public java.lang.String getDefaultEncodingStyle()

  Returns the default encoding that is the encoding style used by the Serializer when it is created. To set the encoding style to another value use `setEncodingStyle()`

  Specified by:
    `getDefaultEncodingStyle` in interface `Serializer`
  Returns:
    The default encoding style.

### setEncodingStyle

    public void setEncodingStyle(java.lang.String encodingStyle)
                          throws java.lang.IllegalArgumentException

  Set the encoding style associated with this Serializer.

  For example "http://www.ossj.org/encoding/ossxml" for the OSSJ XML Encoding Style defined in the OSSJ Design Guidelines.

  One of the items returned by `getSupportedEncodingStyles()` should be provided as parameter.

  Specified by:
    `setEncodingStyle` in interface `Serializer`
  Parameters:
    `encodingStyle` - The encodingStyle string.
  Throws:
    `com.sun.management.oss.IllegalArgumentException` - if the provided encoding style is not valid or is not recognized by the Serializer.
    `java.lang.IllegalArgumentException` - if the provided encoding style is not valid or is not recognized by the Serializer.

### getEncodingStyle

    public java.lang.String getEncodingStyle()

  The encoding style associated with this Serializer.

  For example "http://www.ossj.org/encoding/ossxml" for the OSSJ XML Encoding Style defined in the OSSJ Design Guidelines.

  A Serializer is always created with a default encoding style.

  The default encoding style is provided by the value of the `OSS_DEFAULT_ENCODING_STYLE` found in the declaration of the specific serializer type `EncodingStyles` interface.

  Specified by:
    `getEncodingStyle` in interface `Serializer`
  Returns:
    The encoding style associated with this Serializer.

### getType

    public java.lang.String getType()

  Returns the type of object that this Serializer can marshall and unmarshall from and to XML, for example `com.sun.management.oss.TroubleTicketValue`

  Specified by:
    `getType` in interface `Serializer`
  Returns:
    The type of object that this object can serialize

### toXml

    public java.lang.String toXml(java.lang.Object object,
                                  java.lang.String elementName)
                           throws java.lang.IllegalArgumentException

  Serialize this Java object as an XML element. No doctype declaration is generated, in order to allow this String to be embedded as an element of a larger XML document instance.

  For example assuming that this a Serializer for a <ManagedEntity>Key then calling `toXML( "myElementName")` would result in the following:

       < myElementName >
                < co:applicationContext >
                        < co:factoryClass >String</co:factoryClass >
                        < co:url >http://www.xmlspy.com< /co:url >
                        < co:systemProperties >
                                < co:property >
                                        < co:name >String< /co:name >
                                        < co:value >String< /co:value >
                                < /co:property >
                        < /co:systemProperties >
                < /co:applicationContext >
                < co:applicationDN >String< /co:applicationDN >
                < co:type >String< /co:type >
                < primaryKey >String< /primaryKey >
        < /myElementName >

  Specified by:
    `toXml` in interface `XmlSerializer`
  Parameters:
    `elementName` - String the name of the element for this value
    `object` -
  Returns:
    String XML element
  Throws:
    `com.sun.management.oss.IllegalArgumentException` - if the value is not of the proper type
    `java.lang.IllegalArgumentException` - if the object is not of the proper type.

### fromXml

    public java.lang.Object fromXml(org.w3c.dom.Element element)
                             throws java.lang.IllegalArgumentException

  Deserialize the XML DOM element subtree into the Java object. For example assuming that this a Serializer for a `< ManagedEntity >Key` and that we have a DOM element representing the following

       < key >
                < co:applicationContext >
                        < co:factoryClass >String< /co:factoryClass >
                        < co:url >String< /co:url >
                        < co:systemProperties >
                                < co:property >
                                        < co:name >String< /co:name >
                                        < co:value >String< /co:value >
                                < /co:property >
                        < /co:systemProperties >
                < /co:applicationContext >
                < co:applicationDN >String< /co:applicationDN >
                < co:type >String< /co:type >
                < primaryKey >String< /primaryKey >
        < /key >

  then the returned object would be a < ManagedEntity >Key key populated with the proper `ApplicationContext`, `applicationDN`, `primaryKey` and `type` info

  Specified by:
    `fromXml` in interface `XmlSerializer`
  Parameters:
    `element` - `org.w3c.dom.Element` the subtree representing the serialized object
  Returns:
    a java object corresponding to the XML document.
  Throws:
    `com.sun.management.oss.IllegalArgumentException` - if an invalid dom element is passed
    `java.lang.IllegalArgumentException` - if an invalid dom element is passed.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD