org.apache.pig.scripting.jruby
Class RubySchema

java.lang.Object
  extended by org.jruby.RubyBasicObject
      extended by org.jruby.RubyObject
          extended by org.apache.pig.scripting.jruby.RubySchema
All Implemented Interfaces:
Serializable, Cloneable, Comparable<org.jruby.runtime.builtin.IRubyObject>, org.jruby.runtime.builtin.InstanceVariables, org.jruby.runtime.builtin.InternalVariables, org.jruby.runtime.builtin.IRubyObject, org.jruby.runtime.marshal.CoreObjectType

public class RubySchema
extends org.jruby.RubyObject

This class encapsulated a native Schema object, and provides a more convenient interface for manipulating Schemas. It hides the Schema/FieldSchema distinction from the user, and tries to present a cleaner, more Ruby-esque API to the user. For general information on JRuby's API definition annotations, see RubyDataBag.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jruby.RubyObject
org.jruby.RubyObject.Data
 
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject
org.jruby.RubyBasicObject.Finalizer
 
Field Summary
 
Fields inherited from class org.jruby.RubyObject
OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
 
Fields inherited from class org.jruby.RubyBasicObject
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, TAINTED_F, UNDEF, UNTRUSTED_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F
 
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
 
Constructor Summary
protected RubySchema(org.jruby.Ruby ruby, org.jruby.RubyClass rc)
           
protected RubySchema(org.jruby.Ruby ruby, org.jruby.RubyClass rc, Schema s)
          This constructor sets the encapsulated Schema to be equal to the given Schema.
protected RubySchema(org.jruby.Ruby ruby, org.jruby.RubyClass rc, Schema s, boolean copy)
          This constructor sets the encapsulated Schema to be equal to the given Schema.
protected RubySchema(org.jruby.Ruby ruby, org.jruby.RubyClass rc, String s)
          This constructor is provided for convenience and sets the internal Schema equal to the result of a call to Utils.getSchemaFromString(java.lang.String).
 
Method Summary
 RubySchema add(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)
          This method provides addition semantics, without modifying the original Schema.
 void addInPlace(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)
          This method provides addition semantics, modifying the original Schema in place.
static RubySchema bag(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self, org.jruby.runtime.builtin.IRubyObject arg)
          This is a ruby method which takes an array of arguments and constructs a Bag schema from them.
static RubySchema bag(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2)
          This is a ruby method which takes a name and an array of arguments and constructs a Bag schema from them.
 RubySchema clone(org.jruby.runtime.ThreadContext context)
           
static org.jruby.RubyClass define(org.jruby.Ruby runtime)
          This method registers the class with the given runtime.
 RubySchema find(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)
          Given a field name this string will search the RubySchema for a FieldSchema with that name and return it encapsulated in a Schema.
 RubySchema get(org.jruby.runtime.ThreadContext context)
          This method allows access into the Schema nested in the encapsulated Schema.
 RubySchema get(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)
          This is the ruby method which allows people to access elements of the RubySchema object.
 RubySchema get(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2)
          This is a version of [] which allows the range to be specified as such: [1,2].
 Schema getInternalSchema()
          This is a helper method to pull out the native Java type from the ruby object.
 org.jruby.RubyString getName(org.jruby.runtime.ThreadContext context)
          This method allows the user to see the name of the alias of the FieldSchema of the encapsulated Schema.
 org.jruby.RubyFixnum index(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)
          Given a field name, this will return the index of it in the schema.
 RubySchema initialize(org.jruby.runtime.builtin.IRubyObject[] args)
          The ruby initializer accepts any number of arguments.
static RubySchema map(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self, org.jruby.runtime.builtin.IRubyObject arg)
          This is a ruby method which takes an array of arguments and constructs a Map schema from them.
static RubySchema map(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2)
          This is a ruby method which takes a name and an array of arguments and constructs a Map schema from them.
static RubySchema nullBag(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self)
          This is a static helper method to create a null aliased bag Schema.
