OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [javax/] [management/] [MBeanParameterInfo.java] - Blame information for rev 848

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 772 jeremybenn
/* MBeanParameterInfo.java -- Information about an operation's parameters.
2
   Copyright (C) 2006 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;
39
 
40
/**
41
 * Describes the parameters of a constructor or operation associated
42
 * with a management bean.  The information in this class is immutable
43
 * as standard.  Of course, subclasses may change this, but this
44
 * behaviour is not recommended.
45
 *
46
 * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
47
 * @since 1.5
48
 */
49
public class MBeanParameterInfo
50
  extends MBeanFeatureInfo
51
  implements Cloneable
52
{
53
 
54
  /**
55
   * Compatible with JDK 1.5
56
   */
57
  private static final long serialVersionUID = 7432616882776782338L;
58
 
59
  /**
60
   * The type of the parameter, represented by the class name.
61
   */
62
  private String type;
63
 
64
  /**
65
   * Constructs a new {@link MBeanParameterInfo} using the specified
66
   * name, description and type.
67
   *
68
   * @param name the name of the attribute.
69
   * @param type the type of the attribute, in the form of its class name.
70
   * @param desc a description of the attribute.
71
   */
72
  public MBeanParameterInfo(String name, String type, String desc)
73
  {
74
    super(name, desc);
75
    this.type = type;
76
  }
77
 
78
  /**
79
   * Returns a clone of this instance.  The clone is created
80
   * using just the method provided by {@link java.lang.Object}.
81
   * Thus, the clone is just a shallow clone as returned by
82
   * that method, and does not contain any deeper cloning based
83
   * on the subject of this class.
84
   *
85
   * @return a clone of this instance.
86
   * @see java.lang.Cloneable
87
   */
88
  public Object clone()
89
  {
90
    try
91
      {
92
        return super.clone();
93
      }
94
    catch (CloneNotSupportedException e)
95
      {
96
        /* This shouldn't happen; we implement Cloneable */
97
        throw new IllegalStateException("clone() called on " +
98
                                        "non-cloneable object.");
99
      }
100
  }
101
 
102
  /**
103
   * Compares this feature with the supplied object.  This returns
104
   * true iff the object is an instance of {@link MBeanParameterInfo},
105
   * {@link Object#equals()} returns true for a comparison of both the
106
   * name and description of this parameter with that of the specified
107
   * object (performed by the superclass), and the type of the two
108
   * instances is equal.
109
   *
110
   * @param obj the object to compare.
111
   * @return true if the object is a {@link MBeanParameterInfo}
112
   *         instance,
113
   *         <code>name.equals(object.getName())</code>,
114
   *         <code>description.equals(object.getDescription())</code>,
115
   *         and <code>type.equals(object.getType())</code>.
116
   */
117
  public boolean equals(Object obj)
118
  {
119
    if (!(obj instanceof MBeanParameterInfo))
120
      return false;
121
    if (!(super.equals(obj)))
122
      return false;
123
    MBeanParameterInfo o = (MBeanParameterInfo) obj;
124
    return type.equals(o.getType());
125
  }
126
 
127
  /**
128
   * Returns the type of this attribute, in the form of its class name.
129
   *
130
   * @return the type of this attribute.
131
   */
132
  public String getType()
133
  {
134
    return type;
135
  }
136
 
137
  /**
138
   * Returns the hashcode of the parameter information as the sum of
139
   * the hashcode of the superclass and the hashcode of the type.
140
   *
141
   * @return the hashcode of the parameter information.
142
   */
143
  public int hashCode()
144
  {
145
    return super.hashCode() + type.hashCode();
146
  }
147
 
148
  /**
149
   * <p>
150
   * Returns a textual representation of this instance.  This
151
   * is constructed using the class name
152
   * (<code>javax.management.MBeanParameterInfo</code>) along
153
   * with the name, description and type of the parameter.
154
   * </p>
155
   * <p>
156
   * As instances of this class are immutable, the return value
157
   * is computed just once for each instance and reused
158
   * throughout its life.
159
   * </p>
160
   *
161
   * @return a @link{java.lang.String} instance representing
162
   *         the instance in textual form.
163
   */
164
  public String toString()
165
  {
166
    if (string == null)
167
      {
168
        super.toString();
169
        string = string.substring(0, string.length() - 1)
170
          + ",type=" + type
171
          + "]";
172
      }
173
    return string;
174
  }
175
 
176
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.