org.crosswire.jsword.book.basic

## Class DefaultBookMetaData

- java.lang.Object
- - org.crosswire.jsword.book.basic.AbstractBookMetaData
  - - org.crosswire.jsword.book.basic.DefaultBookMetaData

- All Implemented Interfaces:
    Comparable<BookMetaData>, BookMetaData

      public class DefaultBookMetaData
      extends AbstractBookMetaData

  DefaultBookMetaData is an implementation of the of the BookMetaData interface. A less complete implementation design for inheritance is available in AbstractBookMetaData where the complexity is in the setup rather than the inheritance. DefaultBookMetaData is probably the preferred implementation.
  Author:
    Joe Walker
  See Also:
    `The GNU Lesser General Public License for details.`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static String` | `DEFAULT_CHARSET`
    `private String` | `initials`
    `private String` | `name`
    `private Map<String,String>` | `props`
    `private BookCategory` | `type`

    - ### Fields inherited from interface org.crosswire.jsword.book.BookMetaData

      `KEY_BOOK, KEY_BOOKLIST, KEY_CATEGORY, KEY_DRIVER, KEY_FONT, KEY_LANG, KEY_LANGUAGE, KEY_NAME, KEY_SCOPE, KEY_VERSIFICATION`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultBookMetaData(BookDriver driver, String name, BookCategory type)` Ctor with some default values.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `private void` | `addRow(OSISUtil.OSISFactory factory, org.jdom2.Element table, String key, String value)`
    `String` | `getAbbreviation()` The initials of this book - how people familiar with this book will know it, for example "NIV", "KJV".
    `BookCategory` | `getBookCategory()` What category of content is this, a Bible or a reference work like a Dictionary or Commentary.
    `String` | `getBookCharset()` With which Charset is this Book encoded?
    `String` | `getInitials()` The internal name of this book.
    `String` | `getName()` The name of the book, for example "King James Version" or "Bible in Basic English" or "Greek".
    `String` | `getProperty(String key)` Get the property or null.
    `Set<String>` | `getPropertyKeys()` Get a list of all the properties available to do with this Book.
    `VerseKey` | `getScope()`
    `boolean` | `isLeftToRight()` Return the orientation of the script of the Book.
    `void` | `putProperty(String key, String value)` Save to shared storage.
    `void` | `putProperty(String key, String value, boolean forFrontend)` Saves an entry to a particular configuration file.
    `void` | `setBookCategory(BookCategory aType)`
    `void` | `setInitials(String initials)` See note on setName() for side effect on setInitials().
    `void` | `setName(String name)` Setting the name also sets some default initials, so if you wish to set some specific initials then it should be done after setting the name.
    `void` | `setProperty(String key, String value)` Store a transient property.
    `void` | `setType(String typestr)`
    `org.jdom2.Document` | `toOSIS()` Get an OSIS representation of information concerning this Book.

    - ### Methods inherited from class org.crosswire.jsword.book.basic.AbstractBookMetaData

      `compareTo, equals, getDriver, getDriverName, getIndexStatus, getKeyType, getLanguage, getLibrary, getLocation, getOsisID, getUnlockKey, hasFeature, hashCode, isEnciphered, isLocked, isQuestionable, isSupported, reload, setDriver, setIndexStatus, setLanguage, setLibrary, setLocation, toString, unlock`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### type

          private BookCategory type

    - #### name

          private String name

    - #### initials

          private String initials

    - #### props

          private Map<String,String> props

    - #### DEFAULT_CHARSET

          private static final String DEFAULT_CHARSET

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DefaultBookMetaData

          public DefaultBookMetaData(BookDriver driver,
                             String name,
                             BookCategory type)

      Ctor with some default values. A call to setBook() is still required after this ctor is called
      Parameters:
        `driver` - the driver for this book
        `name` - the name of this book
        `type` - the type of this book

  - ### Method Detail

    - #### getBookCharset

          public String getBookCharset()

      Description copied from interface: `BookMetaData`
      With which Charset is this Book encoded?
      Returns:
        the encoding of the Book

    - #### getPropertyKeys

          public Set<String> getPropertyKeys()

      Description copied from interface: `BookMetaData`
      Get a list of all the properties available to do with this Book. The returned Properties will be read-only so any attempts to alter it will fail.
      Returns:
        the read-only properties for this book

    - #### getProperty

          public String getProperty(String key)

      Description copied from interface: `BookMetaData`
      Get the property or null.
      Parameters:
        `key` - the key of the property.
      Returns:
        the value of the property

    - #### setProperty

          public void setProperty(String key,
                         String value)

      Description copied from interface: `BookMetaData`
      Store a transient property.
      Parameters:
        `key` - the key of the property to set
        `value` - the value of the property

    - #### putProperty

          public void putProperty(String key,
                         String value)

      Description copied from interface: `BookMetaData`
      Save to shared storage.
      Specified by:
        `putProperty` in interface `BookMetaData`
      Overrides:
        `putProperty` in class `AbstractBookMetaData`
      Parameters:
        `key` - the key of the property to set
        `value` - the value of the property

    - #### putProperty

          public void putProperty(String key,
                         String value,
                         boolean forFrontend)

      Description copied from interface: `BookMetaData`
      Saves an entry to a particular configuration file.
      Parameters:
        `key` - the entry that we are saving
        `value` - the value of the entry
        `forFrontend` - when `true` save to front end storage, else in shared storage

    - #### getBookCategory

          public BookCategory getBookCategory()

      Description copied from interface: `BookMetaData`
      What category of content is this, a Bible or a reference work like a Dictionary or Commentary.
      Returns:
        The category of book

    - #### getName

          public String getName()

      Description copied from interface: `BookMetaData`
      The name of the book, for example "King James Version" or "Bible in Basic English" or "Greek". This method should not return null or a blank string.
      Returns:
        The name of this book

    - #### getAbbreviation

          public String getAbbreviation()

      Description copied from interface: `BookMetaData`
      The initials of this book - how people familiar with this book will know it, for example "NIV", "KJV".
      Returns:
        The book's initials

    - #### getInitials

          public String getInitials()

      Description copied from interface: `BookMetaData`
      The internal name of this book.
      Returns:
        The book's internal name

    - #### isLeftToRight

          public boolean isLeftToRight()

      Description copied from interface: `BookMetaData`
      Return the orientation of the script of the Book. If a book contains more than one script, it refers to the dominate script of the book. This will be used to present Arabic and Hebrew in their proper orientation. Note: some languages have multiple scripts which don't have the same directionality.
      Returns:
        true if the orientation for the dominate script is LeftToRight.

    - #### setInitials

          public void setInitials(String initials)

      See note on setName() for side effect on setInitials(). If a value of null is used then the initials are defaulted using the name
      Parameters:
        `initials` - The initials to set.
      See Also:
        `setName(String)`

    - #### setName

          public void setName(String name)

      Setting the name also sets some default initials, so if you wish to set some specific initials then it should be done after setting the name.
      Parameters:
        `name` - The name to set.
      See Also:
        `setInitials(String)`

    - #### setBookCategory

          public void setBookCategory(BookCategory aType)

      Parameters:
        `aType` - The type to set.

    - #### setType

          public void setType(String typestr)

      Parameters:
        `typestr` - The string version of the type to set.

    - #### toOSIS

          public org.jdom2.Document toOSIS()

      Description copied from interface: `BookMetaData`
      Get an OSIS representation of information concerning this Book.
      Specified by:
        `toOSIS` in interface `BookMetaData`
      Overrides:
        `toOSIS` in class `AbstractBookMetaData`
      Returns:
        the OSIS representation of information about this book.

    - #### getScope

          public VerseKey getScope()

      Returns:
        The scope

    - #### addRow

          private void addRow(OSISUtil.OSISFactory factory,
                    org.jdom2.Element table,
                    String key,
                    String value)