static RubySchema nullBoolean(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self)
          This is a static helper method to create a null aliased Boolean Schema.
static RubySchema nullBytearray(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self)
          This is a static helper method to create a null aliased bytearray Schema.
static RubySchema nullChararray(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self)
          This is a static helper method to create a null aliased chararray Schema.
static RubySchema nullDateTime(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self)
          This is a static helper method to create a null aliased datetime Schema.
static RubySchema nullDouble(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self)
          This is a static helper method to create a null aliased double Schema.
static RubySchema nullFloate(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self)
          This is a static helper method to create a null aliased float Schema.
static RubySchema nullInt(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self)
          This is a static helper method to create a null aliased int Schema.
static RubySchema nullLong(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self)
          This is a static helper method to create a null aliased long Schema.
static RubySchema nullMap(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self)
          This is a static helper method to create a null aliased map Schema.
static RubySchema nullTuple(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self)
          This is a static helper method to create a null aliased tuple Schema.
static Schema rubyArgToSchema(Object arg)
          This is a helper function which converts objects into Schema objects.
 RubySchema set(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)
          This allows the users to set an index or a range of values to a specified RubySchema.
 org.jruby.RubyString setName(org.jruby.runtime.builtin.IRubyObject arg)
          This method allows the user to set the name of the alias of the FieldSchema of the encapsulated Schema.
 org.jruby.RubyFixnum size(org.jruby.runtime.ThreadContext context)
           
 org.jruby.RubyString toString(org.jruby.runtime.ThreadContext context)
          The toString method just leverages Schema's printing.
static RubySchema tuple(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self, org.jruby.runtime.builtin.IRubyObject arg)
          This is a ruby method which takes an array of arguments and constructs a Tuple schema from them.
static RubySchema tuple(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject self, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2)
          This is a ruby method which takes a name and an array of arguments and constructs a Tuple schema from them.
 
Methods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, eqlInternal, equalInternal, equals, getNativeTypeIndex, hashCode, initialize, initialize, op_eqq, puts, specificEval, toString
 
Methods inherited from class org.jruby.RubyBasicObject
addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkFrozen, checkStringType, checkStringType19, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, display, dup, ensureInstanceVariablesSettable, eql_p, eql, equal_p, equal_p19, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, freeze, frozen_p, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMetaClass, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, getVariableTableForRead, getVariableTableForWrite, hash, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id_deprecated, id, infectBy, initialize_copy, initialize19, initialize19, initialize19, initialize19, initialize19, initObjectId, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval19, instance_eval19, instance_eval19, instance_eval19, instance_exec, instance_exec19, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, instance_variables19, isBuiltin, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method_missing19, method, method19, methods, methods, methods19, nil_p, op_cmp, op_equal_19, op_equal, op_match, op_match19, op_not_equal, op_not_match, op_not, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbClone, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respond_to_p19, respond_to_p19, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, send19, send19, send19, send19, send19, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setTaint, setUntrusted, setVariable, singleton_method_added19, singleton_method_removed19, singleton_method_undefined19, singleton_methods, singleton_methods19, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, to_s, toJava, trust, type_deprecated, type, untaint, untrust, untrusted_p, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RubySchema

protected RubySchema(org.jruby.Ruby ruby,
                     org.jruby.RubyClass rc)

RubySchema

protected RubySchema(org.jruby.Ruby ruby,
                     org.jruby.RubyClass rc,
                     Schema s,
                     boolean copy)
This constructor sets the encapsulated Schema to be equal to the given Schema. If copy is true, it is set equal to a copy. If it is false, it is set directly equal.

Parameters:
ruby - an instance of the ruby runtime
rc - an instance of the class object with meatadata
s - a Schema to encapsulate
copy - a boolean value. If true, s will be copied and the copy will be encapsulated. If false, it will be encapsulated directly.

RubySchema

protected RubySchema(org.jruby.Ruby ruby,
                     org.jruby.RubyClass rc,
                     Schema s)
This constructor sets the encapsulated Schema to be equal to the given Schema.

