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 org.codehaus.griffon.runtime.core.configuration;
19
20 import javax.annotation.Nonnull;
21 import java.beans.PropertyEditor;
22
23 import static griffon.util.GriffonNameUtils.requireNonBlank;
24
25 /**
26 * @author Andres Almiray
27 * @since 2.11.0
28 */
29 public abstract class InjectionPoint {
30 private final String configuration;
31 private final String key;
32 private final String format;
33 private final Class<? extends PropertyEditor> editor;
34
35 public InjectionPoint(@Nonnull String configuration, @Nonnull String key, @Nonnull String format, @Nonnull Class<? extends PropertyEditor> editor) {
36 this.configuration = configuration;
37 this.key = requireNonBlank(key, "Argument 'key' must not be blank");
38 this.format = format;
39 this.editor = editor;
40 }
41
42 @Nonnull
43 public String getConfiguration() {
44 return configuration;
45 }
46
47 @Nonnull
48 public String getKey() {
49 return key;
50 }
51
52 @Nonnull
53 public String getFormat() {
54 return format;
55 }
56
57 @Nonnull
58 public Class<? extends PropertyEditor> getEditor() {
59 return editor;
60 }
61
62 public abstract void setValue(@Nonnull Object instance, Object value);
63
64 @Nonnull
65 public abstract Class<?> getType();
66 }
|