1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.logging.log4j.core.config.builder.api;
18
19 import java.util.ArrayList;
20 import java.util.LinkedHashMap;
21 import java.util.List;
22 import java.util.Map;
23
24
25
26
27
28
29 public class Component {
30
31 private final Map<String, String> attributes = new LinkedHashMap<>();
32 private final List<Component> components = new ArrayList<>();
33 private final String pluginType;
34 private final String value;
35
36 public Component(final String pluginType) {
37 this(pluginType, null, null);
38 }
39
40 public Component(final String pluginType, final String name) {
41 this(pluginType, name, null);
42 }
43
44 public Component(final String pluginType, final String name, final String value) {
45 this.pluginType = pluginType;
46 this.value = value;
47 if (name != null && name.length() > 0) {
48 attributes.put("name", name);
49 }
50 }
51
52 public Component() {
53 this.pluginType = null;
54 this.value = null;
55 }
56
57
58 public String addAttribute(final String key, final String newValue) {
59 return attributes.put(key, newValue);
60 }
61
62 public void addComponent(final Component component) {
63 components.add(component);
64 }
65
66 public Map<String, String> getAttributes() {
67 return attributes;
68 }
69
70 public List<Component> getComponents() {
71 return components;
72 }
73
74 public String getPluginType() {
75 return pluginType;
76 }
77
78 public String getValue() {
79 return value;
80 }
81 }