|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.artima.place.attribute.Text
A chunk of localizable text, suitable for indexing by search engines.
Inner Class Summary | |
static class |
Text.Cache
Contains a String cached text and its Locale , the cache
for a Text object. |
Constructor Summary | |
Text(java.util.Locale cachedLocale,
java.lang.String cachedText)
Constructs a new Text with passed cached text for the
passed locale, and no text key and resource bundle loader. |
|
Text(ResourceBundleLoader loader,
java.lang.String textKey)
Constructs a new Text with passed resource bundle
loader, text key, and no cached text. |
|
Text(ResourceBundleLoader loader,
java.lang.String textKey,
java.util.Locale cachedLocale,
java.lang.String cachedText)
Constructs a new Text with passed resource bundle
loader, text key, and cached text (for the passed locale). |
Method Summary | |
java.lang.Object |
clone()
Clones this Text . |
boolean |
equals(java.lang.Object o)
Compares this Text to the passed object for equality. |
Text.Cache |
getCache()
Returns this Text's Cache , or null if none exists. |
ResourceBundleLoader |
getResourceBundleLoader()
Returns the ResourceBundleLoader contained in this Text , or
null if none exists. |
java.lang.String |
getText()
Returns a String text, suitable for presentation to
users, appropriate to the default locale. |
java.lang.String |
getText(java.util.Locale desiredLocale)
Returns a String text, suitable for presentation to
users, which represents the best-fit text for the specified locale. |
java.lang.String |
getTextKey()
Returns the String text key contained in this Text , or
null if none exists. |
boolean |
hasCache()
Indicates whether this Text object has a String cached text and its Locale . |
int |
hashCode()
Returns a hash code for this object. |
boolean |
hasResources()
Indicates whether this Text object has a ResourceBundleLoader and String text key. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Text(ResourceBundleLoader loader, java.lang.String textKey)
Text
with passed resource bundle
loader, text key, and no cached text.loader
- the ResourceBundleLoader
which can load
ResourceBundle
s for this Text
.textKey
- the String
key with which the
String
resource can be retrieved from a
ResourceBundle
provided by the
ResourceBundleLoader
NullPointerException
- if either of the passed
loader
or textKey
references are
null
public Text(ResourceBundleLoader loader, java.lang.String textKey, java.util.Locale cachedLocale, java.lang.String cachedText)
Text
with passed resource bundle
loader, text key, and cached text (for the passed locale).loader
- the ResourceBundleLoader
which can load
ResourceBundle
s for this Text
.textKey
- the String
key with which the
String
resource can be retrieved from a
ResourceBundle
provided by the
ResourceBundleLoader
cachedLocale
- the Locale
of the text
passed as cachedText
.cachedText
- the text whose locale is passed as
cachedLocale
that should be cached by this
Text
.NullPointerException
- if any of passed loader
,
textKey
, cachedLocale
, or
cachedText
references are null
public Text(java.util.Locale cachedLocale, java.lang.String cachedText)
Text
with passed cached text for the
passed locale, and no text key and resource bundle loader. (Because
this Text
info object contains no resource bundle
loader, it also requires no key with which to look up a text resource
in a resource bundle.cachedLocale
- the Locale
of the text
passed as cachedText
.cachedText
- the text whose locale is passed as
cachedLocale
that should be cached by this
Text
.NullPointerException
- if any of passed
cachedLocale
, or cachedText
references
are null
Method Detail |
public java.lang.String getText()
String
text, suitable for presentation to
users, appropriate to the default locale.String
text, suitable for presentation to
users, appropriate to the default locale.MissingResourceException
- if a codebase URL is found to be
unusable. (Because URLString
enforces well-formedness
of all URLs used by this method, this exception probably indicates
the protocol was unknown.), or if a ResourceBundle
is
not found at the expected codebasepublic java.lang.String getText(java.util.Locale desiredLocale)
String
text, suitable for presentation to
users, which represents the best-fit text for the specified locale.String
text, suitable for presentation to
users, which represents the best-fit text for the specified
locale.NullPointerException
- if passed desiredLocale
is
null
MissingResourceException
- if a codebase URL is found to be
unusable. (Because URLString
enforces well-formedness
of all URLs used by this method, this exception probably indicates
the protocol was unknown.), or if a ResourceBundle
is
not found at the expected codebasepublic boolean equals(java.lang.Object o)
Text
to the passed object for equality. To
be semantically equal, the class of the passed object must be
Text
, the passed object's cached text must be
semantically equal to this object's cached text, the passed object's
text key must be semantically to this object's text key, and
the equals
method of Text
's superclass must
return true
.equals
in class java.lang.Object
An
- object to compare to this Text
true
if this Text
is
semantically equal to the passed Text
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object clone()
Text
.clone
in class java.lang.Object
public Text.Cache getCache()
Cache
, or null
if none exists.
This method will return null
only if this Text
object contains
no cached String
text. Otherwise, this method will return a Text.Cache
object containing this object's cached String
text and the Locale
of that cached
text (the "cached locale").Text.Cache
, which contains this object's
cached text and locale, or null
if this object contains
no cachepublic boolean hasResources()
Text
object has a ResourceBundleLoader
and String
text key.Text
object has a ResourceBundleLoader
and String
text key.public boolean hasCache()
Text
object has a String
cached text and its Locale
.Text
object has a String
cached text and its Locale
.public ResourceBundleLoader getResourceBundleLoader()
ResourceBundleLoader
contained in this Text
, or
null
if none exists.ResourceBundleLoader
, or null
if this object contains no
ResourceBundleLoader
.public java.lang.String getTextKey()
String
text key contained in this Text
, or
null
if none exists.String
text key, or null
if this object contains no
text key.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |