< prev index next >

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

Print this page
rev 60127 : 8249205: Remove unnecessary trademark symbols


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


 230     /**
 231      * Returns an AnnotatedType object that represents the use of a type to
 232      * specify the type of the formal parameter represented by this Parameter.
 233      *
 234      * @return an {@code AnnotatedType} object representing the use of a type
 235      *         to specify the type of the formal parameter represented by this
 236      *         Parameter
 237      */
 238     public AnnotatedType getAnnotatedType() {
 239         // no caching for now
 240         return executable.getAnnotatedParameterTypes()[index];
 241     }
 242 
 243     private transient volatile Class<?> parameterClassCache;
 244 
 245     /**
 246      * Returns {@code true} if this parameter is implicitly declared
 247      * in source code; returns {@code false} otherwise.
 248      *
 249      * @return true if and only if this parameter is implicitly
 250      * declared as defined by <cite>The Java&trade; Language
 251      * Specification</cite>.
 252      */
 253     public boolean isImplicit() {
 254         return Modifier.isMandated(getModifiers());
 255     }
 256 
 257     /**
 258      * Returns {@code true} if this parameter is neither implicitly
 259      * nor explicitly declared in source code; returns {@code false}
 260      * otherwise.
 261      *
 262      * @jls 13.1 The Form of a Binary
 263      * @return true if and only if this parameter is a synthetic
 264      * construct as defined by
 265      * <cite>The Java&trade; Language Specification</cite>.
 266      */
 267     public boolean isSynthetic() {
 268         return Modifier.isSynthetic(getModifiers());
 269     }
 270 
 271     /**
 272      * Returns {@code true} if this parameter represents a variable
 273      * argument list; returns {@code false} otherwise.
 274      *
 275      * @return {@code true} if an only if this parameter represents a
 276      * variable argument list.
 277      */
 278     public boolean isVarArgs() {
 279         return executable.isVarArgs() &&
 280             index == executable.getParameterCount() - 1;
 281     }
 282 
 283 
 284     /**
 285      * {@inheritDoc}




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


 230     /**
 231      * Returns an AnnotatedType object that represents the use of a type to
 232      * specify the type of the formal parameter represented by this Parameter.
 233      *
 234      * @return an {@code AnnotatedType} object representing the use of a type
 235      *         to specify the type of the formal parameter represented by this
 236      *         Parameter
 237      */
 238     public AnnotatedType getAnnotatedType() {
 239         // no caching for now
 240         return executable.getAnnotatedParameterTypes()[index];
 241     }
 242 
 243     private transient volatile Class<?> parameterClassCache;
 244 
 245     /**
 246      * Returns {@code true} if this parameter is implicitly declared
 247      * in source code; returns {@code false} otherwise.
 248      *
 249      * @return true if and only if this parameter is implicitly
 250      * declared as defined by <cite>The Java Language
 251      * Specification</cite>.
 252      */
 253     public boolean isImplicit() {
 254         return Modifier.isMandated(getModifiers());
 255     }
 256 
 257     /**
 258      * Returns {@code true} if this parameter is neither implicitly
 259      * nor explicitly declared in source code; returns {@code false}
 260      * otherwise.
 261      *
 262      * @jls 13.1 The Form of a Binary
 263      * @return true if and only if this parameter is a synthetic
 264      * construct as defined by
 265      * <cite>The Java Language Specification</cite>.
 266      */
 267     public boolean isSynthetic() {
 268         return Modifier.isSynthetic(getModifiers());
 269     }
 270 
 271     /**
 272      * Returns {@code true} if this parameter represents a variable
 273      * argument list; returns {@code false} otherwise.
 274      *
 275      * @return {@code true} if an only if this parameter represents a
 276      * variable argument list.
 277      */
 278     public boolean isVarArgs() {
 279         return executable.isVarArgs() &&
 280             index == executable.getParameterCount() - 1;
 281     }
 282 
 283 
 284     /**
 285      * {@inheritDoc}


< prev index next >