
nz.co.senanque.validationengine.ProxyField Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of madura-objects Show documentation
Show all versions of madura-objects Show documentation
This is essentially a JAXB/XJC plugin that adds automatic validation to the generated Java classes.
You define business objects in an XSD file, pass it through XJC and the plugin will add the validation code.
It uses information in the XSD to pick up validation, and you can specify extensions to that in the XSD. The resulting
Java classes check for validity when the setter is called and they reject attempts to set invalid values (this is a difference from other validation frameworks). The Java classes also expose a metadata interface to make it easy for UIs to generate, say, lists of options for a select box.
The validation framework handles single field validation but you can inject a rule engine (or several) to handle cross field validation.
But to any Java code the objects still look like ordinary Java beans. The surrounding application is unaware that they are anything different until they throw an exception. This makes it easy to use with frameworks that expect Java beans, and most of them do.
/*******************************************************************************
* Copyright (c)2014 Prometheus Consulting
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package nz.co.senanque.validationengine;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Set;
import nz.co.senanque.validationengine.choicelists.ChoiceBase;
import nz.co.senanque.validationengine.metadata.PropertyMetadataImpl;
public interface ProxyField
{
public abstract String getPath();
public abstract PropertyMetadataImpl getPropertyMetadata();
public abstract FieldMetadata getFieldMetadata();
public abstract ObjectMetadata getObjectMetadata();
public abstract boolean isReadOnly();
public abstract void setReadOnly(final boolean b);
public abstract void setInActive(final boolean b);
public abstract boolean isInActive();
public abstract List getChoiceList();
public abstract void setValue(Object newValue);
public abstract void reset();
public abstract Object getValue();
public abstract void assign(final Object a);
public abstract String toString();
public abstract boolean isRequired();
public abstract boolean isDerived();
public abstract void setDerived(boolean derived);
public abstract String getFieldName();
public abstract void updateValue();
public abstract Object fetchValue();
public abstract void useCurrentValue(boolean useCurrentValue);
public abstract void setRequired(final boolean b);
public abstract boolean isExcluded(final String key);
public abstract void exclude(final String key);
public abstract Set getExcludes();
public abstract void clearExclude(final String key);
public abstract void clearExcludes();
public abstract ProxyObject getProxyObject();
public abstract boolean isSecret();
public abstract Object getInitialValue();
public abstract void setInitialValue(Object convertedDefaultValue);
public abstract boolean isNotKnown();
public abstract boolean isUnknown();
public abstract Method getGetter();
public abstract List getHistory();
public abstract void setHistory(List history);
public abstract boolean expire();
public abstract List getListeners();
public abstract void addListener(SetterListener listener);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy