/** * @param publicFields * takes an array of fields and populates the internal storage mechanisms */ private void populateFields(Field[] publicFields) { // set the fields for (Field publicField : publicFields) { if (publicField != null) { String fieldName = publicField.getName(); if (!namesToProperties.containsKey(fieldName)) { ClassProperty p = new ClassProperty(fieldName, publicField); namesToProperties.put(fieldName, p); } } } }
/** * @param publicFields * takes an array of fields and populates the internal storage mechanisms */ private void populateFields(Field[] publicFields) { // set the fields for (Field publicField : publicFields) { if (publicField != null) { String fieldName = publicField.getName(); if (!namesToProperties.containsKey(fieldName)) { ClassProperty p = new ClassProperty(fieldName, publicField); namesToProperties.put(fieldName, p); } } } }
/** * Populate the internal storage from an array of descriptors * * @param descriptors */ private void populateProperties(PropertyDescriptor[] descriptors) { for (PropertyDescriptor pd : descriptors) { String fieldName = pd.getName(); if (!namesToProperties.containsKey(fieldName)) { Method getter = pd.getReadMethod(); Method setter = pd.getWriteMethod(); if (getter != null && setter != null) { ClassProperty p = null; if (pd instanceof IndexedPropertyDescriptor) { IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd; // Class<?> iType = ipd.getIndexedPropertyType(); Method iGetter = ipd.getIndexedReadMethod(); Method iSetter = ipd.getIndexedWriteMethod(); if (iGetter != null && iSetter != null) { p = new ClassProperty.IndexedProperty(fieldName, getter, setter, iGetter, iSetter); } } if (p == null) { p = new ClassProperty(fieldName, getter, setter); } namesToProperties.put(fieldName, p); } } } }
p.setGetter(method); } else { p = new ClassProperty(fieldName, method, null); propertyMap.put(fieldName, p); p.setSetter(method); } else { p = new ClassProperty(fieldName, null, method); propertyMap.put(fieldName, p);
/** * Populate the internal storage from an array of descriptors * * @param descriptors */ private void populateProperties(PropertyDescriptor[] descriptors) { for (PropertyDescriptor pd : descriptors) { String fieldName = pd.getName(); if (!namesToProperties.containsKey(fieldName)) { Method getter = pd.getReadMethod(); Method setter = pd.getWriteMethod(); if (getter != null && setter != null) { ClassProperty p = null; if (pd instanceof IndexedPropertyDescriptor) { IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd; // Class<?> iType = ipd.getIndexedPropertyType(); Method iGetter = ipd.getIndexedReadMethod(); Method iSetter = ipd.getIndexedWriteMethod(); if (iGetter != null && iSetter != null) { p = new ClassProperty.IndexedProperty(fieldName, getter, setter, iGetter, iSetter); } } if (p == null) { p = new ClassProperty(fieldName, getter, setter); } namesToProperties.put(fieldName, p); } } } }
p.setGetter(method); } else { p = new ClassProperty(fieldName, method, null); propertyMap.put(fieldName, p); p.setSetter(method); } else { p = new ClassProperty(fieldName, null, method); propertyMap.put(fieldName, p);
/** * Populates the fields from the class data object * @param includeNonPublic if true then all fields will be used, if false then only public fields */ private void populateFields(boolean includeNonPublic) { // set the fields List<Field> fields; if (includeNonPublic) { fields = classData.getFields(); } else { fields = classData.getPublicFields(); } for (Field field : fields) { if (! includeStaticFields && isStatic(field)) { continue; // skip statics } String fieldName = field.getName(); if (ignoredFieldNames.contains(fieldName)) { continue; // skip ignored names } if (! namesToProperties.containsKey(fieldName)) { ClassProperty p = new ClassProperty(fieldName, field); namesToProperties.put(fieldName, p); } } }
/** * Populates the fields from the class data object * @param includeNonPublic if true then all fields will be used, if false then only public fields */ private void populateFields(boolean includeNonPublic) { // set the fields List<Field> fields; if (includeNonPublic) { fields = classData.getFields(); } else { fields = classData.getPublicFields(); } for (Field field : fields) { if (! includeStaticFields && isStatic(field)) { continue; // skip statics } String fieldName = field.getName(); if (ignoredFieldNames.contains(fieldName)) { continue; // skip ignored names } if (! namesToProperties.containsKey(fieldName)) { ClassProperty p = new ClassProperty(fieldName, field); namesToProperties.put(fieldName, p); } } }
String fieldName = checkPropertyMethods(getterMethods[i], setterMethods[i]); if (!namesToProperties.containsKey(fieldName)) { ClassProperty p = new ClassProperty(fieldName, getterMethods[i], setterMethods[i]); namesToProperties.put(fieldName, p);
String fieldName = checkPropertyMethods(getterMethods[i], setterMethods[i]); if (!namesToProperties.containsKey(fieldName)) { ClassProperty p = new ClassProperty(fieldName, getterMethods[i], setterMethods[i]); namesToProperties.put(fieldName, p);