1 |
/* TextSyntax.java -- |
/* TextSyntax.java -- |
2 |
Copyright (C) 2003, 2004 Free Software Foundation, Inc. |
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
41 |
import java.util.Locale; |
import java.util.Locale; |
42 |
|
|
43 |
/** |
/** |
44 |
* @author Michael Koch |
* <code>TextSyntax</code> is the abstract base class of all attribute |
45 |
|
* classes which provide a string as value (e.g. the location of the printer). |
46 |
|
* <p> |
47 |
|
* A <code>TextSyntax</code> instance consists of a string value and a |
48 |
|
* locale which indicates the language of the locale of the string. |
49 |
|
* </p> |
50 |
|
* |
51 |
|
* @author Michael Koch (konqueror@gmx.de) |
52 |
*/ |
*/ |
53 |
public abstract class TextSyntax implements Cloneable, Serializable |
public abstract class TextSyntax implements Cloneable, Serializable |
54 |
{ |
{ |
62 |
* and locale. |
* and locale. |
63 |
* |
* |
64 |
* @param value the value for this syntax |
* @param value the value for this syntax |
65 |
* @param locale the locale to use |
* @param locale the locale to use, if <code>null</code> the default |
66 |
|
* locale is used. |
67 |
* |
* |
68 |
* @exception NullPointerException if value and/or locale is null |
* @exception NullPointerException if value is null |
69 |
*/ |
*/ |
70 |
protected TextSyntax(String value, Locale locale) |
protected TextSyntax(String value, Locale locale) |
71 |
{ |
{ |
72 |
if (value == null || locale == null) |
if (value == null) |
73 |
throw new NullPointerException("value and/or locale may not be null"); |
throw new NullPointerException("value may not be null"); |
74 |
|
|
75 |
this.value = value; |
this.value = value; |
76 |
this.locale = locale; |
this.locale = (locale == null ? Locale.getDefault() : locale); |
77 |
} |
} |
78 |
|
|
79 |
/** |
/** |
80 |
* Returns the value of this syntax object. |
* Returns the value of this syntax object. |
81 |
* |
* |
82 |
* @return the value |
* @return The value. |
83 |
*/ |
*/ |
84 |
public String getValue() |
public String getValue() |
85 |
{ |
{ |
89 |
/** |
/** |
90 |
* Returns the locale of this syntax object. |
* Returns the locale of this syntax object. |
91 |
* |
* |
92 |
* @return the locale |
* @return The locale. |
93 |
*/ |
*/ |
94 |
public Locale getLocale() |
public Locale getLocale() |
95 |
{ |
{ |
99 |
/** |
/** |
100 |
* Returns the hashcode for this object. |
* Returns the hashcode for this object. |
101 |
* |
* |
102 |
* @return the hashcode |
* @return The hashcode. |
103 |
*/ |
*/ |
104 |
public int hashCode() |
public int hashCode() |
105 |
{ |
{ |
107 |
} |
} |
108 |
|
|
109 |
/** |
/** |
110 |
* Tests of obj is equal to this object. |
* Tests if the given object is equal to this object. |
111 |
* |
* |
112 |
* @param obj the object to test |
* @param obj the object to test |
113 |
* |
* |
125 |
} |
} |
126 |
|
|
127 |
/** |
/** |
128 |
* Returns a string representing the object. |
* Returns a string representing the object. The returned |
129 |
|
* string is the underlying text value of this object. |
130 |
|
* |
131 |
|
* @return The string representation. |
132 |
*/ |
*/ |
133 |
public String toString() |
public String toString() |
134 |
{ |
{ |