src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/ArrayInfoImpl.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, 2011, 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.xml.internal.bind.v2.model.impl;
    28 import javax.xml.namespace.QName;
    30 import com.sun.xml.internal.bind.v2.model.annotation.Locatable;
    31 import com.sun.xml.internal.bind.v2.model.core.ArrayInfo;
    32 import com.sun.xml.internal.bind.v2.model.core.NonElement;
    33 import com.sun.xml.internal.bind.v2.model.util.ArrayInfoUtil;
    34 import com.sun.xml.internal.bind.v2.runtime.Location;
    35 import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException;
    37 /**
    38  *
    39  * <p>
    40  * Public because XJC needs to access it
    41  *
    42  * @author Kohsuke Kawaguchi
    43  */
    44 public class ArrayInfoImpl<TypeT,ClassDeclT,FieldT,MethodT>
    45     extends TypeInfoImpl<TypeT,ClassDeclT,FieldT,MethodT>
    46     implements ArrayInfo<TypeT,ClassDeclT>, Location {
    48     private final NonElement<TypeT,ClassDeclT> itemType;
    50     private final QName typeName;
    52     /**
    53      * The representation of T[] in the underlying reflection library.
    54      */
    55     private final TypeT arrayType;
    57     public ArrayInfoImpl(ModelBuilder<TypeT,ClassDeclT,FieldT,MethodT> builder,
    58                          Locatable upstream, TypeT arrayType) {
    59         super(builder, upstream);
    60         this.arrayType = arrayType;
    61         TypeT componentType = nav().getComponentType(arrayType);
    62         this.itemType = builder.getTypeInfo(componentType, this);
    64         QName n = itemType.getTypeName();
    65         if(n==null) {
    66             builder.reportError(new IllegalAnnotationException(Messages.ANONYMOUS_ARRAY_ITEM.format(
    67                 nav().getTypeName(componentType)),this));
    68             n = new QName("#dummy"); // for error recovery
    69         }
    70         this.typeName = ArrayInfoUtil.calcArrayTypeName(n);
    71     }
    73     public NonElement<TypeT, ClassDeclT> getItemType() {
    74         return itemType;
    75     }
    77     public QName getTypeName() {
    78         return typeName;
    79     }
    81     public boolean isSimpleType() {
    82         return false;
    83     }
    85     public TypeT getType() {
    86         return arrayType;
    87     }
    89     /**
    90      * Leaf-type cannot be referenced from IDREF.
    91      *
    92      * @deprecated
    93      *      why are you calling a method whose return value is always known?
    94      */
    95     public final boolean canBeReferencedByIDREF() {
    96         return false;
    97     }
    99     public Location getLocation() {
   100         return this;
   101     }
   102     public String toString() {
   103         return nav().getTypeName(arrayType);
   104     }
   105 }

mercurial