View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
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.apache.juddi.datatype;
17  
18  /***
19   * A Description object contains a textual description and an optional
20   * language code.<p>
21   *
22   * A default ISO language code will be determined for a publisher at the time
23   * that a party establishes permissions to publish at a given operator site
24   * or implementation. This default language code will be applied to any
25   * description values that are provided with no language code.<p>
26   *
27   * @author Steve Viens (sviens@apache.org)
28   */
29  public class Description implements RegistryObject
30  {
31    String descValue;
32    String langCode; // ISO language code
33  
34    /***
35     * Construct a new initialized Description instance.
36     */
37    public Description()
38    {
39    }
40  
41    /***
42     * Construct a new initialized Description instance.
43     */
44    public Description(String descValue)
45    {
46      this.setValue(descValue);
47    }
48  
49    /***
50     * Construct a new initialized Description instance.
51     */
52    public Description(String descValue,String langCode)
53    {
54      this.setValue(descValue);
55      this.setLanguageCode(langCode);
56    }
57  
58    /***
59     * Sets the LanguageCode of this Description.
60     *
61     * @param langCode The new LanguageCode.
62     */
63    public void setLanguageCode(String langCode)
64    {
65      this.langCode = langCode;
66    }
67  
68    /***
69     * Returns the LanguageCode of this Description.
70     *
71     * @return The LanguageCode of this Description, or null if this
72     *  description doesn't have a LanguageCode.
73     */
74    public String getLanguageCode()
75    {
76      return this.langCode;
77    }
78  
79    /***
80     * Sets the text of this Description to the given text. If the
81     * Description has more than 255 characters, it will be trunctated.
82     *
83     * @param newDesc The new text of this Description.
84     */
85    public void setValue(String newDesc)
86    {
87      this.descValue = newDesc;
88    }
89  
90    /***
91     * Returns the text of this Description.
92     *
93     * @return The text of this Description.
94     */
95    public String getValue()
96    {
97      return this.descValue;
98    }
99  }