summaryrefslogtreecommitdiff
path: root/gnu/java/lang
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2007-11-30 01:15:17 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2007-11-30 01:15:17 +0000
commit6114a9a08247cb043e1239f6ac8f690a666a5f41 (patch)
treea64dc5bde871d2c74db98c40333c371d64299557 /gnu/java/lang
parentde5073829367a0573cf11a2985069f7007834b48 (diff)
downloadclasspath-6114a9a08247cb043e1239f6ac8f690a666a5f41.tar.gz
2007-11-30 Andrew John Hughes <gnu_andrew@member.fsf.org>
PR classpath/34276: * gnu/java/lang/management/BeanImpl.java: (getDescription(MBeanConstructorInfo,MBeanParameterInfo,int)): Added to provide a default description if the current one is null. (getDescription(MBeanOperationInfo,MBeanParameterInfo,int)): Likewise. (getParameterName(MBeanConstructorInfo,MBeanParameterInfo,int)): Likewise for the name. (getParameterName(MBeanOperationInfo,MBeanParameterInfo,int)): Likewise. * gnu/javax/management/Server.java: (getMBeanInfo()): Try using a StandardMBean wrapper if reflection fails to find getMBeanInfo().
Diffstat (limited to 'gnu/java/lang')
-rw-r--r--gnu/java/lang/management/BeanImpl.java84
1 files changed, 84 insertions, 0 deletions
diff --git a/gnu/java/lang/management/BeanImpl.java b/gnu/java/lang/management/BeanImpl.java
index 26c42ef6a..a651e3548 100644
--- a/gnu/java/lang/management/BeanImpl.java
+++ b/gnu/java/lang/management/BeanImpl.java
@@ -318,6 +318,90 @@ public class BeanImpl
return (MBeanInfo) openInfo;
}
+ /**
+ * Override this method so as to prevent the description of a constructor's
+ * parameter being @code{null}. Open MBeans can not have @code{null} descriptions,
+ * but one will occur as the names of parameters aren't stored for reflection.
+ *
+ * @param constructor the constructor whose parameter needs describing.
+ * @param parameter the parameter to be described.
+ * @param sequenceNo the number of the parameter to describe.
+ * @return a description of the constructor's parameter.
+ */
+ protected String getDescription(MBeanConstructorInfo constructor,
+ MBeanParameterInfo parameter,
+ int sequenceNo)
+ {
+ String desc = parameter.getDescription();
+ if (desc == null)
+ return "param" + sequenceNo;
+ else
+ return desc;
+ }
+
+ /**
+ * Override this method so as to prevent the description of an operation's
+ * parameter being @code{null}. Open MBeans can not have @code{null} descriptions,
+ * but one will occur as the names of parameters aren't stored for reflection.
+ *
+ * @param operation the operation whose parameter needs describing.
+ * @param parameter the parameter to be described.
+ * @param sequenceNo the number of the parameter to describe.
+ * @return a description of the operation's parameter.
+ */
+ protected String getDescription(MBeanOperationInfo operation,
+ MBeanParameterInfo parameter,
+ int sequenceNo)
+ {
+ String desc = parameter.getDescription();
+ if (desc == null)
+ return "param" + sequenceNo;
+ else
+ return desc;
+ }
+
+ /**
+ * Override this method so as to prevent the name of a constructor's
+ * parameter being @code{null}. Open MBeans can not have @code{null} names,
+ * but one will occur as the names of parameters aren't stored for reflection.
+ *
+ * @param constructor the constructor whose parameter needs a name.
+ * @param parameter the parameter to be named.
+ * @param sequenceNo the number of the parameter to name.
+ * @return a description of the constructor's parameter.
+ */
+ protected String getParameterName(MBeanConstructorInfo constructor,
+ MBeanParameterInfo parameter,
+ int sequenceNo)
+ {
+ String name = parameter.getName();
+ if (name == null)
+ return "param" + sequenceNo;
+ else
+ return name;
+ }
+
+ /**
+ * Override this method so as to prevent the name of an operation's
+ * parameter being @code{null}. Open MBeans can not have @code{null} names,
+ * but one will occur as the names of parameters aren't stored for reflection.
+ *
+ * @param operation the operation whose parameter needs a name.
+ * @param parameter the parameter to be named.
+ * @param sequenceNo the number of the parameter to name.
+ * @return a description of the operation's parameter.
+ */
+ protected String getParameterName(MBeanOperationInfo operation,
+ MBeanParameterInfo parameter,
+ int sequenceNo)
+ {
+ String name = parameter.getName();
+ if (name == null)
+ return "param" + sequenceNo;
+ else
+ return name;
+ }
+
public MBeanInfo getMBeanInfo()
{
super.getMBeanInfo();