本文整理汇总了Java中org.apache.hadoop.registry.client.types.Endpoint.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Endpoint.toString方法的具体用法?Java Endpoint.toString怎么用?Java Endpoint.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.registry.client.types.Endpoint
的用法示例。
在下文中一共展示了Endpoint.toString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retrieveAddressesUriType
import org.apache.hadoop.registry.client.types.Endpoint; //导入方法依赖的package包/类
/**
* Get a single URI endpoint
* @param epr endpoint
* @return the uri of the first entry in the address list. Null if the endpoint
* itself is null
* @throws InvalidRecordException if the type is wrong, there are no addresses
* or the payload ill-formatted
*/
public static List<String> retrieveAddressesUriType(Endpoint epr)
throws InvalidRecordException {
if (epr == null) {
return null;
}
requireAddressType(ADDRESS_URI, epr);
List<Map<String, String>> addresses = epr.addresses;
if (addresses.size() < 1) {
throw new InvalidRecordException(epr.toString(),
"No addresses in endpoint");
}
List<String> results = new ArrayList<String>(addresses.size());
for (Map<String, String> address : addresses) {
results.add(getAddressField(address, ADDRESS_URI));
}
return results;
}
示例2: requireAddressType
import org.apache.hadoop.registry.client.types.Endpoint; //导入方法依赖的package包/类
/**
* Require a specific address type on an endpoint
* @param required required type
* @param epr endpoint
* @throws InvalidRecordException if the type is wrong
*/
public static void requireAddressType(String required, Endpoint epr) throws
InvalidRecordException {
if (!required.equals(epr.addressType)) {
throw new InvalidRecordException(
epr.toString(),
"Address type of " + epr.addressType
+ " does not match required type of "
+ required);
}
}