⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 valueelement.java

📁 对xml很好的java处理引擎,编译中绑定xml
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*Copyright (c) 2004-2007, Dennis M. SosnoskiAll rights reserved.Redistribution and use in source and binary forms, with or without modification,are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this   list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice,   this list of conditions and the following disclaimer in the documentation   and/or other materials provided with the distribution. * Neither the name of JiBX nor the names of its contributors may be used   to endorse or promote products derived from this software without specific   prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ANDANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AREDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FORANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ONANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THISSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/package org.jibx.binding.model;import org.jibx.binding.util.StringArray;import org.jibx.runtime.EnumSet;import org.jibx.runtime.IUnmarshallingContext;import org.jibx.runtime.JiBXException;import org.jibx.runtime.QName;/** * Model component for <b>value</b> element. This element defines a value that * can be represented as a simple text string, which may be expressed as an * attribute, element, or text component of the XML document. * * @author Dennis M. Sosnoski */public class ValueElement extends ElementBase implements IComponent{    /** Enumeration of allowed attribute names */    public static final StringArray s_allowedAttributes =        new StringArray(new String[] { "constant", "format", "ident",        "nillable", "style" },        new StringArray(new StringArray        (NameAttributes.s_allowedAttributes,         PropertyAttributes.s_allowedAttributes),        StringAttributes.s_allowedAttributes));        //    // Value set information	    public static final int CDATA_STYLE = 2;    public static final int TEXT_STYLE = 3;        private static final EnumSet s_styleEnum =        new EnumSet(NestingAttributes.s_styleEnum, CDATA_STYLE,        new String[] { "cdata", "text" });        public static final int NONE_IDENT = 0;    public static final int DEF_IDENT = 1;    public static final int REF_IDENT = 2;/*    public static final int AUTO_IDENT = 3;   */        /*package*/ static final EnumSet s_identEnum = new EnumSet(NONE_IDENT,        new String[] { "none", "def", "ref"/*, "auto"*/ });		//	// Instance data        /** Supplied constant value. */    private String m_constantValue;        /** Supplied style name. */    private String m_styleName;        /** Actual selected style. */    private int m_styleIndex;        /** Supplied identity name. */    private String m_identName = s_identEnum.getName(NONE_IDENT);        /** Nillable object flag. */    private boolean m_isNillable;        /** Actual selected identity. */    private int m_identIndex;	    /** Name attributes information for value. */    private NameAttributes m_nameAttrs;	    /** Property attributes information for value. */    private PropertyAttributes m_propertyAttrs;        /** String attributes information for value. */    private StringAttributes m_stringAttrs;        /**     * Constructor.     */    public ValueElement() {        super(VALUE_ELEMENT);        m_nameAttrs = new NameAttributes();        m_propertyAttrs = new PropertyAttributes();        m_stringAttrs = new StringAttributes();    }        /**     * Get constant value.     *      * @return constant value, or <code>null</code> if not a constant     */    public String getConstantValue() {        return m_constantValue;    }        /**     * Set constant value.     *      * @param value constant value, or <code>null</code> if not a constant     */    public void setConstantValue(String value) {        m_constantValue = value;    }        /**     * Get style string value.     *      * @return style string value     */    public String getStyleName() {        return m_styleName;    }        /**     * Get style value. This call is only meaningful after validation.     *      * @return style value     */    public int getStyle() {        return m_styleIndex;    }        /**     * Set style name.     *      * @param name style name (<code>null</code> if to use inherited default)     */    public void setStyleName(String name) {        m_styleName = name;    }        /**     * Get name for style that applies to this value. This call is only     * meaningful after validation.     *      * @return name for style     */    public String getEffectiveStyleName() {        return s_styleEnum.getName(m_styleIndex);    }        /**     * Set style that applies to this value. If the specified style is different     * from the nested default it is applied directly, otherwise this value is     * configured to use the default. This method should therefore only be used     * when the nested settings are considered fixed.     * TODO: implement this with parent links     *      * @param style style value     */    public void setEffectiveStyle(int style) {        m_styleIndex = style;        m_styleName = s_styleEnum.getName(style);    }        /**     * Get identity string value.     *      * @return identity string value     */    public String getIdentName() {        return m_identName;    }        /**     * Get identity value. This call is only meaningful after validation.     *      * @return identity value     */    public int getIdent() {        return m_identIndex;    }        /**     * Set identity name.     *      * @param name identity name     */    public void setIdentName(String name) {        m_identName = name;    }        //    // Name attribute delegate methods        /**     * Get name.     *      * @return name text     */    public String getName() {        return m_nameAttrs.getName();    }        /**     * Set name.     *      * @param name text for name     */    public void setName(String name) {        m_nameAttrs.setName(name);    }    /**     * Get specified namespace URI.     *      * @return namespace URI (<code>null</code> if not set)     */    public String getUri() {        return m_nameAttrs.getUri();    }    /**     * Set namespace URI.     *      * @param uri namespace URI (<code>null</code> if not set)     */    public void setUri(String uri) {        m_nameAttrs.setUri(uri);    }    /**     * Get specified namespace prefix.     *      * @return namespace prefix (<code>null</code> if not set)     */    public String getPrefix() {        return m_nameAttrs.getPrefix();    }    /**     * Set namespace prefix.     *      * @param prefix namespace prefix (<code>null</code> if not set)     */    public void setPrefix(String prefix) {        m_nameAttrs.setPrefix(prefix);    }        /**     * Get effective namespace information. This call is only meaningful after     * validation.     *      * @return effective namespace information     */    public NamespaceElement getNamespace() {        return m_nameAttrs.getNamespace();    }        //    // Property attribute delegate methods        /**     * Get usage name.     *      * @return usage name     */    public String getUsageName() {        return m_propertyAttrs.getUsageName();    }        /**     * Get usage value. This call is only meaningful after validation.     *      * @return usage value     */    public int getUsage() {        return m_propertyAttrs.getUsage();    }        /**     * Set usage name.     *      * @param name usage name     */    public void setUsageName(String name) {        m_propertyAttrs.setUsageName(name);    }        /**     * Set usage value.     *      * @param use value     */    public void setUsage(int use) {        m_propertyAttrs.setUsage(use);    }        /**     * Check if property is defined. This method is only meaningful after     * validation.     *      * @return <code>true</code> if property defined, <code>false</code> if not     */    public boolean hasProperty() {        return m_propertyAttrs.hasProperty();    }        /**     * Get declared type name. This call is only meaningful after validation.     *      * @return type name (or <code>null</code> if none)     */    public String getDeclaredType() {        return m_propertyAttrs.getDeclaredType();    }        /**     * Set declared type name.     *      * @param type name (or <code>null</code> if none)     */    public void setDeclaredType(String type) {        m_propertyAttrs.setDeclaredType(type);    }        /**     * Get field name.     *      * @return field name (or <code>null</code> if none)     */    public String getFieldName() {        return m_propertyAttrs.getFieldName();    }        /**     * Get field information. This call is only meaningful after validation.     *      * @return field information (or <code>null</code> if none)     */    public IClassItem getField() {        return m_propertyAttrs.getField();    }        /**     * Set field name.     *      * @param field field name (or <code>null</code> if none)     */    public void setFieldName(String field) {        m_propertyAttrs.setFieldName(field);    }        /**     * Get test method name.     *      * @return test method name (or <code>null</code> if none)     */    public String getTestName() {        return m_propertyAttrs.getTestName();    }        /**     * Get test method information. This call is only meaningful after     * validation.     *      * @return test method information (or <code>null</code> if none)     */    public IClassItem getTest() {        return m_propertyAttrs.getTest();    }        /**     * Set test method name.     *      * @param test test method name (or <code>null</code> if none)     */    public void setTestName(String test) {        m_propertyAttrs.setTestName(test);    }        /**     * Get get method name.     *      * @return get method name (or <code>null</code> if none)     */    public String getGetName() {        return m_propertyAttrs.getGetName();    }    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -