Created
March 8, 2012 17:18
-
-
Save grimrose/2002168 to your computer and use it in GitHub Desktop.
とりあえず考え中
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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