1 // Copyright 2004, 2005 The Apache Software Foundation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package org.apache.tapestry.contrib.table.model; 16 17 /** 18 * An interface for converting an object to its primary key and back. 19 * Typically used to determine how to store a given object as a hidden 20 * value when rendering a form. 21 * 22 * @author mb 23 * @since 3.0 24 */ 25 public interface IPrimaryKeyConvertor 26 { 27 /** 28 * Gets the serializable primary key of the given value 29 * 30 * @param objValue the value for which a primary key needs to be extracted 31 * @return the serializable primary key of the value 32 */ 33 Object getPrimaryKey(Object objValue); 34 35 /** 36 * Gets the value corresponding the given primary key 37 * 38 * @param objPrimaryKey the primary key for which a value needs to be generated 39 * @return the generated value corresponding to the given primary key 40 */ 41 Object getValue(Object objPrimaryKey); 42 } 43