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

Print this page




  87     /**
  88      * Returns a hash code based on the executable's hash code and the
  89      * index.
  90      *
  91      * @return A hash code based on the executable's hash code.
  92      */
  93     public int hashCode() {
  94         return executable.hashCode() ^ index;
  95     }
  96 
  97     /**
  98      * Returns true if the parameter has a name according to the class
  99      * file; returns false otherwise. Whether a parameter has a name
 100      * is determined by the {@literal MethodParameters} attribute of
 101      * the method which declares the parameter.
 102      *
 103      * @return true if and only if the parameter has a name according
 104      * to the class file.
 105      */
 106     public boolean isNamePresent() {
 107         return executable.hasRealParameterData();
 108     }
 109 
 110     /**
 111      * Returns a string describing this parameter.  The format is the
 112      * modifiers for the parameter, if any, in canonical order as
 113      * recommended by <cite>The Java&trade; Language
 114      * Specification</cite>, followed by the fully- qualified type of
 115      * the parameter (excluding the last [] if the parameter is
 116      * variable arity), followed by "..." if the parameter is variable
 117      * arity, followed by a space, followed by the name of the
 118      * parameter.
 119      *
 120      * @return A string representation of the parameter and associated
 121      * information.
 122      */
 123     public String toString() {
 124         final StringBuilder sb = new StringBuilder();
 125         final Type type = getParameterizedType();
 126         final String typename = type.getTypeName();
 127 




  87     /**
  88      * Returns a hash code based on the executable's hash code and the
  89      * index.
  90      *
  91      * @return A hash code based on the executable's hash code.
  92      */
  93     public int hashCode() {
  94         return executable.hashCode() ^ index;
  95     }
  96 
  97     /**
  98      * Returns true if the parameter has a name according to the class
  99      * file; returns false otherwise. Whether a parameter has a name
 100      * is determined by the {@literal MethodParameters} attribute of
 101      * the method which declares the parameter.
 102      *
 103      * @return true if and only if the parameter has a name according
 104      * to the class file.
 105      */
 106     public boolean isNamePresent() {
 107         return executable.hasRealParameterData() && name != null;
 108     }
 109 
 110     /**
 111      * Returns a string describing this parameter.  The format is the
 112      * modifiers for the parameter, if any, in canonical order as
 113      * recommended by <cite>The Java&trade; Language
 114      * Specification</cite>, followed by the fully- qualified type of
 115      * the parameter (excluding the last [] if the parameter is
 116      * variable arity), followed by "..." if the parameter is variable
 117      * arity, followed by a space, followed by the name of the
 118      * parameter.
 119      *
 120      * @return A string representation of the parameter and associated
 121      * information.
 122      */
 123     public String toString() {
 124         final StringBuilder sb = new StringBuilder();
 125         final Type type = getParameterizedType();
 126         final String typename = type.getTypeName();
 127