Created
December 24, 2015 03:44
-
-
Save kakakazuma/77139931ad142547e3c1 to your computer and use it in GitHub Desktop.
Validation Constraints with nested objects in play2.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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