001: /*
002: * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package com.sun.xml.internal.bind.v2.model.core;
027:
028: import java.util.Collection;
029: import java.util.Set;
030:
031: import javax.xml.namespace.QName;
032:
033: /**
034: * {@link PropertyInfo} that holds references to other {@link Element}s.
035: *
036: * @author Kohsuke Kawaguchi
037: */
038: public interface ReferencePropertyInfo<T, C> extends PropertyInfo<T, C> {
039: /**
040: * Returns the information about the possible elements in this property.
041: *
042: * <p>
043: * As of 2004/08/17, the spec only allows you to use different element names
044: * when a property is a collection, but I think there's really no reason
045: * to limit it there --- if the user wants to use a different tag name
046: * for different objects, I don't see why this can be limited to collections.
047: *
048: * <p>
049: * So this is a generalization of the spec. We always allow a property to have
050: * multiple types and use different tag names for it, depending on the actual type.
051: *
052: * <p>
053: * In most of the cases, this collection only contains 1 item. So the runtime system
054: * is encouraged to provide a faster code-path that is optimized toward such cases.
055: *
056: * @return
057: * Always non-null. Contains at least one entry.
058: */
059: Set<? extends Element<T, C>> getElements();
060:
061: /**
062: * {@inheritDoc}.
063: *
064: * If this {@link ReferencePropertyInfo} has a wildcard in it,
065: * then the returned list will contain {@link WildcardTypeInfo}.
066: */
067: Collection<? extends TypeInfo<T, C>> ref();
068:
069: /**
070: * Gets the wrapper element name.
071: *
072: * @return
073: * must be null if not collection. If the property is a collection,
074: * this can be null (in which case there'll be no wrapper),
075: * or it can be non-null (in which case there'll be a wrapper)
076: */
077: QName getXmlName();
078:
079: /**
080: * Returns true if this property is nillable
081: * (meaning the absence of the value is treated as nil='true')
082: *
083: * <p>
084: * This method is only used when this property is a collection.
085: */
086: boolean isCollectionNillable();
087:
088: /**
089: * Returns true if this property can hold {@link String}s to represent
090: * mixed content model.
091: */
092: boolean isMixed();
093:
094: /**
095: * If this property supports the wildcard, returns its mode.
096: *
097: * @return null
098: * if the wildcard is not allowed on this element.
099: */
100: WildcardMode getWildcard();
101:
102: /**
103: * If this property supports the wildcard, returns its DOM handler.
104: *
105: * @return null
106: * if the wildcard is not allowed on this element.
107: */
108: C getDOMHandler();
109:
110: Adapter<T, C> getAdapter();
111: }
|