JcrJSONWriter.java
1.95 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
59
60
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* javax.jcr.Node
* javax.jcr.Property
* javax.jcr.RepositoryException
* javax.jcr.ValueFormatException
* org.apache.sling.commons.json.JSONException
* org.apache.sling.commons.json.io.JSONWriter
* org.apache.sling.commons.json.jcr.JsonItemWriter
*/
package com.adobe.cq.screens.impl;
import java.util.HashSet;
import java.util.Set;
import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.RepositoryException;
import javax.jcr.ValueFormatException;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.io.JSONWriter;
import org.apache.sling.commons.json.jcr.JsonItemWriter;
public class JcrJSONWriter
extends JsonItemWriter {
private final JSONWriter writer;
private final Set<String> propertyNamesToIgnore;
public JcrJSONWriter(JSONWriter writer) {
this(writer, new HashSet<String>());
}
public JcrJSONWriter(JSONWriter writer, Set<String> propertyNamesToIgnore) {
super(propertyNamesToIgnore);
this.writer = writer;
this.propertyNamesToIgnore = propertyNamesToIgnore;
}
public JcrJSONWriter dump(Node node, int currentRecursionLevel, int maxRecursionLevels) throws RepositoryException, JSONException {
super.dump(node, this.writer, currentRecursionLevel, maxRecursionLevels);
return this;
}
protected JcrJSONWriter dumpSingleNode(Node n, int currentRecursionLevel, int maxRecursionLevels) throws RepositoryException, JSONException {
super.dumpSingleNode(n, this.writer, currentRecursionLevel, maxRecursionLevels);
return this;
}
public JcrJSONWriter writeProperty(Property p) throws ValueFormatException, RepositoryException, JSONException {
super.writeProperty(this.writer, p);
return this;
}
public JcrJSONWriter ignore(String name) {
this.propertyNamesToIgnore.add(name);
return this;
}
}