flags + meta

This commit is contained in:
boy0001 2015-05-04 19:52:37 +10:00
parent f1a7e0d73f
commit 1ad65122b7
8 changed files with 50 additions and 19 deletions

View file

@ -36,13 +36,8 @@ public class Flag {
* @throws IllegalArgumentException if you provide inadequate inputs
*/
public Flag(final AbstractFlag key, final String value) {
final char[] allowedCharacters = new char[] { '[', ']', '(', ')', ',', '_', '-', '.', ',', '?', '!', '&', ':', '\u00A7' };
String tempValue = value;
for (final char c : allowedCharacters) {
tempValue = tempValue.replace(c, 'c');
}
if (!StringUtils.isAlphanumericSpace(tempValue)) {
throw new IllegalArgumentException("Flag must be alphanumerical (colours and some special characters are allowed)");
if (!StringUtils.isAsciiPrintable(value)) {
throw new IllegalArgumentException("Flag must be ascii");
}
if (value.length() > 128) {
throw new IllegalArgumentException("Value must be <= 128 characters");