private Optional<CellPosition> getLabelPosition(final AnnotationProxy anno) {

        if(Utils.isNotEmpty(anno.label())) {
            // 属性「label」によるラベルの指定がある場合
            try {
                if(Utils.isNotEmpty(anno.headerLabel())){
                    Cell headerCell = CellFinder.query(sheet, anno.headerLabel(), config).findWhenNotFoundException();
                    Cell labelCell = CellFinder.query(sheet, anno.label(), config)
                            .startPosition(headerCell.getColumnIndex(), headerCell.getRowIndex() + 1)
                            .findWhenNotFoundException();
                    return Optional.of(CellPosition.of(labelCell));

                } else {
                    Cell labelCell = CellFinder.query(sheet, anno.label(), config).findWhenNotFoundException();
                    return Optional.of(CellPosition.of(labelCell));
                }
            } catch(CellNotFoundException ex){
                if(anno.optional()){
                    return Optional.empty();
                } else {
                    throw ex;
                }
            }

        } else {
            /*
             * 属性「labelRow」「labelColumn」によるアドレスを直接指定の場合
             * これは、アノテーション @XlsIterateTables の中で指定しているときに設定される。
             */
            if(anno.labelRow() < 0) {
                throw new AnnotationInvalidException(anno.getTarget(), MessageBuilder.create("anno.attr.min")
                        .var("property", field.getNameWithClass())
                        .varWithAnno("anno", anno.annotationType())
                        .var("attrName", "labelRow")
                        .var("attrValue", anno.labelRow())
                        .var("min", 0)
                        .format());
            }

            if(anno.labelColumn() < 0) {
                throw new AnnotationInvalidException(anno.getTarget(), MessageBuilder.create("anno.attr.min")
                        .var("property", field.getNameWithClass())
                        .varWithAnno("anno", anno.annotationType())
                        .var("attrName", "labelColumn")
                        .var("attrValue", anno.labelColumn())
                        .var("min", 0)
                        .format());

            }

            return Optional.of(CellPosition.of(anno.labelRow(), anno.labelColumn()));
        }

    }
private Optional < CellPosition > getLabelPosition ( final AnnotationProxy anno ) { if ( Utils . isNotEmpty ( anno . label ( ) ) ) { try { if ( Utils . isNotEmpty ( anno . headerLabel ( ) ) ) { Cell headerCell = CellFinder . query ( sheet , anno . headerLabel ( ) , config ) . findWhenNotFoundException ( ) ; Cell labelCell = CellFinder . query ( sheet , anno . label ( ) , config ) . startPosition ( headerCell . getColumnIndex ( ) , headerCell . getRowIndex ( ) + 1 ) . findWhenNotFoundException ( ) ; return Optional . of ( CellPosition . of ( labelCell ) ) ; } else { Cell labelCell = CellFinder . query ( sheet , anno . label ( ) , config ) . findWhenNotFoundException ( ) ; return Optional . of ( CellPosition . of ( labelCell ) ) ; } } catch ( CellNotFoundException ex ) { if ( anno . optional ( ) ) { return Optional . empty ( ) ; } else { throw ex ; } } } else { if ( anno . labelRow ( ) < 0 ) { throw new AnnotationInvalidException ( anno . getTarget ( ) , MessageBuilder . create ( "anno.attr.min" ) . var ( "property" , field . getNameWithClass ( ) ) . varWithAnno ( "anno" , anno . annotationType ( ) ) . var ( "attrName" , "labelRow" ) . var ( "attrValue" , anno . labelRow ( ) ) . var ( "min" , 0 ) . format ( ) ) ; } if ( anno . labelColumn ( ) < 0 ) { throw new AnnotationInvalidException ( anno . getTarget ( ) , MessageBuilder . create ( "anno.attr.min" ) . var ( "property" , field . getNameWithClass ( ) ) . varWithAnno ( "anno" , anno . annotationType ( ) ) . var ( "attrName" , "labelColumn" ) . var ( "attrValue" , anno . labelColumn ( ) ) . var ( "min" , 0 ) . format ( ) ) ; } return Optional . of ( CellPosition . of ( anno . labelRow ( ) , anno . labelColumn ( ) ) ) ; } }
ラベルの位置を取得する。
@param anno アノテーションの情報
@return ラベルの位置。見つからない場合は、空を返す。
ただし、見つからない場合、設定により例外をスローする場合がある。