commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons-sandbox/clazz/src/java/org/apache/commons/clazz ClazzProperty.java ClazzOperation.java ClazzModifiers.java Clazz.java MetaUnit.java Bean.java Property.java Operation.java MetaProperty.java MetaOperation.java MetaBean.java MetaModifiers.java
Date Wed, 30 Oct 2002 21:16:07 GMT
scolebourne    2002/10/30 13:16:07

  Modified:    clazz/src/java/org/apache/commons/clazz MetaUnit.java
                        Bean.java Property.java Operation.java
  Added:       clazz/src/java/org/apache/commons/clazz ClazzProperty.java
                        ClazzOperation.java ClazzModifiers.java Clazz.java
  Removed:     clazz/src/java/org/apache/commons/clazz MetaProperty.java
                        MetaOperation.java MetaBean.java MetaModifiers.java
  Log:
  Updated class names and method signatures
  
  Revision  Changes    Path
  1.2       +2 -2      jakarta-commons-sandbox/clazz/src/java/org/apache/commons/clazz/MetaUnit.java
  
  Index: MetaUnit.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/clazz/src/java/org/apache/commons/clazz/MetaUnit.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MetaUnit.java	27 Oct 2002 22:45:24 -0000	1.1
  +++ MetaUnit.java	30 Oct 2002 21:16:06 -0000	1.2
  @@ -74,7 +74,7 @@
        * 
        * @return the modifiers object
        */
  -    public MetaModifiers getModifiers();
  +    public ClazzModifiers getModifiers();
   
       //--------------------------------------------------------------------------
       
  
  
  
  1.2       +3 -3      jakarta-commons-sandbox/clazz/src/java/org/apache/commons/clazz/Bean.java
  
  Index: Bean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/clazz/src/java/org/apache/commons/clazz/Bean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Bean.java	27 Oct 2002 22:45:24 -0000	1.1
  +++ Bean.java	30 Oct 2002 21:16:06 -0000	1.2
  @@ -64,11 +64,11 @@
   public interface Bean extends Unit {
       
       /**
  -     * Gets the MetaBean for the bean.
  +     * Gets the Clazz for the bean.
        * 
        * @return the meta bean for the bean
        */
  -    public String getMetaBean();
  +    public String getClazz();
   
       //--------------------------------------------------------------------------
       
  
  
  
  1.2       +3 -3      jakarta-commons-sandbox/clazz/src/java/org/apache/commons/clazz/Property.java
  
  Index: Property.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/clazz/src/java/org/apache/commons/clazz/Property.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Property.java	27 Oct 2002 22:45:24 -0000	1.1
  +++ Property.java	30 Oct 2002 21:16:06 -0000	1.2
  @@ -69,11 +69,11 @@
   public interface Property extends Unit {
       
       /**
  -     * Gets the MetaProperty for the bean.
  +     * Gets the ClazzProperty for the bean.
        * 
        * @return the meta property for the bean
        */
  -    public MetaProperty getMetaProperty();
  +    public ClazzProperty getClazzProperty();
   
       /**
        * Gets the Bean for the property.
  
  
  
  1.2       +3 -3      jakarta-commons-sandbox/clazz/src/java/org/apache/commons/clazz/Operation.java
  
  Index: Operation.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/clazz/src/java/org/apache/commons/clazz/Operation.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Operation.java	27 Oct 2002 22:45:24 -0000	1.1
  +++ Operation.java	30 Oct 2002 21:16:06 -0000	1.2
  @@ -68,11 +68,11 @@
   public interface Operation extends Unit {
       
       /**
  -     * Gets the MetaOperation for the bean.
  +     * Gets the ClazzOperation for the bean.
        * 
        * @return the meta operation for the bean
        */
  -    public MetaOperation getMetaOperation();
  +    public ClazzOperation getClazzOperation();
   
       /**
        * Gets the Bean for the property.
  
  
  
  1.1                  jakarta-commons-sandbox/clazz/src/java/org/apache/commons/clazz/ClazzProperty.java
  
  Index: ClazzProperty.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.clazz;
  
  /**
   * <code>ClazzProperty</code> defines a field in a Java class.
   *
   * @author <a href="mailto:scolebourne@apache.org">Stephen Colebourne</a>
   * @version $Id: ClazzProperty.java,v 1.1 2002/10/30 21:16:06 scolebourne Exp $
   */
  public interface ClazzProperty extends MetaUnit {
      
      /**
       * Gets the clazz that this property is contained in.
       *
       * @return the owning meta bean
       */
      public Clazz getClazz();
      
      /**
       * Gets the type of the property.
       *
       * @return the type of the property
       */
      public Clazz getType();
      
      /**
       * Gets the type of the item if a List, Array or Map.
       *
       * @return the type of the item
       */
      public Clazz getContentType();
      
      /**
       * Gets the type of the key if a Map.
       *
       * @return the type of the key
       */
      public Clazz getKeyType();
      
      /**
       * Gets the value of the property.
       *
       * @param instance  the instance to query
       * @return the value of the property in that instance
       */
      public Object get(Object instance);
      
      /**
       * Sets the value of the property.
       *
       * @param instance  the instance to query
       * @param value  the value of the property in that instance
       */
      public void set(Object instance, Object value);
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/clazz/src/java/org/apache/commons/clazz/ClazzOperation.java
  
  Index: ClazzOperation.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.clazz;
  
  import java.util.List;
  /**
   * <code>ClazzOperation</code> defines a Java method.
   *
   * @author <a href="mailto:scolebourne@apache.org">Stephen Colebourne</a>
   * @version $Id: ClazzOperation.java,v 1.1 2002/10/30 21:16:06 scolebourne Exp $
   */
  public interface ClazzOperation extends MetaUnit {
      
      /**
       * Gets the clazz that this property is contained in.
       *
       * @return the owning meta bean
       */
      public Clazz getClazz();
      
      /**
       * Get the return type of the method.
       *
       * @return the return type
       */
      public Clazz getReturnType();
      
      /**
       * Get the parameters of the method in order.
       *
       * @return list of Clazz objects
       */
      public List getParameters();
      
      /**
       * Gets a parameter of the method by index.
       *
       * @param index  the index to retrieve
       * @return a parameter by index
       */
      public Clazz getParameter(int index);
      
      /**
       * Invokes the operation on a specified instance.
       *
       * @param instance  the instance to invoke
       * @param params  the parameters to pass to the operation
       * @return the result of calling the operation
       */
      public Object invoke(Object instance, Object[] params);
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/clazz/src/java/org/apache/commons/clazz/ClazzModifiers.java
  
  Index: ClazzModifiers.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.clazz;
  
  import java.lang.reflect.Modifier;
  
  import org.apache.commons.lang.StringUtils;
  /**
   * <code>AModifiers</code> defines the modifiers in a manipulable way.
   *
   * @author <a href="mailto:scolebourne@apache.org">Stephen Colebourne</a>
   * @version $Id: ClazzModifiers.java,v 1.1 2002/10/30 21:16:06 scolebourne Exp $
   */
  public class ClazzModifiers {
      
      /**
       * The <code>int</code> value representing the <code>public</code>

       * modifier.
       */    
      public static final int PUBLIC           = Modifier.PUBLIC;
  
      /**
       * The <code>int</code> value representing the <code>private</code>

       * modifier.
       */    
      public static final int PRIVATE          = Modifier.PRIVATE;
  
      /**
       * The <code>int</code> value representing the <code>protected</code>

       * modifier.
       */    
      public static final int PROTECTED        = Modifier.PROTECTED;
  
      /**
       * The <code>int</code> value representing the <code>static</code>

       * modifier.
       */    
      public static final int STATIC           = Modifier.STATIC;
  
      /**
       * The <code>int</code> value representing the <code>final</code>

       * modifier.
       */    
      public static final int FINAL            = Modifier.FINAL;
  
      /**
       * The <code>int</code> value representing the <code>synchronized</code>

       * modifier.
       */    
      public static final int SYNCHRONIZED     = Modifier.SYNCHRONIZED;
  
      /**
       * The <code>int</code> value representing the <code>volatile</code>

       * modifier.
       */    
      public static final int VOLATILE         = Modifier.VOLATILE;
  
      /**
       * The <code>int</code> value representing the <code>transient</code>

       * modifier.
       */    
      public static final int TRANSIENT        = Modifier.TRANSIENT;
  
      /**
       * The <code>int</code> value representing the <code>native</code>

       * modifier.
       */    
      public static final int NATIVE           = Modifier.NATIVE;
  
      /**
       * The <code>int</code> value representing the <code>interface</code>

       * modifier.
       */    
      public static final int INTERFACE        = Modifier.INTERFACE;
  
      /**
       * The <code>int</code> value representing the <code>abstract</code>

       * modifier.
       */    
      public static final int ABSTRACT         = Modifier.ABSTRACT;
  
      /**
       * The <code>int</code> value representing the <code>strictfp</code>

       * modifier.
       */    
      public static final int STRICT           = Modifier.STRICT;
  
      /** The modifiers */
      private int modifiers = 0;
      
      /**
       * Constructor.
       *
       * @param modifiers  the modifiers
       */
      public ClazzModifiers(int modifiers) {
          super();
          setFlags(modifiers);
      }
      
      /**
       * Copy constructor.
       *
       * @param modifiers  the modifiers object
       * @throws IllegalArgumentException if the modifiers object is null
       */
      public ClazzModifiers(ClazzModifiers modifiers) {
          super();
          if (modifiers == null) {
              throw new IllegalArgumentException("The modifiers must not be null");
          }
          setFlags(modifiers.getFlags());
      }
      
      //--------------------------------------------------------------------------
      
      /**
       * Gets the modifier flags, which can be accessed via java.lang.reflect.Modifier.
       * 
       * @return the modifier flags
       */
      public int getFlags() {
          return modifiers;
      }
  
      /**
       * Sets the modifier flags.
       * 
       * @param modifiers  the modifier flags to update to
       */
      public void setFlags(int modifiers) {
          this.modifiers = modifiers;
      }
  
      //--------------------------------------------------------------------------
      
      /**
       * Is the object public scope.
       * 
       * @return true if public scope
       */
      public boolean isPublicScope() {
          return (getFlags() & PUBLIC) != 0;
      }
      
      /**
       * Set the object to be public scope.
       */
      public void setPublicScope() {
          setFlags(getFlags() & ~Modifier.PRIVATE & ~Modifier.PROTECTED & Modifier.PUBLIC);
      }
      
      //--------------------------------------------------------------------------
      
      /**
       * Is the object protected scope.
       * 
       * @return true if protected scope
       */
      public boolean isProtectedScope() {
          return (getFlags() & PROTECTED) != 0;
      }
      
      /**
       * Set the object to be protected scope.
       */
      public void setProtectedScope() {
          setFlags(getFlags() & ~Modifier.PRIVATE & Modifier.PROTECTED & ~Modifier.PUBLIC);
      }
      
      //--------------------------------------------------------------------------
      
      /**
       * Is the object package scope.
       * 
       * @return true if package scope
       */
      public boolean isPackageScope() {
          return ((isPublicScope() == false) &&
                  (isProtectedScope() == false) &&
                  (isPrivateScope() == false));
      }
      
      /**
       * Set the object to be package scope.
       */
      public void setPackageScope() {
          setFlags(getFlags() & ~Modifier.PRIVATE & ~Modifier.PROTECTED & ~Modifier.PUBLIC);
      }
      
      //--------------------------------------------------------------------------
      
      /**
       * Is the object private scope.
       * 
       * @return true if private scope
       */
      public boolean isPrivateScope() {
          return (getFlags() & PRIVATE) != 0;
      }
      
      /**
       * Set the object to be private scope.
       */
      public void setPrivateScope() {
          setFlags(getFlags() & Modifier.PRIVATE & ~Modifier.PROTECTED & ~Modifier.PUBLIC);
      }
      
      //--------------------------------------------------------------------------
      
      /**
       * Is the object static.
       * 
       * @return true if static
       */
      public boolean isStatic() {
          return (getFlags() & STATIC) != 0;
      }
      
      /**
       * Set the object to be static.
       * 
       * @param state  true to make static
       */
      public void setStatic(boolean state) {
          if (state) {
              setFlags(getFlags() & Modifier.STATIC);
          } else {
              setFlags(getFlags() & ~Modifier.STATIC);
          }
      }
      
      //--------------------------------------------------------------------------
      
      /**
       * Is the object final.
       * 
       * @return true if final
       */
      public boolean isFinal() {
          return (getFlags() & FINAL) != 0;
      }
      
      /**
       * Set the object to be final.
       * 
       * @param state  true to make final
       */
      public void setFinal(boolean state) {
          if (state) {
              setFlags(getFlags() & Modifier.FINAL);
          } else {
              setFlags(getFlags() & ~Modifier.FINAL);
          }
      }
      
      //--------------------------------------------------------------------------
      
      /**
       * Is the object synchronized.
       * 
       * @return true if synchronized
       */
      public boolean isSynchronized() {
          return (getFlags() & SYNCHRONIZED) != 0;
      }
      
      /**
       * Set the object to be synchronized.
       * 
       * @param state  true to make synchronized
       */
      public void setSynchronized(boolean state) {
          if (state) {
              setFlags(getFlags() & Modifier.SYNCHRONIZED);
          } else {
              setFlags(getFlags() & ~Modifier.SYNCHRONIZED);
          }
      }
      
      //--------------------------------------------------------------------------
      
      /**
       * Is the object volatile.
       * 
       * @return true if volatile
       */
      public boolean isVolatile() {
          return (getFlags() & VOLATILE) != 0;
      }
      
      /**
       * Set the object to be volatile.
       * 
       * @param state  true to make volatile
       */
      public void setVolatile(boolean state) {
          if (state) {
              setFlags(getFlags() & Modifier.VOLATILE);
          } else {
              setFlags(getFlags() & ~Modifier.VOLATILE);
          }
      }
      
      //--------------------------------------------------------------------------
      
      /**
       * Is the object transient.
       * 
       * @return true if transient
       */
      public boolean isTransient() {
          return (getFlags() & TRANSIENT) != 0;
      }
      
      /**
       * Set the object to be transient.
       * 
       * @param state  true to make transient
       */
      public void setTransient(boolean state) {
          if (state) {
              setFlags(getFlags() & TRANSIENT);
          } else {
              setFlags(getFlags() & ~TRANSIENT);
          }
      }
      
      //--------------------------------------------------------------------------
      
      /**
       * Is the object native.
       * 
       * @return true if native
       */
      public boolean isNative() {
          return (getFlags() & NATIVE) != 0;
      }
      
      /**
       * Set the object to be native.
       * 
       * @param state  true to make native
       */
      public void setNative(boolean state) {
          if (state) {
              setFlags(getFlags() & NATIVE);
          } else {
              setFlags(getFlags() & ~NATIVE);
          }
      }
      
      //--------------------------------------------------------------------------
      
      /**
       * Is the object abstract.
       * 
       * @return true if abstract
       */
      public boolean isAbstract() {
          return (getFlags() & ABSTRACT) != 0;
      }
      
      /**
       * Set the object to be abstract.
       * 
       * @param state  true to make abstract
       */
      public void setAbstract(boolean state) {
          if (state) {
              setFlags(getFlags() & ABSTRACT);
          } else {
              setFlags(getFlags() & ~ABSTRACT);
          }
      }
      
      //--------------------------------------------------------------------------
      
      /**
       * Is the object strictfp.
       * 
       * @return true if strictfp
       */
      public boolean isStrictFP() {
          return (getFlags() & STRICT) != 0;
      }
      
      /**
       * Set the object to be strictfp.
       * 
       * @param state  true to make strictfp
       */
      public void setStrictFP(boolean state) {
          if (state) {
              setFlags(getFlags() & STRICT);
          } else {
              setFlags(getFlags() & ~STRICT);
          }
      }
      
      //--------------------------------------------------------------------------
      
      /**
       * Geta string describing the access modifier flags in
       * the specified modifier. For example:
       * <blockquote><pre>
       *    AModifiers[public final synchronized]
       *    AModifiers[private transient volatile]
       * </pre></blockquote>
       * The modifier names are return in canonical order, as
       * specified by <em>The Java Language Specification</em>.
       * 
       * @return a debug string
       */
      public String toString() {
          StringBuffer sb = new StringBuffer("AModifiers[");
      
          if (isPublicScope()) {
              sb.append("public ");
          }
          if (isPrivateScope()) {
              sb.append("private ");
          }
          if (isProtectedScope()) {
              sb.append("protected ");
          }
      
          // Canonical order
          if (isAbstract()) {
              sb.append("abstract ");
          }
          if (isStatic()) {
              sb.append("static ");
          }
          if (isFinal()) {
              sb.append("final ");
          }
          if (isTransient()) {
              sb.append("transient ");
          }
          if (isVolatile()) {
              sb.append("volatile ");
          }
          if (isNative()) {
              sb.append("native ");
          }
          if (isSynchronized()) {
              sb.append("synchronized ");
          }
  //        if (isInterface()) {
  //            sb.append("interface ");
  //        }
          if (isStrictFP()) {
              sb.append("strictfp ");
          }
      
          if (sb.length() > 11) {
              sb.setCharAt(sb.length() - 1, ']');
          } else {
              sb.append(']');
          }
          return sb.toString();
      }
  
  }
  
  
  
  1.1                  jakarta-commons-sandbox/clazz/src/java/org/apache/commons/clazz/Clazz.java
  
  Index: Clazz.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.clazz;
  
  import java.util.List;
  import java.util.Map;
  /**
   * <code>Clazz</code> defines a Java class unit, either a class or interface.
   *
   * @author <a href="mailto:scolebourne@apache.org">Stephen Colebourne</a>
   * @version $Id: Clazz.java,v 1.1 2002/10/30 21:16:06 scolebourne Exp $
   */
  public interface Clazz extends MetaUnit {
      
      /**
       * Gets the package name.
       * 
       * @return the package name
       */
      public String getPackageName();
  
      /**
       * Gets the class name (without the package).
       * 
       * @return the class name (without the package)
       */
      public String getShortClassName();
  
      /**
       * Queries if the clazz is an interface or a class.
       * 
       * @return true if the clazz is an interface
       */
      public boolean isInterface();
  
      //--------------------------------------------------------------------------
      
      /**
       * Gets the interfaces of the type in order.
       * 
       * @return list of AInterface objects
       */
      public List getInterfaces();
  
      /**
       * Gets all the interfaces of the type in order.
       * 
       * @return list of AInterface objects
       */
      public List getAllInterfaces();
  
      /**
       * Gets the superclass of the class.
       *
       * @return the superclass
       */
      public Clazz getSuperClass();
      
      /**
       * Gets all the superclass of the class in order.
       *
       * @return the superclass
       */
      public List getAllSuperClasses();
      
      //--------------------------------------------------------------------------
      
      /**
       * Get the property map of the bean.
       *
       * @return map of ClazzProperty objects
       */
      public Map getClazzPropertyMap();
      
      /**
       * Gets the number of properties.
       *
       * @return the number of properties
       */
      public int getClazzPropertyCount();
      
      /**
       * Gets a field of the class by name.
       *
       * @param name  the name to retrieve
       * @return a field by name
       */
      public ClazzProperty getClazzProperty(String name);
      
      //--------------------------------------------------------------------------
      
      /**
       * Get the operations of the class in order.
       *
       * @return list of ClazzOperation objects
       */
      public List getClazzOperationList();
      
      /**
       * Gets the number of operations.
       *
       * @return the number of operations
       */
      public int getClazzOperationCount();
      
      /**
       * Gets a operation of the class by index.
       *
       * @param index  the index to retrieve
       * @return a operation by index
       */
      public ClazzOperation getClazzOperation(int index);
      
      //--------------------------------------------------------------------------
      
      /**
       * Creates a new instance of the bean.
       *
       * @return a new instance of the object, whatever that might be
       */
      public Object newInstance();
      
      /**
       * Creates a new instance of the bean.
       *
       * @return a new instance as a Bean.
       */
      public Bean newBean();
      
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message