org.apache.pig
Class FuncSpec

java.lang.Object
  extended by org.apache.pig.FuncSpec
All Implemented Interfaces:
Serializable, Cloneable

@InterfaceAudience.Public
@InterfaceStability.Stable
public class FuncSpec
extends Object
implements Serializable, Cloneable

Class to represent a UDF specification. Encapsulates the class name and the arguments to the constructor.

See Also:
Serialized Form

Constructor Summary
FuncSpec(String funcSpec)
           
FuncSpec(String funcSpec, Schema inputArgsSchema)
           
FuncSpec(String className, String ctorArg)
           
FuncSpec(String className, String[] ctorArgs)
           
FuncSpec(String className, String[] ctorArgs, Schema inputArgsSchema)
           
 
Method Summary
 FuncSpec clone()
           
 boolean equals(Object other)
           
static String getArgStringFromSpec(String funcSpec)
          Get the argument values passed to the func spec.
 String getClassName()
           
static String getClassNameFromSpec(String funcSpec)
          Parse the class name out of a function specification string.
 String[] getCtorArgs()
           
 Schema getInputArgsSchema()
           
 int hashCode()
           
static List<String> parseArguments(String argString)
          Parse the argument values out of a function specification string.
 void setClassName(String className)
           
 void setCtorArgs(String[] ctorArgs)
           
 void setInputArgsSchema(Schema inputArgsSchema)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FuncSpec

public FuncSpec(String className,
                String ctorArg)
Parameters:
className - the name of the class for the udf
ctorArg - the argument to pass the constructor for the above class. Constructors can only take strings.

FuncSpec

public FuncSpec(String className,
                String[] ctorArgs)
Parameters:
className - the name of the class for the udf
ctorArgs - the arguments to pass to the constructor for the above class. Constructors can only take strings.

FuncSpec

public FuncSpec(String className,
                String[] ctorArgs,
                Schema inputArgsSchema)
Parameters:
className - the name of the class for the udf
ctorArgs - the arguments to pass to the constructor for the above class. Constructors can only take strings.
inputArgsSchema - schema for input args taken by this Function

FuncSpec

public FuncSpec(String funcSpec)
Parameters:
funcSpec - the name of the function and any arguments. It should have the form: classname('arg1', 'arg2', ...)

FuncSpec

public FuncSpec(String funcSpec,
                Schema inputArgsSchema)
Parameters:
funcSpec - funcSpec the name of the function and any arguments. It should have the form: classname('arg1', 'arg2', ...)
inputArgsSchema - schema for input args taken by this Function
Method Detail

getClassNameFromSpec

public static String getClassNameFromSpec(String funcSpec)
Parse the class name out of a function specification string.

Returns:
name of the class.

getArgStringFromSpec

public static String getArgStringFromSpec(String funcSpec)
Get the argument values passed to the func spec.

Returns:
argument values. Format will be arg1, arg2, ... )

parseArguments

public static List<String> parseArguments(String argString)
Parse the argument values out of a function specification string.

Parameters:
argString - should be of the form "'arg1', 'arg2', ..."
Returns:
List of the different argument strings

getClassName

public String getClassName()
Returns:
the className

setClassName

public void setClassName(String className)
Parameters:
className - the className to set

getCtorArgs

public String[] getCtorArgs()
Returns:
the ctorArgs

setCtorArgs

public void setCtorArgs(String[] ctorArgs)
Parameters:
ctorArgs - the ctorArgs to set

toString

public String toString()
Overrides:
toString in class Object

getInputArgsSchema

public Schema getInputArgsSchema()
Returns:
the inputArgsSchema

setInputArgsSchema

public void setInputArgsSchema(Schema inputArgsSchema)
Parameters:
inputArgsSchema - the inputArgsSchema to set

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

clone

public FuncSpec clone()
               throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException


Copyright © 2007-2012 The Apache Software Foundation