private void initialize(String[] aliases) { PropertyAccessor propertyAccessor = new ChainedPropertyAccessor( new PropertyAccessor[] { PropertyAccessorFactory.getPropertyAccessor( resultClass, null ), PropertyAccessorFactory.getPropertyAccessor( "field" ) } ); this.aliases = new String[ aliases.length ]; setters = new Setter[ aliases.length ]; for ( int i = 0; i < aliases.length; i++ ) { String alias = aliases[ i ]; if ( alias != null ) { this.aliases[ i ] = alias; setters[ i ] = propertyAccessor.getSetter( resultClass, alias ); } } isInitialized = true; }
private void initialize(String[] newAlias) { PropertyAccessor propertyAccessor = new ChainedPropertyAccessor( new PropertyAccessor[] { PropertyAccessorFactory.getPropertyAccessor( resultClass, null), PropertyAccessorFactory.getPropertyAccessor("field") }); this.aliases = new String[newAlias.length]; setters = new Setter[newAlias.length]; for (int i = 0; i < newAlias.length; i++) { String alias = newAlias[i]; if (alias != null) { this.aliases[i] = alias; // Diferencia con AliasToBeanResultTransformer if (alias.indexOf('.') > 0) { // found nested setters[i] = new NestedSetter(resultClass, alias); } else { // ------------------------------------------- setters[i] = propertyAccessor.getSetter(resultClass, alias); // Diferencia con AliasToBeanResultTransformer } // ------------------------------------------- } } isInitialized = true; }
@SuppressWarnings("rawtypes") public IgnoringCaseAliasToBeanResultTransformer(final Class resultClass) { if (resultClass == null) { throw new IllegalArgumentException("resultClass cannot be null"); } this.resultClass = resultClass; propertyAccessor = new ChainedPropertyAccessor(new PropertyAccessor[] { PropertyAccessorFactory.getPropertyAccessor(resultClass, null), PropertyAccessorFactory.getPropertyAccessor("field") }); fields = this.resultClass.getDeclaredFields(); }
public AliasToBeanResultTransformer(Class resultClass) { if(resultClass==null) throw new IllegalArgumentException("resultClass cannot be null"); this.resultClass = resultClass; propertyAccessor = new ChainedPropertyAccessor(new PropertyAccessor[] { PropertyAccessorFactory.getPropertyAccessor(resultClass,null), PropertyAccessorFactory.getPropertyAccessor("field")}); }