/** * Tries to fetch a {@link Class<?>} for the given type * * @param type name of the type * @return {@link Class<?>} for the type * @throws InvalidSignature if the type is invalid */ private Class<?> getType(String type) throws InvalidSignature { if (type.equals(BOOLEAN)) { return Boolean.TYPE; } else if (type.equals(DOUBLE)) { return Double.TYPE; } else if (type.equals(STRING)) { return String.class; } else { throw new InvalidSignature("Expected type, got '" + type + "' instead"); } }
throw new InvalidSignature("Not enough tokens in '" + signature + "'"); throw new InvalidSignature("Invalid function name '" + tokens.get(1) + "'"); String name = tokens.get(1); throw new InvalidSignature("Missing opening bracket, got '" + tokens.get(2) + "' instead"); throw new InvalidSignature("Missing comma between parameters, got '" + tokens.get(i) + "' instead"); throw new InvalidSignature("No parameter after comma!"); types.add(getType(tokens.get(i))); System.out.println(i); System.out.println(tokens); throw new InvalidSignature("Missing closing bracket, got '" + tokens.get(i) + "' instead"); throw new InvalidSignature("Failed parsing signature at token '" + tokens.get(i) + "'");
throw new InvalidSignature("Not enough tokens in '" + signature + "'"); throw new InvalidSignature("Invalid function name '" + tokens.get(1) + "'"); String name = tokens.get(1); throw new InvalidSignature("Missing opening bracket, got '" + tokens.get(2) + "' instead"); throw new InvalidSignature("Missing comma between parameters, got '" + tokens.get(i) + "' instead"); throw new InvalidSignature("No parameter after comma!"); types.add(getType(tokens.get(i))); System.out.println(i); System.out.println(tokens); throw new InvalidSignature("Missing closing bracket, got '" + tokens.get(i) + "' instead"); throw new InvalidSignature("Failed parsing signature at token '" + tokens.get(i) + "'");
/** * Tries to fetch a {@link Class<?>} for the given type * * @param type name of the type * @return {@link Class<?>} for the type * @throws InvalidSignature if the type is invalid */ private Class<?> getType(String type) throws InvalidSignature { if (type.equals(BOOLEAN)) { return Boolean.TYPE; } else if (type.equals(DOUBLE)) { return Double.TYPE; } else if (type.equals(STRING)) { return String.class; } else { throw new InvalidSignature("Expected type, got '" + type + "' instead"); } }