Eclipseplugins
pAInternalFunctionProto.java
1 package com.proalpha.pds.templates.jet.openEdge;
2 
3 import com.openedge.pdt.core.template.ITemplateGenerator;
4 import com.openedge.pdt.core.template.TemplateGenerationException;
5 import com.openedge.pdt.text.template.OETemplateUtil;
6 import com.openedge.pdt.core.template.ITemplateArgs;
7 
8 public class pAInternalFunctionProto implements ITemplateGenerator
9  {
10  protected static String nl;
11  public static synchronized pAInternalFunctionProto create(String lineSeparator)
12  {
13  nl = lineSeparator;
15  nl = null;
16  return result;
17  }
18 
19  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
20  protected final String TEXT_1 = NL + "function ";
21  protected final String TEXT_2 = " returns ";
22  protected final String TEXT_3 = " ";
23  protected final String TEXT_4 = NL + "\t( ) forward.";
24  protected final String TEXT_5 = NL;
25 
26 /* (non-javadoc)
27  * @see ITemplateGenerator#generate(Object)
28  */
29 public String generate(ITemplateArgs argument) throws TemplateGenerationException
30  {
31  final StringBuffer stringBuffer = new StringBuffer();
32 
33  String functionName = argument.get("functionname");
34  boolean isPrivate = argument.get("private").equalsIgnoreCase("true");
35  String returnType = argument.get("returntype");
36 
37  stringBuffer.append(TEXT_1);
38  stringBuffer.append( functionName );
39  stringBuffer.append(TEXT_2);
40  stringBuffer.append( returnType );
41  stringBuffer.append(TEXT_3);
42  stringBuffer.append( (isPrivate ? "private" : "") );
43  stringBuffer.append(TEXT_4);
44  stringBuffer.append(TEXT_5);
45  return stringBuffer.toString();
46  }
47 }