本文整理汇总了Java中org.apache.curator.x.discovery.ServiceInstanceBuilder.name方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceInstanceBuilder.name方法的具体用法?Java ServiceInstanceBuilder.name怎么用?Java ServiceInstanceBuilder.name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.curator.x.discovery.ServiceInstanceBuilder
的用法示例。
在下文中一共展示了ServiceInstanceBuilder.name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readInstance
import org.apache.curator.x.discovery.ServiceInstanceBuilder; //导入方法依赖的package包/类
static<T> ServiceInstance<T> readInstance(JsonNode node, DiscoveryContext<T> context) throws Exception
{
ServiceInstanceBuilder<T> builder = ServiceInstance.builder();
builder.name(node.get("name").asText());
builder.id(node.get("id").asText());
builder.address(node.get("address").asText());
builder.registrationTimeUTC(node.get("registrationTimeUTC").asLong());
builder.serviceType(ServiceType.valueOf(node.get("serviceType").asText()));
builder.payload(context.unMarshallJson(node.get("payload")));
Integer port = getInteger(node, "port");
Integer sslPort = getInteger(node, "sslPort");
if ( port != null )
{
builder.port(port);
}
if ( sslPort != null )
{
builder.sslPort(sslPort);
}
return builder.build();
}
示例2: deserialize
import org.apache.curator.x.discovery.ServiceInstanceBuilder; //导入方法依赖的package包/类
@Override
public ServiceInstance<DrillbitEndpoint> deserialize(byte[] bytes) throws Exception {
DrillServiceInstance i = DrillServiceInstance.parseFrom(bytes);
ServiceInstanceBuilder<DrillbitEndpoint> b = ServiceInstance.<DrillbitEndpoint>builder();
b.id(i.getId());
b.name(ExecConstants.SERVICE_NAME);
b.registrationTimeUTC(i.getRegistrationTimeUTC());
b.payload(i.getEndpoint());
return b.build();
}
示例3: deserialize
import org.apache.curator.x.discovery.ServiceInstanceBuilder; //导入方法依赖的package包/类
@Override
public ServiceInstance<NodeEndpoint> deserialize(byte[] bytes) throws Exception {
DremioServiceInstance i = DremioServiceInstance.parseFrom(bytes);
ServiceInstanceBuilder<NodeEndpoint> b = ServiceInstance.<NodeEndpoint>builder();
b.id(i.getId());
b.name(i.getName());
b.registrationTimeUTC(i.getRegistrationTimeUTC());
b.payload(i.getEndpoint());
return b.build();
}
示例4: deserialize
import org.apache.curator.x.discovery.ServiceInstanceBuilder; //导入方法依赖的package包/类
@Override
public ServiceInstance<T> deserialize(final byte[] pBytes) throws Exception {
final ByteArrayInputStream bais = new ByteArrayInputStream(pBytes);
final JsonNode rootNode = mMapper.readTree(bais);
final ServiceInstanceBuilder<T> builder = ServiceInstance.builder();
{
final String address = getTextField(rootNode, "address");
if (address != null) {
builder.address(address);
}
}
{
final String id = getTextField(rootNode, "id");
if (id != null) {
builder.id(id);
}
}
{
final String name = getTextField(rootNode, "name");
if (name != null) {
builder.name(name);
}
}
{
final Integer port = getIntegerField(rootNode, "port");
if (port != null) {
builder.port(port);
}
}
{
final Integer sslPort = getIntegerField(rootNode, "sslPort");
if (sslPort != null) {
builder.sslPort(sslPort);
}
}
{
final Long registrationTimeUTC = getLongField(rootNode, "registrationTimeUTC");
if (registrationTimeUTC != null) {
builder.registrationTimeUTC(registrationTimeUTC);
}
}
{
final T payload = getObject(rootNode, "payload", mPayloadClass);
if (payload != null) {
builder.payload(payload);
}
}
{
final ServiceType serviceType = getObject(rootNode, "serviceType", ServiceType.class);
if (serviceType != null) {
builder.serviceType(serviceType);
}
}
{
final UriSpec uriSpec = getObject(rootNode, "uriSpec", UriSpec.class);
if (uriSpec != null) {
builder.uriSpec(uriSpec);
}
}
return builder.build();
}