View Javadoc
1   /*
2    * Copyright 2006 Assaf Arkin, Ralf Joachim
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.exolab.castor.mapping;
17  
18  import org.castor.core.nature.PropertyHolder;
19  
20  /**
21   * Describes the properties of a field. Implementations will extend this inteface to
22   * provide additional properties.
23   *
24   * @author <a href="mailto:arkin AT intalio DOT com">Assaf Arkin</a>
25   * @author <a href="mailto:ralf DOT joachim AT syscon DOT eu">Ralf Joachim</a>
26   * @version $Revision$ $Date: 2005-12-06 14:55:28 -0700 (Tue, 06 Dec 2005) $
27   */
28  public interface FieldDescriptor extends PropertyHolder {
29  
30      /**
31       * Set the class descriptor which contains this field.
32       * 
33       * @param parent The class descriptor which contains this field.
34       */
35      void setContainingClassDescriptor(ClassDescriptor parent);
36  
37      /**
38       * Get the class descriptor which contains this field.
39       * 
40       * @return The class descriptor which contains this field.
41       */
42      ClassDescriptor getContainingClassDescriptor();
43  
44      /**
45       * Returns the name of the field. The field must have a name, even if set through
46       * accessor methods.
47       *
48       * @return Field name.
49       */
50      String getFieldName();
51  
52      /**
53       * Returns the Java type of the field.
54       *
55       * @return Field type.
56       */
57      Class getFieldType();
58  
59      /**
60       * Returns the class descriptor related to the field type. If the field type is a
61       * class for which a descriptor exists, this descriptor is returned. If the field
62       * type is a class for which no mapping is provided, null is returned.
63       *
64       * @return The class descriptor of the field type, or null.
65       */
66      ClassDescriptor getClassDescriptor();
67  
68      /**
69       * Returns the handler of the field. In order to persist or marshal a field
70       * descriptor will be associated with a handler.
71       *
72       * @return The field handler.
73       */
74      FieldHandler getHandler();
75  
76      /**
77       * Returns true if the field is transient. Transient fields are never persisted or
78       * marshalled.
79       *
80       * @return True if transient field.
81       */
82      boolean isTransient();
83  
84      /**
85       * Returns true if the field type is immutable.
86       *
87       * @return True if the field type is immutable.
88       */
89      boolean isImmutable();
90  
91      /**
92       * Returns true if the field type is required.
93       *
94       * @return True if the field type is required.
95       */
96      boolean isRequired();
97  
98      /**
99       * Returns true if the field is multivalued (a collection).
100      *
101      * @return True if the field is multivalued.
102      */
103     boolean isMultivalued();
104 
105 }
106