Project

General

Profile

Download (2.28 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

    
10
package eu.etaxonomy.cdm.strategy.cache;
11

    
12
import java.io.Serializable;
13

    
14
import javax.persistence.Transient;
15

    
16
import org.apache.commons.lang.StringUtils;
17

    
18
import eu.etaxonomy.cdm.common.CdmUtils;
19

    
20

    
21

    
22
/**
23
 *
24
 * @author a.kohlbecker
25
 * @author  m.doering
26
 * @version 1.0
27
 * @created 11.12.2007 12:11:19
28
 *
29
 */
30
public class TaggedText implements Serializable{
31

    
32
	private static final long serialVersionUID = -3553949743902449813L;
33
    private String text;
34
	private TagEnum type;
35

    
36

    
37
	public static TaggedText NewWhitespaceInstance(){
38
		return new TaggedText(TagEnum.separator, " ");
39
	}
40

    
41
	public String getText() {
42
		return text;
43
	}
44
	public void setText(String text) {
45
		this.text = text;
46
	}
47
	public TagEnum getType() {
48
		return type;
49
	}
50
	public void setType(TagEnum type) {
51
		this.type = type;
52
	}
53
	public TaggedText() {
54
		super();
55
	}
56

    
57
	public TaggedText(TagEnum type, String text) {
58
		super();
59
		this.text = text;
60
		this.type = type;
61
	}
62

    
63
// *************************** DELEGATES ************************************/
64

    
65
	@Transient
66
	protected boolean isName() {
67
		return type.isName();
68
	}
69
	@Transient
70
	protected boolean isRank() {
71
		return type.isRank();
72
	}
73
	@Transient
74
	protected boolean isAuthors() {
75
		return type.isAuthors();
76
	}
77
	@Transient
78
	protected boolean isAppendedPhrase() {
79
		return type.isAppendedPhrase();
80
	}
81
	@Transient
82
	protected boolean isReference() {
83
		return type.isReference();
84
	}
85
	@Transient
86
	protected boolean isYear() {
87
		return type.isYear();
88
	}
89
	@Transient
90
	protected boolean isFullName() {
91
		return type.isFullName();
92
	}
93
	@Transient
94
	protected boolean isNomStatus() {
95
		return type.isNomStatus();
96
	}
97
	@Transient
98
	protected boolean isSeparator() {
99
		return type.isSeparator();
100
	}
101
	@Transient
102
	protected boolean isHybridSign() {
103
		return type.isHybridSign();
104
	}
105

    
106

    
107
// ********************** toString() ***********************************************/
108

    
109
	@Override
110
	public String toString(){
111
		String result = CdmUtils.concat(":", type.toString(), text);
112
		if (StringUtils.isBlank(result)){
113
			return super.toString();
114
		}else{
115
			return result;
116
		}
117
	}
118

    
119
}
(4-4/4)