Class ServiceInstanceUtils

java.lang.Object
io.microsphere.util.BaseUtils
io.microsphere.spring.cloud.client.service.util.ServiceInstanceUtils

public class ServiceInstanceUtils extends io.microsphere.util.BaseUtils
ServiceInstance Utilities class
Since:
1.0.0
Author:
Mercy
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    attachMetadata(String contextPath, org.springframework.cloud.client.ServiceInstance serviceInstance, Collection<io.microsphere.spring.web.metadata.WebEndpointMapping> webEndpointMappings)
     
    static String
    getMetadata(org.springframework.cloud.client.ServiceInstance serviceInstance, String metadataName)
    Get metadata by metadataName
    static URI
    getUri(org.springframework.cloud.client.ServiceInstance serviceInstance)
    Alternative method of ServiceInstance.getUri() with the better performance
    static String
    getUriString(org.springframework.cloud.client.ServiceInstance instance)
    Get the String representation of ServiceInstance.getUri()
    static Collection<io.microsphere.spring.web.metadata.WebEndpointMapping>
    getWebEndpointMappings(org.springframework.cloud.client.ServiceInstance serviceInstance)
    Get WebEndpointMappings from ServiceInstance
    static String
    removeMetadata(org.springframework.cloud.client.ServiceInstance serviceInstance, String metadataName)
    Remove metadata by metadataName
    static String
    setMetadata(org.springframework.cloud.client.ServiceInstance serviceInstance, String metadataName, String metadataValue)
    Set metadata by metadataName

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • attachMetadata

      public static void attachMetadata(String contextPath, org.springframework.cloud.client.ServiceInstance serviceInstance, Collection<io.microsphere.spring.web.metadata.WebEndpointMapping> webEndpointMappings)
    • getWebEndpointMappings

      @Nonnull public static Collection<io.microsphere.spring.web.metadata.WebEndpointMapping> getWebEndpointMappings(org.springframework.cloud.client.ServiceInstance serviceInstance)
      Get WebEndpointMappings from ServiceInstance
      Parameters:
      serviceInstance - ServiceInstance
      Returns:
      WebEndpointMappings
    • getUriString

      @Nonnull public static String getUriString(org.springframework.cloud.client.ServiceInstance instance)
      Get the String representation of ServiceInstance.getUri()
      Parameters:
      instance - ServiceInstance
      Returns:
      the String representation of ServiceInstance.getUri()
    • getUri

      @Nonnull public static URI getUri(org.springframework.cloud.client.ServiceInstance serviceInstance)
      Alternative method of ServiceInstance.getUri() with the better performance
      Parameters:
      serviceInstance - ServiceInstance
      Returns:
      URI instance
      See Also:
      • DefaultServiceInstance.getUri(ServiceInstance)
    • getMetadata

      @Nullable public static String getMetadata(org.springframework.cloud.client.ServiceInstance serviceInstance, String metadataName)
      Get metadata by metadataName
      Parameters:
      serviceInstance - ServiceInstance
      metadataName - metadataName
      Returns:
      metadata value
    • setMetadata

      public static String setMetadata(org.springframework.cloud.client.ServiceInstance serviceInstance, String metadataName, String metadataValue)
      Set metadata by metadataName
      Parameters:
      serviceInstance - ServiceInstance
      metadataName - metadataName
      metadataValue - metadata value
      Returns:
      the previous value associated with metadataName if found, null otherwise
    • removeMetadata

      public static String removeMetadata(org.springframework.cloud.client.ServiceInstance serviceInstance, String metadataName)
      Remove metadata by metadataName
      Parameters:
      serviceInstance - ServiceInstance
      metadataName - metadataName
      Returns:
      the value associated with metadataName if found, null otherwise