⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 methodmetaargsfactory.java

📁 Java/J2EE框架Jdon-Framework系统的Sample
💻 JAVA
字号:
/**
 * Copyright 2005 Jdon.com
 * Licensed 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.
  */

package com.jdon.model.handler;

import com.jdon.util.Debug;
import com.jdon.bussinessproxy.meta.MethodMetaArgs;
import com.jdon.controller.events.EventModel;

/**
 * 根据HandlerMetaDef生成相应的Mehtod和参数
 *
 * <p>Copyright: Jdon.com Copyright (c) 2005</p>
 * <p></p>
 * @author banq
 * @version JdonFramework 2005 v1.0
 */
public class MethodMetaArgsFactory {
  private final static String module = MethodMetaArgsFactory.class.getName();

  public MethodMetaArgs createfindMethod(HandlerMetaDef handlerMetaDef,
                                         String keyValue) {
    MethodMetaArgs methodMetaArgs = null;
    try {
      String p_methodName = handlerMetaDef.getFindMethod();
      Class[] paramTypes = new Class[1];
      paramTypes[0] = String.class; //规定:EJB的缺省find参数类型是字符串
      Object[] p_args = new String[1];
      p_args[0] = keyValue;
      methodMetaArgs = new MethodMetaArgs(p_methodName,
                                          paramTypes, p_args);

    } catch (Exception ex) {
      Debug.logError(" getfindMethod error: " + ex, module);
    }
    return methodMetaArgs;
  }

  public MethodMetaArgs createCreateMethod(HandlerMetaDef handlerMetaDef,
                                           EventModel em) {
    MethodMetaArgs methodMetaArgs = null;
    try {
      String p_methodName = handlerMetaDef.getCreateMethod();
      Class[] paramTypes = new Class[1];
      paramTypes[0] = EventModel.class; //规定:EJB的缺省find参数类型是字符串
      Object[] p_args = new EventModel[1];
      p_args[0] = em;
      methodMetaArgs = new MethodMetaArgs(p_methodName,
                                          paramTypes, p_args);

    } catch (Exception ex) {
      Debug.logError(" createCreateMethod error: " + ex, module);
    }
    return methodMetaArgs;
  }

  public MethodMetaArgs createUpdateMethod(HandlerMetaDef handlerMetaDef,
                                           EventModel em) {
    MethodMetaArgs methodMetaArgs = null;
    try {
      String p_methodName = handlerMetaDef.getUpdateMethod();
      Class[] paramTypes = new Class[1];
      paramTypes[0] = EventModel.class; //规定:EJB的缺省find参数类型是字符串
      Object[] p_args = new EventModel[1];
      p_args[0] = em;
      methodMetaArgs = new MethodMetaArgs(p_methodName,
                                          paramTypes, p_args);

    } catch (Exception ex) {
      Debug.logError(" createUpdateMethod error: " + ex, module);
    }
    return methodMetaArgs;
  }

  public MethodMetaArgs createDeleteMethod(HandlerMetaDef handlerMetaDef,
                                           EventModel em) {
    MethodMetaArgs methodMetaArgs = null;
    try {
      String p_methodName = handlerMetaDef.getDeleteMethod();
      Class[] paramTypes = new Class[1];
      paramTypes[0] = EventModel.class; //规定:EJB的缺省find参数类型是字符串
      Object[] p_args = new EventModel[1];
      p_args[0] = em;
      methodMetaArgs = new MethodMetaArgs(p_methodName,
                                          paramTypes, p_args);

    } catch (Exception ex) {
      Debug.logError(" createDeleteMethod error: " + ex, module);
    }
    return methodMetaArgs;
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -