Class ServiceInstanceUtils
- java.lang.Object
-
- io.microsphere.util.BaseUtils
-
- io.microsphere.spring.cloud.client.service.util.ServiceInstanceUtils
-
public class ServiceInstanceUtils extends io.microsphere.util.BaseUtilsServiceInstanceUtilities class- Since:
- 1.0.0
- Author:
- Mercy
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidattachMetadata(java.lang.String contextPath, org.springframework.cloud.client.ServiceInstance serviceInstance, java.util.Collection<io.microsphere.spring.web.metadata.WebEndpointMapping> webEndpointMappings)static java.lang.StringgetMetadata(org.springframework.cloud.client.ServiceInstance serviceInstance, java.lang.String metadataName)Get metadata by metadataNamestatic java.net.URIgetUri(org.springframework.cloud.client.ServiceInstance serviceInstance)Alternative method ofServiceInstance.getUri()with the better performancestatic java.lang.StringgetUriString(org.springframework.cloud.client.ServiceInstance instance)Get the String representation ofServiceInstance.getUri()static java.util.Collection<io.microsphere.spring.web.metadata.WebEndpointMapping>getWebEndpointMappings(org.springframework.cloud.client.ServiceInstance serviceInstance)GetWebEndpointMappings fromServiceInstancestatic java.lang.StringremoveMetadata(org.springframework.cloud.client.ServiceInstance serviceInstance, java.lang.String metadataName)Remove metadata by metadataNamestatic java.lang.StringsetMetadata(org.springframework.cloud.client.ServiceInstance serviceInstance, java.lang.String metadataName, java.lang.String metadataValue)Set metadata by metadataName
-
-
-
Method Detail
-
attachMetadata
public static void attachMetadata(java.lang.String contextPath, org.springframework.cloud.client.ServiceInstance serviceInstance, java.util.Collection<io.microsphere.spring.web.metadata.WebEndpointMapping> webEndpointMappings)
-
getWebEndpointMappings
@Nonnull public static java.util.Collection<io.microsphere.spring.web.metadata.WebEndpointMapping> getWebEndpointMappings(org.springframework.cloud.client.ServiceInstance serviceInstance)
GetWebEndpointMappings fromServiceInstance- Parameters:
serviceInstance-ServiceInstance- Returns:
WebEndpointMappings
-
getUriString
@Nonnull public static java.lang.String getUriString(org.springframework.cloud.client.ServiceInstance instance)
Get the String representation ofServiceInstance.getUri()- Parameters:
instance-ServiceInstance- Returns:
- the String representation of
ServiceInstance.getUri()
-
getUri
@Nonnull public static java.net.URI getUri(org.springframework.cloud.client.ServiceInstance serviceInstance)
Alternative method ofServiceInstance.getUri()with the better performance- Parameters:
serviceInstance-ServiceInstance- Returns:
URIinstance- See Also:
DefaultServiceInstance.getUri(ServiceInstance)
-
getMetadata
@Nullable public static java.lang.String getMetadata(org.springframework.cloud.client.ServiceInstance serviceInstance, java.lang.String metadataName)Get metadata by metadataName- Parameters:
serviceInstance-ServiceInstancemetadataName- metadataName- Returns:
- metadata value
-
setMetadata
public static java.lang.String setMetadata(org.springframework.cloud.client.ServiceInstance serviceInstance, java.lang.String metadataName, java.lang.String metadataValue)Set metadata by metadataName- Parameters:
serviceInstance-ServiceInstancemetadataName- metadataNamemetadataValue- metadata value- Returns:
- the previous value associated with
metadataNameif found,nullotherwise
-
removeMetadata
public static java.lang.String removeMetadata(org.springframework.cloud.client.ServiceInstance serviceInstance, java.lang.String metadataName)Remove metadata by metadataName- Parameters:
serviceInstance-ServiceInstancemetadataName- metadataName- Returns:
- the value associated with
metadataNameif found,nullotherwise
-
-