JavaEntity.java
881 Bytes
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
package org.onlab.jdvue;
import java.util.Objects;
/**
* Abstraction of a Java source entity.
*/
public abstract class JavaEntity {
private final String name;
/**
* Creates a new Java source entity with the given name.
*
* @param name source entity name
*/
JavaEntity(String name) {
this.name = name;
}
/**
* Returns the Java source entity name.
*
* @return source entity name
*/
public String name() {
return name;
}
@Override
public boolean equals(Object o) {
if (o instanceof JavaEntity) {
JavaEntity that = (JavaEntity) o;
return getClass().equals(that.getClass()) &&
Objects.equals(name, that.name);
}
return false;
}
@Override
public int hashCode() {
return Objects.hash(name);
}
}