FileDocCategorySizeDatePackage
OperationFactory.javaAPI DocJava SE 5 API13689Fri Aug 26 14:54:38 BST 2005com.sun.corba.se.spi.orb

OperationFactory

public abstract class OperationFactory extends Object
This is a static factory class for commonly used operations for property parsing. The following operations are supported:
  • maskErrorAction( Operation op ) executes op and returns the result. If op throws an exception, the result is null.
  • indexAction( int arg ) returns the [arg] element of value, which must be an Object[]
  • identityAction() return the value
  • booleanAction() return a Boolean representing true or false values of the String value
  • integerAction() returns an Integer for the String value, which must be a decimal integer
  • stringAction() returns the String value
  • classAction() returns a class for the String value, as loaded by the ORB classloader
  • setFlagAction() always return Boolean.TRUE
  • URLAction() returns a java.net.URL for the String value, which must be a valid URL
  • integerRangeAction( int min, int max ) returns an Integer for the String value, which must be a decimal integer in the range min to max inclusive
  • listAction( String sep, Operation ) tokenizes the String value with sep as separator, then applies the Operation to each token, and returns an array of the result
  • sequenceAction( String, Operation[] ) tokenizes the String value with sep as separator, then applies each Operation in the Operation array to successive tokens, and returns an array of the results
  • compose( Operation op1, Operation op2 ) is the operation that applies op2 to the result of applying op1 to the value
  • mapAction( Operation ) applies the Operation to each element of an array of objects, and returns an array of the results
  • mapSequenceAction( Operation[] ) applies the corresponding element of the Operation array to an element of the Object[] value, and returns an array of the results
  • convertIntegerToShort coerces an Integer into a Short.
Other operations can be directly defined, and combined using these basic operations.

Fields Summary
private static Operation
suffixActionImpl
private static Operation
valueActionImpl
private static Operation
identityActionImpl
private static Operation
booleanActionImpl
private static Operation
integerActionImpl
private static Operation
stringActionImpl
private static Operation
classActionImpl
private static Operation
setFlagActionImpl
private static Operation
URLActionImpl
private static Operation
convertIntegerToShortImpl
Constructors Summary
private OperationFactory()

Methods Summary
public static OperationURLAction()

	return URLActionImpl ;
    
public static OperationbooleanAction()

	return booleanActionImpl ;
    
public static OperationclassAction()

	return classActionImpl ;
    
public static Operationcompose(Operation op1, Operation op2)

	return new ComposeAction( op1, op2 ) ;
    
public static OperationconvertIntegerToShort()


        
    
	return convertIntegerToShortImpl ;
    
private static java.lang.Object[]getObjectArray(java.lang.Object obj)

	if (obj instanceof Object[])
	    return (Object[])obj ;
	else
	    throw new Error( "Object[] expected" ) ;
    
private static java.lang.StringgetString(java.lang.Object obj)

	if (obj instanceof String)
	    return (String)obj ;
	else
	    throw new Error( "String expected" ) ;
    
private static StringPairgetStringPair(java.lang.Object obj)

	if (obj instanceof StringPair)
	    return (StringPair)obj ;
	else
	    throw new Error( "StringPair expected" ) ;
    
public static OperationidentityAction()


       
    
	return identityActionImpl ;
    
public static OperationindexAction(int index)

	return new IndexAction( index ) ;
    
public static OperationintegerAction()

	return integerActionImpl ;
    
public static OperationintegerRangeAction(int min, int max)

	return new IntegerRangeAction( min, max ) ;
    
public static OperationlistAction(java.lang.String sep, Operation act)

	return new ListAction( sep, act ) ;
    
public static OperationmapAction(Operation op)

	return new MapAction( op ) ;
    
public static OperationmapSequenceAction(Operation[] op)

	return new MapSequenceAction( op ) ;
    
public static OperationmaskErrorAction(Operation op)

	return new MaskErrorAction( op ) ;
    
public static OperationsequenceAction(java.lang.String sep, Operation[] actions)

	return new SequenceAction( sep, actions ) ;
    
public static OperationsetFlagAction()

	return setFlagActionImpl ;
    
public static OperationstringAction()

	return stringActionImpl ;
    
public static OperationsuffixAction()

	return suffixActionImpl ;
    
public static OperationvalueAction()

	return valueActionImpl ;