1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.opencastproject.assetmanager.api;
22
23 import static java.lang.String.format;
24
25 import org.opencastproject.util.RequireUtil;
26
27 import java.io.Serializable;
28 import java.util.Objects;
29
30 import javax.annotation.ParametersAreNonnullByDefault;
31 import javax.annotation.concurrent.Immutable;
32
33
34
35
36 @Immutable
37 @ParametersAreNonnullByDefault
38 public final class PropertyName implements Serializable {
39 private static final long serialVersionUID = -7542245565083273994L;
40
41 private final String namespace;
42 private final String name;
43
44
45
46
47 public PropertyName(String namespace, String name) {
48 this.namespace = RequireUtil.notEmpty(namespace, "namespace");
49 this.name = RequireUtil.notEmpty(name, "name");
50 }
51
52
53
54
55 public static PropertyName mk(String namespace, String name) {
56 return new PropertyName(namespace, name);
57 }
58
59
60 public String getNamespace() {
61 return namespace;
62 }
63
64
65 public String getName() {
66 return name;
67 }
68
69
70
71 @Override public int hashCode() {
72 return Objects.hash(namespace, name);
73 }
74
75 @Override public boolean equals(Object that) {
76 return (this == that) || (that instanceof PropertyName && eqFields((PropertyName) that));
77 }
78
79 private boolean eqFields(PropertyName that) {
80 return Objects.equals(namespace, that.namespace) && Objects.equals(name, that.name);
81 }
82
83 @Override public String toString() {
84 return format("PropertyFqn(%s, %s)", namespace, name);
85 }
86 }