FileDocCategorySizeDatePackage
ConstraintMapDemo.javaAPI DocExample2035Sun Dec 14 22:47:42 GMT 2003oreilly.hcj.reflection

ConstraintMapDemo

public class ConstraintMapDemo extends Object
Demonstrate the constraint map functionality.
author
Robert Simmons jr. (kraythe)
version
$Revision: 1.3 $

Fields Summary
Constructors Summary
Methods Summary
public static final voidmain(java.lang.String[] args)
Main demo method.

param
args the command line arguments

		Map constraints = MutableObject.getConstraintMap(Customer.class);
		Iterator iter = constraints.values()
			                       .iterator();
		ObjectConstraint constraint = null;
		while (iter.hasNext()) {
			constraint = (ObjectConstraint)iter.next();
			System.out.println("Property=" + constraint.getName() + " Type="
			                   + constraint.getClass().getName());
		}

		constraint = MutableObject.getConstraint(SavingsAccount.class, "interestRate");
		System.out.println("\nSavingsAccount interestRate property");
		System.out.println("dataType = "
		                   + ((NumericConstraint)constraint).getDataType().getName());
		System.out.println("minValue = " + ((NumericConstraint)constraint).getMinValue());
		System.out.println("maxValue = " + ((NumericConstraint)constraint).getMaxValue());