public Maybe<String> getTypeName() {
Maybe<Object> result = data.getStringKeyMaybe(getPreferredKeyName());
if (result.isAbsent() && typeKeyPrefix!=null) {
result = data.getStringKeyMaybe(typeKeyPrefix+"Type");
if (result.isAbsent()) result = data.getStringKeyMaybe("type");
<BUG>}
if (result.isAbsent()) return Maybe.absent("Missing key '"+getPreferredKeyName()+"'");
if (result.get() instanceof String) return Maybe.of((String)result.get());</BUG>
throw new IllegalArgumentException("Invalid value "+result.get().getClass()+" for "+getPreferredKeyName()+"; "
+ "expected String, got "+result.get());

public Maybe<String> getTypeName() {
Maybe<Object> result = data.getStringKeyMaybe(getPreferredKeyName());
if (result.isAbsent() && typeKeyPrefix!=null) {
result = data.getStringKeyMaybe(typeKeyPrefix+"Type");
if (result.isAbsent()) result = data.getStringKeyMaybe("type");
}
if (result.isAbsent() || result.get()==null)
return Maybe.absent("Missing key '"+getPreferredKeyName()+"'");
if (result.get() instanceof String) return Maybe.of((String)result.get());
throw new IllegalArgumentException("Invalid value "+result.get().getClass()+" for "+getPreferredKeyName()+"; "
+ "expected String, got "+result.get());
