Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

ru.gammalabs.ice.publishing
Class MLString  view MLString download MLString.java

java.lang.Object
  extended byru.gammalabs.ice.publishing.AbstractIF
      extended byru.gammalabs.ice.publishing.MLString
All Implemented Interfaces:
java.lang.Cloneable

public class MLString
extends AbstractIF
implements java.lang.Cloneable

Represents field of information element IE and its type IEType as multi language string.


Field Summary
protected  java.util.Map values
          Map where keys is Locale locales and values is String strings.
 
Constructor Summary
MLString()
          Empty constructor
MLString(java.lang.String str)
          Constructs multi language string from string str using default locale.
MLString(java.lang.String str, java.util.Locale locale)
          Constructs multi language string from string str using locale.
 
Method Summary
 java.lang.Object clone()
          Clone this object.
 boolean equalsTo(AbstractIF obj)
          Compare this object to another MLString object.
 boolean equalsTo(AbstractIF obj, java.util.Locale locale)
          Compare this object to another MLString object.
 java.util.Set getAvailableLocales()
          Returns set of all locales where value of this MLString object was definied.
 java.lang.String getValue(java.util.Locale locale)
          Returns string representing multi language string in locale locale.
 long getValueMaxLength(java.util.Locale locale)
          Returns maximum length of string in multi-language string defined in locale locale.
 boolean isNullValue(java.util.Locale locale)
          Returns true if string in multi-language string in locale locale is null or empty.
static void main(java.lang.String[] args)
          Test
 void merge(MLString str)
          Add values in MLString str to this string, if there is no locale in this object, add locale and its value from str, if there is locale in this object, replace value of this locale from str.
 void setValue(java.lang.String str, java.util.Locale locale)
          Sets value of multi language string from string str in locale locale.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 void trim()
          Trims all strings in all locales.
 
Methods inherited from class ru.gammalabs.ice.publishing.AbstractIF
getValue, setValue
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

values

protected java.util.Map values
Map where keys is Locale locales and values is String strings.

Constructor Detail

MLString

public MLString()
Empty constructor


MLString

public MLString(java.lang.String str)
Constructs multi language string from string str using default locale.


MLString

public MLString(java.lang.String str,
                java.util.Locale locale)
Constructs multi language string from string str using locale.

Method Detail

getValue

public java.lang.String getValue(java.util.Locale locale)
Returns string representing multi language string in locale locale. Returns null if value of multi language string was not definied in local locale.

Specified by:
getValue in class AbstractIF

getAvailableLocales

public java.util.Set getAvailableLocales()
Returns set of all locales where value of this MLString object was definied. In any case returns empty, not null set.


equalsTo

public boolean equalsTo(AbstractIF obj)
Compare this object to another MLString object.

Specified by:
equalsTo in class AbstractIF

equalsTo

public boolean equalsTo(AbstractIF obj,
                        java.util.Locale locale)
Compare this object to another MLString object. in locale locale.

Specified by:
equalsTo in class AbstractIF

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


getValueMaxLength

public long getValueMaxLength(java.util.Locale locale)
Returns maximum length of string in multi-language string defined in locale locale.

Specified by:
getValueMaxLength in class AbstractIF

isNullValue

public boolean isNullValue(java.util.Locale locale)
Returns true if string in multi-language string in locale locale is null or empty.

Specified by:
isNullValue in class AbstractIF

merge

public void merge(MLString str)
Add values in MLString str to this string, if there is no locale in this object, add locale and its value from str, if there is locale in this object, replace value of this locale from str.


trim

public void trim()
Trims all strings in all locales.


setValue

public void setValue(java.lang.String str,
                     java.util.Locale locale)
Sets value of multi language string from string str in locale locale.

Specified by:
setValue in class AbstractIF

clone

public java.lang.Object clone()
Clone this object.

Specified by:
clone in class AbstractIF

main

public static void main(java.lang.String[] args)
Test