1 // Copyright 2008 Thiago H. de Paula Figueiredo
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 br.com.arsmachina.tapestrycrud.encoder;
16
17 import org.apache.tapestry5.corelib.components.Palette;
18 import org.apache.tapestry5.corelib.components.Select;
19
20 /**
21 * Interface which defines a single method, {@link #toLabel(Object)}, that returns a
22 * user-presentable description (label) of a given object.
23 *
24 * @author Thiago H. de Paula Figueiredo
25 * @param <T> the class related to this encoder.
26 */
27 public interface LabelEncoder<T> {
28
29 /**
30 * Returns a user-presentable description (label) of a given object. It can be used, for
31 * example, as the object label in a {@link Select} or {@link Palette}.
32 *
33 * @param object a {@link <T>}.
34 * @return a {@link String}.
35 */
36 String toLabel(T object);
37
38 }