Class BwStringBase<T extends BwStringBase>

All Implemented Interfaces:
Serializable, Comparable<T>, SizedEntity, org.bedework.util.logging.Logged
Direct Known Subclasses:
BwLongString, BwString

public class BwStringBase<T extends BwStringBase> extends BwDbentity<T> implements SizedEntity
A base class for String values in bedework. This allows for i18n etc. It also allows for moving all long strings to one or two tables. RFC 2445 has the following properties with a language param:
 ATTENDEE    (cn param)
 CATEGORIES
 COMMENT
 CONTACT
 DESCRIPTION
 LOCATION
 ORGANIZER   (cn param)
 REQUEST-STATUS
 RESOURCES
 SUMMARY
 TZNAME
 
x-properties can also take the language param. .
Version:
1.0
See Also:
  • Constructor Details

    • BwStringBase

      public BwStringBase()
      Constructor
    • BwStringBase

      public BwStringBase(String lang, String value)
      Create a string by specifying all its fields
      Parameters:
      lang - String language code
      value - String value
  • Method Details

    • setLang

      public void setLang(String val)
      Set the lang
      Parameters:
      val - String lang
    • getLang

      public String getLang()
      Get the lang
      Returns:
      String lang
    • setValue

      public void setValue(String val)
      Set the value
      Parameters:
      val - String value
    • getValue

      public String getValue()
      Get the value
      Returns:
      String value
    • hasDumpValue

      public boolean hasDumpValue()
      Description copied from class: DumpEntity
      Override this if we want to optionally suppress the dump based on some attributes. This allows us to skip empty objects which occasionally turn up.
      Overrides:
      hasDumpValue in class DumpEntity<T extends BwStringBase>
      Returns:
      boolean true to continue with dump.
    • findLanguage

      protected static BwStringBase findLanguage(String lang, Collection<? extends BwStringBase> c)
      Search the collection for a string that matches the given language code.

      A supplied lang of null implies the default language code.

      If the supplied language equals any language in the collection we return with that.

      Otherwise if if matches the first part of a qualified code we take that, e.g lan="en" could match "en_US"

      Otherwise we return the first one we found.

      Parameters:
      lang - language code
      c - collection of strings
      Returns:
      BwString or null if no strings.
    • update

      public boolean update(BwStringBase from)
      Figure out what's different and update it. This should reduce the number of spurious changes to the db.
      Parameters:
      from - the before value
      Returns:
      true if we changed something.
    • getLangPar

      public net.fortuna.ical4j.model.Parameter getLangPar()
      If there is a language attached return as a parameter else return null
      Returns:
      Language or null
    • checkNulls

      public boolean checkNulls()
      Check this is properly trimmed
      Returns:
      boolean true if changed
    • getSize

      public int getSize()
      Size to use for quotas.
      Specified by:
      getSize in interface SizedEntity
      Returns:
      int
    • compareTo

      public int compareTo(T that)
      Specified by:
      compareTo in interface Comparable<T extends BwStringBase>
      Overrides:
      compareTo in class BwUnversionedDbentity<T extends BwStringBase>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class BwUnversionedDbentity<T extends BwStringBase>
    • toStringSegment

      protected void toStringSegment(org.bedework.util.misc.ToString ts)
      Description copied from class: BwUnversionedDbentity
      Add our stuff to the ToString object
      Overrides:
      toStringSegment in class BwUnversionedDbentity<T extends BwStringBase>
      Parameters:
      ts - ToString for result
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clone

      public Object clone()
      Description copied from class: BwUnversionedDbentity
      Make visible
      Overrides:
      clone in class BwUnversionedDbentity<T extends BwStringBase>
      Returns:
      Object of class T