net.sourceforge.jparam
Class JParam

java.lang.Object
  |
  +--net.sourceforge.jparam.JParam

public class JParam
extends java.lang.Object

This is the main JParam class, in order to use JParam, use the static methods of this class

Author:
ron_sidi

Constructor Summary
JParam()
           
 
Method Summary
static java.lang.String help(java.lang.String topic)
          This method should give help about certain parameters and status of JParam
static void init()
          Initializes all the registries of JParam, this must be called before JParam can be used
static java.lang.Object parse(java.lang.String str)
          Parse the given string into the Java object it represents
static java.lang.Object readObject(java.io.InputStream in)
          Parse an Object from the given input stream
static void readValueSet(java.io.InputStream in, AssignmentListener listener)
          Read a set of values from the given stream, the notifyAssignemnt will be called for each assignment in the input stream, this shouldn't be a public interface, but since Java lacks the friend funcionality this has to be public for the ParamSet class to reference
static void registerClass(java.lang.String typeName, java.lang.Class type)
          Register the given Class as the given JParam type
static void registerClass(java.lang.String typeName, java.lang.Class type, java.lang.Class helperClass)
          Register the class as well as the gien helper class All methods from the helper class will be defined regardless of whether or not they are related to the given class
static void registerConstant(java.lang.String name, java.lang.Object value)
          A helper method for registering constants, when the string literal name will be detected in the JParam input, it will be switched with the given value
static void registerHelperClass(java.lang.Class helperClass)
          Register all available creators/converters/serializers/constants from the given helper class
static java.lang.String toString(java.lang.Object obj)
          Get the JParam string representation of the given Object, same restrictions like in writeObject
static void writeObject(java.lang.Object obj, java.io.PrintStream out)
          Output the given object to the given PrintStream, the object's class and all of its internal members must be registered in JParam for this to work
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JParam

public JParam()
Method Detail

init

public static void init()
Initializes all the registries of JParam, this must be called before JParam can be used

help

public static java.lang.String help(java.lang.String topic)
This method should give help about certain parameters and status of JParam
Parameters:
topic -  
Returns:
 

parse

public static java.lang.Object parse(java.lang.String str)
                              throws JParamException
Parse the given string into the Java object it represents
Parameters:
str - A string representation in JParam format
Returns:
Object
Throws:
JParamException - if the parse failed

readObject

public static java.lang.Object readObject(java.io.InputStream in)
                                   throws JParamException
Parse an Object from the given input stream
Parameters:
in - InputStream from which a JParam formatted string can be read
Returns:
@throws JParamException

readValueSet

public static void readValueSet(java.io.InputStream in,
                                AssignmentListener listener)
                         throws JParamException
Read a set of values from the given stream, the notifyAssignemnt will be called for each assignment in the input stream, this shouldn't be a public interface, but since Java lacks the friend funcionality this has to be public for the ParamSet class to reference
Parameters:
in -  
listener -  
Throws:
JParamException -  

writeObject

public static void writeObject(java.lang.Object obj,
                               java.io.PrintStream out)
                        throws JParamException
Output the given object to the given PrintStream, the object's class and all of its internal members must be registered in JParam for this to work
Parameters:
obj -  
out -  
Throws:
JParamException -  

toString

public static java.lang.String toString(java.lang.Object obj)
                                 throws JParamException
Get the JParam string representation of the given Object, same restrictions like in writeObject
Parameters:
obj -  
Returns:
@throws JParamException

registerClass

public static void registerClass(java.lang.String typeName,
                                 java.lang.Class type)
Register the given Class as the given JParam type
Parameters:
typeName - the type name in JParam syntax that will represent this class
type -  

registerClass

public static void registerClass(java.lang.String typeName,
                                 java.lang.Class type,
                                 java.lang.Class helperClass)
Register the class as well as the gien helper class All methods from the helper class will be defined regardless of whether or not they are related to the given class
Parameters:
typeName -  
type -  
helperClass -  

registerHelperClass

public static void registerHelperClass(java.lang.Class helperClass)
Register all available creators/converters/serializers/constants from the given helper class
Parameters:
helperClass -  
See Also:
CreatorRegistry, SerializerRegistry, ConverterRegistry, ConstantRegistry

registerConstant

public static void registerConstant(java.lang.String name,
                                    java.lang.Object value)
A helper method for registering constants, when the string literal name will be detected in the JParam input, it will be switched with the given value
Parameters:
name -  
value -  


Copyright © 2004 SourceForge. All Rights Reserved.