java.lang.Object
de.codecamp.messages.shared.bundle.BundleFile<F>
- Type Parameters:
F- the file reference
- All Implemented Interfaces:
Comparable<BundleFile<F>>
Represents one file (i.e. one locale) of a message bundle.
-
Constructor Summary
ConstructorsConstructorDescriptionBundleFile(FileSystemAdapter<?, F> fileSystem, F file, Charset encoding, MessageBundleManager.BundleFileCoordinates coordinates, String displayPath) -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(BundleFile<F> o) voiddelete()Deletes the bundle file.protected voidEnsures that the file has been loaded.booleanexists()findLineNumberOfKey(String messageKey) Finds the line number of the given message key in the bundle file.findLineNumberOfKeys(Collection<String> messageKeys) Finds the line numbers of the given message keys in the bundle file.getComment(String messageKey) getKeys()getMessage(String messageKey) booleanhasMessage(String messageKey) booleanhasMessageKey(String messageKey) booleanisEmpty()booleanisMessageEmpty(String messageKey) booleanbooleanbooleanremoveMessage(String messageKey) booleansave()Saves the bundle file, if there are unsaved changes.booleansave(boolean force) Saves the bundle file.voidsetComment(String messageKey, String comment) voidsetMessage(String messageKey, String message)
-
Constructor Details
-
Method Details
-
getLocation
-
getDisplayPath
-
getBundleName
-
getLocale
-
isReadOnly
public boolean isReadOnly() -
isEmpty
public boolean isEmpty() -
getKeys
-
hasMessageKey
-
isMessageEmpty
-
hasMessage
-
getMessage
-
setMessage
-
removeMessage
-
getComment
-
setComment
-
findLineNumberOfKey
Finds the line number of the given message key in the bundle file.- Parameters:
messageKey- the message key- Returns:
- the line number or null
- Throws:
BundleException- an error during bundle operations
-
findLineNumberOfKeys
Finds the line numbers of the given message keys in the bundle file.- Parameters:
messageKeys- the message keys- Returns:
- the line number per message key
- Throws:
BundleException- an error during bundle operations
-
exists
public boolean exists() -
needsSaving
public boolean needsSaving() -
needsSorting
public boolean needsSorting() -
save
public boolean save()Saves the bundle file, if there are unsaved changes.- Returns:
- whether the file was saved
- Throws:
BundleException- an error during bundle operations
-
save
public boolean save(boolean force) Saves the bundle file.- Parameters:
force- whether to save even without unsaved changes- Returns:
- whether the file was saved
- Throws:
BundleException- an error during bundle operations
-
ensureLoaded
protected void ensureLoaded()Ensures that the file has been loaded.- Throws:
BundleException- an error during bundle operations
-
delete
public void delete()Deletes the bundle file.- Throws:
BundleException- an error during bundle operations
-