(String functionName)
| 170 | ////////////////////// |
| 171 | |
| 172 | public JsFunction(String functionName) { |
| 173 | this.jsScriptEngine = JsScriptEngine.getInstance(); |
| 174 | this.functionName = functionName; |
| 175 | Object outputSchemaObj = jsScriptEngine.jsEval(this.getClass().getName() + "(String)", |
| 176 | functionName + ".outputSchema"); |
| 177 | //if no schema defined, fall back to bytearray |
| 178 | if (outputSchemaObj == null || outputSchemaObj instanceof Undefined) { |
| 179 | this.outputSchema = new Schema(new Schema.FieldSchema(null, DataType.BYTEARRAY)); |
| 180 | } |
| 181 | else { |
| 182 | try { |
| 183 | this.outputSchema = Utils.getSchemaFromString(outputSchemaObj.toString()); |
| 184 | } |
| 185 | catch (ParserException e) { |
| 186 | throw new IllegalArgumentException(functionName |
| 187 | + ".outputSchema is not a valid schema: " + e.getMessage(), e); |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | } |
| 192 | |
| 193 | /////////////////////////// |
| 194 | // EvalFunc implementation |
nothing calls this directly
no test coverage detected