/** * Gets the style used to recognize properties. */ protected PropertyStyle getPropertyStyle() { if ( mPropertyStyle == null && !mNullPropertyStyle ) { // Do not initialise unless needed, so that we can be shipped without if ( DEFAULT_PROPERTY_STYLE == null ) { DEFAULT_PROPERTY_STYLE = new JavaBeanPropertyStyle(); } return DEFAULT_PROPERTY_STYLE; } return mPropertyStyle; } }
/** * Returns properties sorted by name. */ @Override protected Map<String, Property> inspectProperties( String type ) { // TreeMap so that returns alphabetically sorted properties Map<String, Property> properties = CollectionUtils.newTreeMap( StringUtils.CASE_INSENSITIVE_COMPARATOR ); // Lookup fields, getters and setters Class<?> clazz = ClassUtils.niceForName( type, mAdditionalClassLoader ); if ( clazz == null ) { return properties; } lookupFields( properties, clazz ); lookupGetters( properties, clazz ); lookupSetters( properties, clazz ); // Clean up explicit excludes for ( Iterator<Map.Entry<String, Property>> i = properties.entrySet().iterator(); i.hasNext(); ) { if ( i.next().getValue() == null ) { i.remove(); } } return properties; }
String propertyName = isSetter( method ); if ( isExcluded( ClassUtils.getOriginalDeclaringClass( method ), propertyName, type ) ) { properties.put( propertyName, null ); continue; properties.put( propertyName, new JavaBeanProperty( propertyName, existingJavaBeanProperty.getType(), existingJavaBeanProperty.getReadMethod(), method, getPrivateField( clazz, propertyName ) ) ); continue; properties.put( propertyName, new JavaBeanProperty( propertyName, type.getName(), null, method, getPrivateField( clazz, propertyName ) ) );
String propertyName = isGetter( method ); if ( isExcluded( ClassUtils.getOriginalDeclaringClass( method ), propertyName, type ) ) { properties.put( propertyName, null ); continue; properties.put( propertyName, new JavaBeanProperty( propertyName, type.getName(), method, null, getPrivateField( clazz, propertyName ) ) );
/** * 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 ) ); } }
while ( currentClass != null && !isExcludedBaseType( currentClass ) ) {
/** * Returns properties sorted by name. */ @Override protected Map<String, Property> inspectProperties( String type ) { // TreeMap so that returns alphabetically sorted properties Map<String, Property> properties = CollectionUtils.newTreeMap( StringUtils.CASE_INSENSITIVE_COMPARATOR ); // Lookup fields, getters and setters Class<?> clazz = ClassUtils.niceForName( type, mAdditionalClassLoader ); if ( clazz == null ) { return properties; } lookupFields( properties, clazz ); lookupGetters( properties, clazz ); lookupSetters( properties, clazz ); // Clean up explicit excludes for ( Iterator<Map.Entry<String, Property>> i = properties.entrySet().iterator(); i.hasNext(); ) { if ( i.next().getValue() == null ) { i.remove(); } } return properties; }
String propertyName = isSetter( method ); if ( isExcluded( ClassUtils.getOriginalDeclaringClass( method ), propertyName, type ) ) { properties.put( propertyName, null ); continue; properties.put( propertyName, new JavaBeanProperty( propertyName, existingJavaBeanProperty.getType(), existingJavaBeanProperty.getReadMethod(), method, getPrivateField( clazz, propertyName ) ) ); continue; properties.put( propertyName, new JavaBeanProperty( propertyName, type.getName(), null, method, getPrivateField( clazz, propertyName ) ) );
String propertyName = isGetter( method ); if ( isExcluded( ClassUtils.getOriginalDeclaringClass( method ), propertyName, type ) ) { properties.put( propertyName, null ); continue; properties.put( propertyName, new JavaBeanProperty( propertyName, type.getName(), method, null, getPrivateField( clazz, propertyName ) ) );
/** * 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 ) ); } }
while ( currentClass != null && !isExcludedBaseType( currentClass ) ) {
protected PropertyStyle getInjectThis() { if ( mInjectThis == null && !mNullInjectThis ) { // Do not initialise unless needed, so that we can be shipped without if ( DEFAULT_PROPERTY_STYLE == null ) { DEFAULT_PROPERTY_STYLE = new JavaBeanPropertyStyle(); } return DEFAULT_PROPERTY_STYLE; } return mInjectThis; }
/** * Gets the style used to recognize properties. */ protected PropertyStyle getPropertyStyle() { if ( mPropertyStyle == null && !mNullPropertyStyle ) { // Do not initialise unless needed, so that we can be shipped without if ( DEFAULT_PROPERTY_STYLE == null ) { DEFAULT_PROPERTY_STYLE = new JavaBeanPropertyStyle(); } return DEFAULT_PROPERTY_STYLE; } return mPropertyStyle; }
/** * Gets the style used to recognize properties. */ protected PropertyStyle getPropertyStyle() { if ( mPropertyStyle == null && !mNullPropertyStyle ) { // Do not initialise unless needed, so that we can be shipped without if ( DEFAULT_PROPERTY_STYLE == null ) { DEFAULT_PROPERTY_STYLE = new JavaBeanPropertyStyle(); } return DEFAULT_PROPERTY_STYLE; } return mPropertyStyle; }
/** * Gets the style used to recognize properties. */ protected PropertyStyle getPropertyStyle() { if ( mPropertyStyle == null && !mNullPropertyStyle ) { // Do not initialise unless needed, so that we can be shipped without if ( DEFAULT_PROPERTY_STYLE == null ) { DEFAULT_PROPERTY_STYLE = new JavaBeanPropertyStyle(); } return DEFAULT_PROPERTY_STYLE; } return mPropertyStyle; } }
/** * Gets the style used to recognize properties. */ protected PropertyStyle getPropertyStyle() { if ( mPropertyStyle == null && !mNullPropertyStyle ) { // Do not initialise unless needed, so that we can be shipped without if ( DEFAULT_PROPERTY_STYLE == null ) { DEFAULT_PROPERTY_STYLE = new JavaBeanPropertyStyle(); } return DEFAULT_PROPERTY_STYLE; } return mPropertyStyle; } }