1 23 24 28 29 package com.sun.enterprise.tools.common.validation.constraints; 30 31 import java.util.ArrayList ; 32 import java.util.Collection ; 33 34 53 public class AndConstraint extends ConstraintUtils implements Constraint { 54 55 60 private Constraint leftConstraint = null; 61 62 63 68 private Constraint rightConstraint = null; 69 70 71 72 public AndConstraint() { 73 Constraint leftConstraint = null; 74 Constraint rightConstraint = null; 75 } 76 77 78 79 public AndConstraint(Constraint leftConstraint, 80 Constraint rightConstraint){ 81 this.leftConstraint = leftConstraint; 82 this.rightConstraint = rightConstraint; 83 } 84 85 86 98 public Collection match(String value, String name) { 99 Collection failed_constrained_list = new ArrayList (); 100 failed_constrained_list.addAll(leftConstraint.match(value, name)); 101 failed_constrained_list.addAll(rightConstraint.match(value, name)); 102 return failed_constrained_list; 103 } 104 105 106 113 public void setLeftConstraint(Constraint constraint){ 114 leftConstraint = constraint; 115 } 116 117 118 125 public void setRightConstraint(Constraint constraint){ 126 rightConstraint = constraint; 127 } 128 129 130 133 public void print() { 134 super.print(); 135 ((ConstraintUtils)leftConstraint).print(); 136 ((ConstraintUtils)rightConstraint).print(); 137 } 138 } 139 | Popular Tags |