File:  [Public] / java / classes / org / w3c / tools / resources / StringArrayAttribute.java
Revision 1.8: download - view: text, annotated - select for diffs
Fri Oct 18 13:42:27 2013 UTC (12 years, 2 months ago) by ylafon
Branches: MAIN
CVS tags: HEAD
generics + raw types + serializer

// StringArrayAttribute.java
// $Id: StringArrayAttribute.java,v 1.8 2013/10/18 13:42:27 ylafon Exp $
// (c) COPYRIGHT MIT and INRIA, 1996.
// Please first read the full copyright statement in file COPYRIGHT.html

package org.w3c.tools.resources;

/**
 * The generic description of an StringArrayAttribute.
 */

public class StringArrayAttribute extends ArrayAttribute {

    private static final long serialVersionUID = -5227018742067027439L;

    public StringArrayAttribute(String name, String def[], int flags) {
        super(name, def, flags);
        this.type = "[Ljava.lang.String;".intern();
    }

    public StringArrayAttribute() {
        super();
        this.type = "[Ljava.lang.String;".intern();
    }

    /**
     * Is the given object a valid StringArrayAttribute value ?
     *
     * @param obj The object to test.
     * @return A boolean <strong>true</strong> if okay.
     */

    public boolean checkValue(Object obj) {
        if (obj != null) {
            return (obj instanceof String[]);
        }
        return true;
    }

    public String[] pickle(Object array) {
        return (String[]) array;
    }

    public Object unpickle(String array[]) {
        if (array.length < 1)
            return null;
        return array;
    }

}

Webmaster