AttrAddresspublic class AttrAddress extends AttrType Class which contains Meta data for all types of attributes which is present in Validation Descriptor
XML File
Sample
type="address" />
type="integer" range="low,high" />
type="string" max-length="length" /> |
Constructors Summary |
---|
public AttrAddress(String name, String type, boolean optional)
super(name,type, optional);
|
Methods Summary |
---|
public void | validate(java.lang.Object o, ValidationContext valCtx)
super.validate(o, valCtx); // call to common validator first
String address = null;
if(o == null)
return;
if(o.equals("")) {
valCtx.result.failed(valCtx.smh.getLocalString(getClass().getName() + ".invalidNullStrAddress",
"Attribute({0}=null) : Null address not permitted", new Object[]{valCtx.attrName}));
return;
}
address = (String)o;
try {
StaticTest.checkIPAddress(address);
} catch(IllegalArgumentException e) {
valCtx.result.failed(valCtx.smh.getLocalString(getClass().getName() + ".addressNotAscii",
"Attribute({0}={1}) : Invalid address syntax - {1}",
new Object[]{valCtx.attrName,address}));
} catch(Exception u) {
valCtx.result.failed(valCtx.smh.getLocalString(getClass().getName() + ".invalidAddress",
"Attribute({0}={1}) : Invalid address syntax - {1}",
new Object[]{valCtx.attrName,address}));
}
|
|