|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mbs.services.metatype.Util
public class Util
Utility class for dealing with metatype and configuration information.
Applications working with String data may use this class
to convert Strings
to Objects which are actually used by the ConfigurationAdmin.
(see OSGi ConfigurationAdmin specification).
The Util class provides conversion methods,
which receive metatype definition and String representation
of an object and return its real value.
Convertor,
AttributeDefinition| Constructor Summary | |
|---|---|
Util()
|
|
| Method Summary | |
|---|---|
static int |
compareObjects(java.lang.Object first,
java.lang.Object second,
int syntax)
Comapres two object numerically. |
static java.lang.Object |
getRealObject(java.lang.String[] object,
int cardinality,
int syntax)
Based on an AttributeDefinition's default value, cardinality, and syntax an object is created. |
static java.lang.Object |
getRealObject(java.lang.String[] object,
int cardinality,
int syntax,
int[] syntaxes)
Based on an AttributeDefinition's default value, cardinality, and syntax an object is created. |
static java.lang.Object |
makeArr(java.lang.String[] array,
int syntax)
Makes an array from the string array value and the syntax. |
static java.util.Dictionary |
makeDictionary(java.lang.String[] array,
int[] syntaxes)
Makes an Dictionary from its presentation as
String array and the syntaxes of its values. |
static java.lang.Object |
makeObject(java.lang.String string,
int syntax)
Creates an object from a String value and a type, as returned
by the corresponding AttributeDefinition.getType() method. |
static java.lang.String[] |
stringToArray(java.lang.String str,
java.lang.String separators)
Converts a delimited string into an array of string tokens. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Util()
| Method Detail |
|---|
public static int compareObjects(java.lang.Object first,
java.lang.Object second,
int syntax)
first - The first of the objects to be compared.second - The second of the objects to be compared.syntax - A syntax, valid in the terms of an AttributeDefinition.
public static java.lang.Object makeObject(java.lang.String string,
int syntax)
throws java.lang.IllegalArgumentException
String value and a type, as returned
by the corresponding AttributeDefinition.getType() method.
string - The String value representation of the object.syntax - The object's type as defined by AttributeDefinition.
AttributeDefinition.INTEGER and string is "1",
then the value returned should be Integer("1").
java.lang.IllegalArgumentException - if a proper object can not be created
due to
incompatibility of syntax and value or if the parameters are not correct
(e.g. syntax is not a valid AttributeDefinition constant).
public static java.lang.Object getRealObject(java.lang.String[] object,
int cardinality,
int syntax,
int[] syntaxes)
throws java.lang.IllegalArgumentException
object - The String array representation of the object.cardinality - The cardinality of the object as defined by AttributeDefinition.syntax - The object's type as defined by AttributeDefinition.syntaxes - Used only when syntax is DICITONARY. Defines
the types, as defined by AttributeDefinition, of the dictionary's values.
In this case the object argument's length must be
the doubled value of the syntaxes length.
syntax and value, build from
the given string array. Depending on the cardinality, this can be either
a single object, or an array of objects or primitives, a Vector of objects or
a Dictionary.
java.lang.IllegalArgumentException - if any of the arguments is not compatible with the others.
public static java.lang.Object getRealObject(java.lang.String[] object,
int cardinality,
int syntax)
throws java.lang.IllegalArgumentException
object - The String array representation of the object.cardinality - The cardinality of the object as defined by AttributeDefinition.syntax - The object's type as defined by AttributeDefinition.
syntax and value, build from
the given string array. Depending on the cardinality, this can be either
a single object, or an array of objects or primitives or a Vector of objects.
java.lang.IllegalArgumentException - if any of the arguments is not compatible with the others.
public static java.util.Dictionary makeDictionary(java.lang.String[] array,
int[] syntaxes)
Dictionary from its presentation as
String array and the syntaxes of its values.
array - String array which hold in its odd position the
keys of the dictionary and the String representations of
the corresponding values on the even positions. Its lenght must be even
and exaclty twice the length of the syntaxes array. The type of the value
of the element which key is at position i * 2 is specified
with the ith element in the syntaxes array.syntaxes - The types of the dictionary's valus, as defined by
AttributeDefinition.
Dictionary
java.lang.IllegalArgumentException - if any of the elements in the string array
can not be converted to a proper object or primitive, the array is not of
event lenght of if any of the syntaxes is not a valid
AttributeDefinition type constant.
public static java.lang.Object makeArr(java.lang.String[] array,
int syntax)
throws java.lang.IllegalArgumentException
array - String array representation of an array, which
follows the rules defined by AttributeDefinition.syntax - The array's type as defined by AttributeDefinition.
syntax,
and value build from the string array passed.
java.lang.IllegalArgumentException - if any of the elements in the string array
can not be converted to a proper object or primitive,
or if the syntax is not a valid AttributeDefinition type constant.
public static final java.lang.String[] stringToArray(java.lang.String str,
java.lang.String separators)
String[] - The 'separator' separated string.String - The string separator.
|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||