Parameters:
ruby - an instance of the ruby runtime
rc - an instance of the class object with meatadata
s - a Schema to encapsulate

RubySchema

protected RubySchema(org.jruby.Ruby ruby,
                     org.jruby.RubyClass rc,
                     String s)
This constructor is provided for convenience and sets the internal Schema equal to the result of a call to Utils.getSchemaFromString(java.lang.String).

Parameters:
ruby - an instance of the ruby runtime
rc - an instance of the class object with meatadata
s - a String which will be passed to Utils.getSchemaFromString(java.lang.String)
Method Detail

define

public static org.jruby.RubyClass define(org.jruby.Ruby runtime)
This method registers the class with the given runtime.

Parameters:
runtime - an instance of the Ruby runtime
Returns:
a RubyClass object with metadata about the registered class

initialize

public RubySchema initialize(org.jruby.runtime.builtin.IRubyObject[] args)
The ruby initializer accepts any number of arguments. With no arguments, it will return an empty Schema object. It can accept any number of arguments. To understand the valid arguments, see the documentation for rubyArgToSchema(java.lang.Object).

Parameters:
args - a varargs which can take any number of valid arguments to rubyArgToSchema(java.lang.Object)
Returns:
the initialized RubySchema

nullBytearray

public static RubySchema nullBytearray(org.jruby.runtime.ThreadContext context,
                                       org.jruby.runtime.builtin.IRubyObject self)
This is a static helper method to create a null aliased bytearray Schema. This is useful in cases where you do not want the output to have an explicit name, which Utils.getSchemaFromString(java.lang.String) will assign.

Parameters:
context - the context the method is being executed in
self - an instance of the RubyClass with metadata on the Ruby class object this method is being statically invoked against
Returns:
a null-aliased bytearray schema

nullBoolean

public static RubySchema nullBoolean(org.jruby.runtime.ThreadContext context,
                                     org.jruby.runtime.builtin.IRubyObject self)
This is a static helper method to create a null aliased Boolean Schema. This is useful in cases where you do not want the output to have an explicit name, which Utils.getSchemaFromString(java.lang.String) will assign.

Parameters:
context - the context the method is being executed in
self - an instance of the RubyClass with metadata on the Ruby class object this method is being statically invoked against
Returns:
a null-aliased bytearray schema

nullChararray

public static RubySchema nullChararray(org.jruby.runtime.ThreadContext context,
                                       org.jruby.runtime.builtin.IRubyObject self)
This is a static helper method to create a null aliased chararray Schema. This is useful in cases where you do not want the output to have an explicit name, which Utils.getSchemaFromString(java.lang.String) will assign.

Parameters:
context - the context the method is being executed in
self - an instance of the RubyClass with metadata on the Ruby class object this method is being statically invoked against
Returns:
a null-aliased bytearray schema

nullLong

public static RubySchema nullLong(org.jruby.runtime.ThreadContext context,
                                  org.jruby.runtime.builtin.IRubyObject self)
This is a static helper method to create a null aliased long Schema. This is useful in cases where you do not want the output to have an explicit name, which Utils.getSchemaFromString(java.lang.String) will assign.

Parameters:
context - the context the method is being executed in
self - an instance of the RubyClass with metadata on the Ruby class object this method is being statically invoked against
Returns:
a null-aliased bytearray schema

nullInt

public static RubySchema nullInt(org.jruby.runtime.ThreadContext context,
                                 org.jruby.runtime.builtin.IRubyObject self)
This is a static helper method to create a null aliased int Schema. This is useful in cases where you do not want the output to have an explicit name, which Utils.getSchemaFromString(java.lang.String) will assign.

Parameters:
context - the context the method is being executed in
self - an instance of the RubyClass with metadata on the Ruby class object this method is being statically invoked against
Returns:
a null-aliased bytearray schema

nullDouble

public static RubySchema nullDouble(org.jruby.runtime.ThreadContext context,
                                    org.jruby.runtime.builtin.IRubyObject self)
