All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class guinea.util.Misc

java.lang.Object
   |
   +----guinea.util.Misc

public class Misc
extends Object

Constructor Index

· Misc()

Method Index

· concatArrays(Object[], Object[])
· concatArrays(String[], String[])
· getObject(ItemProperties, String)
Create an object from information in procerties.
· getObject2(Properties, String)
· getObject2(Properties, String, String)
· getObject2(Properties, String, String, Dictionary)
Create an object from information in procerties.
· getObject3(Properties, String, String, Dictionary)
Create an object from information in procerties.
· getObjectNames(Properties)
Get the list of object names in property list.
· loadLines(String)
Load lines from a file to a Vector.
· properties2bvector(Properties)
Create objects from information in a Properties-object.
· properties2bvector(Properties, String)
Create objects from information in a Properties-object.
· properties2bvector(Properties, Vector)
Create objects from information in a Properties-object.
· properties2bvector(Properties, Vector, String)
Create objects from information in a Properties-object.
· readProperties(String)
Read properties from a file.
· readProperties(String, Properties)
Read properties from a file and loads the properties to the given Properties object.
· saveObject(PropertySaver, ExtProperties)
· saveObject(PropertySaver, ExtProperties, String)
· stringToArray(String)
Convert a string-separated string to a array of strings.
· stringToVector(String)
Convert a comma-separated string to a vector of strings.
· stringToVector(String, String)
Convert a string-separated string to a vector of strings.

Constructors

· Misc
 public Misc()

Methods

· stringToVector
 public static Vector stringToVector(String s)
Convert a comma-separated string to a vector of strings.

Parameters:
s - the string to split.
Returns:
A vector containing strings.
· stringToVector
 public static Vector stringToVector(String s,
                                     String separator)
Convert a string-separated string to a vector of strings.

Parameters:
s - the string to split.
separator - the separator string.
Returns:
A vector containing strings.
See Also:
StringTokenizer
· stringToArray
 public static String[] stringToArray(String p)
Convert a string-separated string to a array of strings.

Parameters:
s - the string to split.
Returns:
An array of strings.
· getObject
 public static Object getObject(ItemProperties p,
                                String name) throws ClassNotFoundException, InstantiationException, IllegalAccessException
Create an object from information in procerties.

Parameters:
p - properties of object.
name - the name for the object.
Returns:
a new object
Throws: ClassNotFoundException
class with that name was not found.
Throws: InstantiationException
an instantiation error.
Throws: IllegalAccessException
illegal access.
· getObject2
 public static Object getObject2(Properties p,
                                 String name) throws ClassNotFoundException, InstantiationException, IllegalAccessException
· getObject2
 public static Object getObject2(Properties p,
                                 String name,
                                 String defClassName) throws ClassNotFoundException, InstantiationException, IllegalAccessException
· getObject2
 public static Object getObject2(Properties p,
                                 String name,
                                 String defClassName,
                                 Dictionary classAliases) throws ClassNotFoundException, InstantiationException, IllegalAccessException
Create an object from information in procerties. Class name for the object is looked from the class parameter in the properties. If it is not found, the default class name is used. Then if class aliases are provided, they are searched with the class name as the key. If a match is found, the calue will be used as the class or class name for the new object.

Parameters:
p - Properties of object.
name - The name for the object. If null, objects class name wil be passed as the name.
defClassName - Default class name for this object if the class property was not found from the object properties.
classAliases - A dictionary of class aliases. The class name of the object is used as the key. If a value is not found the class name remains the same it is. If the value is a string, it will be used as the class name. If the object is a Class object, it will be used as the class for the new object.
Returns:
A new object.
Throws: ClassNotFoundException
class with that name was not found.
Throws: InstantiationException
an instantiation error.
Throws: IllegalAccessException
illegal access.
· getObject3
 public static Object getObject3(Properties p,
                                 String name,
                                 String defClassName,
                                 Dictionary classAliases) throws ClassNotFoundException, InstantiationException, IllegalAccessException
Create an object from information in procerties. Class name for the object is looked from the class parameter in the properties. If it is not found, the default class name is used. Then if class aliases are provided, they are searched with the class name as the key. If a match is found, the calue will be used as the class or class name for the new object.

Parameters:
p - Properties of object.
name - The name for the object. If null, objects class name wil be passed as the name.
defClassName - Default class name for this object if the class property was not found from the object properties.
classAliases - A dictionary of class aliases. The class name of the object is used as the key. If a value is not found the class name remains the same it is. If the value is a string, it will be used as the class name. If the object is a Class object, it will be used as the class for the new object.
Returns:
A new object.
Throws: ClassNotFoundException
class with that name was not found.
Throws: InstantiationException
an instantiation error.
Throws: IllegalAccessException
illegal access.
· saveObject
 public static void saveObject(PropertySaver obj,
                               ExtProperties p)
· saveObject
 public static ItemProperties saveObject(PropertySaver obj,
                                         ExtProperties p,
                                         String name)
· getObjectNames
 public static Vector getObjectNames(Properties p)
Get the list of object names in property list.

Parameters:
p - the Properties object where to search for names
Returns:
a vector that contains the names of objects.
· readProperties
 public static Properties readProperties(String filename) throws IOException
Read properties from a file.

Parameters:
filename - file name of the property file.
Returns:
a Properties object.
· readProperties
 public static Properties readProperties(String filename,
                                         Properties p) throws IOException
Read properties from a file and loads the properties to the given Properties object.

Parameters:
filename - file name of the property file.
p - The properties where to load the properties. If it is null, a new Properties object is created.
Returns:
The Properties object passed to as p or a new object if p was null.
Throws: IOException
if an IO exception occured.
· properties2bvector
 public static BindingVector properties2bvector(Properties p) throws Exception
Create objects from information in a Properties-object.

Parameters:
p - the properties that contains information about objects.
Returns:
a BindingVector of objects.
Throws: Exception
if an error occured when creating objects.
· properties2bvector
 public static BindingVector properties2bvector(Properties p,
                                                String defClassName) throws Exception
Create objects from information in a Properties-object.

Parameters:
p - the properties that contains information about objects.
defClassName - Default class name that is used if class name is not provided in the properties.
Returns:
a BindingVector of objects.
Throws: Exception
if an error occured when creating objects.
· properties2bvector
 public static BindingVector properties2bvector(Properties p,
                                                Vector names) throws Exception
Create objects from information in a Properties-object.

Parameters:
p - the properties that contains information about objects.
names - the names of objects to create. If it is null, the names of objects are obtained by searching the properties with getObjectNames().
Returns:
a BindingVector of objects.
Throws: Exception
if an error occured when creating objects.
· properties2bvector
 public static BindingVector properties2bvector(Properties p,
                                                Vector names,
                                                String defClassName) throws Exception
Create objects from information in a Properties-object.

Parameters:
p - the properties that contains information about objects.
names - the names of objects to create. If it is null, the names of objects are obtained by searching the properties with getObjectNames().
defClassName - Default class name that is used if class name is not provided in the properties.
Returns:
a BindingVector of objects.
Throws: Exception
if an error occured when creating objects.
· loadLines
 public static Vector loadLines(String filename) throws IOException
Load lines from a file to a Vector. Comments and empty lines are ignored.

Parameters:
filename - File name of the file to load.
Returns:
A vector containing the lines as elements (as strings).
Throws: IOException
if an IO exception occured.
· concatArrays
 public static Object[] concatArrays(Object a1[],
                                     Object a2[])
· concatArrays
 public static Object[] concatArrays(String a1[],
                                     String a2[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index