KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > repository > Field


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
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.outerj.daisy.repository;
17
18 import org.outerx.daisy.x10.FieldDocument;
19
20 /**
21  * Fields belong to documents (or versions of documents), and can
22  * be used for various purposes.
23  *
24  * <p>Often, fields will be used for meta-data about the document, though
25  * you can use them for whatever data that you want to have addressable
26  * on a finer level then that contained in the {@link Parts}.
27  *
28  * <p>A field is always based upon a {@link org.outerj.daisy.repository.schema.FieldType},
29  * which defines the kind of data that the field can contain.
30  *
31  * <p>Note that a field has no setters methods, modifications can only
32  * be done through the containing {@link Document}. This is because
33  * fields can also be obtained from {@link Version}s, which are not
34  * modifiable.
35  */

36 public abstract interface Field {
37
38     /**
39      * The id of the field type of this field. More information on the field type
40      * can then be retrieved from the {@link org.outerj.daisy.repository.schema.RepositorySchema}.
41      */

42     public long getTypeId();
43
44     /**
45      * The name of the field type (for convenience, this is retrieved from the RepositorySchema).
46      */

47     public String JavaDoc getTypeName();
48
49     /**
50      * The ValueType of the field, which defines the kind of object you
51      * will get from {@link #getValue()}. This method is here for convenience,
52      * the information is retrieved from the RepositorySchema.
53      */

54     public ValueType getValueType();
55
56     /**
57      * Indicates if this field is a multivalue field. This method is here
58      * for convenience, the information is retrieved from the RepositorySchema.
59      */

60     public boolean isMultiValue();
61
62     /**
63      * The value of the field. This will never be null (otherwise the document
64      * wouldn't have the field in the first place). The kind of object returned
65      * is dependent of the {@link ValueType}, and of whether it concerns a multi-value
66      * field type. For multi-value fields, an array (Object[]) is returned.
67      */

68     public Object JavaDoc getValue();
69
70     /**
71      * Get an XML document describing this field.
72      */

73     public FieldDocument getXml();
74 }
75
Popular Tags