1 package org.opensrf.util;
4 import java.util.HashMap;
8 * Generic OpenSRF network-serializable object. This allows
9 * access to object fields.
11 public class OSRFObject extends HashMap<String, Object> implements OSRFSerializable {
13 /** This objects registry */
14 private OSRFRegistry registry;
20 * Creates a new object with the provided registry
22 public OSRFObject(OSRFRegistry reg) {
28 * @return This object's registry
30 public OSRFRegistry getRegistry() {
35 * Implement get() to fulfill our contract with OSRFSerializable
37 public Object get(String field) {
38 return super.get(field);
41 /** Returns the string value found at the given field */
42 public String getString(String field) {
43 return (String) get(field);
46 /** Returns the int value found at the given field */
47 public int getInt(String field) {
48 Object o = get(field);
49 if(o instanceof String)
50 return Integer.parseInt((String) o);
51 return ((Integer) get(field)).intValue();