org.glassfish.jersey.server.model

## Class MethodList

- java.lang.Object
- - org.glassfish.jersey.server.model.MethodList

All Implemented Interfaces:
  Iterable<AnnotatedMethod>

    public final class MethodList
    extends Object
    implements Iterable<AnnotatedMethod>

Iterable list of methods on a single class with convenience getters for additional method information.

Author:
  Paul Sandoz, Marek Potociar

### Nested Class Summary

Nested Classes
`static interface` `MethodList.Filter` Method list filter.

### Constructor Summary

Constructors
Constructor and Description
`MethodList(AnnotatedMethod... methods)` Create new method list from the given array of `annotated methods`.
`MethodList(Class<?> c)` Create new method list for a class.
`MethodList(Class<?> c, boolean declaredMethods)` Create new method list for a class.
`MethodList(Collection<Method> methods)` Create new method list from the given collection of methods.
`MethodList(Method... methods)` Create new method list from the given array of methods.

### Method Summary

All Methods Instance Methods Concrete Methods
`MethodList` `filter(MethodList.Filter filter)` Created a new method list containing only the methods supported by the `method list filter`.
`MethodList` `hasNumParams(int paramCount)` Get a new sub-list of methods containing all the methods from this method list that have the specific number of parameters.
`MethodList` `hasReturnType(Class<?> returnType)` Get a new sub-list of methods containing all the methods from this method list that declare the specified return type.
`MethodList` `isNotPublic()` Get a new sub-list of methods containing all the methods from this method list that are not public.
`Iterator<AnnotatedMethod>` `iterator()` Iterator over the list of `annotated methods` contained in this method list.
`MethodList` `nameStartsWith(String prefix)` Get a new sub-list of methods containing all the methods from this method list with a specified method name prefix.
`<T extends Annotation> MethodList` `withAnnotation(Class<T> annotation)` Get a new sub-list of methods containing all the methods from this method list with a specified method-level annotation declared.
`<T extends Annotation> MethodList` `withMetaAnnotation(Class<T> annotation)` Get a new sub-list of methods containing all the methods from this method list with a method-level annotation declared that is itself annotated with a specified meta-annotation.
`<T extends Annotation> MethodList` `withoutAnnotation(Class<T> annotation)` Get a new sub-list of methods containing all the methods from this method list without a specified method-level annotation declared.
`<T extends Annotation> MethodList` `withoutMetaAnnotation(Class<T> annotation)` Get a new sub-list of methods containing all the methods from this method list without any method-level annotation declared that would itself be annotated with a specified meta-annotation.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Constructor Detail

#### MethodList

    public MethodList(Class<?> c)

Create new method list for a class. The method list contains `all methods` available on the class. The `synthetic methods` and methods declared directly on the `Object` class are filtered out.

Parameters:
  `c` - class from which the method list is created.

#### MethodList

    public MethodList(Class<?> c,
                      boolean declaredMethods)

Create new method list for a class. The method list contains `all methods` available on the class or `declared methods` only, depending on the value of the `declaredMethods` parameter. The `synthetic methods` and methods declared directly on the `Object` class are filtered out.

Parameters:
  `c` - class from which the method list is created.
  `declaredMethods` - if `true` only the `declared methods` will be included in the method list; otherwise `all methods` will be listed.

#### MethodList

    public MethodList(Collection<Method> methods)

Create new method list from the given collection of methods. The `synthetic methods` and methods declared directly on the `Object` class are filtered out.

Parameters:
  `methods` - methods to be included in the method list.

#### MethodList

    public MethodList(Method... methods)

Create new method list from the given array of methods. The `synthetic methods` and methods declared directly on the `Object` class are filtered out.

Parameters:
  `methods` - methods to be included in the method list.

#### MethodList

    public MethodList(AnnotatedMethod... methods)

Create new method list from the given array of `annotated methods`.

Parameters:
  `methods` - methods to be included in the method list.

### Method Detail

#### iterator

    public Iterator<AnnotatedMethod> iterator()

Iterator over the list of `annotated methods` contained in this method list.

Specified by:
  `iterator` in interface `Iterable<AnnotatedMethod>`
Returns:
  method list iterator.

#### isNotPublic

    public MethodList isNotPublic()

Get a new sub-list of methods containing all the methods from this method list that are not public.

Returns:
  new filtered method sub-list.

#### hasNumParams

    public MethodList hasNumParams(int paramCount)

Get a new sub-list of methods containing all the methods from this method list that have the specific number of parameters.

Parameters:
  `paramCount` - number of method parameters.
Returns:
  new filtered method sub-list.

#### hasReturnType

    public MethodList hasReturnType(Class<?> returnType)

Get a new sub-list of methods containing all the methods from this method list that declare the specified return type.

Parameters:
  `returnType` - method return type.
Returns:
  new filtered method sub-list.

#### nameStartsWith

    public MethodList nameStartsWith(String prefix)

Get a new sub-list of methods containing all the methods from this method list with a specified method name prefix.

Parameters:
  `prefix` - method name prefix.
Returns:
  new filtered method sub-list.

#### withAnnotation

    public <T extends Annotation> MethodList withAnnotation(Class<T> annotation)

Get a new sub-list of methods containing all the methods from this method list with a specified method-level annotation declared.

Type Parameters:
  `T` - annotation type.
Parameters:
  `annotation` - annotation class.
Returns:
  new filtered method sub-list.

#### withMetaAnnotation

    public <T extends Annotation> MethodList withMetaAnnotation(Class<T> annotation)

Get a new sub-list of methods containing all the methods from this method list with a method-level annotation declared that is itself annotated with a specified meta-annotation.

Type Parameters:
  `T` - meta-annotation type.
Parameters:
  `annotation` - meta-annotation class.
Returns:
  new filtered method sub-list.

#### withoutAnnotation

    public <T extends Annotation> MethodList withoutAnnotation(Class<T> annotation)

Get a new sub-list of methods containing all the methods from this method list without a specified method-level annotation declared.

Type Parameters:
  `T` - annotation type.
Parameters:
  `annotation` - annotation class.
Returns:
  new filtered method sub-list.

#### withoutMetaAnnotation

    public <T extends Annotation> MethodList withoutMetaAnnotation(Class<T> annotation)

Get a new sub-list of methods containing all the methods from this method list without any method-level annotation declared that would itself be annotated with a specified meta-annotation.

Type Parameters:
  `T` - meta-annotation type.
Parameters:
  `annotation` - meta-annotation class.
Returns:
  new filtered method sub-list.

#### filter

    public MethodList filter(MethodList.Filter filter)

Created a new method list containing only the methods supported by the `method list filter`.

Parameters:
  `filter` - method list filter.
Returns:
  new filtered method list.