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/Aimport java.util.Set;
325N/A
325N/Aimport javax.xml.namespace.QName;
325N/A
325N/A/**
325N/A * {@link PropertyInfo} that holds references to other {@link Element}s.
325N/A *
325N/A * @author Kohsuke Kawaguchi
325N/A */
325N/Apublic interface ReferencePropertyInfo<T,C> extends PropertyInfo<T,C> {
325N/A /**
325N/A * Returns the information about the possible elements in this property.
325N/A *
325N/A * <p>
325N/A * As of 2004/08/17, the spec only allows you to use different element names
325N/A * when a property is a collection, but I think there's really no reason
325N/A * to limit it there --- if the user wants to use a different tag name
325N/A * for different objects, I don't see why this can be limited to collections.
325N/A *
325N/A * <p>
325N/A * So this is a generalization of the spec. We always allow a property to have
325N/A * multiple types and use different tag names for it, depending on the actual type.
325N/A *
325N/A * <p>
325N/A * In most of the cases, this collection only contains 1 item. So the runtime system
325N/A * is encouraged to provide a faster code-path that is optimized toward such cases.
325N/A *
325N/A * @return
325N/A * Always non-null. Contains at least one entry.
325N/A */
325N/A Set<? extends Element<T,C>> getElements();
325N/A
325N/A /**
325N/A * {@inheritDoc}.
325N/A *
325N/A * If this {@link ReferencePropertyInfo} has a wildcard in it,
325N/A * then the returned list will contain {@link WildcardTypeInfo}.
325N/A */
325N/A Collection<? extends TypeInfo<T,C>> ref();
325N/A
325N/A /**
325N/A * Gets the wrapper element name.
325N/A *
325N/A * @return
325N/A * must be null if not collection. If the property is a collection,
325N/A * this can be null (in which case there'll be no wrapper),
325N/A * or it can be non-null (in which case there'll be a wrapper)
325N/A */
325N/A QName getXmlName();
325N/A
325N/A /**
325N/A * Returns true if this property is nillable
325N/A * (meaning the absence of the value is treated as nil='true')
325N/A *
325N/A * <p>
325N/A * This method is only used when this property is a collection.
325N/A */
325N/A boolean isCollectionNillable();
325N/A
325N/A /**
325N/A * Checks if the wrapper element is required.
325N/A *
325N/A * @return
325N/A * Always false if {@link #getXmlName()}==null.
325N/A */
325N/A boolean isCollectionRequired();
325N/A
325N/A /**
325N/A * Returns true if this property can hold {@link String}s to represent
325N/A * mixed content model.
325N/A */
325N/A boolean isMixed();
325N/A
325N/A /**
325N/A * If this property supports the wildcard, returns its mode.
325N/A *
325N/A * @return null
325N/A * if the wildcard is not allowed on this element.
325N/A */
325N/A WildcardMode getWildcard();
325N/A
325N/A /**
325N/A * If this property supports the wildcard, returns its DOM handler.
325N/A *
325N/A * @return null
325N/A * if the wildcard is not allowed on this element.
325N/A */
325N/A C getDOMHandler();
325N/A
325N/A /**
325N/A * Returns true if this element is mandatory.
325N/A */
325N/A boolean isRequired();
325N/A
325N/A Adapter<T,C> getAdapter();
325N/A}