view artifact-database/src/main/java/de/intevation/artifactdatabase/Id.java @ 103:1282cf96d3eb

Corrected a package definition in the artifacts-common package. artifacts/trunk@1286 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 02 Feb 2011 14:43:32 +0000
parents 933bbc9fc11f
children
line wrap: on
line source
/*
 * Copyright (c) 2010 by Intevation GmbH
 *
 * This program is free software under the LGPL (>=v2.1)
 * Read the file LGPL.txt coming with the software for details
 * or visit http://www.gnu.org/licenses/ if it does not exist.
 */

package de.intevation.artifactdatabase;

import java.util.List;

/**
 * Class to model the concept of an 'id' in terms of unique integer as
 * used in databases. Subclasses of this class are able to be processed
 * by this id.
 *
 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
 */
public class Id
{
    /**
     * Interface to filter a list of ids.
     */
    public interface Filter {
        /**
         * A list of ids is processed in a functional way to be
         * free from some ids by the implementing code. The resulting
         * list maybe short or equal sized to the original one. The
         * original list is not modified.
         * @param ids The list of input ids.
         * @return A list of processed ids.
         */
        List filterIds(List ids);
    }

    /**
     * The backing int of the id.
     */
    protected int id;

    /**
     * Default constructor: id = 0
     */
    public Id() {
    }

    /**
     * Constructor to create an id with a given value.
     * @param id The id value
     */
    public Id(int id) {
        this.id = id;
    }

    /**
     * Returns the id value.
     * @return The value of the id.
     */
    public int getId() {
        return id;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org