Package org.springframework.core.annotation

# Class RepeatableContainers

java.lang.Object
org.springframework.core.annotation.RepeatableContainers

public abstract class RepeatableContainers extends Object
Strategy used to determine annotations that act as containers for other annotations. The `standardRepeatables()` method provides a default strategy that respects Java's `@Repeatable` support and should be suitable for most situations.

The `of(java.lang.Class<? extends java.lang.annotation.Annotation>, java.lang.Class<? extends java.lang.annotation.Annotation>)` method can be used to register relationships for annotations that do not wish to use `@Repeatable`.

To completely disable repeatable support use `none()`.

Since:
  5.2
Author:
  Phillip Webb, Sam Brannen

## Method Summary

Modifier and Type
Method
Description
`RepeatableContainers`
`and(Class<? extends Annotation> container, Class<? extends Annotation> repeatable)`
Add an additional explicit relationship between a container and repeatable annotation.
`boolean`
`equals(Object other)`
`int`
`hashCode()`
`static RepeatableContainers`
`none()`
Create a `RepeatableContainers` instance that does not support any repeatable annotations.
`static RepeatableContainers`
`of(Class<? extends Annotation> repeatable, Class<? extends Annotation> container)`
Create a `RepeatableContainers` instance that uses predefined repeatable and container types.
`static RepeatableContainers`
`standardRepeatables()`
Create a `RepeatableContainers` instance that searches using Java's `@Repeatable` annotation.

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

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

## Method Details

### and

public RepeatableContainers and(Class<? extends Annotation> container, Class<? extends Annotation> repeatable)
Add an additional explicit relationship between a container and repeatable annotation.

WARNING: the arguments supplied to this method are in the reverse order of those supplied to `of(Class, Class)`.

Parameters:
  `container` - the container annotation type
  `repeatable` - the repeatable annotation type
Returns:
  a new `RepeatableContainers` instance

### equals

@Contract("null -> false") public boolean equals(@Nullable Object other)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### standardRepeatables

public static RepeatableContainers standardRepeatables()
Create a `RepeatableContainers` instance that searches using Java's `@Repeatable` annotation.

Returns:
  a `RepeatableContainers` instance

### of

public static RepeatableContainers of(Class<? extends Annotation> repeatable, @Nullable Class<? extends Annotation> container)
Create a `RepeatableContainers` instance that uses predefined repeatable and container types.

WARNING: the arguments supplied to this method are in the reverse order of those supplied to `and(Class, Class)`.

Parameters:
  `repeatable` - the repeatable annotation type
  `container` - the container annotation type or `null`. If specified, this annotation must declare a `value` attribute returning an array of repeatable annotations. If not specified, the container will be deduced by inspecting the `@Repeatable` annotation on `repeatable`.
Returns:
  a `RepeatableContainers` instance
Throws:
  `IllegalArgumentException` - if the supplied container type is `null` and the annotation type is not a repeatable annotation
  `AnnotationConfigurationException` - if the supplied container type is not a properly configured container for a repeatable annotation

### none

public static RepeatableContainers none()
Create a `RepeatableContainers` instance that does not support any repeatable annotations.

Returns:
  a `RepeatableContainers` instance