class TypeInfoParser {

	@SuppressWarnings("unchecked")
	public static <X> TypeInformation<X> parse(String infoString) {
		try {
			if (infoString == null) {
				throw new IllegalArgumentException("String is null.");
			}
			String clearedString = infoString.replaceAll("\\s", "");
			if (clearedString.length() == 0) {
				throw new IllegalArgumentException("String must not be empty.");
			}
			StringBuilder sb = new StringBuilder(clearedString);
			TypeInformation<X> ti = (TypeInformation<X>) parse(sb);
			if (sb.length() > 0) {
				throw new IllegalArgumentException("String could not be parsed completely.");
			}
			return ti;
		} catch (Exception e) {
			throw new IllegalArgumentException("String could not be parsed: " + e.getMessage(), e);
		}
	}

}