Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


com.tangosol.run.xml
Class PrimitiveArrayAdapter

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.BitHelper
          extended by com.tangosol.util.ExternalizableHelper
              extended by com.tangosol.run.xml.PropertyAdapter
                  extended by com.tangosol.run.xml.IterableAdapter
                      extended by com.tangosol.run.xml.PrimitiveArrayAdapter

All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
PrimitiveArrayAdapter.BooleanArrayAdapter, PrimitiveArrayAdapter.ByteArrayAdapter, PrimitiveArrayAdapter.CharArrayAdapter, PrimitiveArrayAdapter.DoubleArrayAdapter, PrimitiveArrayAdapter.FloatArrayAdapter, PrimitiveArrayAdapter.IntArrayAdapter, PrimitiveArrayAdapter.LongArrayAdapter, PrimitiveArrayAdapter.ShortArrayAdapter

public abstract class PrimitiveArrayAdapter
extends IterableAdapter

A PrimitiveArrayAdapter supports arrays of primitive types, such as "int", "char", etc.

Version:
1.00 2001.03.06
Author:
cp

Nested Class Summary
static class PrimitiveArrayAdapter.BooleanArrayAdapter
          A PropertyAdapter supporting boolean[].
static class PrimitiveArrayAdapter.ByteArrayAdapter
          A PropertyAdapter supporting byte[].
static class PrimitiveArrayAdapter.CharArrayAdapter
          A PropertyAdapter supporting char[].
static class PrimitiveArrayAdapter.DoubleArrayAdapter
          A PropertyAdapter supporting double[].
static class PrimitiveArrayAdapter.FloatArrayAdapter
          A PropertyAdapter supporting float[].
static class PrimitiveArrayAdapter.IntArrayAdapter
          A PropertyAdapter supporting int[].
static class PrimitiveArrayAdapter.LongArrayAdapter
          A PropertyAdapter supporting long[].
static class PrimitiveArrayAdapter.ShortArrayAdapter
          A PropertyAdapter supporting short[].

 

Field Summary

 

Fields inherited from class com.tangosol.run.xml.IterableAdapter
m_fEmptyIsNull, m_fSparse, m_sElement

 

Fields inherited from class com.tangosol.run.xml.PropertyAdapter
m_clzType, m_fAttribute, m_infoBean, m_methodClone, m_methodGet, m_methodSet, m_sName, m_sNmsPrefix, m_sNmsUri, m_sXml, NOPARAMS

 

Constructor Summary
PrimitiveArrayAdapter(XmlBean.BeanInfo infoBean, java.lang.Class clzType, java.lang.String sName, java.lang.String sXml, XmlElement xml)
          Construct a PrimitiveArrayAdapter.

 

Method Summary
abstract  java.lang.Object clone(java.lang.Object o)
          Make a clone of the passed object.
abstract  boolean equalsValue(java.lang.Object o1, java.lang.Object o2)
          Compare the two passed objects for equality.
 java.lang.Object fromXml(XmlElement xml)
          Deserialize an object from an XML element.
 java.lang.Object fromXmlString(XmlElement xml)
          Deserialize a primitive array from a single XML element.
abstract  int hash(java.lang.Object o)
          Compute a hash code for the passed object.
 boolean isStringable()
           
abstract  java.lang.Object readArray(java.util.Iterator iter, XmlElement xml, boolean fNested)
          Read an array of primitive values.
protected  java.lang.Object readElements(XmlElement xml)
           
abstract  java.lang.Object readSparseArray(java.util.Iterator iter, int c)
          Read a sparse array of primitive values.
 java.lang.Object readXml(XmlElement xml)
          Deserialize an object from XML.
 XmlElement toXml(java.lang.Object o)
          Serialize an object into an XML element.
 XmlElement toXmlString(java.lang.Object o)
          Serialize a primitive array into a single XML element.
abstract  void writeArray(XmlElement xml, java.lang.Object o, java.lang.String sElement)
          Write a sparse array of primitive values.
protected  void writeElements(XmlElement xml, java.lang.Object o)
           
abstract  void writeSparseArray(XmlElement xml, java.lang.Object o, java.lang.String sElement)
          Write a sparse array of primitive values.
 void writeXml(XmlElement xml, java.lang.Object o)
          Serialize an object into an XML element.

 

Methods inherited from class com.tangosol.run.xml.IterableAdapter
findAdapter, getElementName, isCloneRequired, isEmptyIsNull, isNested, isSparse

 

Methods inherited from class com.tangosol.run.xml.PropertyAdapter
findAttribute, findElement, fromUri, get, getAccessor, getBeanInfo, getCloner, getElements, getLocalXmlName, getMutator, getName, getNamespacePrefix, getNamespaceUri, getType, getXmlName, isAnonymous, isAttribute, isElementMatch, isEmpty, readExternal, set, setNamespacePrefix, toString, toUri, writeExternal

 

Methods inherited from class com.tangosol.util.BitHelper
countBits, countBits, countBits, indexOfLSB, indexOfLSB, indexOfLSB, indexOfMSB, indexOfMSB, indexOfMSB, rotateLeft, rotateLeft, rotateLeft, rotateRight, rotateRight, rotateRight, toBitString, toBitString, toBitString

 

