1919
2020import java .io .IOException ;
2121import java .lang .reflect .InvocationTargetException ;
22+ import java .util .logging .Logger ;
2223
2324import org .msgpack .*;
2425import org .msgpack .packer .Packer ;
3132import javassist .CtNewMethod ;
3233import javassist .NotFoundException ;
3334
34- import org .slf4j .Logger ;
35- import org .slf4j .LoggerFactory ;
36-
3735@ SuppressWarnings ({ "rawtypes" })
3836public abstract class BuildContext <T extends FieldEntry > {
3937
40- private static Logger LOG = LoggerFactory .getLogger (BuildContext .class );
38+ private static Logger LOG = Logger .getLogger (BuildContext .class . getName () );
4139
4240 protected JavassistTemplateBuilder director ;
4341
@@ -58,20 +56,20 @@ public BuildContext(JavassistTemplateBuilder director) {
5856 protected Template build (final String className ) {
5957 try {
6058 reset (className , false );
61- LOG .debug ("started generating template class %s for original class %s" ,
62- new Object [] { tmplCtClass .getName (), className });
59+ LOG .fine ( String . format ("started generating template class %s for original class %s" ,
60+ new Object [] { tmplCtClass .getName (), className })) ;
6361 buildClass ();
6462 buildConstructor ();
6563 buildMethodInit ();
6664 buildWriteMethod ();
6765 buildReadMethod ();
68- LOG .debug ("finished generating template class %s for original class %s" ,
69- new Object [] { tmplCtClass .getName (), className });
66+ LOG .fine ( String . format ("finished generating template class %s for original class %s" ,
67+ new Object [] { tmplCtClass .getName (), className })) ;
7068 return buildInstance (createClass ());
7169 } catch (Exception e ) {
7270 String code = getBuiltString ();
7371 if (code != null ) {
74- LOG .error ("builder: " + code , e );
72+ LOG .severe ("builder: " + code );
7573 throw new TemplateBuildException ("Cannot compile: " + code , e );
7674 } else {
7775 throw new TemplateBuildException (e );
@@ -103,8 +101,8 @@ protected abstract Template buildInstance(Class<?> c)
103101 IllegalAccessException , InvocationTargetException ;
104102
105103 protected void buildWriteMethod () throws CannotCompileException , NotFoundException {
106- LOG .debug ("started generating write method in template class %s" ,
107- new Object [] { tmplCtClass .getName () });
104+ LOG .fine ( String . format ("started generating write method in template class %s" ,
105+ new Object [] { tmplCtClass .getName () })) ;
108106 String mbody = buildWriteMethodBody ();
109107 int mod = javassist .Modifier .PUBLIC ;
110108 CtClass returnType = CtClass .voidType ;
@@ -117,19 +115,19 @@ protected void buildWriteMethod() throws CannotCompileException, NotFoundExcepti
117115 CtClass [] exceptTypes = new CtClass [] {
118116 director .getCtClass (IOException .class .getName ())
119117 };
120- LOG .debug ( "compiling write method body: %s" , new Object [] { mbody });
118+ LOG .fine ( String . format ( "compiling write method body: %s" , new Object [] { mbody }) );
121119 CtMethod newCtMethod = CtNewMethod .make (
122120 mod , returnType , mname , paramTypes , exceptTypes , mbody , tmplCtClass );
123121 tmplCtClass .addMethod (newCtMethod );
124- LOG .debug ("finished generating write method in template class %s" ,
125- new Object [] { tmplCtClass .getName () });
122+ LOG .fine ( String . format ("finished generating write method in template class %s" ,
123+ new Object [] { tmplCtClass .getName () })) ;
126124 }
127125
128126 protected abstract String buildWriteMethodBody ();
129127
130128 protected void buildReadMethod () throws CannotCompileException , NotFoundException {
131- LOG .debug ("started generating read method in template class %s" ,
132- new Object [] { tmplCtClass .getName () });
129+ LOG .fine ( String . format ("started generating read method in template class %s" ,
130+ new Object [] { tmplCtClass .getName () })) ;
133131 String mbody = buildReadMethodBody ();
134132 int mod = javassist .Modifier .PUBLIC ;
135133 CtClass returnType = director .getCtClass (Object .class .getName ());
@@ -142,12 +140,12 @@ protected void buildReadMethod() throws CannotCompileException, NotFoundExceptio
142140 CtClass [] exceptTypes = new CtClass [] {
143141 director .getCtClass (MessageTypeException .class .getName ())
144142 };
145- LOG .debug ( "compiling read method body: %s" , new Object [] { mbody });
143+ LOG .fine ( String . format ( "compiling read method body: %s" , new Object [] { mbody }) );
146144 CtMethod newCtMethod = CtNewMethod .make (
147145 mod , returnType , mname , paramTypes , exceptTypes , mbody , tmplCtClass );
148146 tmplCtClass .addMethod (newCtMethod );
149- LOG .debug ("finished generating read method in template class %s" ,
150- new Object [] { tmplCtClass .getName () });
147+ LOG .fine ( String . format ("finished generating read method in template class %s" ,
148+ new Object [] { tmplCtClass .getName () })) ;
151149 }
152150
153151 protected abstract String buildReadMethodBody ();
@@ -221,7 +219,7 @@ protected void write(final String className, final String directoryName) {
221219 } catch (Exception e ) {
222220 String code = getBuiltString ();
223221 if (code != null ) {
224- LOG .error ("builder: " + code , e );
222+ LOG .severe ("builder: " + code );
225223 throw new TemplateBuildException ("Cannot compile: " + code , e );
226224 } else {
227225 throw new TemplateBuildException (e );
@@ -241,7 +239,7 @@ protected Template load(final String className) {
241239 } catch (Exception e ) {
242240 String code = getBuiltString ();
243241 if (code != null ) {
244- LOG .error ("builder: " + code , e );
242+ LOG .severe ("builder: " + code );
245243 throw new TemplateBuildException ("Cannot compile: " + code , e );
246244 } else {
247245 throw new TemplateBuildException (e );
0 commit comments