This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
/
SimpleComment.java
106 lines (91 loc) · 2.21 KB
/
SimpleComment.java
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package org.zanata.rest.dto.extensions.comment;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.codehaus.jackson.annotate.JsonTypeName;
import org.zanata.common.Namespaces;
import org.zanata.rest.dto.DTOUtil;
import org.zanata.rest.dto.extensions.gettext.TextFlowExtension;
import org.zanata.rest.dto.extensions.gettext.TextFlowTargetExtension;
/**
* Holds source/target comments for a Java Properties item, extracted comment
* for a source gettext message, or translator comment for a translated gettext
* message.
*
* @author Sean Flanigan <a
* href="mailto:sflaniga@redhat.com">sflaniga@redhat.com</a>
*
*/
@XmlType(name = "simpleCommentExtension", propOrder = {})
@JsonTypeName(value = "comment")
public class SimpleComment implements TextFlowExtension, TextFlowTargetExtension
{
public static final String ID = "comment";
private String value;
public SimpleComment()
{
}
public SimpleComment(String value)
{
this.value = value;
}
@XmlElement(name = "value", required = true)
public String getValue()
{
return value;
}
public void setValue(String value)
{
this.value = value;
}
@XmlAttribute(name = "space", namespace = Namespaces.XML)
public String getSpace()
{
return "preserve";
}
public void setSpace(String space)
{
}
@Override
public String toString()
{
return DTOUtil.toXML(this);
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (!(obj instanceof SimpleComment))
{
return false;
}
SimpleComment other = (SimpleComment) obj;
if (value == null)
{
if (other.value != null)
{
return false;
}
}
else if (!value.equals(other.value))
{
return false;
}
return true;
}
}