Constructor Detail

PrimitiveArrayAdapter

public PrimitiveArrayAdapter(XmlBean.BeanInfo infoBean,
                             java.lang.Class clzType,
                             java.lang.String sName,
                             java.lang.String sXml,
                             XmlElement xml)
Construct a PrimitiveArrayAdapter.
Parameters:
infoBean - BeanInfo for a bean containing this property
clzType - the type of the property
sName - the property name
sXml - the XML tag name
xml - additional XML information

Method Detail

isStringable

public boolean isStringable()
Returns:
true if the adapter can format the array of primitive values to/from a single value (e.g. char[], byte[])

hash

public abstract int hash(java.lang.Object o)
Compute a hash code for the passed object.
Overrides:
hash in class PropertyAdapter
Parameters:
o - the object to compute a hash code for
Returns:
an integer hash code

equalsValue

public abstract boolean equalsValue(java.lang.Object o1,
                                    java.lang.Object o2)
Compare the two passed objects for equality.
Overrides:
equalsValue in class PropertyAdapter
Parameters:
o1 - the first object
o2 - the second object
Returns:
true if the two objects are equal

clone

public abstract java.lang.Object clone(java.lang.Object o)
Make a clone of the passed object.
Overrides:
clone in class PropertyAdapter
Parameters:
o - the object to clone
Returns:
a clone of the passed object

fromXml

public java.lang.Object fromXml(XmlElement xml)
Deserialize an object from an XML element.
Overrides:
fromXml in class IterableAdapter
Parameters:
xml - the XML element to deserialize from
Returns:
the object deserialized from the XML element
Throws:
java.lang.UnsupportedOperationException - if the property cannot be read from a single XML element

toXml

public XmlElement toXml(java.lang.Object o)
Serialize an object into an XML element.
Overrides:
toXml in class IterableAdapter
Parameters:
o - the object to serialize
Returns:
the XML element representing the serialized form of the passed object
Throws:
java.lang.UnsupportedOperationException - if the property cannot be written to a single XML element

readXml

public java.lang.Object readXml(XmlElement xml)
Deserialize an object from XML. Note that the parent element is the one passed to this method; this method is responsible for finding all of the necessarily elements within the parent element. This method is intended to allow collection properties to read their data from multiple XML elements.
Overrides:
readXml in class PropertyAdapter
Parameters:
xml - the XML element containing the XML elements to deserialize from
Returns:
the object deserialized from the XML (may be null)

writeXml

public void writeXml(XmlElement xml,
                     java.lang.Object o)
Serialize an object into an XML element. Note that the parent element is the one passed to this method; this method is responsible for creating the necessarily elements within the parent element. This method is intended to allow collection properties to write their data to multiple XML elements.
Overrides:
writeXml in class PropertyAdapter
Parameters:
xml - the XML element containing the XML elements to serialize to
o - the object to serialize (may be null)

readElements

protected java.lang.Object readElements(XmlElement xml)
Specified by:
readElements in class IterableAdapter
Parameters:
xml - the XML element containing the XML elements to deserialize from
Returns:
the object deserialized from the XML (not null)

writeElements

protected void writeElements(XmlElement xml,
                             java.lang.Object o)
Specified by:
writeElements in class IterableAdapter
Parameters:
xml - the XML element to which the iterable elements are written
o - the object to serialize (not null)

fromXmlString

public java.lang.Object fromXmlString(XmlElement xml)
Deserialize a primitive array from a single XML element.
Parameters:
xml - the XML element to deserialize from (not null)
Returns:
the object deserialized from the XML element
Throws:
java.lang.UnsupportedOperationException - if the property cannot be read from a single XML element

toXmlString

public XmlElement toXmlString(java.lang.Object o)
Serialize a primitive array into a single XML element.
Parameters:
o - the object to serialize (not null)
Returns:
the XML element representing the serialized form of the passed object
Throws:
java.lang.UnsupportedOperationException - if the property cannot be written to a single XML element

readSparseArray

public abstract java.lang.Object readSparseArray(java.util.Iterator iter,
                                                 int c)
Read a sparse array of primitive values.
Parameters:
iter - the iterator of XmlElement objects
c - the size of the array
Returns:
an array of primitive values

readArray

public abstract java.lang.Object readArray(java.util.Iterator iter,
                                           XmlElement xml,
                                           boolean fNested)
Read an array of primitive values.
Parameters:
iter - the iterator of XmlElement objects
xml - the XmlElement from which the iterator was obtained
fNested - true if the array is nested under an array tag
Returns:
an array of primitive values

writeSparseArray

public abstract void writeSparseArray(XmlElement xml,
                                      java.lang.Object o,
                                      java.lang.String sElement)
Write a sparse array of primitive values.
Parameters:
xml - the XmlElement that will contain the array
o - the primitive array
sElement - the name of the element containing an element value

writeArray

public abstract void writeArray(XmlElement xml,
                                java.lang.Object o,
                                java.lang.String sElement)
Write a sparse array of primitive values.
Parameters:
xml - the XmlElement that will contain the array elements
o - the primitive array
sElement - the name of the element containing an element value

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.