emul/mini/src/main/java/java/lang/Class.java
branchemul
changeset 604 3fcc279c921b
parent 588 6f864278604a
child 643 a2c0afa35c09
     1.1 --- a/emul/mini/src/main/java/java/lang/Class.java	Fri Jan 25 16:36:09 2013 +0100
     1.2 +++ b/emul/mini/src/main/java/java/lang/Class.java	Mon Jan 28 18:15:21 2013 +0100
     1.3 @@ -909,7 +909,50 @@
     1.4          }
     1.5          return m;
     1.6      }
     1.7 -
     1.8 +    
     1.9 +    /**
    1.10 +     * Returns an array of {@code Method} objects reflecting all the
    1.11 +     * methods declared by the class or interface represented by this
    1.12 +     * {@code Class} object. This includes public, protected, default
    1.13 +     * (package) access, and private methods, but excludes inherited methods.
    1.14 +     * The elements in the array returned are not sorted and are not in any
    1.15 +     * particular order.  This method returns an array of length 0 if the class
    1.16 +     * or interface declares no methods, or if this {@code Class} object
    1.17 +     * represents a primitive type, an array class, or void.  The class
    1.18 +     * initialization method {@code <clinit>} is not included in the
    1.19 +     * returned array. If the class declares multiple public member methods
    1.20 +     * with the same parameter types, they are all included in the returned
    1.21 +     * array.
    1.22 +     *
    1.23 +     * <p> See <em>The Java Language Specification</em>, section 8.2.
    1.24 +     *
    1.25 +     * @return    the array of {@code Method} objects representing all the
    1.26 +     * declared methods of this class
    1.27 +     * @exception  SecurityException
    1.28 +     *             If a security manager, <i>s</i>, is present and any of the
    1.29 +     *             following conditions is met:
    1.30 +     *
    1.31 +     *             <ul>
    1.32 +     *
    1.33 +     *             <li> invocation of
    1.34 +     *             {@link SecurityManager#checkMemberAccess
    1.35 +     *             s.checkMemberAccess(this, Member.DECLARED)} denies
    1.36 +     *             access to the declared methods within this class
    1.37 +     *
    1.38 +     *             <li> the caller's class loader is not the same as or an
    1.39 +     *             ancestor of the class loader for the current class and
    1.40 +     *             invocation of {@link SecurityManager#checkPackageAccess
    1.41 +     *             s.checkPackageAccess()} denies access to the package
    1.42 +     *             of this class
    1.43 +     *
    1.44 +     *             </ul>
    1.45 +     *
    1.46 +     * @since JDK1.1
    1.47 +     */
    1.48 +    public Method[] getDeclaredMethods() throws SecurityException {
    1.49 +        throw new SecurityException();
    1.50 +    }
    1.51 +    
    1.52      /**
    1.53       * Character.isDigit answers {@code true} to some non-ascii
    1.54       * digits.  This one does not.
    1.55 @@ -1096,6 +1139,48 @@
    1.56      public ClassLoader getClassLoader() {
    1.57          throw new SecurityException();
    1.58      }
    1.59 +
    1.60 +    /**
    1.61 +     * Determines the interfaces implemented by the class or interface
    1.62 +     * represented by this object.
    1.63 +     *
    1.64 +     * <p> If this object represents a class, the return value is an array
    1.65 +     * containing objects representing all interfaces implemented by the
    1.66 +     * class. The order of the interface objects in the array corresponds to
    1.67 +     * the order of the interface names in the {@code implements} clause
    1.68 +     * of the declaration of the class represented by this object. For
    1.69 +     * example, given the declaration:
    1.70 +     * <blockquote>
    1.71 +     * {@code class Shimmer implements FloorWax, DessertTopping { ... }}
    1.72 +     * </blockquote>
    1.73 +     * suppose the value of {@code s} is an instance of
    1.74 +     * {@code Shimmer}; the value of the expression:
    1.75 +     * <blockquote>
    1.76 +     * {@code s.getClass().getInterfaces()[0]}
    1.77 +     * </blockquote>
    1.78 +     * is the {@code Class} object that represents interface
    1.79 +     * {@code FloorWax}; and the value of:
    1.80 +     * <blockquote>
    1.81 +     * {@code s.getClass().getInterfaces()[1]}
    1.82 +     * </blockquote>
    1.83 +     * is the {@code Class} object that represents interface
    1.84 +     * {@code DessertTopping}.
    1.85 +     *
    1.86 +     * <p> If this object represents an interface, the array contains objects
    1.87 +     * representing all interfaces extended by the interface. The order of the
    1.88 +     * interface objects in the array corresponds to the order of the interface
    1.89 +     * names in the {@code extends} clause of the declaration of the
    1.90 +     * interface represented by this object.
    1.91 +     *
    1.92 +     * <p> If this object represents a class or interface that implements no
    1.93 +     * interfaces, the method returns an array of length 0.
    1.94 +     *
    1.95 +     * <p> If this object represents a primitive type or void, the method
    1.96 +     * returns an array of length 0.
    1.97 +     *
    1.98 +     * @return an array of interfaces implemented by this class.
    1.99 +     */
   1.100 +    public native Class<?>[] getInterfaces();
   1.101      
   1.102      /**
   1.103       * Returns the {@code Class} representing the component type of an