示例#1
0
 /**
  * Create a new alias based on source code.
  *
  * @param db the database
  * @param id the id
  * @param name the name
  * @param source the source code
  * @param force create the object even if the class or method does not exist
  * @return the database object
  */
 public static FunctionAlias newInstanceFromSource(
     Database db, int id, String name, String source, boolean force) throws SQLException {
   FunctionAlias alias = new FunctionAlias(db, id, name);
   alias.source = source;
   alias.init(force);
   return alias;
 }
示例#2
0
 /**
  * Create a new alias based on a method name.
  *
  * @param db the database
  * @param id the id
  * @param name the name
  * @param javaClassMethod the class and method name
  * @param force create the object even if the class or method does not exist
  * @return the database object
  */
 public static FunctionAlias newInstance(
     Database db, int id, String name, String javaClassMethod, boolean force) throws SQLException {
   FunctionAlias alias = new FunctionAlias(db, id, name);
   int paren = javaClassMethod.indexOf('(');
   int lastDot = javaClassMethod.lastIndexOf('.', paren < 0 ? javaClassMethod.length() : paren);
   if (lastDot < 0) {
     throw Message.getSQLException(ErrorCode.SYNTAX_ERROR_1, javaClassMethod);
   }
   alias.className = javaClassMethod.substring(0, lastDot);
   alias.methodName = javaClassMethod.substring(lastDot + 1);
   alias.init(force);
   return alias;
 }