?? memberfieldcustom.java
字號:
/*Copyright (c) 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.generator;import org.jibx.binding.model.IClassItem;import org.jibx.runtime.IUnmarshallingContext;import org.jibx.runtime.JiBXException;/** * Member field customization information. */public class MemberFieldCustom extends MemberCustom{ // values specific to member level private String m_fieldName; /** * Constructor. * * @param parent */ protected MemberFieldCustom(NestingBase parent) { super(parent); } /** * Constructor with name known. * * @param parent * @param name */ protected MemberFieldCustom(NestingBase parent, String name) { super(parent, name); } /** * Check if collection member. * * @return <code>false</code> */ public boolean isCollection() { return false; } /** * Get field name. * * @return field name (<code>null</code> if none) */ public String getFieldName() { return m_fieldName; } /** * Post-set method that converts the field name to a member name. * * @throws JiBXException */ protected void postset() throws JiBXException { if (m_fieldName == null) { throw new JiBXException("'field' attribute is required for <field> element"); } else { ClassCustom clas = (ClassCustom)getParent(); setBaseName(memberNameFromField(m_fieldName, clas.getStripPrefixes(), clas.getStripSuffixes())); } } /** * Complete customization information based on field information. * * @param field (<code>null</code> if none available) * @param req required member flag (<code>null</code> if unknown) */ /*package*/ void completeField(IClassItem field, Boolean req) { if (m_fieldName == null) { m_fieldName = field.getName(); } complete(field == null ? null : field.getTypeName(), req); } private static MemberFieldCustom factory(IUnmarshallingContext ictx) { return new MemberFieldCustom(getContainingClass(ictx)); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -