325N/A/*
325N/A * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325N/A *
325N/A * This code is free software; you can redistribute it and/or modify it
325N/A * under the terms of the GNU General Public License version 2 only, as
325N/A * published by the Free Software Foundation. Oracle designates this
325N/A * particular file as subject to the "Classpath" exception as provided
325N/A * by Oracle in the LICENSE file that accompanied this code.
325N/A *
325N/A * This code is distributed in the hope that it will be useful, but WITHOUT
325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325N/A * version 2 for more details (a copy is included in the LICENSE file that
325N/A * accompanied this code).
325N/A *
325N/A * You should have received a copy of the GNU General Public License version
325N/A * 2 along with this work; if not, write to the Free Software Foundation,
325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325N/A *
325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
325N/A * or visit www.oracle.com if you need additional information or have any
325N/A * questions.
325N/A */
325N/A
325N/Apackage com.sun.xml.internal.bind.v2.model.core;
325N/A
325N/Aimport java.util.Collection;
325N/A
325N/Aimport javax.activation.MimeType;
325N/Aimport javax.xml.bind.annotation.XmlID;
325N/Aimport javax.xml.bind.annotation.XmlIDREF;
325N/Aimport javax.xml.bind.annotation.XmlType;
325N/Aimport javax.xml.bind.annotation.XmlSchemaType;
325N/Aimport javax.xml.namespace.QName;
325N/A
325N/Aimport com.sun.istack.internal.Nullable;
325N/Aimport com.sun.xml.internal.bind.v2.model.annotation.AnnotationSource;
325N/A
325N/A/**
325N/A * Information about a JAXB-bound property.
325N/A *
325N/A * <p>
325N/A * All the JAXB annotations are already incorporated into the model so that
325N/A * the caller doesn't have to worry about reading them. For this reason, you
325N/A * cannot access annotations on properties directly.
325N/A *
325N/A * TODO: don't we need a visitor?
325N/A *
325N/A * @author Kohsuke Kawaguchi
325N/A */
325N/Apublic interface PropertyInfo<T,C> extends AnnotationSource {
325N/A
325N/A /**
325N/A * Gets the {@link ClassInfo} or {@link ElementInfo} to which this property belongs.
325N/A */
325N/A TypeInfo<T,C> parent();
325N/A
325N/A /**
325N/A * Gets the name of the property.
325N/A *
325N/A * <p>
325N/A * For example, "foo" or "bar".
325N/A * Generally, a property name is different from XML,
325N/A * (although they are often related, as a property name is often
325N/A * computed from tag names / attribute names.)
325N/A * In fact, <b>property names do not directly affect XML</b>.
325N/A * The property name uniquely identifies a property within a class.
325N/A *
325N/A * @see XmlType#propOrder()
325N/A */
325N/A String getName();
325N/A
325N/A /**
325N/A * Gets the display name of the property.
325N/A *
325N/A * <p>
325N/A * This is a convenience method for
325N/A * {@code parent().getName()+'#'+getName()}.
325N/A */
325N/A String displayName();
325N/A
325N/A /**
325N/A * Returns true if this is a multi-valued collection property.
325N/A * Otherwise false, in which case the property is a single value.
325N/A */
325N/A boolean isCollection();
325N/A
325N/A /**
325N/A * List of {@link TypeInfo}s that this property references.
325N/A *
325N/A * This allows the caller to traverse the reference graph without
325N/A * getting into the details of each different property type.
325N/A *
325N/A * @return
325N/A * non-null read-only collection.
325N/A */
325N/A Collection<? extends TypeInfo<T,C>> ref();
325N/A
325N/A /**
325N/A * Gets the kind of this proeprty.
325N/A *
325N/A * @return
325N/A * always non-null.
325N/A */
325N/A PropertyKind kind();
325N/A
325N/A /**
325N/A * @return
325N/A * null if the property is not adapted.
325N/A */
325N/A Adapter<T,C> getAdapter();
325N/A
325N/A /**
325N/A * Returns the IDness of the value of this element.
325N/A *
325N/A * @see XmlID
325N/A * @see XmlIDREF
325N/A *
325N/A * @return
325N/A * always non-null
325N/A */
325N/A ID id();
325N/A
325N/A /**
325N/A * Expected MIME type, if any.
325N/A */
325N/A MimeType getExpectedMimeType();
325N/A
325N/A /**
325N/A * If this is true and this property indeed represents a binary data,
325N/A * it should be always inlined.
325N/A */
325N/A boolean inlineBinaryData();
325N/A
325N/A /**
325N/A * The effective value of {@link XmlSchemaType} annotation, if any.
325N/A *
325N/A * <p>
325N/A * If the property doesn't have {@link XmlSchemaType} annotation,
325N/A * this method returns null.
325N/A *
325N/A * <p>
325N/A * Since a type name is a property of a Java type, not a Java property,
325N/A * A schema type name of a Java type should be primarily obtained
325N/A * by using {@link NonElement#getTypeName()}. This method is to correctly
325N/A * implement the ugly semantics of {@link XmlSchemaType} (namely
325N/A * when this returns non-null, it overrides the type names of all types
325N/A * that are in this property.)
325N/A */
325N/A @Nullable QName getSchemaType();
325N/A}