- Hands-On Design Patterns with Java
- Dr. Edward Lavieri
- 60字
- 2021-06-24 14:58:07
The MapIntToCharacters class
The MapIntToCharacters class includes a single String class variable and a constructor method. The constructor expects a String argument:
public class MapIntToCharacters implements Expression {
// class variable
private String tString;
// constructor
public MapIntToCharacters(String tString) {
this.tString = tString;
}
@Override
public void interpret(Conversion orignalContent) {
orignalContent.convertToCharacters(tString);
}
}
The MapIntToCharacters class overrides the interpret() method.