View Javadoc

1   /*
2      Copyright 2007 Ivo Limmen
3   
4      Licensed under the Apache License, Version 2.0 (the "License");
5      you may not use this file except in compliance with the License.
6      You may obtain a copy of the License at
7   
8          http://www.apache.org/licenses/LICENSE-2.0
9   
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15  */
16  package org.limmen.crs.model;
17  
18  /***
19   * The Documentation class is used all over the configuration model and it's
20   * purpose is to provide information on all the parts of the configuration
21   * (the file, sections and settings) in several languages.
22   *
23   * @author Ivo Limmen
24   * @see Configuration
25   * @see Section
26   * @see Setting
27   */
28  public class Documentation {
29  
30  	private String language;
31  
32  	private String text;
33  
34  	public Documentation() {
35  
36  		this(null, null);
37  	}
38  
39  	public Documentation(String aLanguage, String aText) {
40  
41  		super();
42  
43  		setLanguage(aLanguage);
44  		setText(aText);
45  	}
46  
47  	@Override
48     public boolean equals(Object obj) {
49  
50  		if (obj.getClass().equals(getClass())) {
51  
52  			Documentation other = (Documentation) obj;
53  
54  			if (getLanguage().equals(other.getLanguage())) {
55  
56  				if (getText().equals(other.getText())) {
57  
58  					return true;
59  				}
60  			}
61  		}
62  
63  		return false;
64  	}
65  
66  	public String getLanguage() {
67  
68  		return language;
69  	}
70  
71  	public String getText() {
72  
73  		return text;
74  	}
75  
76  	@Override
77     public int hashCode() {
78  
79  	   final int prime = 31;
80  	   int result = 1;
81  	   result = prime * result + ((language == null) ? 0 : language.hashCode());
82  	   result = prime * result + ((text == null) ? 0 : text.hashCode());
83  	   return result;
84     }
85  
86  	public void setLanguage(String language) {
87  
88  		this.language = language;
89  	}
90  
91  	public void setText(String text) {
92  
93  		this.text = text;
94  	}
95  }