1 /*
2  * Copyright (c) 1997, 2011, 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.tools.internal.xjc.generator.bean.field;
27 
28 import com.sun.tools.internal.xjc.generator.bean.ClassOutlineImpl;
29 import com.sun.tools.internal.xjc.model.CPropertyInfo;
30 import com.sun.tools.internal.xjc.outline.FieldOutline;
31 
32 
33 /**
34  * Abstract model of one field in a generated class.
35  *
36  * <p>
37  * Responsible for "realizing" a Java property by actually generating
38  * members(s) to store the property value and a set of methods
39  * to manipulate them.
40  *
41  * <p>
42  * Objects that implement this interface also encapsulates the
43  * <b>internal</b> access to the field.
44  *
45  * <p>
46  * For discussion of the model this interface is representing, see
47  * the "field meta model" design document.
48  *
49  * REVISIT:
50  *  refactor this to two interfaces that provide
51  *  (1) internal access and (2) external access.
52  *
53  * @author
54  *  Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
55  */
56 public interface FieldRenderer {
57     /**
58      * Generates accesssors and fields for the given implementation
59      * class, then return {@link FieldOutline} for accessing
60      * the generated field.
61      */
generate( ClassOutlineImpl context, CPropertyInfo prop)62     public FieldOutline generate( ClassOutlineImpl context, CPropertyInfo prop);
63 
64 //    //
65 //    // field renderers
66 //    //
67 //    public static final FieldRenderer DEFAULT
68 //        = new DefaultFieldRenderer();
69 //
70 //    public static final FieldRenderer ARRAY
71 //        = new GenericFieldRenderer(ArrayField.class);
72 //
73 //    public static final FieldRenderer REQUIRED_UNBOXED
74 //        = new GenericFieldRenderer(UnboxedField.class);
75 //
76 //    public static final FieldRenderer SINGLE
77 //        = new GenericFieldRenderer(SingleField.class);
78 //
79 //    public static final FieldRenderer SINGLE_PRIMITIVE_ACCESS
80 //        = new GenericFieldRenderer(SinglePrimitiveAccessField.class);
81 //
82 //    public static final FieldRenderer JAXB_DEFAULT
83 //        = new DefaultFieldRenderer();
84 }
85