저는 PlaceHistoryMapperWithoutColon이라는 PlaceHistoryMapper 데코레이터를 사용하고 있습니다.
용도 :
final PlaceHistoryMapper historyMapper0 = GWT
.create(PlaceHistoryMapperImpl.class);
final PlaceHistoryMapper historyMapper = new PlaceHistoryMapperWithoutColon(historyMapper0);
데코레이터 소스 :
public class PlaceHistoryMapperWithoutColon implements PlaceHistoryMapper {
private static final String COLON = ":";
private PlaceHistoryMapper placeHistoryMapper;
public PlaceHistoryMapperWithoutColon(PlaceHistoryMapper placeHistoryMapper) {
this.placeHistoryMapper = placeHistoryMapper;
}
@Override
public Place getPlace(String token) {
if (token != null && !token.endsWith(COLON)) {
token = token.concat(COLON);
}
return placeHistoryMapper.getPlace(token);
}
@Override
public String getToken(Place place) {
String token = placeHistoryMapper.getToken(place);
if (token != null && token.endsWith(COLON)) {
token = token.substring(0, token.length() - 1);
}
return token;
}
}
장식 소스 예 :
@WithTokenizers({ FirstPlace.Tokenizer.class, SecondPlace.Tokenizer.class })
public interface PlaceHistoryMapperImpl extends PlaceHistoryMapper {
}
찾는 소스 예 :
public final class FirstPlace extends Place {
@Prefix("first")
public static class Tokenizer implements PlaceTokenizer<FirstPlace> {
@Override
public NetworkInfosPlace getPlace(String token) {
return new FirstPlace();
}
@Override
public String getToken(FirstPlace place) {
return "";
}
}
}
이것은 doc에서 온 것입니다 :'앱의 많은 장소가 URL에 어떤 상태도 저장할 수 없으므로 null 토큰을 반환하는 PlaceTokenizer를 선언하는 BasicPlace를 확장 할 수 있습니다 .' 당신이 다시 돌려주는 PlaceTokenizer를 만들려고 했습니까? Add Person 양식에 대한 널 토큰? 답장을 보내 주셔서 감사합니다. – Strelok
getToken (PlaceName place)에서 null을 반환하면 "#addPersonForm : null"과 같은 URL로 끝납니다. 내가 뭔가를 놓친 건가? – Justin