Title: AttributesLib for Java
Description:
Copyright: Copyright (c) 2004
Company: eBay Inc.
@author Weijun Li @version 1.0serialOverride
configuration property to specify classes that are to be serialized in standard form. See Persistit JSA 1.1 Object Serialization for more detailed information on these these subjects.
It may be useful to build a WeakHashMap associating the serialized content of a Value
with an associated deserialized object to avoid object deserialization overhead or to implement correct identity semantics. Since Value
is mutable it is a poor choice for use as a map key. Instead, an immutable {@link ValueState} should be used to hold an immutablecopy of this state. Value
and ValueState
implement hashCode
and equals
in a compatible fashion so that code similar to the following works as expected:
... Value value = <some value>; if (!map.contains(value)) // uses the transient current state { ValueState vs = new ValueState(value); map.put(vs, object); // uses an immutable copy as the key }
The {@link #toString()} method of this class attempts to construct ahuman-readable representation of the serialized value. The Tree display panel of the AdminUI utility uses this capability to summarize the contents of values stored in a tree. The string representation is constructed as follows:
Value
is undefined, then return "undefined".null
or a boolean
, return "null" "false", or "true".int
and double
are presented without prefix to reduce clutter.java.util.Date
, return a formatted representation of the date using the format specified by {@link Key#SDF}. This is a readable format the displays the date with full precision, including milliseconds.Collection
implementations in the java.util
package, then return a comma-separated list of values surrounded by square brackets.Map
implementations in the java.util
package, then return a comma-separated list of key/value pairs surrounded by square brackets. Each key/value pair is represented by a string in the form key->value.Collection
contain two references to the same object - then instead of creating an additional string representing the second or subsequent instance, emit a back reference pointer in the form @NNN where NNN is the character offset within the displayable string where the first instance was found. (Note: does not apply to strings and the primitive wrapper classes.) For example, consider a Person class with fields for date of birth, first name, last name, salary and friends, an array of other Person objects. The result returned by {@link #toString} on a Value
representing twoPerson instances, each with just the other as a friend, might appear as follows: (Note, space added for legibility.)
(Person){(Date)19490826000000.000-0400,"Mary","Jones",(long)75000,[ (Person){(Date)19550522000000.000-0400,"John","Smith",(long)68000,[@0]}]}
In this example, John Smith's friends
array contains a back reference to Mary Jones in the form "@0" because Mary's displayable reference starts at the beginning of the string. A Value
normally contains just one object or primitive value. In its normal mode of operation, the put
operation overwrites any previously held state, and the get
operation retrieves the one object or primitive value represented by the current state of the Value
. A subsequent invocation of get
returns the same value.
However, at certain times it is useful to store multiple items (fields) together in one Value
object. To allow this, Value
implements an alternative mode of operation called stream mode in which each put
invocation appends a new field to the state rather than replacing the previous state. Similarly, get
operations retrieve sequentially written fields rather than rereading the same field. Stream allows {@link com.persistit.encoding.ValueCoder ValueCoder} implementations to aggregate the multiple fields encapsulatedwithin an encoded value.
The low-level API allows an application to bypass the encoding and decoding operations described above and instead to operate directly on the byte array stored in the database. This might be appropriate for an existing application that has already implemented its own serialization mechanisms. Applications should use these methods only if there is a compelling design requirement to do so.
The low-level API methods are:
@version 1.1byte[] {@link #getEncodedBytes}int {@link #getEncodedSize}void {@link #setEncodedSize(int)}void {@link #putEncodedBytes(byte[],int,int)}void {@link #copyFromEncodedBytes(byte[],int,int,int)}boolean {@link #ensureFit(int)}
Some examples of where values may be accessed:
{@link ObjectReference#getValue(com.sun.jdi.Field) ObjectReference.getValue(Field)} - value of a field {@link StackFrame#getValue(com.sun.jdi.LocalVariable) StackFrame.getValue(LocalVariable)} - value of a variable {@link VirtualMachine#mirrorOf(double) VirtualMachine.mirrorOf(double)} - created in the target VM by the JDI client {@link com.sun.jdi.event.ModificationWatchpointEvent#valueToBe() ModificationWatchpointEvent.valueToBe()} - returned with an event
The following table illustrates which subinterfaces of Value are used to mirror values in the target VM --
Subinterfaces of {@link PrimitiveValue} | |||
---|---|---|---|
Kind of value | For example - expression in target | Is mirrored as an instance of | {@link Type} of value {@link #type() Value.type()} |
a boolean | true | {@link BooleanValue} | {@link BooleanType} |
a byte | (byte)4 | {@link ByteValue} | {@link ByteType} |
a char | 'a' | {@link CharValue} | {@link CharType} |
a double | 3.1415926 | {@link DoubleValue} | {@link DoubleType} |
a float | 2.5f | {@link FloatValue} | {@link FloatType} |
an int | 22 | {@link IntegerValue} | {@link IntegerType} |
a long | 1024L | {@link LongValue} | {@link LongType} |
a short | (short)12 | {@link ShortValue} | {@link ShortType} |
a void | | {@link VoidValue} | {@link VoidType} |
Subinterfaces of {@link ObjectReference} | |||
Kind of value | For example - expression in target | Is mirrored as an instance of | {@link Type} of value {@link #type() Value.type()} |
a class instance | this | {@link ObjectReference} | {@link ClassType} |
an array | new int[5] | {@link ArrayReference} | {@link ArrayType} |
a string | "hello" | {@link StringReference} | {@link ClassType} |
a thread | Thread.currentThread() | {@link ThreadReference} | {@link ClassType} |
a thread group | Thread.currentThread() | {@link ThreadGroupReference} | {@link ClassType} |
a java.lang.Class instance | this.getClass() | {@link ClassObjectReference} | {@link ClassType} |
a class loader | this.getClass() | {@link ClassLoaderReference} | {@link ClassType} |
Other | |||
Kind of value | For example - expression in target | Is mirrored as | {@link Type} of value |
null | null | null | n/a |
Warning: This is a facade provided for use by user code, not for implementation in user code. User implementations of this interface are highly likely to be incompatible with future releases of the product at both binary and source levels.
All value objects are immutable once they have been created.
An empty sequence is the XPath 2.0 equivalent of a Java null value. See {@link Sequence#EMPTY}.
@volantis-api-include-in PublicAPI @volantis-api-include-in ProfessionalServicesAPI @volantis-api-include-in InternalAPI @mock.generateThis interface extends {@link IOReadableWritable} and requires to implementthe serialization of its value. @see eu.stratosphere.core.io.IOReadableWritable
This interface extends {@link IOReadableWritable} and requires to implementthe serialization of its value. @see org.apache.flink.core.io.IOReadableWritable
String[] onProvideCompletionsFromMyField(String input) { return . . .; }
An abstract value.
@author Jochen WiedmannAs a style sheet may express values in several different units. This class purpose is to pack the value and the units it is expressed in into a single object.
The following features are supported:
Smooks smooks = new Smooks(); Value customerNumberValue = new Value( "customerNumber", "customer/@number") .setDecoder("Integer"); Value customerNameValue = new Value( "customerName", "customer") .setDefault("Unknown"); smooks.addVisitors(customerNumberValue); smooks.addVisitors(customerNameValue);And the execution code:
JavaResult result = new JavaResult(); smooks.filterSource(new StreamSource(orderMessageStream), result); Integer customerNumber = (Integer) result.getBean("customerNumber"); String customerName = (String) result.getBean("customerName");@author maurice.zeijen@smies.com @see Bean
The following features are supported:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|