forked from gooddata/gooddata-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInUse.java
More file actions
52 lines (41 loc) · 1.43 KB
/
Copy pathInUse.java
File metadata and controls
52 lines (41 loc) · 1.43 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
package com.gooddata.md;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonTypeInfo;
import org.codehaus.jackson.annotate.JsonTypeName;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import java.util.HashSet;
import java.util.Set;
import static com.gooddata.Validate.noNullElements;
import static com.gooddata.Validate.notNull;
/**
* UsedBy/Using result
*/
@JsonTypeName("inUse")
@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
class InUse {
public static final String USEDBY_URI = "/gdc/md/{projectId}/usedby2";
public static final String USING_URI = "/gdc/md/{projectId}/using2";
private final String uri;
private final Set<String> type;
public InUse(final String uri, final Set<String> type) {
this.uri = notNull(uri, "uri");
this.type = type;
}
@SafeVarargs
public InUse(final String uri, final Class<? extends Obj>... type) {
this.uri = notNull(uri, "uri");
noNullElements(type, "type");
this.type = new HashSet<>();
for (Class<? extends Obj> t: type) {
this.type.add(t.getSimpleName()); // todo lower case first letter
}
}
public String getUri() {
return uri;
}
public Set<String> getType() {
return type;
}
}