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