de.smartics.properties.tutorial.property.constraints
Class PropertyConstraintsWithGroupsTutorial

Package class diagram package PropertyConstraintsWithGroupsTutorial
java.lang.Object
  extended by de.smartics.properties.tutorial.property.constraints.PropertyConstraintsWithGroupsTutorial

@Document(title="Property Constraints With Groups",
          sortKey="basics0060")
@DocCategory(value="basics")
public class PropertyConstraintsWithGroupsTutorial
     
     
extends Object

This tutorial introduces how to add constraints to the property declaration.

This feature takes the burden of validation from the developers shoulders. It is based on Beans Validation (JSR-303), so any constraint defined with this technology can be used for validating properties.


Constructor Summary
PropertyConstraintsWithGroupsTutorial()
           
 
Method Summary
 void calledWithUnknownGroup()
           If there are no constraints in the given group, every value is valid.
 void declaredDefaultGroup()
           Having no group or explicitly set the constraint in a default group has the same effect.
 void declaredDefaultGroupExplictCallWithDefaultGroup()
           And it is also the same if you call the validation using the default group.
 void invalidInStartupGroup()
           Let's have a look at some examples that use groups to activate and deactivate constraints for a particular validation.
 void setUp()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyConstraintsWithGroupsTutorial

public PropertyConstraintsWithGroupsTutorial()
Method Detail

setUp

public void setUp()

invalidInStartupGroup

@DocSection
public void invalidInStartupGroup()

Let's have a look at some examples that use groups to activate and deactivate constraints for a particular validation.

In the following example the value 11 is correct in the default group, but not in the startup group.


declaredDefaultGroup

@DocSection
public void declaredDefaultGroup()

Having no group or explicitly set the constraint in a default group has the same effect.


declaredDefaultGroupExplictCallWithDefaultGroup

@DocSection
public void declaredDefaultGroupExplictCallWithDefaultGroup()

And it is also the same if you call the validation using the default group.


calledWithUnknownGroup

@DocSection
public void calledWithUnknownGroup()

If there are no constraints in the given group, every value is valid.



Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.