我一直在使用SpringBatch并查看类的源代码
org.springframework.batch.item.file.transform.BeanWrapperFieldExtractor<T>
我发现了这个:
public void setNames(String[] names) {
Assert.notNull(names, "Names must be non-null");
this.names = Arrays.asList(names).toArray(new String[names.length]);
}
public void setNames(String[] names) {
Assert.notNull(names, "Names must be non-null");
this.names = names; // Simpler and without conversions
}
public void setNames(String[] names) {
Assert.notNull(names, "Names must be non-null");
this.names = names.clone(); //Simpler and create a new instance
}
所有答案都欢迎。
System.arraycopy()