com.neeve.util
Class UtlAddressDescriptor

java.lang.Object
  extended by com.neeve.util.UtlDescriptor
      extended by com.neeve.util.UtlAddressDescriptor

public final class UtlAddressDescriptor
extends UtlDescriptor

Utility class representing a Neeve address descriptor.

This class is a utility class to represent a Neeve address descriptor. Such descriptors are specialized descriptors (see UtlDescriptor) of the form [type]://[address]&prop=name&prop=name&...&prop=name where address specifies the type specific address of the link endpoint and each prop=name name value pair specifies a property value .

This class MAY be used by end users, however it is not supported.


Field Summary
 String address
          The address portion parsed from the config string
 HashMap<String,Object> props
          The set of properties parsed from the config string.
 
Fields inherited from class com.neeve.util.UtlDescriptor
config, SEPARATOR_STR, type
 
Method Summary
 void appendFullStringTo(Appendable appendable)
          Appends the descriptor string to the given Appendable.
 void appendShortStringTo(Appendable appendable)
          Appends the descriptor string to the given Appendable.
 UtlAddressDescriptor copy()
          Creates a copy of this UtlAddressDescriptor.
 boolean equals(Object o)
          Compares the specified object with this object for equality
 UtlAddressDescriptor getConnectorDescriptor()
          Get a descriptor's connector descriptor.
 int hashCode(Object o)
          Returns an address descriptor's hash code.
static boolean isValid(CharSequence descriptor)
          Validate if a descriptor string is syntactically correct.
static UtlAddressDescriptor parse(String descriptor, HashMap<String,Object> props)
          Parse an address descriptor into its components.
 void setConnectorDescriptor(UtlAddressDescriptor connectorDescriptor)
          Set a descriptor's connector descriptor.
 String toFullString()
          Get the address descriptor as a string of the format prot://addr&prop1=val1...propn-=valn
 String toShortString()
          Get the address descriptor as a string of the format prot://addr i.e.
 
Methods inherited from class com.neeve.util.UtlDescriptor
appendTo, parse, toString
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

address

public final String address
The address portion parsed from the config string


props

public final HashMap<String,Object> props
The set of properties parsed from the config string.

Method Detail

parse

public static UtlAddressDescriptor parse(String descriptor,
                                         HashMap<String,Object> props)
                                  throws IllegalArgumentException
Parse an address descriptor into its components.

Parameters:
descriptor - The address descriptor.
props - The properties table to use as the starting point for setting properties parsed from the config string. This value can be null in which case a new properties table is created to store parsed properties.
Throws:
IllegalArgumentException - Thrown in case the descriptor string is not of the form [type]://[address]&prop=name&prop=name&...

This method parses an address descriptor. Upon return, the provided properties table is updated with the configuration properties parsed from the descriptor string.


isValid

public static boolean isValid(CharSequence descriptor)
Validate if a descriptor string is syntactically correct. This is a zero garbage operation.

Parameters:
descriptor - The address descriptor.
Returns:
Returns true if correct and false otherwise.

equals

public final boolean equals(Object o)
Compares the specified object with this object for equality

Overrides:
equals in class Object

hashCode

public final int hashCode(Object o)
Returns an address descriptor's hash code.


setConnectorDescriptor

public final void setConnectorDescriptor(UtlAddressDescriptor connectorDescriptor)
Set a descriptor's connector descriptor.

This method pertains only to server address descriptors. It is for use by server link endpoints to set a descriptor that can be used to connect to the server endpoint configured using a server address descriptor. The connector descriptor can then be communicated to the client side to connect to the server endpoint.


getConnectorDescriptor

public final UtlAddressDescriptor getConnectorDescriptor()
Get a descriptor's connector descriptor.

This method pertains only to server address descriptors. It returns the descriptor set by setConnectorDescriptor(com.neeve.util.UtlAddressDescriptor) i.e. the descriptor that can be used to connect to a server endpoint listening on an address in a server address descriptor.

This method does not pertain to client side address descriptors and will return null.


toShortString

public final String toShortString()
Get the address descriptor as a string of the format prot://addr i.e. without the descriptor properties


appendShortStringTo

public final void appendShortStringTo(Appendable appendable)
Appends the descriptor string to the given Appendable.

Parameters:
appendable - The Appendable to which to append.
Throws:
RuntimeException - if the appendable throws an IOException

toFullString

public final String toFullString()
Get the address descriptor as a string of the format prot://addr&prop1=val1...propn-=valn


appendFullStringTo

public final void appendFullStringTo(Appendable appendable)
Appends the descriptor string to the given Appendable.

Parameters:
appendable - The Appendable to which to append.
Throws:
RuntimeException - if the appendable throws an IOException

copy

public final UtlAddressDescriptor copy()
Creates a copy of this UtlAddressDescriptor. This is a deep copy, so the underlying props and connectorDescriptor are also copied.



Copyright © 2016 Neeve Research, LLC. All Rights Reserved.