GenericMetaDataProperty.java
1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.cq.dam.cfm.MetaDataProperty
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ValueMap
*/
package com.adobe.cq.dam.cfm.impl;
import com.adobe.cq.dam.cfm.MetaDataProperty;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
public class GenericMetaDataProperty
implements MetaDataProperty {
private final String name;
private final String title;
private final String type;
private final Map<String, Object> config;
public GenericMetaDataProperty(Resource resource) {
ValueMap properties = (ValueMap)resource.adaptTo(ValueMap.class);
this.name = resource.getName();
this.title = (String)properties.get("jcr:title", String.class);
this.type = (String)properties.get("type", String.class);
this.config = new HashMap<String, Object>(4);
for (String propName : properties.keySet()) {
if (propName.startsWith("jcr:") || propName.equals("type")) continue;
this.config.put(propName, properties.get((Object)propName));
}
}
public String getName() {
return this.name;
}
public String getTitle() {
return this.title;
}
public String getType() {
return this.type;
}
public Object getConfig(String name) {
return this.config.get(name);
}
public Iterator<String> getConfigNames() {
return this.config.keySet().iterator();
}
}