01: /*
02: * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04: *
05: * This code is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU General Public License version 2 only, as
07: * published by the Free Software Foundation. Sun designates this
08: * particular file as subject to the "Classpath" exception as provided
09: * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22: * CA 95054 USA or visit www.sun.com if you need additional information or
23: * have any 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.reflect.Accessor;
33:
34: /**
35: * {@link PropertyInfo} that exposes more information.
36: *
37: * @author Kohsuke Kawaguchi (kk@kohsuke.org)
38: */
39: public interface RuntimePropertyInfo extends PropertyInfo<Type, Class> {
40:
41: /** {@inheritDoc} */
42: Collection<? extends RuntimeTypeInfo> ref();
43:
44: /**
45: * Gets the {@link Accessor} for this property.
46: *
47: * <p>
48: * Even for a multi-value property, this method returns an accessor
49: * to that property. IOW, the accessor works against the raw type.
50: *
51: * <p>
52: * This methods returns unoptimized accessor (because optimization
53: * accessors are often combined into bigger pieces, and optimization
54: * generally works better if you can look at a bigger piece, as opposed
55: * to individually optimize a smaller components)
56: *
57: * @return
58: * never null.
59: *
60: * @see Accessor#optimize()
61: */
62: Accessor getAccessor();
63:
64: /**
65: * Returns true if this property has an element-only content. False otherwise.
66: */
67: public boolean elementOnlyContent();
68:
69: /**
70: * Gets the "raw" type of the field.
71: *
72: * The raw type is the actual signature of the property.
73: * For example, if the field is the primitive int, this will be the primitive int.
74: * If the field is Object, this will be Object.
75: * If the property is the collection and typed as {@code Collection<Integer>},
76: * this method returns {@code Collection<Integer>}.
77: *
78: * @return always non-null.
79: */
80: Type getRawType();
81:
82: /**
83: * Gets the type of the individual item.
84: *
85: * The individual type is the signature of the property used to store individual
86: * values. For a non-collection field, this is the same as {@link #getRawType()}.
87: * For acollection property, this is the type used to store individual value.
88: * So if {@link #getRawType()} is {@code Collection<Integer>}, this method will
89: * return {@link Integer}.
90: *
91: * @return always non-null.
92: */
93: Type getIndividualType();
94: }
|