This is a static helper method to create a null aliased double Schema. This is useful in cases where you do not want the output to have an explicit name, which Utils.getSchemaFromString(java.lang.String) will assign.

Parameters:
context - the context the method is being executed in
self - an instance of the RubyClass with metadata on the Ruby class object this method is being statically invoked against
Returns:
a null-aliased bytearray schema

nullFloate

public static RubySchema nullFloate(org.jruby.runtime.ThreadContext context,
                                    org.jruby.runtime.builtin.IRubyObject self)
This is a static helper method to create a null aliased float Schema. This is useful in cases where you do not want the output to have an explicit name, which Utils.getSchemaFromString(java.lang.String) will assign.

Parameters:
context - the context the method is being executed in
self - an instance of the RubyClass with metadata on the Ruby class object this method is being statically invoked against
Returns:
a null-aliased bytearray schema

nullDateTime

public static RubySchema nullDateTime(org.jruby.runtime.ThreadContext context,
                                      org.jruby.runtime.builtin.IRubyObject self)
This is a static helper method to create a null aliased datetime Schema. This is useful in cases where you do not want the output to have an explicit name, which Utils.getSchemaFromString(java.lang.String) will assign.

Parameters:
context - the context the method is being executed in
self - an instance of the RubyClass with metadata on the Ruby class object this method is being statically invoked against
Returns:
a null-aliased bytearray schema

nullTuple

public static RubySchema nullTuple(org.jruby.runtime.ThreadContext context,
                                   org.jruby.runtime.builtin.IRubyObject self)
This is a static helper method to create a null aliased tuple Schema. This is useful in cases where you do not want the output to have an explicit name, which Utils.getSchemaFromString(java.lang.String) will assign.

Parameters:
context - the context the method is being executed in
self - an instance of the RubyClass with metadata on the Ruby class object this method is being statically invoked against
Returns:
a null-aliased bytearray schema

nullBag

public static RubySchema nullBag(org.jruby.runtime.ThreadContext context,
                                 org.jruby.runtime.builtin.IRubyObject self)
This is a static helper method to create a null aliased bag Schema. This is useful in cases where you do not want the output to have an explicit name, which Utils.getSchemaFromString(java.lang.String) will assign.

Parameters:
context - the context the method is being executed in
self - an instance of the RubyClass with metadata on the Ruby class object this method is being statically invoked against
Returns:
a null-aliased bytearray schema

nullMap

public static RubySchema nullMap(org.jruby.runtime.ThreadContext context,
                                 org.jruby.runtime.builtin.IRubyObject self)
This is a static helper method to create a null aliased map Schema. This is useful in cases where you do not want the output to have an explicit name, which Utils.getSchemaFromString(java.lang.String) will assign.

Parameters:
context - the context the method is being executed in
self - an instance of the RubyClass with metadata on the Ruby class object this method is being statically invoked against
Returns:
a null-aliased bytearray schema

rubyArgToSchema

public static Schema rubyArgToSchema(Object arg)
This is a helper function which converts objects into Schema objects. The valid options are as follows:

A RubyString, which will have Utils.getSchemaFromString(java.lang.String) called on it, and it will be added.

A RubySchema, which will be added directly. IMPORTANT NOTE: since this API abstracts away from the distinction between Schema/FieldSchema, its important to understand how a Schema is added to another. In this case, the FieldSchema is pulled directly out of the given Schema. Thus, where in Pig a Schema.FieldSchema might be passed around, internally to this class, generally a Schema will be passed around encapsulating it.

A list will create the Schema for a Tuple whose elements will be the elements of the list. Each element will be subjected to the same rules applied here.

A hash in the form of:
{"name:tuple"=>["x:int","y:int,z:int"], "name2:bag"=>["a:chararray"]}
The keys must be a tuple, bag, or map, and the value must be an array.

Parameters:
arg - an object (generally an IRubyObject or String) to convert. See above for the rules on valid arguments
Returns:
the Schema constructed for the given argument

tuple

