/**
* Return the value for the field with a given name and type.
*
* @param field
* The name of the field to retrieve the value of.
* @param extensionFieldType
* The type of the field.
* @return The value for the field with the given name.
* @throws NoSuchElementException
* if this schema does not contain a field of the given name.
* @throws IllegalArgumentException
* if the given field is null or an empty string or if the extensionFieldType is null.
*/
@JsonAnyGetter
public <T> T getField(String field, ExtensionFieldType<T> extensionFieldType) {
if (field == null || field.isEmpty()) {
throw new IllegalArgumentException("Invalid field name");
}
if (extensionFieldType == null) {
throw new IllegalArgumentException("Invalid field type");
}
if (!isFieldPresent(field)) {
throw new NoSuchElementException("Field " + field + " not valid in this extension");
}
return extensionFieldType.fromString(fields.get(field).value);
}
Extension.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:gluu
作者:
评论列表
文章目录