本文整理汇总了Java中org.supercsv.cellprocessor.ift.StringCellProcessor类的典型用法代码示例。如果您正苦于以下问题:Java StringCellProcessor类的具体用法?Java StringCellProcessor怎么用?Java StringCellProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringCellProcessor类属于org.supercsv.cellprocessor.ift包,在下文中一共展示了StringCellProcessor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public CellProcessorFactory create(ProcessingMetadata<StrRegEx> metadata) {
return new CellProcessorFactory() {
@Override
public int getOrder() {
return metadata.getAnnotation().order();
}
@Override
public CellProcessor create(CellProcessor next) {
return new org.supercsv.cellprocessor.constraint.StrRegEx(metadata.getAnnotation().regex(),
(StringCellProcessor) next);
}
};
}
示例2: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public CellProcessorFactory create(ProcessingMetadata<StrReplace> metadata) {
return new CellProcessorFactory() {
@Override
public int getOrder() {
return metadata.getAnnotation().order();
}
@Override
public CellProcessor create(CellProcessor next) {
return new org.supercsv.cellprocessor.StrReplace(metadata.getAnnotation().pattern(), metadata.getAnnotation().replacement(),
(StringCellProcessor) next);
}
};
}
示例3: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public CellProcessorFactory create(ProcessingMetadata<Truncate> metadata) {
return new CellProcessorFactory() {
@Override
public int getOrder() {
return metadata.getAnnotation().order();
}
@Override
public CellProcessor create(CellProcessor next) {
return new org.supercsv.cellprocessor.Truncate(metadata.getAnnotation().maxSize(), metadata.getAnnotation().suffix(),
(StringCellProcessor) next);
}
};
}
示例4: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public CellProcessorFactory create(ProcessingMetadata<FmtDate> metadata) {
return new CellProcessorFactory() {
@Override
public int getOrder() {
return metadata.getAnnotation().order();
}
@Override
public CellProcessor create(CellProcessor next) {
return new org.supercsv.cellprocessor.FmtDate(metadata.getAnnotation().format(), (StringCellProcessor) next);
}
};
}
示例5: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public CellProcessorFactory create(ProcessingMetadata<FmtBool> metadata) {
return new CellProcessorFactory() {
@Override
public int getOrder() {
return metadata.getAnnotation().order();
}
@Override
public CellProcessor create(CellProcessor next) {
return new org.supercsv.cellprocessor.FmtBool(metadata.getAnnotation().trueValue(), metadata.getAnnotation().falseValue(),
(StringCellProcessor) next);
}
};
}
示例6: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public CellProcessorFactory create(ProcessingMetadata<com.github.dmn1k.supercsv.io.declarative.annotation.Trim> metadata) {
return new CellProcessorFactory() {
@Override
public int getOrder() {
return metadata.getAnnotation().order();
}
@Override
public CellProcessor create(CellProcessor next) {
return new Trim((StringCellProcessor) next);
}
};
}
示例7: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public CellProcessorFactory create(ProcessingMetadata<FmtNumber> metadata) {
return new CellProcessorFactory() {
@Override
public int getOrder() {
return metadata.getAnnotation().order();
}
@Override
public CellProcessor create(CellProcessor next) {
return new org.supercsv.cellprocessor.FmtNumber(metadata.getAnnotation().decimalFormat(), (StringCellProcessor) next);
}
};
}
示例8: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
@Override
public Optional<CellProcessor> create(final CsvPattern anno, final Optional<CellProcessor> next,
final FieldAccessor field, final TextFormatter<?> formatter, final Configuration config) {
final int flags = Utils.buildRegexFlags(anno.flags());
final java.util.regex.Pattern pattern;
try {
pattern = java.util.regex.Pattern.compile(anno.regex(), flags);
} catch(PatternSyntaxException e) {
throw new SuperCsvInvalidAnnotationException(anno, MessageBuilder.create("anno.attr.invalidType")
.var("property", field.getNameWithClass())
.varWithAnno("anno", anno.annotationType())
.var("attrName", "regex")
.var("attrValue", anno.regex())
.var("type", "{key.regex}")
.format(true));
}
final Pattern processor = next.map(n -> new Pattern(pattern, anno.description(), (StringCellProcessor)n))
.orElseGet(() -> new Pattern(pattern, anno.description()));
processor.setValidationMessage(anno.message());
return Optional.of(processor);
}
示例9: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
@Override
public Optional<CellProcessor> create(final CsvRightPad anno, final Optional<CellProcessor> next,
final FieldAccessor field, final TextFormatter<?> formatter, final Configuration config) {
if(anno.size() <= 0) {
throw new SuperCsvInvalidAnnotationException(anno, MessageBuilder.create("anno.attr.min")
.var("property", field.getNameWithClass())
.varWithAnno("anno", anno.annotationType())
.var("attrName", "size")
.var("attrValue", anno.size())
.var("min", 1)
.format());
}
final RightPad processor = next.map(n -> new RightPad(anno.size(), anno.padChar(), (StringCellProcessor)n))
.orElseGet(() -> new RightPad(anno.size(), anno.padChar()));
return Optional.of(processor);
}
示例10: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
@Override
public Optional<CellProcessor> create(final CsvFullChar anno, final Optional<CellProcessor> next,
final FieldAccessor field, final TextFormatter<?> formatter, final Configuration config) {
final CharCategory[] categories;
if(anno.categories().length == 0) {
categories = CharCategory.values();
} else {
categories = anno.categories();
}
final FullChar processor = next.map(n -> new FullChar(categories, (StringCellProcessor) n))
.orElseGet(() -> new FullChar(categories));
return Optional.of(processor);
}
示例11: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
@Override
public Optional<CellProcessor> create(final CsvHalfChar anno, final Optional<CellProcessor> next,
final FieldAccessor field, final TextFormatter<?> formatter, final Configuration config) {
final CharCategory[] categories;
if(anno.categories().length == 0) {
categories = CharCategory.values();
} else {
categories = anno.categories();
}
final HalfChar processor = next.map(n -> new HalfChar(categories, (StringCellProcessor) n))
.orElseGet(() -> new HalfChar(categories));
return Optional.of(processor);
}
示例12: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
@Override
public Optional<CellProcessor> create(final CsvLeftPad anno, final Optional<CellProcessor> next,
final FieldAccessor field, final TextFormatter<?> formatter, final Configuration config) {
if(anno.size() <= 0) {
throw new SuperCsvInvalidAnnotationException(anno, MessageBuilder.create("anno.attr.min")
.var("property", field.getNameWithClass())
.varWithAnno("anno", anno.annotationType())
.var("attrName", "size")
.var("attrValue", anno.size())
.var("min", 1)
.format());
}
final LeftPad processor = next.map(n -> new LeftPad(anno.size(), anno.padChar(), (StringCellProcessor)n))
.orElseGet(() -> new LeftPad(anno.size(), anno.padChar()));
return Optional.of(processor);
}
示例13: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
@Override
public Optional<CellProcessor> create(final CsvRegexReplace anno, final Optional<CellProcessor> next,
final FieldAccessor field, final TextFormatter<?> formatter, final Configuration config) {
final int flags = Utils.buildRegexFlags(anno.flags());
final Pattern pattern;
try {
pattern = Pattern.compile(anno.regex(), flags);
} catch(PatternSyntaxException e) {
throw new SuperCsvInvalidAnnotationException(anno, MessageBuilder.create("anno.attr.invalidType")
.var("property", field.getNameWithClass())
.varWithAnno("anno", anno.annotationType())
.var("attrName", "regex")
.var("attrValue", anno.regex())
.var("type", "{key.regex}")
.format(true));
}
final String replacement = anno.replacement();
final RegexReplace processor = next.map(n -> new RegexReplace(pattern, replacement, (StringCellProcessor) n))
.orElseGet(() -> new RegexReplace(pattern, replacement));
return Optional.of(processor);
}
示例14: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
@Override
public Optional<CellProcessor> create(final CsvMultiPad anno, final Optional<CellProcessor> next,
final FieldAccessor field, final TextFormatter<?> formatter, final Configuration config) {
if(anno.size() <= 0) {
throw new SuperCsvInvalidAnnotationException(anno,
MessageBuilder.create("anno.attr.min")
.var("property", field.getNameWithClass())
.varWithAnno("anno", anno.annotationType())
.var("attrName", "size")
.var("attrValue", anno.size())
.var("min", 1)
.format());
}
final PaddingProcessor paddingProcessor = (PaddingProcessor)config.getBeanFactory().create(anno.paddingProcessor());
final MultiPad processor = next.map(n -> new MultiPad(anno.size(), anno.padChar(), anno.rightAlign(),
anno.chopped(), paddingProcessor, (StringCellProcessor)n))
.orElseGet(() -> new MultiPad(anno.size(), anno.padChar(), anno.rightAlign(),
anno.chopped(), paddingProcessor));
return Optional.of(processor);
}
示例15: create
import org.supercsv.cellprocessor.ift.StringCellProcessor; //导入依赖的package包/类
@Override
public Optional<CellProcessor> create(final CsvTruncate anno, final Optional<CellProcessor> next,
final FieldAccessor field, final TextFormatter<?> formatter, final Configuration config) {
if(anno.maxSize() <= 0) {
throw new SuperCsvInvalidAnnotationException(anno, MessageBuilder.create("anno.attr.min")
.var("property", field.getNameWithClass())
.varWithAnno("anno", anno.annotationType())
.var("attrName", "maxSize")
.var("attrValue", anno.maxSize())
.var("min", 1)
.format());
}
final Truncate processor = next.map(n -> new Truncate(anno.maxSize(), anno.suffix(), (StringCellProcessor)n))
.orElseGet(() -> new Truncate(anno.maxSize(), anno.suffix()));
return Optional.of(processor);
}