@SuppressWarnings({ "unchecked", "rawtypes" }) public PartScript(String prefixPattern, String ... propertyNames) { this.prefixFormat = (prefixPattern != null ? new MessageFormat(prefixPattern) : null); this.propertyNames = propertyNames; int length = propertyNames.length; Converter[] propertyConverters = new Converter[length]; for (int i = 0; i < length; i++) propertyConverters[i] = new ToStringConverter(); this.converter = new ConverterChain( new BeanToPropertyArrayConverter(propertyNames), new ArrayConverter(Object.class, String.class, propertyConverters) ); this.elementCount = 0; this.buffer = new StringBuffer(); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public PartScript(String prefixPattern, String ... propertyNames) { this.prefixFormat = (prefixPattern != null ? new MessageFormat(prefixPattern) : null); this.propertyNames = propertyNames; int length = propertyNames.length; Converter[] propertyConverters = new Converter[length]; for (int i = 0; i < length; i++) propertyConverters[i] = new ToStringConverter(); this.converter = new ConverterChain( new BeanToPropertyArrayConverter(propertyNames), new ArrayConverter(Object.class, String.class, propertyConverters) ); this.elementCount = 0; this.buffer = new StringBuffer(); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public BeanCSVScript(String[] propertyNames, char separator) { this.separator = separator; int length = propertyNames.length; Converter[] propertyConverters = new Converter[length]; for (int i = 0; i < length; i++) propertyConverters[i] = new ToStringConverter(); this.converter = new ConverterChain( new BeanToPropertyArrayConverter(propertyNames), new ArrayConverter(Object.class, String.class, propertyConverters) ); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public BeanCSVScript(String[] propertyNames, char separator) { this.separator = separator; int length = propertyNames.length; Converter[] propertyConverters = new Converter[length]; for (int i = 0; i < length; i++) propertyConverters[i] = new ToStringConverter(); this.converter = new ConverterChain( new BeanToFeatureArrayConverter(propertyNames.clone()), new ArrayConverter(Object.class, String.class, propertyConverters) ); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public BeanFixedWidthScript(FixedWidthColumnDescriptor[] descriptors) { int length = descriptors.length; String[] propertyNames = new String[length]; Converter[] propertyConverters = new Converter[length]; for (int i = 0; i < length; i++) { FixedWidthColumnDescriptor descriptor = descriptors[i]; propertyNames[i] = descriptor.getName(); propertyConverters[i] = new ConverterChain( new ToStringConverter(), new FormatFormatConverter(String.class, descriptor.getFormat(), true ) ); } this.converter = new ConverterChain( new BeanToPropertyArrayConverter(propertyNames), new ArrayConverter(Object.class, String.class, propertyConverters) ); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public BeanFixedWidthScript(FixedWidthColumnDescriptor[] descriptors) { int length = descriptors.length; String[] propertyNames = new String[length]; Converter[] propertyConverters = new Converter[length]; for (int i = 0; i < length; i++) { FixedWidthColumnDescriptor descriptor = descriptors[i]; propertyNames[i] = descriptor.getName(); propertyConverters[i] = new ConverterChain( new ToStringConverter(), new FormatFormatConverter(String.class, new PadFormat(descriptor.getWidth(), descriptor.getAlignment(), ' '), true ) ); } this.converter = new ConverterChain( new BeanToPropertyArrayConverter(propertyNames), new ArrayConverter(Object.class, String.class, propertyConverters) ); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public ArrayFixedWidthScript(FixedWidthColumnDescriptor[] descriptors) { this.converters = new Converter[descriptors.length]; for (int i = 0; i < descriptors.length; i++) { FixedWidthColumnDescriptor descriptor = descriptors[i]; this.converters[i] = new ConverterChain( new ToStringConverter(), new FormatFormatConverter(String.class, new PadFormat(descriptor.getWidth(), descriptor.getAlignment(), ' '), true ) ); } }