User: juhalindfors
  Date: 01/12/10 09:21:13

  Modified:    src/main/javax/management MBeanAttributeInfo.java
  Log:
  more styling
  
  Revision  Changes    Path
  1.3       +62 -36    jmx/src/main/javax/management/MBeanAttributeInfo.java
  
  Index: MBeanAttributeInfo.java
  ===================================================================
  RCS file: /cvsroot/jboss/jmx/src/main/javax/management/MBeanAttributeInfo.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MBeanAttributeInfo.java   2001/12/05 14:12:46     1.2
  +++ MBeanAttributeInfo.java   2001/12/10 17:21:13     1.3
  @@ -1,22 +1,36 @@
   /*
  - * LGPL
  + * JBoss, the OpenSource J2EE webOS
  + *
  + * Distributable under LGPL license.
  + * See terms of license at gnu.org.
    */
   package javax.management;
   
  +import java.lang.reflect.Method;
  +
  +/**
  + * Represents a management attribute in an MBeans' management interface.
  + *
  + * @see javax.management.MBeanInfo
  + *
  + * @author  <a href="mailto:[EMAIL PROTECTED]";>Juha Lindfors</a>.
  + * @version $Revision: 1.3 $
  + *   
  + */
   public class MBeanAttributeInfo extends MBeanFeatureInfo
  -   implements java.io.Serializable, Cloneable {
  +   implements java.io.Serializable, Cloneable
  +{
   
  +   // Attributes ----------------------------------------------------
      protected String type = null;
      protected boolean isReadable = false;
      protected boolean isWritable = false;
      protected boolean isIs = false;
  -   
  -   public MBeanAttributeInfo(java.lang.String name,
  -                             java.lang.String type,
  -                             java.lang.String description,
  -                             boolean isReadable,
  -                             boolean isWritable,
  -                             boolean isIs) {
  +
  +   // Constructors --------------------------------------------------
  +   public MBeanAttributeInfo(String name, String type, String description,
  +                             boolean isReadable, boolean isWritable, boolean isIs)
  +   {
         super(name, description);
         this.type = type;
         this.isReadable = isReadable;
  @@ -24,61 +38,73 @@
         this.isIs = isIs;
      }
   
  -   public MBeanAttributeInfo(java.lang.String name,
  -                             java.lang.String description,
  -                             java.lang.reflect.Method getter,
  -                             java.lang.reflect.Method setter) throws 
IntrospectionException {
  +   public MBeanAttributeInfo(String name, String description, Method getter, Method 
setter)
  +   throws IntrospectionException
  +   {
         super(name, description);
  -      
  -      if (getter != null) {
  +
  +      if (getter != null)
  +      {
            this.isReadable = true;
            if (getter.getName().startsWith("is"))
               this.isIs = true;
            this.type = getter.getReturnType().getName();
         }
  -      
  -      if (setter != null) {
  +
  +      if (setter != null)
  +      {
            this.isWritable = true;
  -         
  -         if (type == null) {
  -            try {
  +
  +         if (type == null)
  +         {
  +            try
  +            {
                  type = setter.getParameterTypes() [0].getName();
               }
  -            catch (ArrayIndexOutOfBoundsException e) {
  +            catch (ArrayIndexOutOfBoundsException e)
  +            {
                  throw new IntrospectionException("Attribute setter is lacking type: 
" + name);
               }
            }
  -         
  +
            if (!(type.equals(setter.getParameterTypes() [0].getName())))
               throw new IntrospectionException("Attribute type mismatch: " + name);
         }
      }
  -
  -   public java.lang.Object clone() throws CloneNotSupportedException {
  -      MBeanAttributeInfo clone = (MBeanAttributeInfo)super.clone();
  -      clone.type = getType();
  -      clone.isReadable = isReadable();
  -      clone.isWritable = isWritable();
  -      clone.isIs = isIs();
  -      
  -      return clone;
  -   }
   
  -   public java.lang.String getType() {
  +   // Public --------------------------------------------------------
  +   public String getType()
  +   {
         return type;
      }
  -   public boolean isReadable() {
  +   
  +   public boolean isReadable()
  +   {
         return isReadable;
      }
   
  -   public boolean isWritable() {
  +   public boolean isWritable()
  +   {
         return isWritable;
      }
   
  -   public boolean isIs() {
  +   public boolean isIs()
  +   {
         return isIs;
      }
   
  +   // Cloneable implementation --------------------------------------
  +   public Object clone() throws CloneNotSupportedException
  +   {
  +      MBeanAttributeInfo clone = (MBeanAttributeInfo)super.clone();
  +      clone.type = getType();
  +      clone.isReadable = isReadable();
  +      clone.isWritable = isWritable();
  +      clone.isIs = isIs();
   
  +      return clone;
  +   }
   
   }
  +
  +
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to