当前位置: 首页>>代码示例>>Java>>正文


Java Utils类代码示例

本文整理汇总了Java中net.java.amateras.xlsbeans.Utils的典型用法代码示例。如果您正苦于以下问题:Java Utils类的具体用法?Java Utils怎么用?Java Utils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Utils类属于net.java.amateras.xlsbeans包,在下文中一共展示了Utils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkColumns

import net.java.amateras.xlsbeans.Utils; //导入依赖的package包/类
public static void checkColumns(Class<?> recordClass,
		List<HeaderInfo> headers, AnnotationReader reader) throws Exception {

	for(Object property: Utils.getColumnProperties(recordClass.newInstance(), null, reader)){
		Column column = null;
		if(property instanceof Method){
			column = reader.getAnnotation(recordClass, (Method) property, Column.class);
		} else if(property instanceof Field){
			column = reader.getAnnotation(recordClass, (Field) property, Column.class);
		}

		if(!column.optional()){
			String columnName = column.columnName();
			boolean find = false;
			for(HeaderInfo info: headers){
				if(info.getHeaderLabel().equals(columnName)){
					find = true;
					break;
				}
			}
			if(!find){
				throw new XLSBeansException("Column '" + columnName + "' doesn't exist.");
			}
		}
	}
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:27,代码来源:RecordsProcessorUtil.java

示例2: createTables

import net.java.amateras.xlsbeans.Utils; //导入依赖的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;
}
 
开发者ID:takezoe,项目名称:xlsbeans,代码行数:26,代码来源:IterateTablesProcessor.java

示例3: checkColumns

import net.java.amateras.xlsbeans.Utils; //导入依赖的package包/类
public static void checkColumns(Class<?> recordClass, List<HeaderInfo> headers,
                                   AnnotationReader reader, XLSBeansConfig config) throws Exception {
	
	for(Object property: Utils.getColumnProperties(recordClass.newInstance(), null, reader, config)){
		Column column = null;
		if(property instanceof Method){
			column = reader.getAnnotation(recordClass, (Method) property, Column.class);
		} else if(property instanceof Field){
			column = reader.getAnnotation(recordClass, (Field) property, Column.class);
		}
		
		if(!column.optional()){
			String columnName = column.columnName();
			boolean find = false;
			for(HeaderInfo info: headers){
                   if(Utils.matches(info.getHeaderLabel(), columnName, config)){
                       find = true;
                       break;
                   }
			}
			if(!find){
				throw new XLSBeansException("Column '" + columnName + "' doesn't exist.");
			}
		}
	}
}
 
开发者ID:takezoe,项目名称:xlsbeans,代码行数:27,代码来源:RecordsProcessorUtil.java

示例4: createTables

import net.java.amateras.xlsbeans.Utils; //导入依赖的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;
}
 
开发者ID:ctc-g,项目名称:sinavi-jfw,代码行数:32,代码来源:JxIterateTableProcessor.java

示例5: checkColumns

import net.java.amateras.xlsbeans.Utils; //导入依赖的package包/类
protected void checkColumns(Class<?> recordClass, List<JxHeaderInfo> headers, AnnotationReader reader) throws Exception {

        for (Object property : Utils.getColumnProperties(recordClass.newInstance(), null, reader)) {
            Column column = null;
            if (property instanceof Method) {
                column = reader.getAnnotation(recordClass, (Method) property, Column.class);
            } else if (property instanceof Field) {
                column = reader.getAnnotation(recordClass, (Field) property, Column.class);
            }
            if (column != null && !column.optional()) {
                String columnName = column.columnName();
                boolean find = false;
                for (JxHeaderInfo info : headers) {
                    if (info.getHeaderLabel().equals(columnName)) {
                        find = true;
                        break;
                    }
                }
                if (!find) { throw new XLSBeansException("Column '" + columnName + "' doesn't exist."); }
            }
        }
    }
 
开发者ID:ctc-g,项目名称:sinavi-jfw,代码行数:23,代码来源:JxVerticalRecordsProcessor.java

示例6: doProcess

import net.java.amateras.xlsbeans.Utils; //导入依赖的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());
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:11,代码来源:CellProcessor.java

示例7: processMapColumns

