PropKey.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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.scene7.is.util.callbacks.Option
* com.scene7.is.util.text.Parser
* javax.jcr.Property
* javax.jcr.RepositoryException
*/
package com.adobe.cq.dam.s7imaging.impl.jcr.props;
import com.adobe.cq.dam.s7imaging.impl.jcr.props.OptionalPropKey;
import com.adobe.cq.dam.s7imaging.impl.jcr.props.PropExtractor;
import com.adobe.cq.dam.s7imaging.impl.jcr.props.RequiredPropKey;
import com.adobe.cq.dam.s7imaging.impl.jcr.props.StandardExtractors;
import com.scene7.is.util.callbacks.Option;
import com.scene7.is.util.text.Parser;
import javax.jcr.Property;
import javax.jcr.RepositoryException;
public abstract class PropKey<T> {
public final String name;
public static <T> PropKey<Option<T>> optional(String name, PropExtractor<T> extractor) {
return OptionalPropKey.optionalPropKey(name, extractor);
}
public static <T> PropKey<Option<T>> optional(String name, Parser<T> parser) {
return PropKey.optional(name, StandardExtractors.parsingExtractor(parser));
}
public static <T> PropKey<T> required(String name, PropExtractor<T> extractor) {
return RequiredPropKey.requiredPropKey(PropKey.optional(name, extractor), Option.none());
}
public static <T> PropKey<T> required(String name, Parser<T> parser) {
return PropKey.required(name, StandardExtractors.parsingExtractor(parser));
}
public static <T> PropKey<T> optional(String name, T defaultValue, PropExtractor<T> extractor) {
return RequiredPropKey.requiredPropKey(PropKey.optional(name, extractor), Option.some(defaultValue));
}
public static <T> PropKey<T> optional(String name, T defaultValue, Parser<T> parser) {
return PropKey.optional(name, defaultValue, StandardExtractors.parsingExtractor(parser));
}
PropKey(String name) {
this.name = name;
}
abstract T extractValue(Option<Property> var1) throws RepositoryException;
}