1 /* 2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.xml.internal.bind.v2.model.runtime; 27 28 import java.lang.reflect.Type; 29 import java.util.Collection; 30 31 import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; 32 import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; 33 import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; 34 35 /** 36 * {@link PropertyInfo} that exposes more information. 37 * 38 * @author Kohsuke Kawaguchi (kk@kohsuke.org) 39 */ 40 public interface RuntimePropertyInfo extends PropertyInfo<Type,Class> { 41 42 /** {@inheritDoc} */ 43 Collection<? extends RuntimeTypeInfo> ref(); 44 45 46 /** 47 * Gets the {@link Accessor} for this property. 48 * 49 * <p> 50 * Even for a multi-value property, this method returns an accessor 51 * to that property. IOW, the accessor works against the raw type. 52 * 53 * <p> 54 * This methods returns unoptimized accessor (because optimization 55 * accessors are often combined into bigger pieces, and optimization 56 * generally works better if you can look at a bigger piece, as opposed 57 * to individually optimize a smaller components) 58 * 59 * @return 60 * never null. 61 * 62 * @see Accessor#optimize(JAXBContextImpl) 63 */ 64 Accessor getAccessor(); 65 66 /** 67 * Returns true if this property has an element-only content. False otherwise. 68 */ 69 public boolean elementOnlyContent(); 70 71 /** 72 * Gets the "raw" type of the field. 73 * 74 * The raw type is the actual signature of the property. 75 * For example, if the field is the primitive int, this will be the primitive int. 76 * If the field is Object, this will be Object. 77 * If the property is the collection and typed as {@code Collection<Integer>}, 78 * this method returns {@code Collection<Integer>}. 79 * 80 * @return always non-null. 81 */ 82 Type getRawType(); 83 84 /** 85 * Gets the type of the individual item. 86 * 87 * The individual type is the signature of the property used to store individual 88 * values. For a non-collection field, this is the same as {@link #getRawType()}. 89 * For acollection property, this is the type used to store individual value. 90 * So if {@link #getRawType()} is {@code Collection<Integer>}, this method will 91 * return {@link Integer}. 92 * 93 * @return always non-null. 94 */ 95 Type getIndividualType(); 96 }