001/**
002 * Copyright 2005-2018 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.kew.api.document.attribute;
017
018/**
019 * Defines the contract for an attribute of a document.  These attributes are generally extracted during an indexing
020 * process and stored as key-value pairs associated with the document.  In addition to the key-value pair, the
021 * document attribute also defines the data type of data that is held by the attribute.
022 *
023 * <p>This contract simply defines the interface that specific (and strongly typed) implementations of document
024 * attributes will implement.  The number of possible implementations of this contract are generally constrainted by
025 * the set of defined {@link DocumentAttributeDataType} enumeration values.</p>
026 *
027 * <p>Concrete instances of should be created using the {@link DocumentAttributeFactory}.  It is not generally
028 * of value for a client of the API to create custom implementations of this contract interface.</p>
029 *
030 * @see DocumentAttributeFactory
031 *
032 * @author Kuali Rice Team (rice.collab@kuali.org)
033 */
034public interface DocumentAttributeContract {
035
036    /**
037     * Returns the name of this document attribute which serves as an identifier for this attribute on the document.  A
038     * document may have more then one attribute with the same name, in which case it is treated as a multi-valued
039     * attribute.  This method should never return a null or blank value.
040     *
041     * @return the name of the document attribute
042     */
043    String getName();
044
045    /**
046     * Returns the value of this document attribute.  It can be of any type as defined by the implementations of this
047     * interface.  It is possible that this value may be null in cases where the document has a particular attribute
048     * but no actual value associated with that attribute.
049     *
050     * @return the value of the document attribute
051     */
052    Object getValue();
053
054    /**
055     * Returns the data type of this document attribute.  This will generally inform the type of object returned from
056     * the {@code #getValue} method.  This method should never return a null value.
057     *
058     * @return the data type of this document attribute
059     */
060    DocumentAttributeDataType getDataType();
061
062}