codahale/dropwizard — pull request #116 by nicktelford (2012-06-21 00:32:52+00:00)
Title: Add @Range constraint for Size and Duration

Provides a convenience for defining a range constraint on `Duration` and `Size`, using `@MinDuration`, `@MaxDuration`, `@MinSize` and `@MaxSize` that was introduced in #115:

```java
@DurationRange(min = 10, max = 60, unit = TimeUnit.SECONDS)
private Duration timeout = Duration.seconds(10);

@SizeRange(min = 1024, max = 10240, unit = SizeUnit.KILOBYTES)
private Size chunkSize = Size.megabytes(1);
```

The _unit_ parameter defines the unit for both the _min_ and _max_ parameters; it is not possible to mix quantities of different units in a range constraint.