GNU Classpath (0.95) | |
Frames | No Frames |
1: /* CompositeData.java -- A composite data structure. 2: Copyright (C) 2006, 2007 Free Software Foundation, Inc. 3: 4: This file is part of GNU Classpath. 5: 6: GNU Classpath is free software; you can redistribute it and/or modify 7: it under the terms of the GNU General Public License as published by 8: the Free Software Foundation; either version 2, or (at your option) 9: any later version. 10: 11: GNU Classpath is distributed in the hope that it will be useful, but 12: WITHOUT ANY WARRANTY; without even the implied warranty of 13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14: General Public License for more details. 15: 16: You should have received a copy of the GNU General Public License 17: along with GNU Classpath; see the file COPYING. If not, write to the 18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19: 02110-1301 USA. 20: 21: Linking this library statically or dynamically with other modules is 22: making a combined work based on this library. Thus, the terms and 23: conditions of the GNU General Public License cover the whole 24: combination. 25: 26: As a special exception, the copyright holders of this library give you 27: permission to link this library with independent modules to produce an 28: executable, regardless of the license terms of these independent 29: modules, and to copy and distribute the resulting executable under 30: terms of your choice, provided that you also meet, for each linked 31: independent module, the terms and conditions of the license of that 32: module. An independent module is a module which is not derived from 33: or based on this library. If you modify this library, you may extend 34: this exception to your version of the library, but you are not 35: obligated to do so. If you do not wish to do so, delete this 36: exception statement from your version. */ 37: 38: package javax.management.openmbean; 39: 40: import java.util.Collection; 41: 42: /** 43: * Provides an interface to a composite data structure, 44: * in order to aid interoperability. The composite data 45: * structure is represented by mapping field names to 46: * values. 47: * 48: * @author Andrew John Hughes (gnu_andrew@member.fsf.org) 49: * @since 1.5 50: */ 51: public interface CompositeData 52: { 53: 54: /** 55: * Returns true if this {@link CompositeData} instance contains 56: * the specified key. This method always returns false for 57: * an input key equal to <code>null</code> or the empty string. 58: * 59: * @param key the key to find in the structure. 60: * @return true if the key exists. 61: */ 62: boolean containsKey(String key); 63: 64: /** 65: * Returns true if this {@link CompositeData} instance has 66: * a value equal to that supplied. 67: * 68: * @param value the value to look for. 69: * @return true if the value exists. 70: */ 71: boolean containsValue(Object value); 72: 73: /** 74: * Compares the specified object with this object for equality. 75: * The object is judged equivalent if it is non-null, and also 76: * an instance of {@link CompositeData} with the same name-value 77: * mappings and types. The two compared instances may be 78: * equivalent even if they represent different implementations of 79: * {@link CompositeData}. 80: * 81: * @param obj the object to compare for equality. 82: * @return true if <code>obj</code> is equal to <code>this</code>. 83: */ 84: boolean equals(Object obj); 85: 86: /** 87: * Retrieves the value for the specified key. 88: * 89: * @param key the key whose value should be returned. 90: * @return the matching value. 91: * @throws IllegalArgumentException if the key is <code>null</code> 92: * or the empty string. 93: * @throws InvalidKeyException if the key does not exist. 94: */ 95: Object get(String key); 96: 97: /** 98: * Returns the appropriate value for each key in the given array, 99: * using the same ordering. 100: * 101: * @param keys the keys whose values should be returned. 102: * @return the matching values. 103: * @throws IllegalArgumentException if one of the keys is 104: * <code>null</code> or the 105: * empty string. 106: * @throws InvalidKeyException if one of the keys does not exist. 107: */ 108: Object[] getAll(String[] keys); 109: 110: /** 111: * Returns the composite type which corresponds to this instance 112: * of {@link CompositeData}. 113: * 114: * @return the composite type for this instance. 115: */ 116: CompositeType getCompositeType(); 117: 118: /** 119: * Returns the hash code of this instance. The hash code is 120: * computed as the sum of the hash codes of all the values plus 121: * the hash code of the composite type. As equality comparisons 122: * take place using this same information, this ensures that 123: * the property, <code>e1.equals(e2)</code> implies 124: * <code>e1.hashCode() == e2.hashCode(), holds for any pair 125: * of instances, <code>e1</code> and <code>e2</code>. 126: * 127: * @return the hash code of this {@link CompositeData}. 128: * @see Object#equals(Object) 129: */ 130: int hashCode(); 131: 132: /** 133: * Returns a textual representation of this instance. The 134: * exact format is left up to the implementation, but it 135: * should contain the name of the implementing class, 136: * the name of the type and a mapping of the form 137: * <code>key=value</code> for each pair of key and value. 138: * 139: * @return a {@link java.lang.String} representation of the 140: * object. 141: */ 142: String toString(); 143: 144: /** 145: * Returns a read-only collection of the values associated with 146: * this instance. The values are sorted using the lexicographic 147: * ordering of the corresponding keys. 148: * 149: * @return the values of this instance. 150: */ 151: Collection<?> values(); 152: 153: }
GNU Classpath (0.95) |