1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.core.model;
15
16 import java.util.Objects;
17
18 public class NamedComponentModel extends ComponentModel implements INamedModel {
19
20 private static final long serialVersionUID = -6388316680413871442L;
21 String name;
22
23 @Override
24 protected NamedComponentModel makeNewInstance() {
25 return new NamedComponentModel();
26 }
27
28 @Override
29 protected void mirror(Model that) {
30 NamedComponentModel actual = (NamedComponentModel) that;
31 super.mirror(actual);
32 this.name = actual.name;
33 }
34
35 public String getName() {
36 return name;
37 }
38
39 public void setName(String name) {
40 this.name = name;
41 }
42
43 @Override
44 public String toString() {
45 return "NamedComponentModel [name=" + name + ", className=" + className + ", tag=" + tag + ", bodyText="
46 + bodyText + "]";
47 }
48
49 @Override
50 public int hashCode() {
51 final int prime = 31;
52 int result = super.hashCode();
53 result = prime * result + Objects.hash(name);
54 return result;
55 }
56
57 @Override
58 public boolean equals(Object obj) {
59 if (this == obj)
60 return true;
61 if (!super.equals(obj))
62 return false;
63 if (getClass() != obj.getClass())
64 return false;
65 NamedComponentModel other = (NamedComponentModel) obj;
66 return Objects.equals(name, other.name);
67 }
68
69
70 }