| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.seasar.teeda.core.config.faces.assembler.impl; |
| 17 | |
|
| 18 | |
import java.util.Iterator; |
| 19 | |
import java.util.Map; |
| 20 | |
|
| 21 | |
import javax.faces.application.Application; |
| 22 | |
|
| 23 | |
import org.seasar.teeda.core.config.faces.assembler.ValidatorAssembler; |
| 24 | |
import org.seasar.teeda.core.config.faces.element.ValidatorElement; |
| 25 | |
import org.seasar.teeda.core.util.ApplicationUtil; |
| 26 | |
import org.seasar.teeda.core.util.IteratorUtil; |
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
public class DefaultValidatorAssembler extends ValidatorAssembler { |
| 32 | |
|
| 33 | |
private Application application_; |
| 34 | |
|
| 35 | |
public DefaultValidatorAssembler(Map validators) { |
| 36 | 3 | super(validators); |
| 37 | 3 | } |
| 38 | |
|
| 39 | |
protected void setupBeforeAssemble() { |
| 40 | 3 | application_ = ApplicationUtil.getApplicationFromFactory(); |
| 41 | 3 | } |
| 42 | |
|
| 43 | |
public void assemble() { |
| 44 | 3 | for (Iterator itr = IteratorUtil.getEntryIterator(getValidators()); itr |
| 45 | 4 | .hasNext();) { |
| 46 | 1 | Map.Entry entry = (Map.Entry) itr.next(); |
| 47 | 1 | String validatorId = (String) entry.getKey(); |
| 48 | 1 | ValidatorElement validatorElement = (ValidatorElement) entry |
| 49 | |
.getValue(); |
| 50 | 1 | String validatorClass = validatorElement.getValidatorClass(); |
| 51 | 1 | application_.addValidator(validatorId, validatorClass); |
| 52 | |
} |
| 53 | 3 | } |
| 54 | |
|
| 55 | |
} |