import net.java.amateras.xlsbeans.Utils; //导入依赖的package包/类
private void processMapColumns(WSheet sheet, List<HeaderInfo> headerInfos,
		int begin, int column, Object record, AnnotationReader reader) throws Exception {

	List<Object> properties = Utils.getMapColumnProperties(record, reader);

	for(Object property : properties){
		MapColumns ann = null;
		if(property instanceof Method){
			ann = reader.getAnnotation(record.getClass(), (Method) property, MapColumns.class);
		} else if(property instanceof Field){
			ann = reader.getAnnotation(record.getClass(), (Field) property, MapColumns.class);
		}

		boolean flag = false;
		Map<String, String> map = new LinkedHashMap<String, String>();
		for(HeaderInfo headerInfo : headerInfos){
			if(headerInfo.getHeaderLabel().equals(ann.previousColumnName())){
				flag = true;
				begin++;
				continue;
			}
			if(flag){
				WCell cell = sheet.getCell(column, begin + headerInfo.getHeaderRange());
				map.put(headerInfo.getHeaderLabel(), cell.getContents());
			}
			begin = begin + headerInfo.getHeaderRange() + 1;
		}

		if(property instanceof Method){
			((Method) property).invoke(record, map);
		} else if(property instanceof Field){
			((Field) property).set(record, map);
		}
	}
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:36,代码来源:VerticalRecordsProcessor.java

示例8: processMapColumns

import net.java.amateras.xlsbeans.Utils; //导入依赖的package包/类
private void processMapColumns(WSheet wSheet, List<HeaderInfo> headerInfos,
		int begin, int row, Object record, AnnotationReader reader) throws Exception {

	List<Object> properties = Utils.getMapColumnProperties(record, reader);

	for(Object property : properties){
		MapColumns ann = null;
		if(property instanceof Method){
			ann = reader.getAnnotation(record.getClass(), (Method) property, MapColumns.class);
		} else if(property instanceof Field){
			ann = reader.getAnnotation(record.getClass(), (Field) property, MapColumns.class);
		}

		boolean flag = false;
		Map<String, String> map = new LinkedHashMap<String, String>();
		for(HeaderInfo headerInfo : headerInfos){
			if(headerInfo.getHeaderLabel().equals(ann.previousColumnName())){
				flag = true;
				begin++;
				continue;
			}
			if(flag){
				WCell cell = wSheet.getCell(begin + headerInfo.getHeaderRange(), row);
				map.put(headerInfo.getHeaderLabel(), cell.getContents());
			}
			begin = begin + headerInfo.getHeaderRange() + 1;
		}

		if(property instanceof Method){
			((Method) property).invoke(record, map);
		} else if(property instanceof Field){
			((Field) property).set(record, map);
		}
	}
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:36,代码来源:HorizontalRecordsProcessor.java

示例9: createTables

import net.java.amateras.xlsbeans.Utils; //导入依赖的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;
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:28,代码来源:IterateTablesProcessor.java

示例10: doProcess

import net.java.amateras.xlsbeans.Utils; //导入依赖的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);
}
 
开发者ID:takezoe,项目名称:xlsbeans,代码行数:9,代码来源:CellProcessor.java

示例11: processMapColumns

import net.java.amateras.xlsbeans.Utils; //导入依赖的package包/类
private void processMapColumns(WSheet sheet, List<HeaderInfo> headerInfos,
		int begin, int column, Object record, AnnotationReader reader, XLSBeansConfig config) throws Exception {

	List<Object> properties = Utils.getMapColumnProperties(record, reader);

	for(Object property : properties){
		MapColumns ann = null;
		if(property instanceof Method){
			ann = reader.getAnnotation(record.getClass(), (Method) property, MapColumns.class);
		} else if(property instanceof Field){
			ann = reader.getAnnotation(record.getClass(), (Field) property, MapColumns.class);
		}

		boolean flag = false;
		Map<String, String> map = new LinkedHashMap<String, String>();
		for(HeaderInfo headerInfo : headerInfos){
               if(Utils.matches(headerInfo.getHeaderLabel(), ann.previousColumnName(), config)){
				flag = true;
				begin++;
				continue;
			}
			if(flag){
				WCell cell = sheet.getCell(column, begin + headerInfo.getHeaderRange());
				map.put(headerInfo.getHeaderLabel(), cell.getContents());
			}
			begin = begin + headerInfo.getHeaderRange() + 1;
		}

		if(property instanceof Method){
			((Method) property).invoke(record, map);
		} else if(property instanceof Field){
			((Field) property).set(record, map);
		}
	}
}
 
开发者ID:takezoe,项目名称:xlsbeans,代码行数:36,代码来源:VerticalRecordsProcessor.java

示例12: processMapColumns

import net.java.amateras.xlsbeans.Utils; //导入依赖的package包/类
private void processMapColumns(WSheet wSheet, List<HeaderInfo> headerInfos,
		int begin, int row, Object record, AnnotationReader reader, XLSBeansConfig config) throws Exception {

	List<Object> properties = Utils.getMapColumnProperties(record, reader);

	for(Object property : properties){
		MapColumns ann = null;
		if(property instanceof Method){
			ann = reader.getAnnotation(record.getClass(), (Method) property, MapColumns.class);
		} else if(property instanceof Field){
			ann = reader.getAnnotation(record.getClass(), (Field) property, MapColumns.class);
		}

		boolean flag = false;
		Map<String, String> map = new LinkedHashMap<String, String>();
		for(HeaderInfo headerInfo : headerInfos){
               if(Utils.matches(headerInfo.getHeaderLabel(), ann.previousColumnName(), config)){
                   flag = true;
                   begin++;
                   continue;
               }
			if(flag){
				WCell cell = wSheet.getCell(begin + headerInfo.getHeaderRange(), row);
				map.put(headerInfo.getHeaderLabel(), cell.getContents());
			}
			begin = begin + headerInfo.getHeaderRange() + 1;
		}

		if(property instanceof Method){
			((Method) property).invoke(record, map);
		} else if(property instanceof Field){
			((Field) property).set(record, map);
		}
	}
}
 
开发者ID:takezoe,项目名称:xlsbeans,代码行数:36,代码来源:HorizontalRecordsProcessor.java

示例13: processSingleLabelledCell

import net.java.amateras.xlsbeans.Utils; //导入依赖的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);
        }
    }
}
 
开发者ID:takezoe,项目名称:xlsbeans,代码行数:37,代码来源:IterateTablesProcessor.java

示例14: processMultipleTableCell

import net.java.amateras.xlsbeans.Utils; //导入依赖的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);
            }
        }
    }
}
 
开发者ID:takezoe,项目名称:xlsbeans,代码行数:38,代码来源:IterateTablesProcessor.java

示例15: processMultipleTableCellForVertical

import net.java.amateras.xlsbeans.Utils; //导入依赖的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);
            }
        }
    }
}
 
开发者ID:ctc-g,项目名称:sinavi-jfw,代码行数:37,代码来源:JxIterateTableProcessor.java


注:本文中的net.java.amateras.xlsbeans.Utils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。