org.zkoss.bind.impl.ValidationContextImpl Maven / Gradle / Ivy
/* ValidationContextImpl.java
Purpose:
Description:
History:
2011/9/29 Created by Dennis Chen
Copyright (C) 2011 Potix Corporation. All Rights Reserved.
*/
package org.zkoss.bind.impl;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.zkoss.bind.BindContext;
import org.zkoss.bind.Property;
import org.zkoss.bind.ValidationContext;
/**
* the default implementation of validation context
* @author dennis
* @since 6.0.0
*/
public class ValidationContextImpl implements ValidationContext {
private boolean _valid = true; //default validation result is true
//ZK-1819 ValidationContext support a new flag that can identify the value of single field whether is valid when use form binding
private boolean _localValid = true;
private String _command;
private Property _property; //main property
private Map _properties; //related properties
private BindContext _ctx;
private static final String BASED_VALIDATION_PROPERTIES = "$BASED_VALIDATION_PROPS$";
public ValidationContextImpl(String command, Property property, Map properties, BindContext ctx,
boolean valid) {
this._command = command;
this._property = property;
this._properties = properties;
this._ctx = ctx;
this._valid = valid;
}
public BindContext getBindContext() {
return _ctx;
}
public String getCommand() {
return _command;
}
public Map getProperties() {
return _properties;
}
public Property[] getProperties(String name) {
return _properties.get(name);
}
@SuppressWarnings("unchecked")
public Map getProperties(Object base) {
if (base == null)
throw new IllegalArgumentException("base object is null");
Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy