0
그래서 같은 JSONDeserializer 있습니다flexjson TypeLocator가 누락 된 값에 예외를 발생시키는 방법은 무엇입니까?
if (json != null)
{
response = new JSONDeserializer<EnvelopeBuilder>().use(null, EnvelopeBuilder.class)
// Target
.use("header.targetIdentifier", EnvelopeJsonCodec.locator)
// Source
.use("header.sourceIdentifier", EnvelopeJsonCodec.locator)
// Do it
.deserialize(json);
EnvelopeJsonCodec.logger.debug(new StringBuffer("Builder: ").append(response).toString());
}
그리고 이와 같은 유형의 로케이터에 의존 :
private static final TypeLocator<String> locator = new TypeLocator<String>("msg-type")
// Request/Response
.add("TARGETED_MESSAGE", ServiceIdentifier.class)
// Publish/Subscribe
.add("PUBLISH", PublishChannel.class);
하지만 실현 클라이언트가 내 통제하에 반드시이기 때문에, 그들은 수 typo는 msg-type이고 이후에는 null 객체를 얻습니다.
나중에 null 객체를 테스트 할 수 있지만 그 뒤에 오는 것은 msg-type이 잘못되어 객체가 null 인 이유가 분명하지 않다는 것입니다.
msg-type이 잘못되면 TypeLocator가 예외를 throw 할 수 있습니까?