/** * Check if the field identified by the field name is a valid numeric field according to the schema. * @param type contains metadata about fields * @param numericFieldName is the field's field name to test * @return a String error message if the field doesn't exist or is not numeric, or null to indicate success */ public static String checkNumeric(EventType type, String numericFieldName) { return checkFieldNumeric(type, numericFieldName); }
/** * Check if the fields identified by their field names are valid numeric field according to the schema. * @param type contains metadata about fields * @param numericFieldNameX is the first field's field name to test * @param numericFieldNameY is the second field's field name to test * @return a String error message if the field doesn't exist or is not numeric, or null to indicate success */ public static String checkNumeric(EventType type, String numericFieldNameX, String numericFieldNameY) { String error = checkFieldNumeric(type, numericFieldNameX); if (error != null) { return error; } return checkFieldNumeric(type, numericFieldNameY); }
/** * Check if the field identified by the field name is of type long according to the schema. * @param type contains metadata about fields * @param longFieldName is the field's field name to test * @return a String error message if the field doesn't exist or is not a long, or null to indicate success */ public static String checkLong(EventType type, String longFieldName) { Class clazz = getClass(type, longFieldName); if (clazz == null) { return "Parent view does not contain a field named '" + longFieldName + '\''; } if ((clazz != Long.class) && (clazz != long.class)) { return "Parent view field named '" + longFieldName + "' is not of type long"; } return checkFieldNumeric(type, longFieldName); }