1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.modeshape.example.sequencer;
25
26 import java.util.Map;
27 import java.util.Properties;
28 import net.jcip.annotations.Immutable;
29
30
31
32
33 @Immutable
34 public class ContentInfo {
35
36 private final Properties properties = new Properties();
37 private final String name;
38 private final String path;
39
40 protected ContentInfo( String path,
41 String name,
42 Properties props ) {
43 this.name = name;
44 this.path = path;
45 if (props != null) this.properties.putAll(props);
46 }
47
48 public String getName() {
49 return this.name;
50 }
51
52 public String getPath() {
53 return this.path;
54 }
55
56 public Properties getProperties() {
57 return this.properties;
58 }
59
60 public String getInfoType() {
61 return this.getClass().getSimpleName().replaceAll("Info$", "");
62 }
63
64 @Override
65 public String toString() {
66 StringBuilder sb = new StringBuilder();
67 sb.append(" Name: " + getName() + "\n");
68 sb.append(" Path: " + getPath() + "\n");
69 for (Map.Entry<Object, Object> entry : getProperties().entrySet()) {
70 sb.append(" " + entry.getKey() + ": " + entry.getValue() + "\n");
71 }
72 return sb.toString();
73 }
74
75 }