User: juhalindfors
Date: 02/03/20 06:50:44
Modified: src/main/javax/management/modelmbean Tag: BranchMX_1_0
ModelMBeanAttributeInfo.java
ModelMBeanOperationInfo.java
Log:
toString() impl
Revision Changes Path
No revision
No revision
1.3.2.1 +36 -4
jmx/src/main/javax/management/modelmbean/ModelMBeanAttributeInfo.java
Index: ModelMBeanAttributeInfo.java
===================================================================
RCS file:
/cvsroot/jboss/jmx/src/main/javax/management/modelmbean/ModelMBeanAttributeInfo.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- ModelMBeanAttributeInfo.java 8 Mar 2002 22:09:20 -0000 1.3
+++ ModelMBeanAttributeInfo.java 20 Mar 2002 14:50:43 -0000 1.3.2.1
@@ -21,8 +21,14 @@
* @see javax.management.MBeanAttributeInfo
*
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>.
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.3.2.1 $
*
+ * <p><b>Revisions:</b>
+ *
+ * <p><b>20020320 Juha Lindfors:</b>
+ * <ul>
+ * <li>toString() implementation</li>
+ * </ul>
*/
public class ModelMBeanAttributeInfo
extends MBeanAttributeInfo
@@ -54,7 +60,9 @@
}
/**
- * Creates a new attribute info object.
+ * Creates a new attribute info object. If a <tt>null</tt> or
+ * invalid descriptor is passed as a parameter, a default descriptor will be
created
+ * for the attribute.
*
* @param name name of the attribute
* @param description human readable description string
@@ -154,6 +162,14 @@
return (Descriptor)descriptor.clone();
}
+ /**
+ * Replaces the descriptor associated with this attribute. If the
<tt>inDescriptor</tt>
+ * argument is <tt>null</tt> then the existing descriptor is replaced with a
default
+ * descriptor.
+ *
+ * @param inDescriptor descriptor used for replacing the existing operation
descriptor
+ * @throws IllegalArgumentException if the new descriptor is not valid
+ */
public void setDescriptor(Descriptor inDescriptor)
{
if (inDescriptor == null)
@@ -182,10 +198,26 @@
}
// Object override -----------------------------------------------
+ /**
+ * Returns a string representation of this Model MBean attribute info object.
+ * The returned string is in the form: <pre>
+ *
+ * ModelMBeanAttributeInfo[Name=<attribute name>,
+ * Type=<class name of the attribute type>,
+ * Access= RW | RO | WO,
+ * Descriptor=(fieldName1=fieldValue1, ... ,
fieldName<n>=fieldValue<n>)]
+ *
+ * </pre>
+ *
+ * @return string representation of this object
+ */
public String toString()
{
- // FIXME: human readable string
- return super.toString();
+ return "ModelMBeanAttributeInfo[" +
+ "Name=" + getName() +
+ ",Type=" + getType() +
+ ",Access=" + ((isReadable() && isWritable()) ? "RW" : (isReadable()) ?
"RO" : "WO") +
+ ",Descriptor(" + getDescriptor() + ")]";
}
// Private -------------------------------------------------------
1.5.2.1 +62 -3
jmx/src/main/javax/management/modelmbean/ModelMBeanOperationInfo.java
Index: ModelMBeanOperationInfo.java
===================================================================
RCS file:
/cvsroot/jboss/jmx/src/main/javax/management/modelmbean/ModelMBeanOperationInfo.java,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -r1.5 -r1.5.2.1
--- ModelMBeanOperationInfo.java 8 Mar 2002 22:09:20 -0000 1.5
+++ ModelMBeanOperationInfo.java 20 Mar 2002 14:50:43 -0000 1.5.2.1
@@ -22,7 +22,14 @@
* @see javax.management.modelmbean.ModelMBeanInfoSupport
*
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>.
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.5.2.1 $
+ *
+ * <p><b>Revisions:</b>
+ *
+ * <p><b>20020320 Juha Lindfors:</b>
+ * <ul>
+ * <li>toString() implementation</li>
+ * </ul>
*/
public class ModelMBeanOperationInfo
extends MBeanOperationInfo
@@ -167,13 +174,65 @@
}
// Object overrides ----------------------------------------------
+ /**
+ * Returns a string representation of this Model MBean operation info object.
+ * The returned string is in the form: <pre>
+ *
+ * ModelMBeanOperationInfo[<return type> <operation
name>(<signature>),
+ * Impact=ACTION | INFO | ACTION_INFO | UNKNOWN,
+ * Descriptor=(fieldName1=fieldValue1, ... ,
fieldName<n>=fieldValue<n>)]
+ *
+ * </pre>
+ *
+ * @return string representation of this object
+ */
public String toString()
{
- // FIXME: human readable string
- return super.toString();
+ return "ModelMBeanOperationInfo[" +
+ getReturnType() + " " + getName() + getSignatureString() +
+ ",Impact=" + getImpactString() +
+ ",Descriptor(" + getDescriptor() + ")]";
}
// Private -------------------------------------------------------
+ private String getSignatureString()
+ {
+ StringBuffer sbuf = new StringBuffer(400);
+ sbuf.append("(");
+
+ MBeanParameterInfo[] sign = getSignature();
+
+ if (sign.length > 0)
+ {
+ for (int i = 0; i < sign.length; ++i)
+ {
+ sbuf.append(sign[i].getType());
+ sbuf.append(" ");
+ sbuf.append(sign[i].getName());
+
+ sbuf.append(",");
+ }
+
+ sbuf.delete(sbuf.length() - 1, sbuf.length());
+ }
+ sbuf.append(")");
+
+ return sbuf.toString();
+ }
+
+ private String getImpactString()
+ {
+ int impact = getImpact();
+ if (impact == MBeanOperationInfo.ACTION)
+ return "ACTION";
+ else if (impact == MBeanOperationInfo.INFO)
+ return "INFO";
+ else if (impact == MBeanOperationInfo.ACTION_INFO)
+ return "ACTION_INFO";
+ else
+ return "UNKNOWN";
+ }
+
private Descriptor createDefaultDescriptor()
{
DescriptorSupport descr = new DescriptorSupport();
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development