com.jamonapi
Class MonKeyBase

java.lang.Object
  extended by com.jamonapi.MonKeyBase
All Implemented Interfaces:
MonKey, MonKeyItem

public class MonKeyBase
extends java.lang.Object
implements MonKey

Class that can be used as a composite key for MonitorFactor.add(compositeKey, 100) method calls Note the passed in LinkedHashMap is used as a key to another Map that looks up the associated monitor. Sun java docs says this regarding keys in Maps: "Note: great care must be exercised if mutable objects are used as map keys. The behavior of a map is not specified if the value of an object is changed in a manner that affects equals comparisons while the object is a key in the map." So once a value is placed in the LinkedHashMap is passed to the MonKeyBase constructor it should not be changed.


Field Summary
 
Fields inherited from interface com.jamonapi.MonKey
LABEL_HEADER, UNITS_HEADER
 
Constructor Summary
MonKeyBase(java.util.LinkedHashMap keyMap)
          Calls the other constructor.
MonKeyBase(java.lang.String rangeKeyStr, java.util.LinkedHashMap keyMap)
          The LinkHashMap will contain key value pairs.
 
Method Summary
 boolean equals(java.lang.Object compareKey)
          This method is called automatically by a HashMap when this class is used as a HashMap key.
 java.util.List getBasicHeader(java.util.List header)
          Puts the word 'Label' into the list.
 java.util.List getBasicRowData(java.util.List rowData)
          Returns the values assoicated with the key as a comma delimited entry in the list.
 java.lang.Object getDetails()
           
 java.util.List getDisplayHeader(java.util.List header)
          Returns each key in the map as a header element in the list
 java.util.List getHeader(java.util.List header)
          Returns each key in the map as a header element in the list
 java.util.Map getMonKeyMap()
          Return the map underlying this Object
 java.lang.String getRangeKey()
          Returns either the passed in range key, or it builds the key from the maps keys concatenated
 java.util.List getRowData(java.util.List rowData)
          Add each value from the map at an element to the list.
 java.util.List getRowDisplayData(java.util.List rowData)
          Add each value from the map at an element to the list.
 java.lang.Object getValue(java.lang.String key)
          Returns any object that has a named key.
 int hashCode()
          Used when key is put into a Map to look up the monitor
static void main(java.lang.String[] arg)
           
 void setDetails(java.lang.Object details)
           
 java.lang.String toString()
          Returns a string representation of this object: JAMon Key, firstname=steve, lastname=souza, age=44
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MonKeyBase

public MonKeyBase(java.util.LinkedHashMap keyMap)
Calls the other constructor. The keyMap will be used to create the range name


MonKeyBase

public MonKeyBase(java.lang.String rangeKeyStr,
                  java.util.LinkedHashMap keyMap)
The LinkHashMap will contain key value pairs. For example: fn=steve, ln=souza, age=44. LinkHashMap is used as the insertion order needs to be retained for displaying header, and data. The rangeKeyString is used to look up an associated range should one exist

Method Detail

getValue

public java.lang.Object getValue(java.lang.String key)
Returns any object that has a named key. In this keys case 'label' and 'units' makes sense, but any values are acceptible.

Specified by:
getValue in interface MonKey

equals

public boolean equals(java.lang.Object compareKey)
This method is called automatically by a HashMap when this class is used as a HashMap key. A Coordinate is considered equal if its x and y variables have the same value.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Used when key is put into a Map to look up the monitor

Overrides:
hashCode in class java.lang.Object

getMonKeyMap

public java.util.Map getMonKeyMap()
Return the map underlying this Object


getBasicHeader

public java.util.List getBasicHeader(java.util.List header)
Puts the word 'Label' into the list. Used in the basic JAMon report


getDisplayHeader

public java.util.List getDisplayHeader(java.util.List header)
Returns each key in the map as a header element in the list


getHeader

public java.util.List getHeader(java.util.List header)
Returns each key in the map as a header element in the list


getBasicRowData

public java.util.List getBasicRowData(java.util.List rowData)
Returns the values assoicated with the key as a comma delimited entry in the list. For example if the map contains firstname, lastname, age then something like steve, souza, 44 would be returned


getRowData

public java.util.List getRowData(java.util.List rowData)
Add each value from the map at an element to the list.


getRowDisplayData

public java.util.List getRowDisplayData(java.util.List rowData)
Add each value from the map at an element to the list.


toString

public java.lang.String toString()
Returns a string representation of this object: JAMon Key, firstname=steve, lastname=souza, age=44

Overrides:
toString in class java.lang.Object

getRangeKey

public java.lang.String getRangeKey()
Returns either the passed in range key, or it builds the key from the maps keys concatenated

Specified by:
getRangeKey in interface MonKey

getDetails

public java.lang.Object getDetails()
Specified by:
getDetails in interface MonKeyItem

setDetails

public void setDetails(java.lang.Object details)
Specified by:
setDetails in interface MonKeyItem

main

public static void main(java.lang.String[] arg)