org.marketcetera.ors.info
Interface ReadInfo

All Known Subinterfaces:
ReadWriteInfo, RequestInfo, SessionInfo, SystemInfo
All Known Implementing Classes:
RequestInfoImpl, SessionInfoImpl, SystemInfoImpl

public interface ReadInfo

A generic store of key-value pairs whose contents are checked against certain conditions upon retrieval.

Since:
2.0.0
Version:
$Id: ReadInfo.java 16154 2012-07-14 16:34:05Z colin $
Author:
tlerios@marketcetera.com

Method Summary
 boolean contains(String key)
          Checks whether the given key is associated with a value (which may or may not be null) in the receiver's map.
 String getName()
          Returns the receiver's name.
 String getPath()
          Returns the receiver's path name.
 Object getValue(String key)
          Returns the value associated with the given key in the receiver's map.
<T> T
getValueIfInstanceOf(String key, Class<T> cls)
          Returns the value associated with the given key in the receiver's map, provided one is set and is either null or an object of the given class.
 Object getValueIfNonNull(String key)
          Returns the value associated with the given key in the receiver's map, provided one is set and is not null.
<T> T
getValueIfNonNullInstanceOf(String key, Class<T> cls)
          Returns the value associated with the given key in the receiver's map, provided one is set and is non-null and an object of the given class.
 Object getValueIfSet(String key)
          Returns the value associated with the given key in the receiver's map, provided one (which may be null) is set.
 

Method Detail

getName

String getName()
Returns the receiver's name.

Returns:
The name.

getPath

String getPath()
Returns the receiver's path name.

Returns:
The path name.

contains

boolean contains(String key)
Checks whether the given key is associated with a value (which may or may not be null) in the receiver's map.

Parameters:
key - The key.
Returns:
Returns true if it is.

getValue

Object getValue(String key)
Returns the value associated with the given key in the receiver's map.

Parameters:
key - The key.
Returns:
The value. It may be null, indicating either that the given key is absent or that the null value is associated with that key; use contains(String) to distinguish these two cases.

getValueIfSet

Object getValueIfSet(String key)
                     throws InfoException
Returns the value associated with the given key in the receiver's map, provided one (which may be null) is set.

Parameters:
key - The key.
Returns:
The value. It may be null.
Throws:
InfoException - Thrown if no value is associated with the given key.

getValueIfNonNull

Object getValueIfNonNull(String key)
                         throws InfoException
Returns the value associated with the given key in the receiver's map, provided one is set and is not null.

Parameters:
key - The key.
Returns:
The value.
Throws:
InfoException - Thrown if no or a null value is associated with the given key.

getValueIfInstanceOf

<T> T getValueIfInstanceOf(String key,
                           Class<T> cls)
                       throws InfoException
Returns the value associated with the given key in the receiver's map, provided one is set and is either null or an object of the given class.

Parameters:
key - The key.
cls - The class.
Returns:
The value. It may be null.
Throws:
InfoException - Thrown if a no value is associated with the given key, or if the value is non-null and of a class other than the given one.

getValueIfNonNullInstanceOf

<T> T getValueIfNonNullInstanceOf(String key,
                                  Class<T> cls)
                              throws InfoException
Returns the value associated with the given key in the receiver's map, provided one is set and is non-null and an object of the given class.

Parameters:
key - The key.
cls - The class.
Returns:
The value.
Throws:
InfoException - Thrown if a no value is associated with the given key, or if the value is null or of a class other than the given one.


Copyright © 2012. All Rights Reserved.