01 /*
02 * Copyright 2008-2014 the original author or authors.
03 *
04 * Licensed under the Apache License, Version 2.0 (the "License");
05 * you may not use this file except in compliance with the License.
06 * You may obtain a copy of the License at
07 *
08 * http://www.apache.org/licenses/LICENSE-2.0
09 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package griffon.core.mvc;
17
18 import javax.annotation.Nonnull;
19 import javax.annotation.Nullable;
20 import java.util.Map;
21
22 /**
23 * Holds the configuration of an MVC group
24 *
25 * @author Andres Almiray
26 * @since 2.0.0
27 */
28 public interface MVCGroupConfiguration {
29 /**
30 * Returns the type of this group.
31 *
32 * @return the type of the group.
33 */
34 @Nonnull
35 String getMvcType();
36
37 /**
38 * Returns a Map with the names of all members keyed by type.
39 *
40 * @return a Map of all configured members as defined by the application's configuration or and addon contribution.
41 */
42 @Nonnull
43 Map<String, String> getMembers();
44
45 /**
46 * Returns a Map with additional configuration for this group.
47 *
48 * @return a Map with additional configuration for this group.
49 */
50 @Nonnull
51 Map<String, Object> getConfig();
52
53 /**
54 * Creates a new MVCGroup instance based in this configuration.
55 * The group's id will should be set to the group's type and an empty Map should be used as the additional arguments.
56 *
57 * @return a newly instantiated MVCGroup
58 */
59 @Nonnull
60 MVCGroup create();
61
62 /**
63 * Creates a new MVCGroup instance based in this configuration.
64 * An empty Map should be used as the additional arguments.
65 *
66 * @param mvcId the id to assign to this group
67 * @return a newly instantiated MVCGroup
68 */
69 @Nonnull
70 MVCGroup create(@Nullable String mvcId);
71
72 /**
73 * Creates a new MVCGroup instance based in this configuration.
74 * The group's id will should be set to the group's type.
75 *
76 * @param args additional arguments sent to each member when initializing
77 * @return a newly instantiated MVCGroup
78 */
79 @Nonnull
80 MVCGroup create(@Nonnull Map<String, Object> args);
81
82 /**
83 * Creates a new MVCGroup instance based in this configuration.
84 *
85 * @param mvcId the id to assign to this group
86 * @param args additional arguments sent to each member when initializing
87 * @return a newly instantiated MVCGroup
88 */
89 @Nonnull
90 MVCGroup create(@Nullable String mvcId, @Nonnull Map<String, Object> args);
91 }
|