All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.xml.bind.v2.model.impl.ArrayInfoImpl Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0, which is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

package com.sun.xml.bind.v2.model.impl;

import javax.xml.namespace.QName;

import com.sun.xml.bind.v2.model.annotation.Locatable;
import com.sun.xml.bind.v2.model.core.ArrayInfo;
import com.sun.xml.bind.v2.model.core.NonElement;
import com.sun.xml.bind.v2.model.util.ArrayInfoUtil;
import com.sun.xml.bind.v2.runtime.Location;
import com.sun.xml.bind.v2.runtime.IllegalAnnotationException;

/**
 *
 * 

* Public because XJC needs to access it * * @author Kohsuke Kawaguchi */ public class ArrayInfoImpl extends TypeInfoImpl implements ArrayInfo, Location { private final NonElement itemType; private final QName typeName; /** * The representation of T[] in the underlying reflection library. */ private final TypeT arrayType; public ArrayInfoImpl(ModelBuilder builder, Locatable upstream, TypeT arrayType) { super(builder, upstream); this.arrayType = arrayType; TypeT componentType = nav().getComponentType(arrayType); this.itemType = builder.getTypeInfo(componentType, this); QName n = itemType.getTypeName(); if(n==null) { builder.reportError(new IllegalAnnotationException(Messages.ANONYMOUS_ARRAY_ITEM.format( nav().getTypeName(componentType)),this)); n = new QName("#dummy"); // for error recovery } this.typeName = ArrayInfoUtil.calcArrayTypeName(n); } public NonElement getItemType() { return itemType; } public QName getTypeName() { return typeName; } public boolean isSimpleType() { return false; } public TypeT getType() { return arrayType; } /** * Leaf-type cannot be referenced from IDREF. * * @deprecated * why are you calling a method whose return value is always known? */ public final boolean canBeReferencedByIDREF() { return false; } public Location getLocation() { return this; } public String toString() { return nav().getTypeName(arrayType); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy