Skip to content

Instantly share code, notes, and snippets.

@kakakazuma
Created December 24, 2015 03:44
Show Gist options
  • Save kakakazuma/77139931ad142547e3c1 to your computer and use it in GitHub Desktop.
Save kakakazuma/77139931ad142547e3c1 to your computer and use it in GitHub Desktop.
Validation Constraints with nested objects in play2.0
import play.data.validation.Constraints;
import java.util.List;
public class ChildParameter {
@Constraints.Required
public List<String> idChildList;
@Constraints.Required
@Constraints.Max(2)
@Constraints.Min(0)
public Integer type;
public ChildParameter() {
}
}
import play.data.validation.Constraints;
import javax.validation.Valid;
import java.util.List;
public class ParentParameter {
@Constraints.Required
public String id;
@Valid
@Constraints.Required
public List<ChildParameter> childs;
public ParentParameter() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment