/** * Lookup public field-based properties. * <p> * This method will be called before <code>lookupGetters</code> and <code>lookupSetters</code>. */ protected void lookupFields( Map<String, Property> properties, Class<?> clazz ) { if ( !mSupportPublicFields ) { return; } // Note: we must use clazz.getFields(), not clazz.getDeclaredFields(), in order // to avoid Applet SecurityExceptions for ( Field field : clazz.getFields() ) { // Exclude static fields int modifiers = field.getModifiers(); if ( Modifier.isStatic( modifiers ) ) { continue; } // Get name and type String fieldName = field.getName(); Class<?> type = field.getType(); // Exclude based on other criteria // // (explicitly set to null in case we encounter an imbalanced getter/setter) if ( isExcluded( field.getDeclaringClass(), fieldName, type ) ) { properties.put( fieldName, null ); continue; } properties.put( fieldName, new FieldProperty( fieldName, field ) ); } }
throw InspectorException.newException( "JavaBeanProperty '" + ( (FieldProperty) existingProperty ).getField() + "' has both a public member variable and a public getter method. Should be one or the other" );
throw InspectorException.newException( "JavaBeanProperty '" + ( (FieldProperty) existingProperty ).getField() + "' has both a public member variable and a public setter method. Should be one or the other" );
throw InspectorException.newException( "JavaBeanProperty '" + ( (FieldProperty) existingProperty ).getField() + "' has both a public member variable and a public setter method. Should be one or the other" );
throw InspectorException.newException( "JavaBeanProperty '" + ( (FieldProperty) existingProperty ).getField() + "' has both a public member variable and a public getter method. Should be one or the other" );
lineNumberedProperties.put( new ClassAndLineNumberAndName( fieldProperty.getField().getDeclaringClass(), 0, propertyName ), property ); continue;
/** * Lookup public field-based properties. * <p> * This method will be called before <code>lookupGetters</code> and <code>lookupSetters</code>. */ protected void lookupFields( Map<String, Property> properties, Class<?> clazz ) { if ( !mSupportPublicFields ) { return; } // Note: we must use clazz.getFields(), not clazz.getDeclaredFields(), in order // to avoid Applet SecurityExceptions for ( Field field : clazz.getFields() ) { // Exclude static fields int modifiers = field.getModifiers(); if ( Modifier.isStatic( modifiers ) ) { continue; } // Get name and type String fieldName = field.getName(); Class<?> type = field.getType(); // Exclude based on other criteria // // (explicitly set to null in case we encounter an imbalanced getter/setter) if ( isExcluded( field.getDeclaringClass(), fieldName, type ) ) { properties.put( fieldName, null ); continue; } properties.put( fieldName, new FieldProperty( fieldName, field ) ); } }