migrated to Java 8
This commit is contained in:
@ -36,7 +36,7 @@ public abstract class Parameter<T> {
|
||||
this.description = name;
|
||||
this.mandatory = true;
|
||||
this.stringConverter = converter;
|
||||
this.requiredParameters = new LinkedList<Parameter<?>>();
|
||||
this.requiredParameters = new LinkedList<>();
|
||||
this.validator = null;
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ package de.muehlencord.shared.configuration.converter;
|
||||
|
||||
import de.muehlencord.shared.configuration.ConverterException;
|
||||
import de.muehlencord.shared.configuration.StringConverter;
|
||||
import static java.lang.Boolean.parseBoolean;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -16,6 +17,6 @@ public class BooleanStringConverter implements StringConverter<Boolean> {
|
||||
|
||||
@Override
|
||||
public Boolean fromString(String s) throws ConverterException {
|
||||
return Boolean.parseBoolean(s);
|
||||
return parseBoolean(s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package de.muehlencord.shared.configuration.converter;
|
||||
|
||||
import de.muehlencord.shared.configuration.ConverterException;
|
||||
import de.muehlencord.shared.configuration.StringConverter;
|
||||
import static java.lang.Integer.parseInt;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -9,12 +10,14 @@ import de.muehlencord.shared.configuration.StringConverter;
|
||||
*/
|
||||
public class IntegerStringConverter implements StringConverter<Integer> {
|
||||
|
||||
@Override
|
||||
public String toString(Integer o) throws ConverterException {
|
||||
return o.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer fromString(String s) throws ConverterException {
|
||||
return Integer.parseInt(s);
|
||||
return parseInt(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package de.muehlencord.shared.configuration.converter;
|
||||
import de.muehlencord.shared.configuration.ConverterException;
|
||||
import de.muehlencord.shared.configuration.StringConverter;
|
||||
import java.net.URI;
|
||||
import static java.net.URI.create;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -17,7 +18,7 @@ public class URIStringConverter implements StringConverter<URI> {
|
||||
|
||||
@Override
|
||||
public URI fromString(String s) throws ConverterException {
|
||||
return URI.create(s);
|
||||
return create(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package de.muehlencord.shared.configuration.validator;
|
||||
import de.muehlencord.shared.configuration.ValidationException;
|
||||
import de.muehlencord.shared.configuration.Validator;
|
||||
import java.util.Arrays;
|
||||
import static java.util.Arrays.asList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@ -15,12 +16,12 @@ public class StringValueListValidator implements Validator<String> {
|
||||
private List<String> valueList;
|
||||
|
||||
public StringValueListValidator() {
|
||||
this.valueList = new LinkedList<String>();
|
||||
this.valueList = new LinkedList<>();
|
||||
}
|
||||
|
||||
public StringValueListValidator(String... values) {
|
||||
this();
|
||||
valueList.addAll(Arrays.asList(values));
|
||||
valueList.addAll(asList(values));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user