ingo@100: /* ingo@100: * Copyright (c) 2010 by Intevation GmbH ingo@100: * ingo@100: * This program is free software under the LGPL (>=v2.1) ingo@100: * Read the file LGPL.txt coming with the software for details ingo@100: * or visit http://www.gnu.org/licenses/ if it does not exist. ingo@100: */ ingo@100: sascha@32: package de.intevation.artifactdatabase; sascha@32: sascha@32: import java.util.List; sascha@32: sascha@32: /** sascha@89: * Class to model the concept of an 'id' in terms of unique integer as sascha@89: * used in databases. Subclasses of this class are able to be processed sascha@89: * by this id. sascha@89: * ingo@80: * @author Sascha L. Teichmann sascha@32: */ sascha@32: public class Id sascha@32: { sascha@89: /** sascha@89: * Interface to filter a list of ids. sascha@89: */ sascha@32: public interface Filter { sascha@89: /** sascha@89: * A list of ids is processed in a functional way to be sascha@89: * free from some ids by the implementing code. The resulting sascha@89: * list maybe short or equal sized to the original one. The sascha@89: * original list is not modified. sascha@89: * @param ids The list of input ids. sascha@89: * @return A list of processed ids. sascha@89: */ sascha@32: List filterIds(List ids); sascha@32: } sascha@32: sascha@89: /** sascha@89: * The backing int of the id. sascha@89: */ sascha@32: protected int id; sascha@32: sascha@89: /** sascha@89: * Default constructor: id = 0 sascha@89: */ sascha@32: public Id() { sascha@32: } sascha@32: sascha@89: /** sascha@89: * Constructor to create an id with a given value. sascha@89: * @param id The id value sascha@89: */ sascha@32: public Id(int id) { sascha@32: this.id = id; sascha@32: } sascha@32: sascha@89: /** sascha@89: * Returns the id value. sascha@89: * @return The value of the id. sascha@89: */ sascha@32: public int getId() { sascha@32: return id; sascha@32: } sascha@32: } sascha@89: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :