braju.com
Java printf

com.braju.format
Class Parameters

java.lang.Object
  |
  +--com.braju.format.Parameters

public class Parameters
extends java.lang.Object

This class makes it possible to simulate parameter lists to method with arbitrary length. The parameters can be of any datatype or class.

This class was written to be used for the class Format and its printf()-methods, but it probably useful in other situations as well.
A closely related class is the class ParametersAutoClear. It is an empty class that can be inserted into the list to mark that we want the list to be cleared after one usage. It is up to the method that used the list to do this and to be aware that an object of class ParametersAutoClear can exists.
Note:Since version 1.3 is this class not subclassing java.lang.Vector.

See Also:
Format, ParametersAutoClear

Constructor Summary
Parameters()
          Creates an empty parameter list.
Parameters(boolean b)
          Creates a parameter list with the given boolean inserted.
Parameters(byte b)
          Creates a parameter list with the given byte inserted.
Parameters(char ch)
          Creates a parameter list with the given char inserted.
Parameters(double d)
          Creates a parameter list with the given double inserted.
Parameters(float f)
          Creates a parameter list with the given float inserted.
Parameters(int i)
          Creates a parameter list with the given integer inserted.
Parameters(long l)
          Creates a parameter list with the given long inserted.
Parameters(java.lang.Object obj)
          Creates a parameter list with the given object inserted.
Parameters(short sh)
          Creates a parameter list with the given short inserted.
Parameters(java.lang.String s)
          Creates a parameter list with the given string inserted.
Parameters(java.util.Vector vector)
          Creates a parameter list from a java.util.Vector.
 
Method Summary
 Parameters add(boolean b)
          Add a boolean to the list.
 Parameters add(byte b)
          Add an byte to the list.
 Parameters add(char ch)
          Add a char to the list.
 Parameters add(double d)
          Add a double to the list.
 Parameters add(float f)
          Add a float to the list.
 Parameters add(int i)
          Add an integer to the list.
 Parameters add(long l)
          Add a long to the list.
 Parameters add(java.lang.Object obj)
          Add an object to the list.
 Parameters add(short sh)
          Add an short to the list.
 Parameters add(java.lang.String s)
          Add a string to the list.
 Parameters autoClear(boolean clear)
          Place or remove a ParametersAutoClear at the first position.
 Parameters clear()
          Remove all parameters from the list.
 boolean isAutoClear()
          Checks if there is a ParameterAutoClear-object at the first position.
 java.util.Vector toVector()
          Return the list of parameters as a java.util.Vector.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parameters

public Parameters()
Creates an empty parameter list. A ParametersAutoClear is inserted at the first position.


Parameters

public Parameters(boolean b)
Creates a parameter list with the given boolean inserted. The boolean is wrapped in a Boolean-object. A ParametersAutoClear is inserted at the first position.


Parameters

public Parameters(byte b)
Creates a parameter list with the given byte inserted. The byte is wrapped in a Byte-object. A ParametersAutoClear is inserted at the first position.
Note: Not in the Java 1.0.2 version the wrapper class is com.braju.format.Byte.


Parameters

public Parameters(char ch)
Creates a parameter list with the given char inserted. The char is wrapped in a Character-object. A ParametersAutoClear is inserted at the first position.


Parameters

public Parameters(double d)
Creates a parameter list with the given double inserted. The double is wrapped in a Double-object. A ParametersAutoClear is inserted at the first position.


Parameters

public Parameters(float f)
Creates a parameter list with the given float inserted. The float is wrapped in a Float-object. A ParametersAutoClear is inserted at the first position.


Parameters

public Parameters(int i)
Creates a parameter list with the given integer inserted. The integer is wrapped in a Integer-object. A ParametersAutoClear is inserted at the first position.


Parameters

public Parameters(long l)
Creates a parameter list with the given long inserted. The long is wrapped in a Long-object. A ParametersAutoClear is inserted at the first position.


Parameters

public Parameters(java.lang.Object obj)
Creates a parameter list with the given object inserted. A ParametersAutoClear is inserted at the first position.


Parameters

public Parameters(short sh)
Creates a parameter list with the given short inserted. The short is wrapped in a Short-object. A ParametersAutoClear is inserted at the first position.
Note: Not in the Java 1.0.2 version the wrapper class is com.braju.format.Short.


Parameters

public Parameters(java.lang.String s)
Creates a parameter list with the given string inserted. A ParametersAutoClear is inserted at the first position.


Parameters

public Parameters(java.util.Vector vector)
Creates a parameter list from a java.util.Vector.

Method Detail

add

public Parameters add(boolean b)
Add a boolean to the list. The boolean is wrapped in a Boolean-object.

Returns:
A reference to the object itself.

add

public Parameters add(byte b)
Add an byte to the list. The byte is wrapped in a Byte-object.
Note: In the Java 1.0.2 version the wrapper class is com.braju.lang.Byte.

Returns:
A reference to the object itself.

add

public Parameters add(char ch)
Add a char to the list. The char is wrapped in a Character-object.

Returns:
A reference to the object itself.

add

public Parameters add(double d)
Add a double to the list. The double is wrapped in a Double-object.

Returns:
A reference to the object itself.

add

public Parameters add(float f)
Add a float to the list. The float is wrapped in a Float-object.

Returns:
A reference to the object itself.

add

public Parameters add(int i)
Add an integer to the list. The integer is wrapped in a Integer-object.

Returns:
A reference to the object itself.

add

public Parameters add(long l)
Add a long to the list. The long is wrapped in a Long-object.

Returns:
A reference to the object itself.

add

public Parameters add(java.lang.Object obj)
Add an object to the list.

Returns:
A reference to the object itself.

add

public Parameters add(short sh)
Add an short to the list. The short is wrapped in a Short-object.
Note: In the Java 1.0.2 version the wrapper class is com.braju.lang.Short.

Returns:
A reference to the object itself.

add

public Parameters add(java.lang.String s)
Add a string to the list.

Returns:
A reference to the object itself.

autoClear

public Parameters autoClear(boolean clear)
Place or remove a ParametersAutoClear at the first position.

Returns:
A reference to the object itself.

clear

public Parameters clear()
Remove all parameters from the list. If an ParameterAutoClear-object exists it is keept.

Returns:
A reference to the object itself.

isAutoClear

public boolean isAutoClear()
Checks if there is a ParameterAutoClear-object at the first position.

Returns:
True if a ParameterAutoClear-object exists, otherwise false.

toVector

public java.util.Vector toVector()
Return the list of parameters as a java.util.Vector.


braju.com
Java printf

Copyright 1997-2003, Henrik Bengtsson.