FileDocCategorySizeDatePackage
TextSyntax.javaAPI DocJava SE 5 API3588Fri Aug 26 14:57:44 BST 2005javax.print.attribute

TextSyntax

public abstract class TextSyntax extends Object implements Serializable, Cloneable
Class TextSyntax is an abstract base class providing the common implementation of all attributes whose value is a string. The text attribute includes a locale to indicate the natural language. Thus, a text attribute always represents a localized string. Once constructed, a text attribute's value is immutable.

author
David Mendenhall
author
Alan Kaminsky

Fields Summary
private static final long
serialVersionUID
private String
value
String value of this text attribute.
private Locale
locale
Locale of this text attribute.
Constructors Summary
protected TextSyntax(String value, Locale locale)
Constructs a TextAttribute with the specified string and locale.

param
value Text string.
param
locale Natural language of the text string. null is interpreted to mean the default locale for as returned by Locale.getDefault()
exception
NullPointerException (unchecked exception) Thrown if value is null.


                                                               
         
	this.value = verify (value);
	this.locale = verify (locale);
    
Methods Summary
public booleanequals(java.lang.Object object)
Returns whether this text attribute is equivalent to the passed in object. To be equivalent, all of the following conditions must be true:
  1. object is not null.
  2. object is an instance of class TextSyntax.
  3. This text attribute's underlying string and object's underlying string are equal.
  4. This text attribute's locale and object's locale are equal.

param
object Object to compare to.
return
True if object is equivalent to this text attribute, false otherwise.

	return(object != null &&
	       object instanceof TextSyntax &&
	       this.value.equals (((TextSyntax) object).value) &&
	       this.locale.equals (((TextSyntax) object).locale));
    
public java.util.LocalegetLocale()
Returns this text attribute's text string's natural language (locale).

return
the locale

	return locale;
    
public java.lang.StringgetValue()
Returns this text attribute's text string.

return
the text string.

	return value;
    
public inthashCode()
Returns a hashcode for this text attribute.

return
A hashcode value for this object.

	return value.hashCode() ^ locale.hashCode();
    
public java.lang.StringtoString()
Returns a String identifying this text attribute. The String is the attribute's underlying text string.

return
A String identifying this object.

	return value;
    
private static java.lang.Stringverify(java.lang.String value)

	if (value == null) {
	    throw new NullPointerException(" value is null");
	}
	return value;
    
private static java.util.Localeverify(java.util.Locale locale)

	if (locale == null) {
	    return Locale.getDefault();
	}
	return locale;