Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.util
Class MapUtil

java.lang.Object
  extended by org.hyperic.util.MapUtil

public class MapUtil
extends java.lang.Object


Method Summary
static java.lang.Object getOrCreate(java.util.Map m, java.lang.Object key, java.lang.Class toCreate)
          Get a value from a map, creating a new instance of a class and inserting it as the default value if it's not found.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getOrCreate

public static java.lang.Object getOrCreate(java.util.Map m,
                                           java.lang.Object key,
                                           java.lang.Class toCreate)
Get a value from a map, creating a new instance of a class and inserting it as the default value if it's not found. This method synchronizes on the map argument and relies on toCreate to be a class with a default constructor.

Parameters:
m - Map to get value from
key - Key into map
toCreate - Class to instantiate and insert into 'm' if the key doesn't exist in the map.
Returns:
The value of the map in the key, or an instance of toCreate if not.

main

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

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.