jp.go.aist.rtm.RTC.util
Class NVUtil

java.lang.Object
  extended by jp.go.aist.rtm.RTC.util.NVUtil

public class NVUtil
extends java.lang.Object

Utility for NameValue


Nested Class Summary
(package private) static class NVUtil.nv_find
           {@.en Helper class to retrieve NameValue.
(package private) static class NVUtil.to_prop
           Helper class that makes Properties object based on content of specified NameValue object
 
Constructor Summary
NVUtil()
           
 
Method Summary
static void append(NVListHolder destNvList, NVListHolder srcNvList)
           Append an element to NVList
static boolean appendStringValue(NVListHolder nvlist, java.lang.String name, java.lang.String value)
           Append the specified string to element of NVList
static void copyFromProperties(NVListHolder nvlist, Properties prop)
           Copy the properties to NVList
static void copyToProperties(Properties prop, NVListHolder nvlist)
           Copy NVList to the Proeprties
static void dump(NVListHolder nvlist)
           Print information configured in NVList as string type
static int find_index(NVListHolder nvlist, java.lang.String name)
           Return the index of element specified by name from NVList
static org.omg.CORBA.Any find(NVListHolder nvlist, java.lang.String name)
           Return the value specified by name from NVList
static boolean isString(NVListHolder nvlist, java.lang.String name)
           Validate whether value type specified by name is string type
static boolean isStringValue(NVListHolder nvlist, java.lang.String name, java.lang.String value)
           Check whether the value of specified name matches the specified string
static NameValue newNV(java.lang.String name, java.lang.String value)
           Create NameValue
static
<T> NameValue
newNV(java.lang.String name, T value, java.lang.Class<T> klass)
           Create NameValue
static NameValue newNVAny(java.lang.String name, org.omg.CORBA.Any value)
           Create NameValue typed CORBA::Any
static NameValue newNVString(java.lang.String name, java.lang.String value)
           Create NameValue typed String
static Properties toProperties(NVListHolder nvlist)
           Transform NVList to the properties
static java.lang.String toString(NVListHolder nvlist)
           {@.en Acquires the value of the character string of the NameValue object from NVListHolder.
static java.lang.String toString(NVListHolder nvlist, java.lang.String name)
           Get NVList of specifid name as string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NVUtil

public NVUtil()
Method Detail

newNV

public static <T> NameValue newNV(java.lang.String name,
                                  T value,
                                  java.lang.Class<T> klass)
Create NameValue

Parameters:
name - Name of NameValue
value - The value of NameValue
klass - ClassType
Returns:
NameValue

newNVString

public static NameValue newNVString(java.lang.String name,
                                    java.lang.String value)
Create NameValue typed String

Parameters:
name - Name of NameValue
value - The value of NameValue
Returns:
NameValue

newNV

public static NameValue newNV(java.lang.String name,
                              java.lang.String value)
Create NameValue

Parameters:
name - Name of NameValue
value - The value of NameValue
Returns:
NameValue

newNVAny

public static NameValue newNVAny(java.lang.String name,
                                 org.omg.CORBA.Any value)
Create NameValue typed CORBA::Any

Parameters:
name - Name of NameValue
value - The value of NameValue
Returns:
NameValue

copyFromProperties

public static void copyFromProperties(NVListHolder nvlist,
                                      Properties prop)
Copy the properties to NVList

This operation copies the properties to NVList. All NVList's values are copied as CORBA::string.

Parameters:
nvlist - NVList to store properties values
prop - Properties that is copies from

copyToProperties

public static void copyToProperties(Properties prop,
                                    NVListHolder nvlist)
Copy NVList to the Proeprties

This operation copies NVList to properties.

Parameters:
prop - Properties to store NVList values
nvlist - NVList of copy source

toProperties

public static Properties toProperties(NVListHolder nvlist)
Transform NVList to the properties

This operation transforms NVList to properties

Parameters:
nvlist - NVList of tranformation source
Returns:
Transformation result Property

find

public static final org.omg.CORBA.Any find(NVListHolder nvlist,
                                           java.lang.String name)
                                    throws java.lang.Exception
Return the value specified by name from NVList

This operation returns Any type of value specified by name. When an element of specified name doesn't exist, the exception will occur.

Parameters:
nvlist - The target NVList for the find
name - Name for the find
Returns:
Find result
Throws:
java.lang.Exception - Not found NameValue object

find_index

public static final int find_index(NVListHolder nvlist,
                                   java.lang.String name)
Return the index of element specified by name from NVList

This operation returns the index at the position where the element specified by name is stored.

Parameters:
nvlist - The target NVList for the find
name - Name for the find
Returns:
Index of target object for the find

isString

public static boolean isString(NVListHolder nvlist,
                               java.lang.String name)
Validate whether value type specified by name is string type

This operation returns the bool value by checking whether the type of value specified with name is CORBA::string.

Parameters:
nvlist - @param nv The target NVList for the search
name - Name for the search
Returns:
String validation result (String:true, Else:false)

isStringValue

public static boolean isStringValue(NVListHolder nvlist,
                                    java.lang.String name,
                                    java.lang.String value)
Check whether the value of specified name matches the specified string

This operation checks whether the value specified with name is CORBA::string and returns the bool value which matches spcified string.

Parameters:
nvlist - The target NVList for the search
name - Name for the search
value - String value to compare
Returns:
Check result (Match:true, Unmatch:false)

toString

public static java.lang.String toString(NVListHolder nvlist,
                                        java.lang.String name)
Get NVList of specifid name as string

This operation returns string value in NVList specified by name. If the value in NVList specified by name is not CORBA::string type this operation returns empty string value.

Parameters:
nvlist - The target NVList for the search
name - Name for the search
Returns:
String value corresponding to name

appendStringValue

public static boolean appendStringValue(NVListHolder nvlist,
                                        java.lang.String name,
                                        java.lang.String value)
Append the specified string to element of NVList

This operation appends the string value specified by value to the elementspecified by name. Operate nothing when the 'value' value has already been set to the element specified by name. Add the 'value' value each separating by a comma "," when the 'value' value is not set to the element specified by name. Set the specified value. Add a new element at the end of NVList, and set the specified value, when the element specified by name does not exist.

Parameters:
nvlist - The target NVList for the search
name - The target element name for the appending
value - String to append
Returns:
Append operation result

append

public static void append(NVListHolder destNvList,
                          NVListHolder srcNvList)
Append an element to NVList

This operation appends elements specified by src to NVList specified by dest.

Parameters:
destNvList - NVList to be appended
srcNvList - NVList to append

dump

public static void dump(NVListHolder nvlist)
Print information configured in NVList as string type

Parameters:
nvlist - The target NVList for the print

toString

public static java.lang.String toString(NVListHolder nvlist)
Acquires the value of the character string of the NameValue object from NVListHolder.

Parameters:
nvlist - NVListHolder object
Returns:
Throws:
java.lang.Exception - Throws Exception, when the specified object is not NameValue object.