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.services;
16
17 import java.util.Set;
18
19 import org.apache.tapestry5.PrimaryKeyEncoder;
20
21 import br.com.arsmachina.module.Module;
22 import br.com.arsmachina.tapestrycrud.encoder.ActivationContextEncoder;
23 import br.com.arsmachina.tapestrycrud.encoder.LabelEncoder;
24 import br.com.arsmachina.tapestrycrud.module.TapestryCrudModule;
25
26 /**
27 * Service that provides module-related methods.
28 *
29 * @see Module
30 * @author Thiago H. de Paula Figueiredo
31 */
32 public interface TapestryCrudModuleService {
33
34 /**
35 * Returns the set of all modules.
36 *
37 * @return a {@link Set} of {@link TapestryCrudModule}s.
38 */
39 Set<TapestryCrudModule> getModules();
40
41 /**
42 * Returns the activation context encoder class corresponding to a given entity class.
43 *
44 * @param <T> the entity type.
45 * @param entityClass a {@link Class} instance. It cannot be null.
46 * @return an {@link Class} or null (if no corresponding one is found).
47 */
48 <T> Class<? extends ActivationContextEncoder<T>> getActivationContextEncoderClass(
49 Class<T> entityClass);
50
51 /**
52 * Returns the encoder class corresponding to a given entity class.
53 *
54 * @param <T> the entity type.
55 * @param entityClass a {@link Class} instance. It cannot be null.
56 * @return an {@link Class} or null (if no corresponding one is found).
57 */
58 <T> Class<? extends ActivationContextEncoder<T>> getEncoderClass(
59 Class<T> entityClass);
60
61 /**
62 * Returns the label encoder class corresponding to a given entity class.
63 *
64 * @param <T> the entity type.
65 * @param entityClass a {@link Class} instance. It cannot be null.
66 * @return a {@link Class} or null (if no corresponding one is found).
67 */
68 <T> Class<? extends LabelEncoder<T>> getLabelEncoderClass(Class<T> entityClass);
69
70 /**
71 * Returns the primary key encoder class corresponding to a given entity class.
72 *
73 * @param <T> the entity type.
74 * @param entityClass a {@link Class} instance. It cannot be null.
75 * @return a {@link Class} or null (if no corresponding one is found).
76 */
77 <T> Class<? extends PrimaryKeyEncoder<?, T>> getPrimaryKeyEncoderClass(Class<T> entityClass);
78
79 }