vertx-pg-client-js.row.js Maven / Gradle / Ivy
/*
* Copyright 2014 Red Hat, Inc.
*
* Red Hat licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
/** @module vertx-pg-client-js/row */
var utils = require('vertx-js/util/utils');
var Tuple = require('vertx-pg-client-js/tuple');
var Buffer = require('vertx-js/buffer');
var io = Packages.io;
var JsonObject = io.vertx.core.json.JsonObject;
var JRow = Java.type('com.julienviet.pgclient.Row');
/**
@class
*/
var Row = function(j_val) {
var j_row = j_val;
var that = this;
Tuple.call(this, j_val);
/**
Get a boolean value at pos
.
@public
@param name {string} the column
@return {boolean} the value or null
*/
this.getBoolean = function() {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
return j_row["getBoolean(int)"](__args[0]);
} else if (__args.length === 1 && typeof __args[0] === 'string') {
return j_row["getBoolean(java.lang.String)"](__args[0]);
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Get an object value at pos
.
@public
@param name {string} the column
@return {Object} the value or null
*/
this.getValue = function() {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
return utils.convReturnTypeUnknown(j_row["getValue(int)"](__args[0]));
} else if (__args.length === 1 && typeof __args[0] === 'string') {
return utils.convReturnTypeUnknown(j_row["getValue(java.lang.String)"](__args[0]));
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Get an integer value at pos
.
@public
@param name {string} the column
@return {number} the value or null
*/
this.getInteger = function() {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
return j_row["getInteger(int)"](__args[0]);
} else if (__args.length === 1 && typeof __args[0] === 'string') {
return j_row["getInteger(java.lang.String)"](__args[0]);
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Get a long value at pos
.
@public
@param name {string} the column
@return {number} the value or null
*/
this.getLong = function() {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
return utils.convReturnLong(j_row["getLong(int)"](__args[0]));
} else if (__args.length === 1 && typeof __args[0] === 'string') {
return utils.convReturnLong(j_row["getLong(java.lang.String)"](__args[0]));
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Get a float value at pos
.
@public
@param name {string} the column
@return {number} the value or null
*/
this.getFloat = function() {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
return j_row["getFloat(int)"](__args[0]);
} else if (__args.length === 1 && typeof __args[0] === 'string') {
return j_row["getFloat(java.lang.String)"](__args[0]);
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Get a double value at pos
.
@public
@param name {string} the column
@return {number} the value or null
*/
this.getDouble = function() {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
return j_row["getDouble(int)"](__args[0]);
} else if (__args.length === 1 && typeof __args[0] === 'string') {
return j_row["getDouble(java.lang.String)"](__args[0]);
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Get a string value at pos
.
@public
@param name {string} the column
@return {string} the value or null
*/
this.getString = function() {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
return j_row["getString(int)"](__args[0]);
} else if (__args.length === 1 && typeof __args[0] === 'string') {
return j_row["getString(java.lang.String)"](__args[0]);
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Get a string value at pos
.
@public
@param name {string} the column
@return {string} the value or null
*/
this.getCharacter = function() {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
return j_row["getCharacter(int)"](__args[0]);
} else if (__args.length === 1 && typeof __args[0] === 'string') {
return j_row["getCharacter(java.lang.String)"](__args[0]);
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Get a json object value at pos
.
@public
@param name {string} the column
@return {Object} the value or null
*/
this.getJsonObject = function() {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
return utils.convReturnJson(j_row["getJsonObject(int)"](__args[0]));
} else if (__args.length === 1 && typeof __args[0] === 'string') {
return utils.convReturnJson(j_row["getJsonObject(java.lang.String)"](__args[0]));
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Get a json array value at pos
.
@public
@param name {string} the column
@return {todo} the value or null
*/
this.getJsonArray = function() {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
return utils.convReturnJson(j_row["getJsonArray(int)"](__args[0]));
} else if (__args.length === 1 && typeof __args[0] === 'string') {
return utils.convReturnJson(j_row["getJsonArray(java.lang.String)"](__args[0]));
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Get a buffer value at pos
.
@public
@param name {string} the column
@return {Buffer} the value or null
*/
this.getBuffer = function() {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
return utils.convReturnVertxGen(Buffer, j_row["getBuffer(int)"](__args[0]));
} else if (__args.length === 1 && typeof __args[0] === 'string') {
return utils.convReturnVertxGen(Buffer, j_row["getBuffer(java.lang.String)"](__args[0]));
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Add a boolean value at the end of the tuple.
@public
@param value {boolean} the value
@return {Tuple} a reference to this, so the API can be used fluently
*/
this.addBoolean = function(value) {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='boolean') {
j_row["addBoolean(java.lang.Boolean)"](value);
return that;
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Add an object value at the end of the tuple.
@public
@param value {Object} the value
@return {Tuple} a reference to this, so the API can be used fluently
*/
this.addValue = function(value) {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] !== 'function') {
j_row["addValue(java.lang.Object)"](utils.convParamTypeUnknown(value));
return that;
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Add an integer value at the end of the tuple.
@public
@param value {number} the value
@return {Tuple} a reference to this, so the API can be used fluently
*/
this.addInteger = function(value) {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
j_row["addInteger(java.lang.Integer)"](utils.convParamInteger(value));
return that;
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Add a long value at the end of the tuple.
@public
@param value {number} the value
@return {Tuple} a reference to this, so the API can be used fluently
*/
this.addLong = function(value) {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
j_row["addLong(java.lang.Long)"](utils.convParamLong(value));
return that;
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Add a float value at the end of the tuple.
@public
@param value {number} the value
@return {Tuple} a reference to this, so the API can be used fluently
*/
this.addFloat = function(value) {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
j_row["addFloat(java.lang.Float)"](utils.convParamFloat(value));
return that;
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Add a double value at the end of the tuple.
@public
@param value {number} the value
@return {Tuple} a reference to this, so the API can be used fluently
*/
this.addDouble = function(value) {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='number') {
j_row["addDouble(java.lang.Double)"](utils.convParamDouble(value));
return that;
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Add a string value at the end of the tuple.
@public
@param value {string} the value
@return {Tuple} a reference to this, so the API can be used fluently
*/
this.addString = function(value) {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] === 'string') {
j_row["addString(java.lang.String)"](value);
return that;
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Add a Character value at the end of the tuple.
@public
@param value {string} the value
@return {Tuple} a reference to this, so the API can be used fluently
*/
this.addCharacter = function(value) {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] ==='string') {
j_row["addCharacter(java.lang.Character)"](utils.convParamCharacter(value));
return that;
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Add a json object value at the end of the tuple.
@public
@param value {Object} the value
@return {Tuple} a reference to this, so the API can be used fluently
*/
this.addJsonObject = function(value) {
var __args = arguments;
if (__args.length === 1 && (typeof __args[0] === 'object' && __args[0] != null)) {
j_row["addJsonObject(io.vertx.core.json.JsonObject)"](utils.convParamJsonObject(value));
return that;
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Add a json array value at the end of the tuple.
@public
@param value {todo} the value
@return {Tuple} a reference to this, so the API can be used fluently
*/
this.addJsonArray = function(value) {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] === 'object' && __args[0] instanceof Array) {
j_row["addJsonArray(io.vertx.core.json.JsonArray)"](utils.convParamJsonArray(value));
return that;
} else throw new TypeError('function invoked with invalid arguments');
};
/**
Add a buffer value at the end of the tuple.
@public
@param value {Buffer} the value
@return {Tuple} a reference to this, so the API can be used fluently
*/
this.addBuffer = function(value) {
var __args = arguments;
if (__args.length === 1 && typeof __args[0] === 'object' && __args[0]._jdel) {
j_row["addBuffer(io.vertx.core.buffer.Buffer)"](value._jdel);
return that;
} else throw new TypeError('function invoked with invalid arguments');
};
/**
@public
@return {number} the tuple size
*/
this.size = function() {
var __args = arguments;
if (__args.length === 0) {
return j_row["size()"]();
} else throw new TypeError('function invoked with invalid arguments');
};
// A reference to the underlying Java delegate
// NOTE! This is an internal API and must not be used in user code.
// If you rely on this property your code is likely to break if we change it / remove it without warning.
this._jdel = j_row;
};
Row._jclass = utils.getJavaClass("com.julienviet.pgclient.Row");
Row._jtype = {
accept: function(obj) {
return Row._jclass.isInstance(obj._jdel);
},
wrap: function(jdel) {
var obj = Object.create(Row.prototype, {});
Row.apply(obj, arguments);
return obj;
},
unwrap: function(obj) {
return obj._jdel;
}
};
Row._create = function(jdel) {
var obj = Object.create(Row.prototype, {});
Row.apply(obj, arguments);
return obj;
}
module.exports = Row;