src/share/jaxws_classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBType.java

Thu, 31 Aug 2017 15:18:52 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:18:52 +0800
changeset 637
9c07ef4934dd
parent 368
0989ad8c0860
parent 0
373ffda63c9a
permissions
-rw-r--r--

merge

     1 /*
     2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.tools.internal.ws.processor.model.jaxb;
    28 import com.sun.tools.internal.ws.processor.model.AbstractType;
    29 import com.sun.tools.internal.ws.processor.model.java.JavaType;
    31 import javax.xml.namespace.QName;
    32 import java.util.ArrayList;
    33 import java.util.List;
    35 /**
    36  * Top-level binding between JAXB generated Java type
    37  * and XML Schema element declaration.
    38  *
    39  * @author
    40  *     Vivek Pandey
    41  */
    42 public class JAXBType extends AbstractType{
    43     public JAXBType(JAXBType jaxbType){
    44         setName(jaxbType.getName());
    45         this.jaxbMapping = jaxbType.getJaxbMapping();
    46         this.jaxbModel = jaxbType.getJaxbModel();
    47         init();
    48     }
    50     public JAXBType(){}
    52     public JAXBType(QName name, JavaType type){
    53         super(name, type);
    54     }
    56     public JAXBType(QName name, JavaType type, JAXBMapping jaxbMapping, JAXBModel jaxbModel){
    57         super(name, type);
    58         this.jaxbMapping = jaxbMapping;
    59         this.jaxbModel = jaxbModel;
    60         init();
    61     }
    63     public void accept(JAXBTypeVisitor visitor) throws Exception {
    64         visitor.visit(this);
    65     }
    67     private void init() {
    68         if (jaxbMapping != null)
    69             wrapperChildren = jaxbMapping.getWrapperStyleDrilldown();
    70         else
    71             wrapperChildren =  new ArrayList<JAXBProperty>();
    72     }
    74     public boolean isUnwrappable(){
    75         return jaxbMapping != null && jaxbMapping.getWrapperStyleDrilldown() != null;
    76     }
    78     public boolean hasWrapperChildren(){
    79         return wrapperChildren.size() > 0;
    80     }
    82     public boolean isLiteralType() {
    83         return true;
    84     }
    86     public List<JAXBProperty> getWrapperChildren(){
    87         return wrapperChildren;
    88     }
    90     public void setWrapperChildren(List<JAXBProperty> children) {
    91         wrapperChildren = children;
    92     }
    94     public JAXBMapping getJaxbMapping() {
    95         return jaxbMapping;
    96     }
    98     public void setJaxbMapping(JAXBMapping jaxbMapping) {
    99         this.jaxbMapping = jaxbMapping;
   100         init();
   101     }
   103     public void setUnwrapped(boolean unwrapped) {
   104         this.unwrapped = unwrapped;
   105     }
   107     public boolean isUnwrapped() {
   108         return unwrapped;
   109     }
   111     private JAXBMapping jaxbMapping;
   113     public JAXBModel getJaxbModel() {
   114         return jaxbModel;
   115     }
   117     public void setJaxbModel(JAXBModel jaxbModel) {
   118         this.jaxbModel = jaxbModel;
   119     }
   121     private JAXBModel jaxbModel;
   122     private boolean unwrapped = false;
   123     private List<JAXBProperty> wrapperChildren;
   124 }

mercurial