?? objectattributes.java
字號:
/*Copyright (c) 2004-2005, 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;/** * Model component for <i>object</i> attribute group in binding definition. * TODO: Add "create" attribute to say whether object should be created or not * * @author Dennis M. Sosnoski * @version 1.0 */ public class ObjectAttributes extends AttributeBase{ /** Enumeration of allowed attribute names */ public static final StringArray s_allowedAttributes = new StringArray(new String[] { "create-type", "factory", "marshaller", "nillable", "post-set", "pre-get", "pre-set", "unmarshaller" }); // // Constants and such related to code generation. // recognized marshal hook method (pre-get) signatures. private static final String[] MARSHAL_HOOK_SIGNATURES = { "(Lorg/jibx/runtime/IMarshallingContext;)V", "(Ljava/lang/Object;)V", "()V" }; // recognized factory hook method signatures. private static final String[] FACTORY_HOOK_SIGNATURES = { "(Lorg/jibx/runtime/IUnmarshallingContext;)", "(Ljava/lang/Object;)", "()" }; // recognized unmarshal hook method (pre-set, post-set) signatures. private static final String[] UNMARSHAL_HOOK_SIGNATURES = { "(Lorg/jibx/runtime/IUnmarshallingContext;)V", "(Ljava/lang/Object;)V", "()V" }; // marshaller/unmarshaller definitions private static final String UNMARSHALLER_INTERFACE = "org.jibx.runtime.IUnmarshaller"; private static final String MARSHALLER_INTERFACE = "org.jibx.runtime.IMarshaller"; private static final String UNMARSHALLER_INTERFACETYPE = "Lorg/jibx/runtime/IUnmarshaller;"; private static final String MARSHALLER_INTERFACETYPE = "Lorg/jibx/runtime/IMarshaller;"; // // Instance data. /** Factory method name (fully qualified, including package and class). */ private String m_factoryName; /** Pre-set method name. */ private String m_preSetName; /** Post-set method name. */ private String m_postSetName; /** Pre-get method name. */ private String m_preGetName; /** Object marshaller class name. */ private String m_marshallerName; /** Object unmarshaller class name. */ private String m_unmarshallerName; /** Nillable object flag. */ private boolean m_isNillable; /** Instance type for creation (fully qualified, including package and class). */ private String m_createType; /** Factory method information. */ private IClassItem m_factoryItem; /** Pre-set method information. */ private IClassItem m_preSetItem; /** Post-set method information. */ private IClassItem m_postSetItem; /** Pre-get method information. */ private IClassItem m_preGetItem; /** Object marshaller class. */ private IClass m_marshallerClass; /** Object unmarshaller class. */ private IClass m_unmarshallerClass; /** Class to use for new instance creation. */ private IClass m_createClass; /** * Constructor. * * @param element owning element */ public ObjectAttributes() {} /** * Get factory method name. * * @return fully-qualified factory class and method name (or * <code>null</code> if none) */ public String getFactoryName() { return m_factoryName; } /** * Get factory method information. This method is only usable after a * call to {@link #validate}. * * @return factory method information (or <code>null</code> if none) */ public IClassItem getFactory() { return m_factoryItem; } /** * Set factory method name. * * @param name fully qualified class and method name for object factory */ public void setFactoryName(String name) { m_factoryName = name; } /** * Get pre-set method name. * * @return pre-set method name (or <code>null</code> if none) */ public String getPresetName() { return m_preSetName; } /** * Get pre-set method information. This method is only usable after a * call to {@link #validate}. * * @return pre-set method information (or <code>null</code> if none) */ public IClassItem getPreset() { return m_preSetItem; } /** * Set pre-set method name. * * @param name member method name to be called before unmarshalling */ public void setPresetName(String name) { m_preSetName = name; } /** * Get post-set method name. * * @return post-set method name (or <code>null</code> if none) */ public String getPostsetName() { return m_postSetName; } /** * Get post-set method information. This method is only usable after a * call to {@link #validate}. * * @return post-set method information (or <code>null</code> if none) */ public IClassItem getPostset() { return m_postSetItem; } /** * Set post-set method name. * * @param name member method name to be called after unmarshalling */ public void setPostsetName(String name) { m_postSetName = name; } /** * Get pre-get method name. * * @return pre-get method name (or <code>null</code> if none) */ public String getPregetName() { return m_preGetName; } /** * Get pre-get method information. This method is only usable after a * call to {@link #validate}. * * @return pre-get method information (or <code>null</code> if none) */ public IClassItem getPreget() { return m_preGetItem; } /** * Set pre-get method name. * * @param name member method name to be called before marshalling */ public void setPreget(String name) { m_preGetName = name; } /** * Get marshaller class name. * * @return marshaller class name (or <code>null</code> if none) */ public String getMarshallerName() { return m_marshallerName; } /** * Get marshaller class information. This method is only usable after a * call to {@link #validate}. * * @return class information for marshaller (or <code>null</code> if none) */ public IClass getMarshaller() { return m_marshallerClass; } /** * Set marshaller class name. * * @param name class name to be used for marshalling */ public void setMarshallerName(String name) { m_marshallerName = name; } /**
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -