[
https://issues.apache.org/jira/browse/CSV-109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17055664#comment-17055664
]
Chen commented on CSV-109:
--------------------------
pseudocode as below, If that thought is Ok , I will try to give a patch.
{code:java}
//代码占位符
interface Process {
public Object Validate(Object src);
public Object Transform(Object src);
}
//a default implemention
public DefaultProcess implements Process{
public Object Validate(Object src){
return src;
}
public Object Transform(Object src){
return src;
}
}
//developer implemention as they need
public DateProcess implements Process{
public Object Validate(Object src){
//do something
}
public Object Transform(Object src){
//do something
}
}
//Init
CSVFormat.withProcess(List<Process> process)
//USE
void addRecodrValue(...){
CSVFormat.getProcess[index]
validateSrc = CSVFormat.getProcess[index].Valiedate(src)
recordList.add(validateSrc)
}
{code}
> Support external CSV schema definition
> --------------------------------------
>
> Key: CSV-109
> URL: https://issues.apache.org/jira/browse/CSV-109
> Project: Commons CSV
> Issue Type: Wish
> Components: Parser
> Affects Versions: 1.0
> Reporter: Jay Zylstra
> Priority: Minor
> Fix For: Patch Needed, 1.x
>
>
> As XML has XSD, so CSV needs an external schema definition file which defines
> the schema of the flat file format and the values it contains.
> Programmatically adding constraints, as supported by
> {{org.supercsv.cellprocessor.constraint.StrRegEx}}, are useful but not
> portable. Fortunately, Microsoft has already created such a CSV schema
> definition file format called
> [Schema.ini|http://msdn.microsoft.com/en-us/library/ms709353(v=vs.85).aspx].
> It is my suggestion to add file and data parsing validation to Apache Commons
> CSV by adopting support for _Schema.ini_, bringing this long overdue
> functionality to the Java world.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)