001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package javax.management.openmbean;
023:
024: import java.util.Collection;
025:
026: /**
027: * An Open Data Type for composite data structures.<p>
028: *
029: * @see CompositeDataSupport
030: *
031: * @author <a href="mailto:Adrian.Brock@HappeningTimes.com">Adrian Brock</a>.
032: *
033: * @version $Revision: 57200 $
034: *
035: */
036: public interface CompositeData {
037:
038: // Attributes ----------------------------------------------------
039:
040: // Public --------------------------------------------------------
041:
042: /**
043: * Retrieve the composite type for this composite data
044: *
045: * @return the composite type
046: */
047: CompositeType getCompositeType();
048:
049: /**
050: * Retrieve the value for the item with the passed key
051: *
052: * @param the key to the item
053: * @return the value
054: * @exception IllegalArgumentException when the key is null or the empty
055: * string
056: * @exception InvalidKeyException when the key does not exist
057: */
058: Object get(String key);
059:
060: /**
061: * Retrieve the arrray of values for the item with the passed keys
062: *
063: * @param an array of key values
064: * @return the array of values
065: * @exception IllegalArgumentException when a key is null or the empty
066: * string or the array is null
067: * @exception InvalidKeyException when a key does not exist
068: */
069: Object[] getAll(String[] key);
070:
071: /**
072: * Tests whether a key is part of this composite data
073: *
074: * @param the key to test
075: * @return true when the key exists, false otherwise
076: */
077: boolean containsKey(String key);
078:
079: /**
080: * Tests whether a item exists with the passed value
081: *
082: * @param the value to test
083: * @return true when the value exists, false otherwise
084: */
085: boolean containsValue(Object value);
086:
087: /**
088: * The values of this composite data<p>
089: *
090: * An iterator over the returned collection returns result in ascending
091: * lexicographic order
092: *
093: * @return an unmodifiable Collection of the values of this CompositeType.
094: */
095: Collection values();
096:
097: /**
098: * Tests whether two composite data objects are equal<p>
099: *
100: * The object is non-null<br>
101: * The object implements this interface<br>
102: * The composite types are equal<br>
103: * The values are equal
104: *
105: * @param obj the object to test
106: * @return true when the above conditions are satisfied, false otherwise.
107: */
108: boolean equals(Object obj);
109:
110: /**
111: * Generates a hashcode for the implementation.<p>
112: *
113: * The sum of the hashCodes for the elements mentioned in the equals
114: * method
115: *
116: * @return the calculated hashcode
117: */
118: int hashCode();
119:
120: /**
121: * A string representation of the open mbean operation info.<p>
122: *
123: * It is made up of implementation class and the values mentioned
124: * in the equals method
125: *
126: * @return the string
127: */
128: String toString();
129: }
|