/** * Get the field names but filter the fields to return * @param filter (optional) indicates the fields to return the names for, can be null for defaults * @return the list of field names */ public List<String> getFieldNames(FieldsFilter filter) { List<String> names = new ArrayList<String>(); for (Entry<String, ClassProperty> entry : namesToProperties.getEntries()) { String name = entry.getKey(); ClassProperty cp = entry.getValue(); if ( isFieldInFilter(cp, filter) ) { names.add(name); } } return names; }
/** * Get the field names but filter the fields to return * @param filter (optional) indicates the fields to return the names for, can be null for defaults * @return the list of field names */ public List<String> getFieldNames(FieldsFilter filter) { List<String> names = new ArrayList<String>(); for (Entry<String, ClassProperty> entry : namesToProperties.getEntries()) { String name = entry.getKey(); ClassProperty cp = entry.getValue(); if ( isFieldInFilter(cp, filter) ) { names.add(name); } } return names; }
/** * Checks if a field is valid for the given filter * * @param name the fieldName * @param filter (optional) indicates the fields to include in the check, can be null for defaults * @return true if this fieldName is valid, false otherwise */ public boolean isFieldNameValid(String name, FieldsFilter filter) { boolean valid = namesToProperties.containsKey(name); if (valid) { // the field is real so check to see if it is in this filter ClassProperty cp = getAnyPropertyOrFail(name); if ( isFieldInFilter(cp, filter) ) { valid = true; } else { valid = false; } } return valid; }
/** * Checks if a field is valid for the given filter * * @param name the fieldName * @param filter (optional) indicates the fields to include in the check, can be null for defaults * @return true if this fieldName is valid, false otherwise */ public boolean isFieldNameValid(String name, FieldsFilter filter) { boolean valid = namesToProperties.containsKey(name); if (valid) { // the field is real so check to see if it is in this filter ClassProperty cp = getAnyPropertyOrFail(name); if ( isFieldInFilter(cp, filter) ) { valid = true; } else { valid = false; } } return valid; }
/** * Get the types for fields in a class but filter the fields to get the types for * @param filter (optional) indicates the fields to return the types for, can be null for defaults * @return the map of fieldName -> field type */ public Map<String, Class<?>> getFieldTypes(FieldsFilter filter) { OrderedMap<String, Class<?>> fieldTypes = new ArrayOrderedMap<String, Class<?>>(); fieldTypes.setName(getStoredClass().getName()); for (Entry<String, ClassProperty> entry : namesToProperties.getEntries()) { String name = entry.getKey(); ClassProperty cp = entry.getValue(); if ( isFieldInFilter(cp, filter) ) { fieldTypes.put(name, cp.getType()); } } return fieldTypes; }
/** * Get the types for fields in a class but filter the fields to get the types for * @param filter (optional) indicates the fields to return the types for, can be null for defaults * @return the map of fieldName -> field type */ public Map<String, Class<?>> getFieldTypes(FieldsFilter filter) { OrderedMap<String, Class<?>> fieldTypes = new ArrayOrderedMap<String, Class<?>>(); fieldTypes.setName(getStoredClass().getName()); for (Entry<String, ClassProperty> entry : namesToProperties.getEntries()) { String name = entry.getKey(); ClassProperty cp = entry.getValue(); if ( isFieldInFilter(cp, filter) ) { fieldTypes.put(name, cp.getType()); } } return fieldTypes; }