public static RubySchema tuple(org.jruby.runtime.ThreadContext context,
                               org.jruby.runtime.builtin.IRubyObject self,
                               org.jruby.runtime.builtin.IRubyObject arg1,
                               org.jruby.runtime.builtin.IRubyObject arg2)
This is a ruby method which takes a name and an array of arguments and constructs a Tuple schema from them.

Parameters:
context - the context the method is being executed in
self - the RubyClass for the Class object this was invoked on
arg1 - the name for the RubySchema
arg2 - a list of arguments to instantiate the new RubySchema
Returns:
the new Tuple RubySchema

tuple

public static RubySchema tuple(org.jruby.runtime.ThreadContext context,
                               org.jruby.runtime.builtin.IRubyObject self,
                               org.jruby.runtime.builtin.IRubyObject arg)
This is a ruby method which takes an array of arguments and constructs a Tuple schema from them. The name will be set automatically.

Parameters:
context - the context the method is being executed in
self - the RubyClass for the Class object this was invoked on
arg - a list of arguments to instantiate the new RubySchema
Returns:
the new RubySchema

map

public static RubySchema map(org.jruby.runtime.ThreadContext context,
                             org.jruby.runtime.builtin.IRubyObject self,
                             org.jruby.runtime.builtin.IRubyObject arg1,
                             org.jruby.runtime.builtin.IRubyObject arg2)
This is a ruby method which takes a name and an array of arguments and constructs a Map schema from them.

Parameters:
context - the context the method is being executed in
self - the RubyClass for the Class object this was invoked on
arg1 - the name for the RubySchema
arg2 - a list of arguments to instantiate the new RubySchema
Returns:
the new RubySchema

map

public static RubySchema map(org.jruby.runtime.ThreadContext context,
                             org.jruby.runtime.builtin.IRubyObject self,
                             org.jruby.runtime.builtin.IRubyObject arg)
This is a ruby method which takes an array of arguments and constructs a Map schema from them. The name will be set automatically.

Parameters:
context - the context the method is being executed in
self - the RubyClass for the Class object this was invoked on
arg - a list of arguments to instantiate the new RubySchema
Returns:
the new RubySchema

bag

public static RubySchema bag(org.jruby.runtime.ThreadContext context,
                             org.jruby.runtime.builtin.IRubyObject self,
                             org.jruby.runtime.builtin.IRubyObject arg1,
                             org.jruby.runtime.builtin.IRubyObject arg2)
This is a ruby method which takes a name and an array of arguments and constructs a Bag schema from them.

Parameters:
context - the context the method is being executed in
self - the RubyClass for the Class object this was invoked on
arg1 - the name for the RubySchema
arg2 - a list of arguments to instantiate the new RubySchema
Returns:
the new RubySchema

bag

public static RubySchema bag(org.jruby.runtime.ThreadContext context,
                             org.jruby.runtime.builtin.IRubyObject self,
                             org.jruby.runtime.builtin.IRubyObject arg)
This is a ruby method which takes an array of arguments and constructs a Bag schema from them. The name will be set automatically.

Parameters:
context - the context the method is being executed in
self - the RubyClass for the Class object this was invoked on
arg - a list of arguments to instantiate the new RubySchema
Returns:
the new RubySchema

toString

public org.jruby.RubyString toString(org.jruby.runtime.ThreadContext context)
The toString method just leverages Schema's printing.

Parameters:
context - the context the method is being executed in
Returns:
a String representation of the encapsulated Schema object

get

public RubySchema get(org.jruby.runtime.ThreadContext context,
                      org.jruby.runtime.builtin.IRubyObject arg)
This is the ruby method which allows people to access elements of the RubySchema object. It can be given either a single numeric index, or a Range object to specify a range of indices. It's important to note that the Schema object returned from this references the Schema stored internally, so if the user wants to make changes without affecting this object, it must be cloned.

Parameters:
context - the context the method is being executed in
arg - a Fixnum index, Range object to specify a range of values to return, or a String to look up by alias name
Returns:
the RubySchema object encapsulated the found Schema

