javax.infobus
Interface ImmediateAccess


public abstract interface ImmediateAccess

ImmediateAccess is the access interface wrapper for simple DataItems which are not collections of other DataItems, and offers methods to extract the contained data as either a String or an Object.

The getPresentationString method differs from getValueAsString by including locale-specific formatting in the returned string. For example, getPresentationString might return "$100.00" while getValueAsString would return "100" for a DataItem.


Method Summary
 java.lang.String getPresentationString(java.util.Locale locale)
          Extracts the contained data in a String representation which includes appropriate formatting characters like "$" for the specified locale.
 java.lang.Object getValueAsObject()
          Extracts the contained data as an Object.
 java.lang.String getValueAsString()
          Extracts the contained data in a String representation, not necessarily equivalent to getValueAsObject.toString().
 void setValue(java.lang.Object newValue)
          This method sets a new value for the data in the ImmediateAccess.
 

Method Detail

getValueAsString

public java.lang.String getValueAsString()
Extracts the contained data in a String representation, not necessarily equivalent to getValueAsObject.toString(). Does not typically include formatting characters (like "$"), which are included in getPresentationString().
Returns:
the embedded data as a single String representation

getValueAsObject

public java.lang.Object getValueAsObject()
Extracts the contained data as an Object.
Returns:
the DataItem data

getPresentationString

public java.lang.String getPresentationString(java.util.Locale locale)
Extracts the contained data in a String representation which includes appropriate formatting characters like "$" for the specified locale. Localization of symbols and format is the responsibility of the DataItem and its source.

This method may throw UnsupportedOperationException to indicate that it does not support the specified locale.

Parameters:
locale - the locale for which the returned String should be formatted. Null indicates the producer's default locale.
Returns:
the embedded data including specified formatting

setValue

public void setValue(java.lang.Object newValue)
              throws InvalidDataException
This method sets a new value for the data in the ImmediateAccess. The DataItem whose setValue has been called must do a deep copy of newValue rather than adopt a reference to it (so that further changes to newValue by the caller are not reflected after setValue returns)

This method may throw UnsupportedOperationException to indicate that setValue is not supported (its data is immutable).

Parameters:
newValue - the new data to be copied
Throws:
InvalidDataException - if the data item supports modifications but the data in newValue is invalid for this item
UnsupportedOperationException - if the data item does not support modifications