Skip to content

Instantly share code, notes, and snippets.

@grimrose
Created March 8, 2012 17:18
Show Gist options
  • Save grimrose/2002168 to your computer and use it in GitHub Desktop.
Save grimrose/2002168 to your computer and use it in GitHub Desktop.
とりあえず考え中
class Parser {
void parse(String docbase){
Result result = getBuilder().build(docbase);
print result.result
}
Builder getBuilder() {
return new Builder();
}
}
class Finder {
List<String> find(String docbase) {
List<String> list = new ArrayList<String>()
list.add( docbase)
return list
}
}
class Builder {
Finder getFinder() {
return new Finder();
}
Result build(String docbase) {
Result result = new Result();
List list = getFinder().find(docbase)
list.each{ result = getConverter().convert(it) }
return result
}
Converter getConverter(){
return new Converter();
}
}
class Converter {
Result convert(String value) {
Result result = new Result()
result.result = "input value: ${value}"
result
}
}
class Result {
String result;
}
Parser parser = new Parser()
​parser.parse("asdf")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment