src/share/classes/java/lang/reflect/Parameter.java

Print this page




  93     public int hashCode() {
  94         return executable.hashCode() ^ index;
  95     }
  96 
  97     /**
  98      * Returns a string describing this parameter.  The format is the
  99      * modifiers for the parameter, if any, in canonical order as
 100      * recommended by <cite>The Java&trade; Language
 101      * Specification</cite>, followed by the fully- qualified type of
 102      * the parameter (excluding the last [] if the parameter is
 103      * variable arity), followed by "..." if the parameter is variable
 104      * arity, followed by a space, followed by the name of the
 105      * parameter.
 106      *
 107      * @return A string representation of the parameter and associated
 108      * information.
 109      */
 110     public String toString() {
 111         final StringBuilder sb = new StringBuilder();
 112         final Type type = getParameterizedType();
 113         final String typename = (type instanceof Class)?
 114             Field.getTypeName((Class)type):
 115             (type.toString());
 116 
 117         sb.append(Modifier.toString(getModifiers()));
 118 
 119         if(0 != modifiers)
 120             sb.append(" ");
 121 
 122         if(isVarArgs())
 123             sb.append(typename.replaceFirst("\\[\\]$", "..."));
 124         else
 125             sb.append(typename);
 126 
 127         sb.append(" ");
 128         sb.append(getName());
 129 
 130         return sb.toString();
 131     }
 132 
 133     /**
 134      * Return the {@code Executable} which declares this parameter.
 135      *
 136      * @return The {@code Executable} declaring this parameter.
 137      */
 138     public Executable getDeclaringExecutable() {
 139         return executable;
 140     }
 141 
 142     /**
 143      * Get the modifier flags for this the parameter represented by
 144      * this {@code Parameter} object.
 145      *
 146      * @return The modifier flags for this parameter.
 147      */




  93     public int hashCode() {
  94         return executable.hashCode() ^ index;
  95     }
  96 
  97     /**
  98      * Returns a string describing this parameter.  The format is the
  99      * modifiers for the parameter, if any, in canonical order as
 100      * recommended by <cite>The Java&trade; Language
 101      * Specification</cite>, followed by the fully- qualified type of
 102      * the parameter (excluding the last [] if the parameter is
 103      * variable arity), followed by "..." if the parameter is variable
 104      * arity, followed by a space, followed by the name of the
 105      * parameter.
 106      *
 107      * @return A string representation of the parameter and associated
 108      * information.
 109      */
 110     public String toString() {
 111         final StringBuilder sb = new StringBuilder();
 112         final Type type = getParameterizedType();
 113         final String typename = type.getTypeName();


 114 
 115         sb.append(Modifier.toString(getModifiers()));
 116 
 117         if(0 != modifiers)
 118             sb.append(' ');
 119 
 120         if(isVarArgs())
 121             sb.append(typename.replaceFirst("\\[\\]$", "..."));
 122         else
 123             sb.append(typename);
 124 
 125         sb.append(' ');
 126         sb.append(getName());
 127 
 128         return sb.toString();
 129     }
 130 
 131     /**
 132      * Return the {@code Executable} which declares this parameter.
 133      *
 134      * @return The {@code Executable} declaring this parameter.
 135      */
 136     public Executable getDeclaringExecutable() {
 137         return executable;
 138     }
 139 
 140     /**
 141      * Get the modifier flags for this the parameter represented by
 142      * this {@code Parameter} object.
 143      *
 144      * @return The modifier flags for this parameter.
 145      */