Package com.tangosol.run.xml
Class PropertyAdapter
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.BitHelper
com.tangosol.util.ExternalizableHelper
com.tangosol.run.xml.PropertyAdapter
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
IterableAdapter
,SerializableAdapter
,SimpleAdapter
,XmlElementAdapter
,XmlSerializableAdapter
The PropertyAdapter is the base class for handling the operations that
can occur on any property.
<property>
<name>People</name>
<xml-name>people</xml-name> <!-- optional, empty name indicates anonymous element -->
<adapter>...</adapter> <!-- optional -->
<type>...</type> <!-- defaults via reflection -->
<class>...</class> <!-- defaults to <type> -->
<property>
- Version:
- 1.00 2001.03.06
- Author:
- cp
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.ExternalizableHelper
ExternalizableHelper.DecoratedMultiBufferReadBuffer, ExternalizableHelper.DefaultObjectStreamFactory, ExternalizableHelper.FormatAwareCompressor, ExternalizableHelper.IntDecoratedObject, ExternalizableHelper.Shielded, ExternalizableHelper.ShieldedDataOutputStream, ExternalizableHelper.ShieldedInputStream, ExternalizableHelper.ShieldedObjectOutputStream, ExternalizableHelper.ShieldedOutputStream, ExternalizableHelper.SimpleXmlBeanClassCache, ExternalizableHelper.Stats, ExternalizableHelper.XmlBeanClassCache
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
Field Summary
Modifier and TypeFieldDescriptionprotected Class
The type of the property.protected boolean
True if the property is stored in an attribute instead of an XML element.protected XmlBean.BeanInfo
The BeanInfo object that contains this PropertyAdapter.protected Method
The "public Object clone()" method for the property type, if available.protected Method
The property "accessor" method.protected Method
The property "mutator" method.protected String
The property name.protected String
The namespace prefix for this property.protected String
The namespace URI for this property.protected String
The XML element name used to store this property.protected static final Class[]
Parameters for finding no-parameter methods.Fields inherited from class com.tangosol.util.ExternalizableHelper
BINARY_SIZE, CHUNK_SIZE, CHUNK_THRESHOLD, CONVERTER_FROM_BINARY, CONVERTER_STRIP_INTDECO, CONVERTER_TO_BINARY, DECO_APP_1, DECO_APP_2, DECO_APP_3, DECO_BACKUP, DECO_CUSTOM, DECO_EXPIRY, DECO_ID_MAX, DECO_ID_MIN, DECO_JCACHE, DECO_JCACHE_SYNTHETIC, DECO_MEMCACHED, DECO_PUSHREP, DECO_QUEUE_METADATA, DECO_RSVD_1, DECO_STORE, DECO_TX, DECO_VALUE, DECO_WLS, EMPTY_BINARY_ARRAY, FMT_B_ARRAY, FMT_BIN_DECO, FMT_BIN_EXT_DECO, FMT_BINARY, FMT_BOOLEAN, FMT_BYTE, FMT_DECIMAL, FMT_DOUBLE, FMT_EXT, FMT_FLOAT, FMT_IDO, FMT_INT, FMT_INTEGER, FMT_LONG, FMT_NONE, FMT_NULL, FMT_OBJ_EXT, FMT_OBJ_SER, FMT_OPT, FMT_OPT_DOUBLE, FMT_OPT_INT, FMT_OPT_LONG, FMT_SHORT, FMT_STRING, FMT_UNKNOWN, FMT_XML_BEAN, FMT_XML_SER, FORCE_RESOLVING_STREAMS, LAMBDA_SERIALIZATION, MAX_DECO_HEADER_BYTES, PACKED_INT_SIZE, PACKED_LONG_SIZE, PROPERTY_CONFIG, s_streamfactory, TRINT_DOMAIN_SPAN, TRINT_MAX_VALUE, TRINT_MAX_VARIANCE, USE_POF_STREAMS, USE_XMLBEAN_CLASS_CACHE, XMLBEAN_CLASS_CACHE
-
Constructor Summary
ModifierConstructorDescriptionprotected
PropertyAdapter
(XmlBean.BeanInfo infoBean, Class clzType, String sName, String sXml, XmlElement xml) Construct a PropertyAdapter. -
Method Summary
Modifier and TypeMethodDescriptionMake a clone of the passed object.boolean
equalsValue
(Object o1, Object o2) Compare the two passed objects for equality.findAttribute
(XmlElement xml) Find an attribute of the specified XmlElement that represents a value for a property represented by this adapter.findElement
(XmlElement xml) Find a child element of the specified XmlElement that represents a value for a property represented by this adapter.Deserialize an object from a URI element.fromXml
(XmlElement xml) Deserialize an object from an XML element.Extract the property value from the passed bean reference.Obtain the Method object that is used to call the property accessor.Obtain the containing BeanInfo object.Obtain the Method object that is used to deep-clone the property value.getElements
(XmlElement xml) Get an iterator of child elements of the specified XmlElement that represent values for a property represented by this adapter.Determine the "local" XML element name that will be used to hold the property value.Obtain the Method object that is used to call the property mutator.getName()
Obtain the name of the property that this PropertyAdapter handles.Determine the default namespace prefix for the property.Determine the namespace URI for the property.getType()
Obtain the type of the property (the class of the object declared as being returned by the accessor and passed to the mutator).Return the XML element name used to generate an XML.int
compute a hash code for the passed object.boolean
Determine if this property does not have a designated element name.boolean
Determine if the property is stored in an XML attribute instead of an XML element.abstract boolean
Determine if the property value must be deep-cloned.boolean
isElementMatch
(XmlElement xml) Check whether or not the passed element matches to the property's local name and Namespace URI.boolean
Determine if the specified value is empty.Read a value from the passed DataInput object.readXml
(XmlElement xml) Deserialize an object from XML.void
Store the property value in the passed bean.void
setNamespacePrefix
(String sPrefix) Set the default Namespace prefix for this property.toString()
Debugging support.Serialize an object into a URI element.Serialize an object into an XML element.void
writeExternal
(DataOutput out, Object o) Write the specified data to the passed DataOutput object.void
writeXml
(XmlElement xml, Object o) Serialize an object into an XML element.Methods inherited from class com.tangosol.util.ExternalizableHelper
asBinary, calculatePackedLength, calculatePackedLength, checkObjectInputFilter, checkObjectInputFilter, checkObjectInputFilter, convertUTF, decodeExpiry, decorate, decorate, decorate, decorate, decorate, decorateBinary, encodeExpiry, ensureSerializer, extractIntDecoration, fromBinary, fromBinary, fromBinary, fromBinary, fromBinary, fromBinary, fromByteArray, fromByteArray, getClass, getConfigSerialFilter, getConfigSerialFilterFactory, getDecoration, getDecoration, getDecorations, getDeltaCompressor, getInputStream, getNewObjectInput, getObjectInput, getObjectInputFilter, getObjectOutput, getObjectStreamFactory, getOutputStream, getShieldedOutputStream, getStreamFormat, getUndecorated, getUndecorated, isDecorated, isDecorated, isIntDecorated, isIntDecorated, isResolving, isSerializable, isSerializerCompatible, isVersionCompatible, isVersionCompatible, isVersionCompatible, isVersionCompatible, loadClass, loadResource, main, makeTrint, readBigDecimal, readBigInteger, readBooleanArray, readBooleanArray, readByteArray, readCharArray, readCharArray, readCollection, readDate, readDoubleArray, readDoubleArray, readExternalizableLite, readExternalizableLite, readFloatArray, readFloatArray, readInt, readInt, readIntArray, readIntArray, readIntArray2d, readLargeBooleanArray, readLargeByteArray, readLargeCharArray, readLargeDoubleArray, readLargeFloatArray, readLargeIntArray, readLargeLongArray, readLargeObjectArray, readLargeStringArray, readLong, readLong, readLongArray, readLongArray, readMap, readMap, readObject, readObject, readObjectArray, readObjectArray, readSafeUTF, readSafeUTF, readSerializable, readSerializable, readStringArray, readStringArray, readTime, readTimestamp, readTrint, readUnsignedTrint, readUTF, readXmlBean, readXmlSerializable, readXmlSerializable, realize, removeIntDecoration, removeIntDecoration, replace, reportIncompatibleSerializers, setObjectStreamFactory, toBinary, toBinary, toBinary, toByteArray, toByteArray, toByteArray, toLiteBinary, toLong, undecorate, undecorate, validateBufferSize, validateLoadArray, validateLoadClass, writeBigDecimal, writeBigInteger, writeBooleanArray, writeByteArray, writeCollection, writeDate, writeDoubleArray, writeExternalizableLite, writeFloatArray, writeInt, writeInt, writeIntArray2d, writeLong, writeLong, writeMap, writeObject, writeSafeUTF, writeSafeUTF, writeSerializable, writeStringArray, writeTime, writeTimestamp, writeTrint, writeTrint, writeUTF, writeXmlBean, writeXmlSerializable
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, toBytes, toBytes, toBytes, toBytes, toInt, toInt, toLong
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
Field Details
-
NOPARAMS
Parameters for finding no-parameter methods. -
m_infoBean
The BeanInfo object that contains this PropertyAdapter. -
m_sName
The property name. -
m_sXml
The XML element name used to store this property. -
m_fAttribute
protected boolean m_fAttributeTrue if the property is stored in an attribute instead of an XML element. -
m_clzType
The type of the property. -
m_methodGet
The property "accessor" method. -
m_methodSet
The property "mutator" method. -
m_methodClone
The "public Object clone()" method for the property type, if available. -
m_sNmsUri
The namespace URI for this property. -
m_sNmsPrefix
The namespace prefix for this property.
-
-
Constructor Details
-
PropertyAdapter
protected PropertyAdapter(XmlBean.BeanInfo infoBean, Class clzType, String sName, String sXml, XmlElement xml) Construct a PropertyAdapter.Note: This constructor may narrow the specified property type to match the declared property accessor return type; therefore, subclasses should not assume that the specified property type will be equal to that returned by the
getType()
method.- Parameters:
infoBean
- BeanInfo for a bean containing this propertyclzType
- the type of the propertysName
- the property namesXml
- the XML tag namexml
- additional XML information
-
-
Method Details
-
getBeanInfo
Obtain the containing BeanInfo object.- Returns:
- the BeanInfo that describes an XML bean containing this property
-
getName
Obtain the name of the property that this PropertyAdapter handles.- Returns:
- the property name
-
getLocalXmlName
Determine the "local" XML element name that will be used to hold the property value.- Returns:
- the local XML element name for the property value
-
getXmlName
Return the XML element name used to generate an XML.- Returns:
- the outgoing XML element name for the property value
-
isElementMatch
Check whether or not the passed element matches to the property's local name and Namespace URI.- Parameters:
xml
- the XML element- Returns:
- true if the specified element represents a value for a property represented by this adapter
-
findElement
Find a child element of the specified XmlElement that represents a value for a property represented by this adapter.- Parameters:
xml
- the parent XmlElement- Returns:
- an element that can be processed by this adapther; null if none could be found
-
getElements
Get an iterator of child elements of the specified XmlElement that represent values for a property represented by this adapter.- Parameters:
xml
- the parent XmlElement- Returns:
- an iterator containing all child elements that can be processed by this adapther
-
findAttribute
Find an attribute of the specified XmlElement that represents a value for a property represented by this adapter.- Parameters:
xml
- the parent XmlElement- Returns:
- an attribute that can be processed by this adapther; null if none could be found
-
getNamespaceUri
Determine the namespace URI for the property.- Returns:
- the URI that qualifies the Namespace for this property
-
getNamespacePrefix
Determine the default namespace prefix for the property.- Returns:
- the default Namespace prefix for this property
-
setNamespacePrefix
Set the default Namespace prefix for this property.- Parameters:
sPrefix
- the new default namespace for this property
-
getType
Obtain the type of the property (the class of the object declared as being returned by the accessor and passed to the mutator).- Returns:
- the property type
-
getAccessor
Obtain the Method object that is used to call the property accessor.- Returns:
- the accessor (getter) method for the property
-
getMutator
Obtain the Method object that is used to call the property mutator.- Returns:
- the mutator (setter) method for the property or null if the property is not settable
-
getCloner
Obtain the Method object that is used to deep-clone the property value.- Returns:
- the clone method for the property or null if none is applicable or available
-
isAnonymous
public boolean isAnonymous()Determine if this property does not have a designated element name.- Returns:
- true if the property doesn't have an associated XmlElement
-
isAttribute
public boolean isAttribute()Determine if the property is stored in an XML attribute instead of an XML element.- Returns:
- true if the property is attribute bound
-
isCloneRequired
public abstract boolean isCloneRequired()Determine if the property value must be deep-cloned. Typically, a property value must be deep-cloned if it is a mutable reference type, e.g. StringBuffer, Date, byte[].- Returns:
- true if the property value must be "deep" cloned when the containing object is cloned
-
get
Extract the property value from the passed bean reference.- Parameters:
bean
- the XML bean object to obtain the property value from- Returns:
- the property value
-
isEmpty
Determine if the specified value is empty.- Parameters:
o
- the value- Returns:
- true if the object is considered to be empty for persistence and XML-generation purposes
-
set
Store the property value in the passed bean.- Parameters:
bean
- the XML bean object to store the property value intoo
- the property value
-
hash
compute a hash code for the passed object.- Parameters:
o
- the object to compute a hash code for- Returns:
- an integer hash code
-
equalsValue
Compare the two passed objects for equality.- Parameters:
o1
- the first objecto2
- the second object- Returns:
- true if the two objects are equal
-
clone
Make a clone of the passed object.- Parameters:
o
- the object to clone- Returns:
- a clone of the passed object
-
fromXml
Deserialize an object from an XML element.- Parameters:
xml
- the XML element to deserialize from- Returns:
- the object deserialized from the XML element
- Throws:
UnsupportedOperationException
- if the property cannot be read from a single XML element
-
toXml
Serialize an object into an XML element.- Parameters:
o
- the object to serialize- Returns:
- the XML element representing the serialized form of the passed object
- Throws:
UnsupportedOperationException
- if the property cannot be written to a single XML element
-
readXml
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.- Parameters:
xml
- the XML element containing the XML elements to deserialize from- Returns:
- the object deserialized from the XML (may be null)
-
writeXml
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.- Parameters:
xml
- the XML element containing the XML elements to serialize too
- the object to serialize (may be null)
-
fromUri
Deserialize an object from a URI element.- Parameters:
sUri
- the URI element to deserialize from- Returns:
- the object deserialized from the URI element
- Throws:
UnsupportedOperationException
- if the property cannot be read from a URI element
-
toUri
Serialize an object into a URI element.- Parameters:
o
- the object to serialize- Returns:
- the URI element representing the serialized form of the passed object
- Throws:
UnsupportedOperationException
- if the property cannot be written to a URI element
-
readExternal
Read a value from the passed DataInput object.- Parameters:
in
- the DataInput stream to read property data from- Returns:
- the data read from the DataInput; never null
- Throws:
IOException
- if an I/O exception occurs
-
writeExternal
Write the specified data to the passed DataOutput object.- Parameters:
out
- the DataOutput stream to write too
- the data to write to the DataOutput; never null- Throws:
IOException
- if an I/O exception occurs
-
toString
Debugging support.
-