Added missing javadoc in the configuration-package.

This commit is contained in:
main() 2011-12-31 20:49:17 +01:00
parent c9b409844f
commit da0bed3b5e
10 changed files with 171 additions and 0 deletions

View File

@ -9,6 +9,9 @@ package com.onarandombox.MultiverseCore.configuration;
import org.bukkit.configuration.ConfigurationSection;
/**
* A {@link Boolean} config-property.
*/
public class BooleanConfigProperty implements MVConfigProperty<Boolean> {
private String name;
private Boolean value;

View File

@ -10,6 +10,9 @@ package com.onarandombox.MultiverseCore.configuration;
import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
import org.bukkit.configuration.ConfigurationSection;
/**
* A {@link EnglishChatColor} config-property.
*/
public class ColorConfigProperty implements MVConfigProperty<EnglishChatColor> {
private String name;
private EnglishChatColor value;

View File

@ -22,73 +22,209 @@ public class ConfigPropertyFactory {
}
// Booleans
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public BooleanConfigProperty getNewProperty(String name, boolean defaultValue, String help) {
return new BooleanConfigProperty(this.section, name, defaultValue, help);
}
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param node The name of the configuration-node this ConfigProperty will be stored as.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public BooleanConfigProperty getNewProperty(String name, boolean defaultValue, String node, String help) {
return new BooleanConfigProperty(this.section, name, defaultValue, node, help);
}
// Integers
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public IntegerConfigProperty getNewProperty(String name, int defaultValue, String help) {
return new IntegerConfigProperty(this.section, name, defaultValue, help);
}
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param node The name of the configuration-node this ConfigProperty will be stored as.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public IntegerConfigProperty getNewProperty(String name, int defaultValue, String node, String help) {
return new IntegerConfigProperty(this.section, name, defaultValue, node, help);
}
// Doubles
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public DoubleConfigProperty getNewProperty(String name, double defaultValue, String help) {
return new DoubleConfigProperty(this.section, name, defaultValue, help);
}
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param node The name of the configuration-node this ConfigProperty will be stored as.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public DoubleConfigProperty getNewProperty(String name, double defaultValue, String node, String help) {
return new DoubleConfigProperty(this.section, name, defaultValue, node, help);
}
// Strings
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public StringConfigProperty getNewProperty(String name, String defaultValue, String help) {
return new StringConfigProperty(this.section, name, defaultValue, help);
}
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param node The name of the configuration-node this ConfigProperty will be stored as.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public StringConfigProperty getNewProperty(String name, String defaultValue, String node, String help) {
return new StringConfigProperty(this.section, name, defaultValue, node, help);
}
// Colors
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public ColorConfigProperty getNewProperty(String name, EnglishChatColor defaultValue, String help) {
return new ColorConfigProperty(this.section, name, defaultValue, help);
}
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param node The name of the configuration-node this ConfigProperty will be stored as.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public ColorConfigProperty getNewProperty(String name, EnglishChatColor defaultValue, String node, String help) {
return new ColorConfigProperty(this.section, name, defaultValue, node, help);
}
// Difficulty
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public DifficultyConfigProperty getNewProperty(String name, Difficulty defaultValue, String help) {
return new DifficultyConfigProperty(this.section, name, defaultValue, help);
}
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param node The name of the configuration-node this ConfigProperty will be stored as.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public DifficultyConfigProperty getNewProperty(String name, Difficulty defaultValue, String node, String help) {
return new DifficultyConfigProperty(this.section, name, defaultValue, node, help);
}
// GameMode
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public GameModeConfigProperty getNewProperty(String name, GameMode defaultValue, String help) {
return new GameModeConfigProperty(this.section, name, defaultValue, help);
}
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param node The name of the configuration-node this ConfigProperty will be stored as.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public GameModeConfigProperty getNewProperty(String name, GameMode defaultValue, String node, String help) {
return new GameModeConfigProperty(this.section, name, defaultValue, node, help);
}
// GameMode
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public LocationConfigProperty getNewProperty(String name, Location defaultValue, String help) {
return new LocationConfigProperty(this.section, name, defaultValue, help);
}
/**
* Constructs a new ConfigProperty.
*
* @param name The name of this ConfigProperty.
* @param defaultValue The default-value.
* @param node The name of the configuration-node this ConfigProperty will be stored as.
* @param help The text that's displayed when a user failed to set the property.
* @return The ConfigProperty.
*/
public LocationConfigProperty getNewProperty(String name, Location defaultValue, String node, String help) {
return new LocationConfigProperty(this.section, name, defaultValue, node, help);
}

View File

@ -10,6 +10,9 @@ package com.onarandombox.MultiverseCore.configuration;
import org.bukkit.Difficulty;
import org.bukkit.configuration.ConfigurationSection;
/**
* A {@link Difficulty} config-property.
*/
public class DifficultyConfigProperty implements MVConfigProperty<Difficulty> {
private String name;
private Difficulty value;

View File

@ -9,6 +9,9 @@ package com.onarandombox.MultiverseCore.configuration;
import org.bukkit.configuration.ConfigurationSection;
/**
* A {@link Double} config-property.
*/
public class DoubleConfigProperty implements MVConfigProperty<Double> {
private String name;
private Double value;

View File

@ -10,6 +10,9 @@ package com.onarandombox.MultiverseCore.configuration;
import org.bukkit.GameMode;
import org.bukkit.configuration.ConfigurationSection;
/**
* A {@link GameMode} config-property.
*/
public class GameModeConfigProperty implements MVConfigProperty<GameMode> {
private String name;
private GameMode value;

View File

@ -9,6 +9,9 @@ package com.onarandombox.MultiverseCore.configuration;
import org.bukkit.configuration.ConfigurationSection;
/**
* A {@link Integer} config-property.
*/
public class IntegerConfigProperty implements MVConfigProperty<Integer> {
private String name;
private Integer value;

View File

@ -11,6 +11,9 @@ import com.onarandombox.MultiverseCore.utils.LocationManipulation;
import org.bukkit.Location;
import org.bukkit.configuration.ConfigurationSection;
/**
* A {@link Location} config-property.
*/
public class LocationConfigProperty implements MVConfigProperty<Location> {
private String name;
private Location value;

View File

@ -7,6 +7,11 @@
package com.onarandombox.MultiverseCore.configuration;
/**
* A generic config-property.
*
* @param <T> The type of the config-property.
*/
public interface MVConfigProperty<T> {
/**
* Gets the name of this property.
@ -40,6 +45,7 @@ public interface MVConfigProperty<T> {
* Sets the value of this property.
*
* @param value The T representation of this value.
* @return True the value was successfully set.
*/
boolean setValue(T value);
@ -52,5 +58,10 @@ public interface MVConfigProperty<T> {
*/
boolean parseValue(String value);
/**
* Gets the name of the config-node that this {@link MVConfigProperty} is saved as.
*
* @return The name of the config-node that this {@link MVConfigProperty} is saved as.
*/
String getConfigNode();
}

View File

@ -9,6 +9,9 @@ package com.onarandombox.MultiverseCore.configuration;
import org.bukkit.configuration.ConfigurationSection;
/**
* A {@link String} config-property.
*/
public class StringConfigProperty implements MVConfigProperty<String> {
private String name;
private String value;