FileDocCategorySizeDatePackage
AttrAddress.javaAPI DocGlassfish v2 API4116Wed Jul 25 23:56:22 BST 2007com.sun.enterprise.config.serverbeans.validation

AttrAddress

public 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" />
author
Srinivas Krishnan
version
2.0

Fields Summary
Constructors Summary
public AttrAddress(String name, String type, boolean optional)

        super(name,type, optional);
    
Methods Summary
public voidvalidate(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}));
        }