View Javadoc

1   /**
2    * Copyright 2005-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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.kuali.rice.kew.api.document.attribute;
17  
18  /**
19   * Defines the contract for an attribute of a document.  These attributes are generally extracted during an indexing
20   * process and stored as key-value pairs associated with the document.  In addition to the key-value pair, the
21   * document attribute also defines the data type of data that is held by the attribute.
22   *
23   * <p>This contract simply defines the interface that specific (and strongly typed) implementations of document
24   * attributes will implement.  The number of possible implementations of this contract are generally constrainted by
25   * the set of defined {@link DocumentAttributeDataType} enumeration values.</p>
26   *
27   * <p>Concrete instances of should be created using the {@link DocumentAttributeFactory}.  It is not generally
28   * of value for a client of the API to create custom implementations of this contract interface.</p>
29   *
30   * @see DocumentAttributeFactory
31   *
32   * @author Kuali Rice Team (rice.collab@kuali.org)
33   */
34  public interface DocumentAttributeContract {
35  
36      /**
37       * Returns the name of this document attribute which serves as an identifier for this attribute on the document.  A
38       * document may have more then one attribute with the same name, in which case it is treated as a multi-valued
39       * attribute.  This method should never return a null or blank value.
40       *
41       * @return the name of the document attribute
42       */
43      String getName();
44  
45      /**
46       * Returns the value of this document attribute.  It can be of any type as defined by the implementations of this
47       * interface.  It is possible that this value may be null in cases where the document has a particular attribute
48       * but no actual value associated with that attribute.
49       *
50       * @return the value of the document attribute
51       */
52      Object getValue();
53  
54      /**
55       * Returns the data type of this document attribute.  This will generally inform the type of object returned from
56       * the {@code #getValue} method.  This method should never return a null value.
57       *
58       * @return the data type of this document attribute
59       */
60      DocumentAttributeDataType getDataType();
61  
62  }