Hands-On Design Patterns with Java
上QQ阅读APP看书,第一时间看更新

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.