updated API description

This commit is contained in:
2019-09-14 17:54:26 +02:00
parent 13d16a1309
commit 6348f81bed
53 changed files with 487 additions and 670 deletions

View File

@ -20,7 +20,7 @@ import de.muehlencord.shared.configuration.converter.BooleanStringConverter;
/**
* A Boolean parameter
*
* @author joern@muehlencord.de
* @author Joern Muehlencord (joern@muehlencord.de)
*/
public class BooleanParameter extends Parameter<Boolean> {

View File

@ -18,14 +18,16 @@ package de.muehlencord.shared.configuration;
import java.util.Map;
/**
* Specifies a configurable objects.
*
* @author joern@muehlencord.de
* @author Joern Muehlencord (joern@muehlencord.de)
*/
public interface Configuration {
/**
* adds a new parameter to the configuration
*
* @param <T> the type of the parameter to add
* @param p the parameter to add
* @throws ConfigurationException if the parameter cannot be added
*/
@ -34,25 +36,27 @@ public interface Configuration {
/**
* sets the value of the given parameter
*
* @param <T>
* @param p
* @param value
* @param <T> the type of the parameter to add
* @param p the parameter to add
* @param value the value the parameter should have
* @throws ConfigurationException if the parameter is not defined
*/
public <T> void setParameterValue(Parameter<T> p, T value) throws ConfigurationException;
/**
* sets the value of parameter with given name
*
* @param <T> the type of the parameter to add
* @param parameterName parameter to set
* @param value value to set
* @throws ConfigurationException if the parameter is not defined
*/
public <T> void setParameterValue(String parameterName, T value) throws ConfigurationException;
public <T> void setParameterValue(String parameterName, T value) throws ConfigurationException;
/**
* sets the value of the given parameter
*
* @param <T> the type of the parameter to add
* @param p parameter to set
* @param value value to set
* @throws ConfigurationException if the parameter is not defined
@ -71,22 +75,26 @@ public interface Configuration {
/**
* returns the value of the given parameter
*
* @param <T> the type of the parameter to add
* @param p the parameter to return the value for
* @return the value of the given parameter; null if not set
*
* @throws ConfigurationException if the parameter is not defined or if the value is not set
* @throws ConfigurationException if the parameter is not defined or if the
* value is not set
*/
public <T> T getParameterValue(Parameter<T> p) throws ConfigurationException;
/**
* returns the value of the given parameter
*
* @param <T> the type of the parameter to add
* @param parameterName the name of the parameter to return the value for
* @return the value of the given parameter; null if not set
*
* @throws ConfigurationException if the parameter is not defined or if the value is not set
* @throws ConfigurationException if the parameter is not defined or if the
* value is not set
*/
public <T> T getParameterValue(String parameterName) throws ConfigurationException;
public <T> T getParameterValue(String parameterName) throws ConfigurationException;
/**
* validates the configuration
@ -94,11 +102,12 @@ public interface Configuration {
* @throws ConfigurationException if the configuration is invalid
*/
public void validateConfiguration() throws ConfigurationException;
/**
* returns the map of parameters and values
*
* @param <T> the type of the parameter to add
* @return the map of parameters and values
*/
public <T> Map<Parameter<T>, T> getParameterMap();
public <T> Map<Parameter<T>, T> getParameterMap();
}

View File

@ -20,7 +20,8 @@ import java.util.Date;
/**
* A Date parameter
* @author joern@muehlencord.de
*
* @author Joern Muehlencord (joern@muehlencord.de)
*/
public class DateParameter extends Parameter<Date> {
@ -47,7 +48,7 @@ public class DateParameter extends Parameter<Date> {
* creates a new parameter object using default string converter
*
* @param name the name of the parameter
* @param mandatory detremines if this is a mandatory parameter or not
* @param mandatory determines if this is a mandatory parameter or not
*/
public DateParameter(String name, boolean mandatory) {
super(name, new DateStringConverter(), mandatory);
@ -58,7 +59,7 @@ public class DateParameter extends Parameter<Date> {
*
* @param name the name of the parameter
* @param converter the converter object to convert the value of the parameter to string and vice versa
* @param mandatory detremines if this is a mandatory parameter or not
* @param mandatory determines if this is a mandatory parameter or not
*/
public DateParameter(String name, StringConverter<Date> converter, boolean mandatory) {
super(name, converter, mandatory);

View File

@ -22,7 +22,7 @@ import java.util.Map;
/**
*
* @author joern@muehlencord.de
* @author Joern Muehlencord (joern@muehlencord.de)
*/
public class DefaultConfiguration implements Configuration {
@ -104,6 +104,7 @@ public class DefaultConfiguration implements Configuration {
/**
* overrides parameter map with given map
*
* @param <T> the type of the parameter to add
* @param map map to use
* @throws ConfigurationException if the parameter is not defined
*/

View File

@ -20,7 +20,7 @@ import de.muehlencord.shared.configuration.converter.IntegerStringConverter;
/**
* A Integer parameter
*
* @author joern@muehlencord.de
* @author Joern Muehlencord (joern@muehlencord.de)
*/
public class IntegerParameter extends Parameter<Integer> {

View File

@ -19,7 +19,8 @@ import de.muehlencord.shared.configuration.converter.StringStringConverter;
/**
* A String parameter
* @author joern@muehlencord.de
*
* @author Joern Muehlencord (joern@muehlencord.de)
*/
public class StringParameter extends Parameter<String> {
@ -31,22 +32,24 @@ public class StringParameter extends Parameter<String> {
public StringParameter(String name) {
super(name, new StringStringConverter(), true);
}
/**
* creates a new mandatory parameter object using default string converter
*
* @param name the name of the parameter
* @param defaultValue the default value of the parameter to set.
*/
public StringParameter(String name, String defaultValue) {
super(name, new StringStringConverter(), true);
this.defaultValue = defaultValue;
}
}
/**
* creates a new mandatory parameter object
*
* @param name the name of the parameter
* @param converter the converter object to convert the value of the parameter to string and vice versa
* @param converter the converter object to convert the value of the
* parameter to string and vice versa
*/
public StringParameter(String name, StringConverter<String> converter) {
super(name, converter, true);
@ -66,7 +69,8 @@ public class StringParameter extends Parameter<String> {
* creates a new parameter object
*
* @param name the name of the parameter
* @param converter the converter object to convert the value of the parameter to string and vice versa
* @param converter the converter object to convert the value of the
* parameter to string and vice versa
* @param mandatory detremines if this is a mandatory parameter or not
*/
public StringParameter(String name, StringConverter<String> converter, boolean mandatory) {

View File

@ -20,7 +20,7 @@ import java.net.URI;
/**
* A URI parameter
* @author joern@muehlencord.de
* @author Joern Muehlencord (joern@muehlencord.de)
*/
public class URIParameter extends Parameter<URI> {

View File

@ -17,7 +17,7 @@ package de.muehlencord.shared.configuration;
/**
*
* @author joern@muehlencord.de
* @author Joern Muehlencord (joern@muehlencord.de)
*/
public class ValidationException extends Exception {

View File

@ -18,7 +18,7 @@ package de.muehlencord.shared.configuration;
/**
*
* @param <T> the type of the validator
* @author joern@muehlencord.de
* @author Joern Muehlencord (joern@muehlencord.de)
*/
public interface Validator<T> {

View File

@ -21,7 +21,7 @@ import static java.lang.Boolean.parseBoolean;
/**
*
* @author joern@muehlencord.de
* @author Joern Muehlencord (joern@muehlencord.de)
*/
public class BooleanStringConverter implements StringConverter<Boolean> {

View File

@ -20,7 +20,7 @@ import de.muehlencord.shared.configuration.Validator;
/**
*
* @author joern@muehlencord.de
* @author Joern Muehlencord (joern@muehlencord.de)
*/
public class IntgerRangeValidator implements Validator<Integer> {

View File

@ -23,7 +23,7 @@ import java.util.List;
/**
*
* @author joern@muehlencord.de
* @author Joern Muehlencord (joern@muehlencord.de)
*/
public class StringValueListValidator implements Validator<String> {