get

public RubySchema get(org.jruby.runtime.ThreadContext context,
                      org.jruby.runtime.builtin.IRubyObject arg1,
                      org.jruby.runtime.builtin.IRubyObject arg2)
This is a version of [] which allows the range to be specified as such: [1,2].

Parameters:
context - the context the method is being executed in
arg1 - a Fixnum start index
arg2 - a Fixnum end index
Returns:
the RubySchema object encapsulated the found Schema

set

public RubySchema set(org.jruby.runtime.ThreadContext context,
                      org.jruby.runtime.builtin.IRubyObject[] args)
This allows the users to set an index or a range of values to a specified RubySchema. The first argument must be a Fixnum or Range, and the second argument may optionally be a Fixnum. The given index (or range of indices) will be replaced by a RubySchema instantiated based on the remaining arguments.

Parameters:
context - the contextthe method is being executed in
args - a varargs which has to be at least length two.
Returns:
the RubySchema that was added

add

public RubySchema add(org.jruby.runtime.ThreadContext context,
                      org.jruby.runtime.builtin.IRubyObject[] args)
This method provides addition semantics, without modifying the original Schema. This method can be given any number of arguments, much as with the constructor.

Parameters:
context - the context the method is being executed in
args - a varargs which can be any valid set of arguments that can initialize a RubySchema
Returns:
the Rresult of the addition

addInPlace

public void addInPlace(org.jruby.runtime.ThreadContext context,
                       org.jruby.runtime.builtin.IRubyObject[] args)
This method provides addition semantics, modifying the original Schema in place. This method can be given any number of arguments, much as with the constructor.

Parameters:
context - the context the method is being executed in
args - a varargs which can be any valid set of arguments that can initialize a RubySchema

clone

public RubySchema clone(org.jruby.runtime.ThreadContext context)
Parameters:
context - the context the method is being executed in
Returns:
a RubySchema copy of the Schema

find

public RubySchema find(org.jruby.runtime.ThreadContext context,
                       org.jruby.runtime.builtin.IRubyObject arg)
Given a field name this string will search the RubySchema for a FieldSchema with that name and return it encapsulated in a Schema.

Parameters:
context - the context the method is being executed in
arg - a RubyString serving as an alias to look for in the Schema
Returns:
the found RubySchema

index

public org.jruby.RubyFixnum index(org.jruby.runtime.ThreadContext context,
                                  org.jruby.runtime.builtin.IRubyObject arg)
Given a field name, this will return the index of it in the schema.

Parameters:
context - the context the method is being executed in
arg - a field name to look for
Returns:
the index for that field name

size

public org.jruby.RubyFixnum size(org.jruby.runtime.ThreadContext context)
Parameters:
context - the context the method is being executed in
Returns:
the size of the encapsulated Schema

getInternalSchema

public Schema getInternalSchema()
This is a helper method to pull out the native Java type from the ruby object.

Returns:
the encapsulated Schema

get

public RubySchema get(org.jruby.runtime.ThreadContext context)
This method allows access into the Schema nested in the encapsulated Schema. For example, if the encapsulated Schema is a bag Schema, this allows the user to access the schema of the interior Tuple.

Parameters:
context - the context the method is being executed in
Returns:
a RubySchema encapsulating the nested Schema

getName

public org.jruby.RubyString getName(org.jruby.runtime.ThreadContext context)
This method allows the user to see the name of the alias of the FieldSchema of the encapsulated Schema. This method only works if the Schema has one FieldSchema.

Parameters:
context - the context the method is being executed in
Returns:
the name of the Schema

setName

public org.jruby.RubyString setName(org.jruby.runtime.builtin.IRubyObject arg)
This method allows the user to set the name of the alias of the FieldSchema of the encapsulated Schema. This method only works if the Schema has one FieldSchema.

Parameters:
arg - a RubyString to set the name to
Returns:
the new name


Copyright © 2007-2012 The Apache Software Foundation