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

📄 typecommentgenerator.java

📁 《精通SOA:基于服务总线的Struts+EJB+Web Service整合应用开发》原书的实例代码
💻 JAVA
字号:
package com.objectlearn.gmf.templates.session;

import java.util.*;
import com.objectlearn.lomboz.xml.lomboz.DocumentRoot;
import com.objectlearn.lomboz.xml.lomboz.SessionBean;
import com.sun.java.xml.ns.j2ee.SessionBeanType;

public class TypeCommentGenerator
{
  protected final String NL = System.getProperties().getProperty("line.separator");
  protected final String TEXT_1 = "/**" + NL + " *" + NL + " * <!-- begin-user-doc -->" + NL + " * A generated session bean" + NL + " * <!-- end-user-doc -->" + NL + " *" + NL + "<!-- lomboz.beginDefinition -->";
  protected final String TEXT_2 = NL + " ";
  protected final String TEXT_3 = NL + "<!-- lomboz.endDefinition -->" + NL + " *" + NL + " * <!-- begin-xdoclet-definition --> " + NL + " * @ejb.bean name=\"";
  protected final String TEXT_4 = "\"\t" + NL + " *           jndi-name=\"";
  protected final String TEXT_5 = "\"" + NL + " *           type=\"";
  protected final String TEXT_6 = "\" " + NL + " *           transaction-type=\"";
  protected final String TEXT_7 = "\"" + NL + " * " + NL + " * <!-- end-xdoclet-definition --> " + NL + " * @generated" + NL + " */";
  protected final String TEXT_8 = NL;

  public String generate(Object argument)
  {
    StringBuffer stringBuffer = new StringBuffer();
     DocumentRoot root = (DocumentRoot)argument;
   SessionBean lsb = (SessionBean) root.getEjb().getSession();
   SessionBeanType sb = (SessionBeanType) lsb.getSessionEjb();
 
   String ejbName = sb.getEjbClass().getUnqualifiedClassName();
   if(ejbName.endsWith("Bean") ){
      ejbName = ejbName.substring(0,ejbName.length()-4);
   }else if(ejbName.endsWith("Ejb") ){
      ejbName = ejbName.substring(0,ejbName.length()-3);
   }

    stringBuffer.append(TEXT_1);
    stringBuffer.append(TEXT_2);
    stringBuffer.append( root.asString() );
    stringBuffer.append(TEXT_3);
    stringBuffer.append(ejbName);
    stringBuffer.append(TEXT_4);
    stringBuffer.append(sb.getEjbName());
    stringBuffer.append(TEXT_5);
    stringBuffer.append(sb.getSessionType().getValue());
    stringBuffer.append(TEXT_6);
    stringBuffer.append( sb.getTransactionType().getValue() );
    stringBuffer.append(TEXT_7);
    stringBuffer.append(TEXT_8);
    return stringBuffer.toString();
  }
}

⌨️ 快捷键说明

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