本文整理汇总了Java中net.java.amateras.xlsbeans.NeedPostProcess类的典型用法代码示例。如果您正苦于以下问题:Java NeedPostProcess类的具体用法?Java NeedPostProcess怎么用?Java NeedPostProcess使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NeedPostProcess类属于net.java.amateras.xlsbeans包,在下文中一共展示了NeedPostProcess类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doProcess
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
public void doProcess(WSheet wSheet, Object obj, Field field, Annotation ann,
AnnotationReader reader, List<NeedPostProcess> needPostProcess)
throws Exception {
IterateTables iterateTables = (IterateTables) ann;
Class<?> fieldType = field.getType();
// create multi-table objects.
List<?> value = createTables(wSheet, iterateTables, reader, needPostProcess);
if (List.class.isAssignableFrom(fieldType)) {
field.set(obj, value);
} else if (fieldType.isArray()) {
Class<?> type = fieldType.getComponentType();
Object array = Array.newInstance(type, value.size());
for(int i=0;i<value.size();i++){
Array.set(array, i, value.get(i));
}
field.set(obj, array);
} else {
throw new XLSBeansException(
"Arguments of '" + field.toString() + "' is invalid.");
}
}
示例2: doProcess
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
public void doProcess(WSheet wSheet, Object obj, Field field, Annotation ann, AnnotationReader reader,
XLSBeansConfig config, List<NeedPostProcess> needPostProcess) throws Exception {
IterateTables iterateTables = (IterateTables) ann;
Class<?> fieldType = field.getType();
// create multi-table objects.
List<?> value = createTables(wSheet, iterateTables, reader, config, needPostProcess);
if (List.class.isAssignableFrom(fieldType)) {
field.set(obj, value);
} else if (fieldType.isArray()) {
Class<?> type = fieldType.getComponentType();
Object array = Array.newInstance(type, value.size());
for(int i = 0; i < value.size(); i++){
Array.set(array, i, value.get(i));
}
field.set(obj, array);
} else {
throw new XLSBeansException("Arguments of '" + field.toString() + "' is invalid.");
}
}
示例3: createTables
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
protected List<?> createTables(WSheet wSheet, IterateTables iterateTables, AnnotationReader reader,
XLSBeansConfig config, List<NeedPostProcess> needPostProcess) throws Exception {
List<Object> resultTableList = new ArrayList<Object>();
WCell after = null;
WCell currentCell = null;
String label = iterateTables.tableLabel();
currentCell = Utils.getCell(wSheet, label, after, false, !iterateTables.optional(), config);
while (currentCell != null) {
// 1 table object instance
Object tableObj = iterateTables.tableClass().newInstance();
// process single label.
processSingleLabelledCell(wSheet, tableObj, currentCell, reader, config, needPostProcess);
// process horizontal table.
processMultipleTableCell(wSheet, tableObj, currentCell, reader, iterateTables, config, needPostProcess);
// TODO process vertical table
resultTableList.add(tableObj);
after = currentCell;
currentCell = Utils.getCell(wSheet, label, after, false, false, config);
}
return resultTableList;
}
示例4: createTables
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
/**
* VerticalRecordsへの対応のため、オーバーライドしました。
* @param sheet シート
* @param tables IterateTablesアノテーションの定義
* @param reader アノテーションリーダ
* @param process プロセッサ
* @throws Exception 予期しない例外
*/
@Override
protected List<?> createTables(WSheet sheet, IterateTables tables, AnnotationReader reader, List<NeedPostProcess> process)
throws Exception {
List<Object> resultTableList = new ArrayList<Object>();
String label = tables.tableLabel();
WCell after = null;
WCell currentCell = Utils.getCell(sheet, label, after, false, !tables.optional());
while (currentCell != null) {
// 1 table object instance
Object obj = tables.tableClass().newInstance();
// LabeledCellをマッピング
processSingleLabelledCell(sheet, obj, currentCell, reader, process);
// HorizontalRecordsをマッピング
processMultipleTableCell(sheet, obj, currentCell, reader, tables, process);
// VerticalRecordsをマッピング
processMultipleTableCellForVertical(sheet, obj, currentCell, reader, tables, process);
resultTableList.add(obj);
after = currentCell;
currentCell = Utils.getCell(sheet, label, after, false, false);
}
return resultTableList;
}
示例5: doProcess
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
public void doProcess(WSheet wSheet, Object obj,
Method setter, Annotation ann, AnnotationReader reader,
List<NeedPostProcess> needPostProcess) throws Exception {
Cell cell = (Cell)ann;
Utils.setPosition(cell.column(), cell.row(), obj, Utils.toPropertyName(setter.getName()));
WCell wCell = wSheet.getCell(cell.column(), cell.row());
Utils.invokeSetter(setter, obj, wCell.getContents());
}
示例6: createTables
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
protected List<?> createTables(WSheet wSheet, IterateTables iterateTables ,
AnnotationReader reader, List<NeedPostProcess> needPostProcess) throws Exception {
List<Object> resultTableList = new ArrayList<Object>();
WCell after = null;
WCell currentCell = null;
String label = iterateTables.tableLabel();
currentCell = Utils.getCell(wSheet, label, after, false, !iterateTables.optional());
while (currentCell != null) {
// 1 table object instance
Object tableObj = iterateTables.tableClass().newInstance();
// process single label.
processSingleLabelledCell(wSheet, tableObj, currentCell, reader,
needPostProcess);
// process horizontal table.
processMultipleTableCell(wSheet, tableObj, currentCell, reader,
iterateTables, needPostProcess);
// TODO process vertical table
resultTableList.add(tableObj);
after = currentCell;
currentCell = Utils.getCell(wSheet, label, after, false, false);
}
return resultTableList;
}
示例7: doProcess
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
public void doProcess(WSheet wSheet, Object obj, Method setter, Annotation ann, AnnotationReader reader,
XLSBeansConfig config, List<NeedPostProcess> needPostProcess) throws Exception {
Cell cell = (Cell)ann;
Utils.setPosition(cell.column(), cell.row(), obj, Utils.toPropertyName(setter.getName()));
WCell wCell = wSheet.getCell(cell.column(), cell.row());
Utils.invokeSetter(setter, obj, wCell.getContents(), config);
}
示例8: processSingleLabelledCell
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
protected void processSingleLabelledCell(WSheet wSheet, Object tableObj, WCell headerCell, AnnotationReader reader,
XLSBeansConfig config, List<NeedPostProcess> needPostProcess) throws Exception {
List<Object> properties = Utils.getPropertiesWithAnnotation(tableObj, reader, LabelledCell.class);
LabelledCellProcessor labelledCellProcessor = new LabelledCellProcessor();
for (Object property : properties) {
LabelledCell ann = null;
if(property instanceof Method){
ann = reader.getAnnotation(tableObj.getClass(), (Method) property, LabelledCell.class);
} else if(property instanceof Field){
ann = reader.getAnnotation(tableObj.getClass(), (Field) property, LabelledCell.class);
}
WCell titleCell = null;
try {
titleCell = Utils.getCell(wSheet, ann.label(), headerCell, config);
} catch (XLSBeansException e) {
if (ann.optional()) {
continue;
} else {
throw e;
}
}
LabelledCell labelledCell = new LabelledCellForIterateTable(ann, titleCell.getRow(), titleCell.getColumn());
if(property instanceof Method){
labelledCellProcessor.doProcess(wSheet, tableObj, (Method) property, labelledCell, reader, config, needPostProcess);
} else if(property instanceof Field){
labelledCellProcessor.doProcess(wSheet, tableObj, (Field) property, labelledCell, reader, config, needPostProcess);
}
}
}
示例9: processMultipleTableCell
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
protected void processMultipleTableCell(WSheet wSheet, Object tableObj, WCell headerCell, AnnotationReader reader,
IterateTables iterateTables, XLSBeansConfig config, List<NeedPostProcess> needPostProcess) throws Exception {
List<Object> properties = Utils.getPropertiesWithAnnotation(tableObj, reader, HorizontalRecords.class);
int headerColumn = headerCell.getColumn();
int headerRow = headerCell.getRow();
if (iterateTables.bottom() > 0) {
// if positive value set to bottom(), row index of table header move
headerRow += iterateTables.bottom();
}
HorizontalRecordsProcessor processor = new HorizontalRecordsProcessor();
for (Object property : properties) {
HorizontalRecords ann = null;
if(property instanceof Method){
ann = reader.getAnnotation(tableObj.getClass(), (Method) property, HorizontalRecords.class);
} else if(property instanceof Field){
ann = reader.getAnnotation(tableObj.getClass(), (Field) property, HorizontalRecords.class);
}
if (iterateTables.tableLabel().equals(ann.tableLabel())) {
//
HorizontalRecords records = new HorizontalRecordsForIterateTable(ann, headerColumn, headerRow);
// horizontal record-mapping
if(property instanceof Method){
processor.doProcess(wSheet, tableObj, (Method) property, records, reader, config, needPostProcess);
} else if(property instanceof Field){
processor.doProcess(wSheet, tableObj, (Field) property, records, reader, config, needPostProcess);
}
}
}
}
示例10: processMultipleTableCellForVertical
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
/**
* VerticalRecordsのマッピングを行います。
* @param sheet シート
* @param tableObj オブジェクト
* @param headerCell ヘッダセル
* @param reader リーダ
* @param iterateTables IterateTablesアノテーションの定義
* @param needPostProcess プロセッサ
* @throws Exception 予期しない例外
*/
protected void processMultipleTableCellForVertical(WSheet sheet, Object tableObj, WCell headerCell,
AnnotationReader reader, IterateTables iterateTables, List<NeedPostProcess> needPostProcess) throws Exception {
List<Object> properties = Utils.getPropertiesWithAnnotation(tableObj, reader, JxVerticalRecords.class);
int headerColumn = headerCell.getColumn();
int headerRow = headerCell.getRow();
if (iterateTables.bottom() > 0) {
headerRow += iterateTables.bottom();
}
JxVerticalRecordsProcessor processor = new JxVerticalRecordsProcessor();
for (Object property : properties) {
JxVerticalRecords ann = null;
if (property instanceof Method) {
ann = reader.getAnnotation(tableObj.getClass(), (Method) property, JxVerticalRecords.class);
} else if (property instanceof Field) {
ann = reader.getAnnotation(tableObj.getClass(), (Field) property, JxVerticalRecords.class);
}
if (ann != null && ann.tableLabel().equals(iterateTables.tableLabel())) {
JxVerticalRecords records = new JxVerticalRecordsForIterateTable(ann, headerColumn, headerRow);
if (property instanceof Method) {
processor.doProcess(sheet, tableObj, (Method) property, records, reader, needPostProcess);
} else if (property instanceof Field) {
processor.doProcess(sheet, tableObj, (Field) property, records, reader, needPostProcess);
}
}
}
}
示例11: doProcess
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
public void doProcess(WSheet wSheet, Object obj, Method setter,
Annotation cell, AnnotationReader reader,
List<NeedPostProcess> needPostProcess) throws Exception {
Utils.invokeSetter(setter, obj, wSheet.getName());
}
示例12: doProcess
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
public void doProcess(WSheet wSheet, Object obj,
Method setter, Annotation ann, AnnotationReader reader,
List<NeedPostProcess> needPostProcess) throws Exception {
doProcess(wSheet, obj, setter, null, ann, reader, needPostProcess);
}
示例13: doProcess
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
public void doProcess(WSheet wSheet, Object obj,
Method setter, Annotation ann, AnnotationReader reader,
List<NeedPostProcess> needPostProcess) throws Exception ;
示例14: processSingleLabelledCell
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
protected void processSingleLabelledCell(WSheet wSheet, Object tableObj,
WCell headerCell, AnnotationReader reader,
List<NeedPostProcess> needPostProcess) throws Exception {
List<Object> properties = Utils.getPropertiesWithAnnotation(
tableObj, reader, LabelledCell.class);
LabelledCellProcessor labelledCellProcessor = new LabelledCellProcessor();
for (Object property : properties) {
LabelledCell ann = null;
if(property instanceof Method){
ann = reader.getAnnotation(
tableObj.getClass(), (Method) property, LabelledCell.class);
} else if(property instanceof Field){
ann = reader.getAnnotation(
tableObj.getClass(), (Field) property, LabelledCell.class);
}
WCell titleCell = null;
try {
titleCell = Utils.getCell(wSheet, ann.label(), headerCell);
} catch (XLSBeansException e) {
if (ann.optional()) {
continue;
} else {
throw e;
}
}
LabelledCell labelledCell = new LabelledCellForIterateTable(ann,
titleCell.getRow(), titleCell.getColumn());
if(property instanceof Method){
labelledCellProcessor.doProcess(wSheet, tableObj,
(Method) property, labelledCell, reader, needPostProcess);
} else if(property instanceof Field){
labelledCellProcessor.doProcess(wSheet, tableObj,
(Field) property, labelledCell, reader, needPostProcess);
}
}
}
示例15: processMultipleTableCell
import net.java.amateras.xlsbeans.NeedPostProcess; //导入依赖的package包/类
protected void processMultipleTableCell(WSheet wSheet, Object tableObj,
WCell headerCell, AnnotationReader reader,
IterateTables iterateTables,
List<NeedPostProcess> needPostProcess) throws Exception {
List<Object> properties = Utils.getPropertiesWithAnnotation(
tableObj, reader, HorizontalRecords.class);
int headerColumn = headerCell.getColumn();
int headerRow = headerCell.getRow();
if (iterateTables.bottom() > 0) {
// if positive value set to bottom(), row index of table header move
headerRow += iterateTables.bottom();
}
HorizontalRecordsProcessor processor = new HorizontalRecordsProcessor();
for (Object property : properties) {
HorizontalRecords ann = null;
if(property instanceof Method){
ann = reader.getAnnotation(
tableObj.getClass(), (Method) property, HorizontalRecords.class);
} else if(property instanceof Field){
ann = reader.getAnnotation(
tableObj.getClass(), (Field) property, HorizontalRecords.class);
}
if (iterateTables.tableLabel().equals(ann.tableLabel())) {
//
HorizontalRecords records = new HorizontalRecordsForIterateTable(
ann,headerColumn, headerRow);
// horizontal record-mapping
if(property instanceof Method){
processor.doProcess(wSheet, tableObj, (Method) property, records,
reader, needPostProcess);
} else if(property instanceof Field){
processor.doProcess(wSheet, tableObj, (Field) property, records,
reader, needPostProcess);
}
}
}
}