net.nand.util.i18n
Class ParsedPropsFilePair.FileKeyEntry

java.lang.Object
  extended by net.nand.util.i18n.ParsedPropsFilePair.FileEntry
      extended by net.nand.util.i18n.ParsedPropsFilePair.FileKeyEntry
Enclosing class:
ParsedPropsFilePair

public static final class ParsedPropsFilePair.FileKeyEntry
extends ParsedPropsFilePair.FileEntry

Key-value pair line in source and destination, with preceding comments, or multi-line comment at the end of the file.

Also used by editor for newly inserted lines, when we are unsure if they will be comments or key-value. To convert those before saving, call ParsedPropsFilePair.convertInsertedRows().


Field Summary
 java.util.List<java.lang.String> destComment
          Preceding comment lines and/or blank lines in the destination language, or null; same format as PropsFileParser.KeyPairLine.comment
 boolean destSpacedEquals
          If true, the key and value are separated by " = " instead of "=".
 java.lang.CharSequence destValue
          Value in destination language, or null.
 java.lang.String key
          key for retrieval, or null for comments at the end of the file
 boolean newAdd
          Is this line newly added in the editor during this edit session? Remains true even after saving the file, so its key can still be edited.
 java.util.List<java.lang.String> srcComment
          Preceding comment lines and/or blank lines in the source language, or null; same format as PropsFileParser.KeyPairLine.comment
 boolean srcSpacedEquals
          If true, the key and value are separated by " = " instead of "=".
 java.lang.CharSequence srcValue
          Value in source language, or null for a key defined only in the destination file, or for empty strings or only whitespace.
 
Constructor Summary
ParsedPropsFilePair.FileKeyEntry(java.util.List<java.lang.String> srcComment)
          Create an entry that's only a comment without a following key-value pair (at the end of the file).
ParsedPropsFilePair.FileKeyEntry(java.lang.String key, java.lang.String srcValue)
          Create an entry for a source language (no destination value yet).
ParsedPropsFilePair.FileKeyEntry(java.lang.String key, java.lang.String srcValue, java.lang.String destValue)
          Create an entry for a source and destination.
 
Method Summary
 java.lang.String toString()
          toString includes the source and destination values, and number of source and destination comment lines.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

newAdd

public boolean newAdd
Is this line newly added in the editor during this edit session? Remains true even after saving the file, so its key can still be edited.

See Also:
ParsedPropsFilePair.convertInsertedRows()

key

public java.lang.String key
key for retrieval, or null for comments at the end of the file


srcComment

public java.util.List<java.lang.String> srcComment
Preceding comment lines and/or blank lines in the source language, or null; same format as PropsFileParser.KeyPairLine.comment


destComment

public java.util.List<java.lang.String> destComment
Preceding comment lines and/or blank lines in the destination language, or null; same format as PropsFileParser.KeyPairLine.comment


srcValue

public java.lang.CharSequence srcValue
Value in source language, or null for a key defined only in the destination file, or for empty strings or only whitespace.


destValue

public java.lang.CharSequence destValue
Value in destination language, or null. Empty strings or only whitespace are null.


srcSpacedEquals

public boolean srcSpacedEquals
If true, the key and value are separated by " = " instead of "=". This is tracked to minimize whitespace changes when editing a properties file. True by default except comment lines; set false after constructor if needed.


destSpacedEquals

public boolean destSpacedEquals
If true, the key and value are separated by " = " instead of "=". This is tracked to minimize whitespace changes when editing a properties file. True by default except comment lines; set false after constructor if needed.

Constructor Detail

ParsedPropsFilePair.FileKeyEntry

public ParsedPropsFilePair.FileKeyEntry(java.lang.String key,
                                        java.lang.String srcValue)
                                 throws java.lang.IllegalArgumentException
Create an entry for a source language (no destination value yet).

Parameters:
key -
srcValue -
Throws:
java.lang.IllegalArgumentException - if key is null

ParsedPropsFilePair.FileKeyEntry

public ParsedPropsFilePair.FileKeyEntry(java.lang.String key,
                                        java.lang.String srcValue,
                                        java.lang.String destValue)
                                 throws java.lang.IllegalArgumentException
Create an entry for a source and destination.

Parameters:
key - Key for retrieval. May be null only if inserting a new line which may become a comment. Before saving, set the key and value, or convert to ParsedPropsFilePair.FileCommentEntry.
srcValue - Value in source language, or null for empty or only whitespace
destValue - Value in destination language, or null for undefined, empty or only whitespace
Throws:
java.lang.IllegalArgumentException - if key is null

ParsedPropsFilePair.FileKeyEntry

public ParsedPropsFilePair.FileKeyEntry(java.util.List<java.lang.String> srcComment)
Create an entry that's only a comment without a following key-value pair (at the end of the file).

Parameters:
srcComment - Comment text in the source language file
Method Detail

toString

public final java.lang.String toString()
toString includes the source and destination values, and number of source and destination comment lines.

Overrides:
toString in class java.lang.Object