| 1 |
package org.jetTest; |
| 2 |
|
| 3 |
public class MediumGen |
| 4 |
{ |
| 5 |
protected static String nl; |
| 6 |
public static synchronized MediumGen create(String lineSeparator) |
| 7 |
{ |
| 8 |
nl = lineSeparator; |
| 9 |
MediumGen result = new MediumGen(); |
| 10 |
nl = null; |
| 11 |
return result; |
| 12 |
} |
| 13 |
|
| 14 |
public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; |
| 15 |
protected final String TEXT_1 = "public class Medium" + NL + "{" + NL + "\tpublic void main(String[] args)" + NL + "\t{" + NL + "\t\tSystem.out.println(\"The class of the argument is '"; |
| 16 |
protected final String TEXT_2 = "'.\");" + NL + "\t}" + NL + "}" + NL; |
| 17 |
protected final String TEXT_3 = NL; |
| 18 |
|
| 19 |
public String generate(Object argument) |
| 20 |
{ |
| 21 |
final StringBuffer stringBuffer = new StringBuffer(); |
| 22 |
stringBuffer.append(TEXT_1); |
| 23 |
stringBuffer.append(argument.getClass().getName()); |
| 24 |
stringBuffer.append(TEXT_2); |
| 25 |
stringBuffer.append(TEXT_3); |
| 26 |
return stringBuffer.toString(); |
| 27 |
} |
| 28 |
} |