Thu, 31 Aug 2017 15:18:52 +0800
merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | package com.sun.xml.internal.bind.v2.model.core; |
aoqi@0 | 27 | |
aoqi@0 | 28 | import java.util.List; |
aoqi@0 | 29 | |
aoqi@0 | 30 | import javax.xml.bind.annotation.XmlTransient; |
aoqi@0 | 31 | import javax.xml.bind.annotation.XmlValue; |
aoqi@0 | 32 | |
aoqi@0 | 33 | /** |
aoqi@0 | 34 | * Information about JAXB-bound class. |
aoqi@0 | 35 | * |
aoqi@0 | 36 | * <p> |
aoqi@0 | 37 | * All the JAXB annotations are already reflected to the model so that |
aoqi@0 | 38 | * the caller doesn't have to worry about them. For this reason, you |
aoqi@0 | 39 | * cannot access annotations on properties. |
aoqi@0 | 40 | * |
aoqi@0 | 41 | * <h2>XML representation</h2> |
aoqi@0 | 42 | * <p> |
aoqi@0 | 43 | * A JAXB-bound class always have at least one representation |
aoqi@0 | 44 | * (called "type representation"),but it can optionally have another |
aoqi@0 | 45 | * representation ("element representation"). |
aoqi@0 | 46 | * |
aoqi@0 | 47 | * <p> |
aoqi@0 | 48 | * In the type representaion, a class |
aoqi@0 | 49 | * is represented as a set of attributes and (elements or values). |
aoqi@0 | 50 | * You can inspect the details of those attributes/elements/values by {@link #getProperties()}. |
aoqi@0 | 51 | * This representation corresponds to a complex/simple type in XML Schema. |
aoqi@0 | 52 | * You can obtain the schema type name by {@link #getTypeName()}. |
aoqi@0 | 53 | * |
aoqi@0 | 54 | * <p> |
aoqi@0 | 55 | * If a class has an element representation, {@link #isElement()} returns true. |
aoqi@0 | 56 | * This representation is mostly similar to the type representation |
aoqi@0 | 57 | * except that the whoe attributes/elements/values are wrapped into |
aoqi@0 | 58 | * one element. You can obtain the name of this element through {@link #asElement()}. |
aoqi@0 | 59 | * |
aoqi@0 | 60 | * @author Kohsuke Kawaguchi (kk@kohsuke.org) |
aoqi@0 | 61 | */ |
aoqi@0 | 62 | public interface ClassInfo<T,C> extends MaybeElement<T,C> { |
aoqi@0 | 63 | |
aoqi@0 | 64 | /** |
aoqi@0 | 65 | * Obtains the information about the base class. |
aoqi@0 | 66 | * |
aoqi@0 | 67 | * @return null |
aoqi@0 | 68 | * if this info extends from {@link Object}. |
aoqi@0 | 69 | */ |
aoqi@0 | 70 | ClassInfo<T,C> getBaseClass(); |
aoqi@0 | 71 | |
aoqi@0 | 72 | /** |
aoqi@0 | 73 | * Gets the declaration this object is wrapping. |
aoqi@0 | 74 | */ |
aoqi@0 | 75 | C getClazz(); |
aoqi@0 | 76 | |
aoqi@0 | 77 | /** |
aoqi@0 | 78 | * Gets the fully-qualified name of the class. |
aoqi@0 | 79 | */ |
aoqi@0 | 80 | String getName(); |
aoqi@0 | 81 | |
aoqi@0 | 82 | /** |
aoqi@0 | 83 | * Returns all the properties newly declared in this class. |
aoqi@0 | 84 | * |
aoqi@0 | 85 | * <p> |
aoqi@0 | 86 | * This excludes properties defined in the super class. |
aoqi@0 | 87 | * |
aoqi@0 | 88 | * <p> |
aoqi@0 | 89 | * If the properties are {@link #isOrdered() ordered}, |
aoqi@0 | 90 | * it will be returned in the order that appear in XML. |
aoqi@0 | 91 | * Otherwise it will be returned in no particular order. |
aoqi@0 | 92 | * |
aoqi@0 | 93 | * <p> |
aoqi@0 | 94 | * Properties marked with {@link XmlTransient} will not show up |
aoqi@0 | 95 | * in this list. As far as JAXB is concerned, they are considered |
aoqi@0 | 96 | * non-existent. |
aoqi@0 | 97 | * |
aoqi@0 | 98 | * @return |
aoqi@0 | 99 | * always non-null, but can be empty. |
aoqi@0 | 100 | */ |
aoqi@0 | 101 | List<? extends PropertyInfo<T,C>> getProperties(); |
aoqi@0 | 102 | |
aoqi@0 | 103 | /** |
aoqi@0 | 104 | * Returns true if this class or its ancestor has {@link XmlValue} |
aoqi@0 | 105 | * property. |
aoqi@0 | 106 | */ |
aoqi@0 | 107 | boolean hasValueProperty(); |
aoqi@0 | 108 | |
aoqi@0 | 109 | /** |
aoqi@0 | 110 | * Gets the property that has the specified name. |
aoqi@0 | 111 | * |
aoqi@0 | 112 | * <p> |
aoqi@0 | 113 | * This is just a convenience method for: |
aoqi@0 | 114 | * <pre> |
aoqi@0 | 115 | * for( PropertyInfo p : getProperties() ) { |
aoqi@0 | 116 | * if(p.getName().equals(name)) |
aoqi@0 | 117 | * return p; |
aoqi@0 | 118 | * } |
aoqi@0 | 119 | * return null; |
aoqi@0 | 120 | * </pre> |
aoqi@0 | 121 | * |
aoqi@0 | 122 | * @return null |
aoqi@0 | 123 | * if the property was not found. |
aoqi@0 | 124 | * |
aoqi@0 | 125 | * @see PropertyInfo#getName() |
aoqi@0 | 126 | */ |
aoqi@0 | 127 | PropertyInfo<T,C> getProperty(String name); |
aoqi@0 | 128 | |
aoqi@0 | 129 | /** |
aoqi@0 | 130 | * If the class has properties, return true. This is only |
aoqi@0 | 131 | * true if the Collection object returned by {@link #getProperties()} |
aoqi@0 | 132 | * is not empty. |
aoqi@0 | 133 | */ |
aoqi@0 | 134 | boolean hasProperties(); |
aoqi@0 | 135 | |
aoqi@0 | 136 | /** |
aoqi@0 | 137 | * If this class is abstract and thus shall never be directly instanciated. |
aoqi@0 | 138 | */ |
aoqi@0 | 139 | boolean isAbstract(); |
aoqi@0 | 140 | |
aoqi@0 | 141 | /** |
aoqi@0 | 142 | * Returns true if the properties of this class is ordered in XML. |
aoqi@0 | 143 | * False if it't not. |
aoqi@0 | 144 | * |
aoqi@0 | 145 | * <p> |
aoqi@0 | 146 | * In RELAX NG context, ordered properties mean <group> and |
aoqi@0 | 147 | * unordered properties mean <interleave>. |
aoqi@0 | 148 | */ |
aoqi@0 | 149 | boolean isOrdered(); |
aoqi@0 | 150 | |
aoqi@0 | 151 | /** |
aoqi@0 | 152 | * If this class is marked as final and no further extension/restriction is allowed. |
aoqi@0 | 153 | */ |
aoqi@0 | 154 | boolean isFinal(); |
aoqi@0 | 155 | |
aoqi@0 | 156 | /** |
aoqi@0 | 157 | * True if there's a known sub-type of this class in {@link TypeInfoSet}. |
aoqi@0 | 158 | */ |
aoqi@0 | 159 | boolean hasSubClasses(); |
aoqi@0 | 160 | |
aoqi@0 | 161 | /** |
aoqi@0 | 162 | * Returns true if this bean class has an attribute wildcard. |
aoqi@0 | 163 | * |
aoqi@0 | 164 | * <p> |
aoqi@0 | 165 | * This is true if the class declares an attribute wildcard, |
aoqi@0 | 166 | * or it is inherited from its super classes. |
aoqi@0 | 167 | * |
aoqi@0 | 168 | * @see #inheritsAttributeWildcard() |
aoqi@0 | 169 | */ |
aoqi@0 | 170 | boolean hasAttributeWildcard(); |
aoqi@0 | 171 | |
aoqi@0 | 172 | /** |
aoqi@0 | 173 | * Returns true iff this class inherits a wildcard attribute |
aoqi@0 | 174 | * from its ancestor classes. |
aoqi@0 | 175 | */ |
aoqi@0 | 176 | boolean inheritsAttributeWildcard(); |
aoqi@0 | 177 | |
aoqi@0 | 178 | /** |
aoqi@0 | 179 | * Returns true iff this class declares a wildcard attribute. |
aoqi@0 | 180 | */ |
aoqi@0 | 181 | boolean declaresAttributeWildcard(); |
aoqi@0 | 182 | } |