This project has retired. For details please refer to its Attic page.
Constraints Starter Template for Bootstrap
Overview
Scripting
Alarms
Circuit Breaker
Constraints
FileConfig
HTTP
Invocation Cache
JMX
Locking
Logging
OSGi
RDF
ReST Client
ReST - HATEOAS Primer
ReST Common
ReST Server
Restlet Support
Servlet
Shiro Security
Shiro Web Security
Spring Integration
SQL
UID
UoWFile

Constraints

code

docs

tests

The Constraints library provide a bunch of often used Constraints based on the Polygene™ Constraints api described in Constraint.

Remember that you are not limited to constraints presents in this library, you are encouraged to write your own constraints. See Create a Constraint or take a look at this library source code to learn how to write your own.

Table 25. Artifact

Group IDArtifact IDVersion

org.apache.polygene.libraries

org.apache.polygene.library.constraints

0


Usage

You can use theses constraints on Properties or on method arguments. Here are some examples:

import org.apache.polygene.library.constraints.annotation.*;
  [...snip...]

@Contains( "foo" ) Property<String> containsString();

@Email Property<String> email();

@URL Property<String> url();

@URI Property<String> uri();

@GreaterThan( 10 ) Property<Integer> greaterThan();

@InstanceOf( List.class ) Property<Collection> instanceOf();

@LessThan( 10 ) Property<Integer> lessThan();

@Matches( "a*b*c*" ) Property<String> matches();

@MaxLength( 3 ) Property<String> maxLength();

@MinLength( 3 ) Property<String> minLength();

@NotEmpty Property<String> notEmptyString();

@NotEmpty Property<Collection> notEmptyCollection();

@NotEmpty Property<List> notEmptyList();

@Range( min = 0, max = 100 ) Property<Integer> range();

@OneOf( { "Bar", "Xyzzy" } ) Property<String> oneOf();

void testParameters( @GreaterThan( 10 ) Integer greaterThan );