1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.healthmarketscience.jackcess.expr;
18
19 import java.util.Objects;
20
21
22
23
24
25
26
27
28
29 public class Identifier
30 {
31 private final String _collectionName;
32 private final String _objectName;
33 private final String _propertyName;
34
35 public Identifier(String objectName)
36 {
37 this(null, objectName, null);
38 }
39
40 public Identifier(String collectionName, String objectName, String propertyName)
41 {
42 _collectionName = collectionName;
43 _objectName = objectName;
44 _propertyName = propertyName;
45 }
46
47 public String getCollectionName()
48 {
49 return _collectionName;
50 }
51
52 public String getObjectName()
53 {
54 return _objectName;
55 }
56
57 public String getPropertyName()
58 {
59 return _propertyName;
60 }
61
62 @Override
63 public int hashCode() {
64 return _objectName.hashCode();
65 }
66
67 @Override
68 public boolean equals(Object o) {
69 if(!(o instanceof Identifier)) {
70 return false;
71 }
72
73 Identifier../../../../com/healthmarketscience/jackcess/expr/Identifier.html#Identifier">Identifier oi = (Identifier)o;
74
75 return (Objects.equals(_objectName, oi._objectName) &&
76 Objects.equals(_collectionName, oi._collectionName) &&
77 Objects.equals(_propertyName, oi._propertyName));
78 }
79
80 @Override
81 public String toString() {
82 StringBuilder sb = new StringBuilder();
83 if(_collectionName != null) {
84 sb.append("[").append(_collectionName).append("].");
85 }
86 sb.append("[").append(_objectName).append("]");
87 if(_propertyName != null) {
88 sb.append(".[").append(_propertyName).append("]");
89 }
90 return sb.toString();
91 }
92
93 }