1 | // |
2 | // (c) Copyright, Moebius Solutions, 2002 |
3 | // |
4 | // All Rights Reserved |
5 | // |
6 | // This material may be reproduced by or for the U. S. Government |
7 | // pursuant to the copyright license under the clause at |
8 | // DFARS 252.227-7013 (OCT 1988). |
9 | // |
10 | /* |
11 | * $Id: JniClassGenerator.java,v 1.1.1.5 2004/05/25 20:23:28 hastings Exp $ |
12 | */ |
13 | package com.moesol.generator; |
14 | |
15 | import java.io.*; |
16 | import java.lang.reflect.*; |
17 | import java.util.*; |
18 | import com.moesol.generator.core.*; |
19 | |
20 | /** |
21 | * Abstract base class for code generators |
22 | */ |
23 | public class JniClassGenerator extends ClassGenerator { |
24 | public JniClassGenerator(Class clazz, boolean quiet, TranslationContext ctx) { |
25 | super(clazz, quiet, ctx); |
26 | } |
27 | |
28 | /** Template method */ |
29 | protected boolean shouldGenerate() { |
30 | return Modifier.isPublic(m_class.getModifiers()) && !m_class.isInterface(); |
31 | } |
32 | /** Template method */ |
33 | protected void extendClassProperties(Properties p) { |
34 | } |
35 | /** Template method */ |
36 | protected String getTemplateName() throws ApplyException { |
37 | return findClassTemplate("jni", "class"); |
38 | } |
39 | /** Template method */ |
40 | protected ClassGeneratorVisitor createClassVisitor(Writer out) throws ApplyException { |
41 | return new JniClassGeneratorVisitor(out, getTranslationContext()); |
42 | } |
43 | /** Template method */ |
44 | protected String getFileSuffix(){ |
45 | return ".cpp"; |
46 | } |
47 | |
48 | // additional method for each #{method} in the template... |
49 | } |