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

org.glassfish.jaxb.runtime.v2.model.impl.ArrayInfoImpl Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 1997, 2021 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 cn.lzgabel.jaxb.runtime.v2.model.impl;

import cn.lzgabel.jaxb.core.v2.model.annotation.Locatable;
import cn.lzgabel.jaxb.core.v2.model.core.ArrayInfo;
import cn.lzgabel.jaxb.core.v2.model.core.NonElement;
import cn.lzgabel.jaxb.core.v2.model.util.ArrayInfoUtil;
import cn.lzgabel.jaxb.core.v2.runtime.IllegalAnnotationException;
import cn.lzgabel.jaxb.core.v2.runtime.Location;

import javax.xml.namespace.QName;

/**
 *
 * 

* 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); } @Override public NonElement getItemType() { return itemType; } @Override public QName getTypeName() { return typeName; } @Override public boolean isSimpleType() { return false; } @Override 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? */ @Override @Deprecated public final boolean canBeReferencedByIDREF() { return false; } @Override public Location getLocation() { return this; } @Override public String toString() { return nav().getTypeName(arrayType); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy