From ae12acd08f805870c454c58ba196e929da7d2e21 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 22 Jun 2008 06:51:11 +0200 Subject: [PATCH] add javadoc --- src/de/todesbaum/jsite/application/FileOption.java | 109 +++++++++++++++++++-- 1 file changed, 103 insertions(+), 6 deletions(-) diff --git a/src/de/todesbaum/jsite/application/FileOption.java b/src/de/todesbaum/jsite/application/FileOption.java index 94cd9b7..41e83b7 100644 --- a/src/de/todesbaum/jsite/application/FileOption.java +++ b/src/de/todesbaum/jsite/application/FileOption.java @@ -19,22 +19,55 @@ package de.todesbaum.jsite.application; +/** + * Container for various file options. + * + * @author David ‘Bombe’ Roden <bombe@freenetproject.org> + */ public class FileOption { + /** The default for the insert state. */ private static final boolean DEFAULT_INSERT = true; + + /** The default for the custom key. */ private static final String DEFAULT_CUSTOM_KEY = "CHK@"; + + /** The default container. */ private static final String DEFAULT_CONTAINER = ""; + + /** The default edition range. */ private static final int DEFAULT_EDITION_RANGE = 3; + + /** The default for the replace edition state. */ private static final boolean DEFAULT_REPLACE_EDITION = false; + /** The insert state. */ private boolean insert; + + /** The custom key. */ private String customKey; + + /** The default MIME type. */ private final String defaultMimeType; + + /** The current MIME type. */ private String mimeType; + + /** The container. */ private String container; + + /** The edition range. */ private int editionRange; + + /** The replace edition state. */ private boolean replaceEdition; + /** + * Creates new file options. + * + * @param defaultMimeType + * The default MIME type of the file + */ public FileOption(String defaultMimeType) { insert = DEFAULT_INSERT; customKey = DEFAULT_CUSTOM_KEY; @@ -46,15 +79,21 @@ public class FileOption { } /** - * @return Returns the customKey. + * Returns the custom key. The custom key is only used when + * {@link #isInsert()} returns true. + * + * @return The custom key */ public String getCustomKey() { return customKey; } /** + * Sets the custom key. The custom key is only used when {@link #isInsert()} + * returns true. + * * @param customKey - * The customKey to set. + * The custom key */ public void setCustomKey(String customKey) { if (customKey == null) { @@ -64,20 +103,36 @@ public class FileOption { } /** - * @return Returns the insert. + * Returns whether the file should be inserted. If a file is not inserted, a + * custom key has to be specified for it. + * + * @see #setCustomKey(String) + * @return true if the file should be inserted, + * false otherwise */ public boolean isInsert() { return insert; } /** + * Sets whether the file should be inserted. If a file is not inserted, a + * custom key has to be specified for it. + * * @param insert - * The insert to set. + * true if the file should be inserted, + * false otherwise */ public void setInsert(boolean insert) { this.insert = insert; } + /** + * Sets the MIME type of the file. Setting the MIME type to + * null will set the MIME type to the default MIME type. + * + * @param mimeType + * The MIME type of the file + */ public void setMimeType(String mimeType) { if (mimeType == null) { mimeType = defaultMimeType; @@ -85,20 +140,30 @@ public class FileOption { this.mimeType = mimeType; } + /** + * Returns the MIME type of the file. If no custom MIME type has been set, + * the default MIME type is returned. + * + * @return The MIME type of the file + */ public String getMimeType() { return mimeType; } /** - * @return Returns the container. + * Returns the name of the container this file should be put in. + * + * @return The name of the container */ public String getContainer() { return container; } /** + * Sets the name of the container this file should be put in. + * * @param container - * The container to set. + * The name of the container */ public void setContainer(String container) { if (container == null) { @@ -107,22 +172,54 @@ public class FileOption { this.container = container; } + /** + * Sets whether the file should have “$[EDITION+n]” tags replaced. + * + * @param replaceEdition + * true to replace tags, false not + * to replace + */ public void setReplaceEdition(boolean replaceEdition) { this.replaceEdition = replaceEdition; } + /** + * Returns whether the file should have “$[EDITION+n]” tags + * replaced. + * + * @return true if tags should be replaced, + * false otherwise + */ public boolean getReplaceEdition() { return replaceEdition; } + /** + * Sets the range of editions that should be replaced. + * + * @param editionRange + * The range editions to replace + */ public void setEditionRange(int editionRange) { this.editionRange = editionRange; } + /** + * Returns the range of editions that should be replaced. + * + * @return The range of editions to replace + */ public int getEditionRange() { return editionRange; } + /** + * Returns whether the options for this file have been modified, i.e. are + * not at their default values. + * + * @return true if the options have been modified, + * false if they are at default values + */ public boolean isCustom() { if (insert != DEFAULT_INSERT) { return true; -- 2.7.4