1 package com.atlassian.user.repository;
2
3
4
5
6
7
8
9
10 public class DefaultRepositoryIdentifier implements RepositoryIdentifier
11 {
12 private final String key;
13 private final String name;
14
15
16
17
18
19
20
21
22 public DefaultRepositoryIdentifier(String key, String name)
23 {
24 if (key == null)
25 throw new IllegalArgumentException("Repository key cannot be null");
26 if (name == null)
27 throw new IllegalArgumentException("Repository name cannot be null");
28 this.key = key;
29 this.name = name;
30 }
31
32 public String getName()
33 {
34 return name;
35 }
36
37 public String getKey()
38 {
39 return key;
40 }
41
42
43
44
45
46
47 public boolean equals(Object o)
48 {
49 if (this == o) return true;
50 if (!(o instanceof RepositoryIdentifier)) return false;
51
52 final RepositoryIdentifier repo = (RepositoryIdentifier) o;
53 return key.equals(repo.getKey());
54 }
55
56 public int hashCode()
57 {
58 return key.hashCode();
59 }
60
61 public String toString()
62 {
63 return name;
64 }
65 }