* Allow Extended IO interface usage without muddying up the Stringifier Interface\r
*/\r
public class JAXBObjectifier<T> implements IOObjectifier<T> {\r
- private JAXBumar jumar;\r
-\r
- public JAXBObjectifier(Schema schema, Class<?>... classes) throws APIException {\r
- try {\r
- jumar = new JAXBumar(schema, classes);\r
- } catch (JAXBException e) {\r
- throw new APIException(e);\r
- }\r
- }\r
-\r
- public JAXBObjectifier(Class<?>... classes) throws APIException {\r
- try {\r
- jumar = new JAXBumar(classes);\r
- } catch (JAXBException e) {\r
- throw new APIException(e);\r
- }\r
- }\r
- \r
+ private JAXBumar jumar;\r
+\r
+ public JAXBObjectifier(Schema schema, Class<?>... classes) throws APIException {\r
+ try {\r
+ jumar = new JAXBumar(schema, classes);\r
+ } catch (JAXBException e) {\r
+ throw new APIException(e);\r
+ }\r
+ }\r
+\r
+ public JAXBObjectifier(Class<?>... classes) throws APIException {\r
+ try {\r
+ jumar = new JAXBumar(classes);\r
+ } catch (JAXBException e) {\r
+ throw new APIException(e);\r
+ }\r
+ }\r
+ \r
// package on purpose\r
- JAXBObjectifier(JAXBumar jumar) {\r
- this.jumar = jumar;\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- // @Override\r
- public T objectify(Env env, String input) throws APIException {\r
- TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);\r
- try {\r
- tt.size(input.length());\r
- return (T)jumar.unmarshal(env.debug(), input);\r
- } catch (JAXBException e) {\r
- throw new APIException(e);\r
- } finally {\r
- tt.done();\r
- }\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- // @Override\r
- public T objectify(Env env, Reader rdr) throws APIException {\r
- //TODO create a Reader that Counts?\r
- TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);\r
- try {\r
- return (T)jumar.unmarshal(env.debug(), rdr);\r
- } catch (JAXBException e) {\r
- throw new APIException(e);\r
- } finally {\r
- tt.done();\r
- }\r
- }\r
-\r
-\r
- @SuppressWarnings("unchecked")\r
- // @Override\r
- public T objectify(Env env, InputStream is) throws APIException {\r
- //TODO create a Reader that Counts?\r
- TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);\r
- try {\r
- return (T)jumar.unmarshal(env.debug(), is);\r
- } catch (JAXBException e) {\r
- throw new APIException(e);\r
- } finally {\r
- tt.done();\r
- }\r
- }\r
-\r
-\r
- public void servicePrestart(Env env) throws APIException {\r
- }\r
-\r
- public void threadPrestart(Env env) throws APIException {\r
- }\r
-\r
- // // @Override\r
- public void refresh(Env env) throws APIException {\r
- }\r
-\r
- // // @Override\r
- public void threadDestroy(Env env) throws APIException {\r
- }\r
-\r
- // // @Override\r
- public void serviceDestroy(Env env) throws APIException {\r
- }\r
-\r
-\r
- @SuppressWarnings("unchecked")\r
- public T newInstance() throws APIException {\r
- try {\r
- return (T)jumar.newInstance();\r
- } catch (Exception e) {\r
- throw new APIException(e);\r
- }\r
- }\r
+ JAXBObjectifier(JAXBumar jumar) {\r
+ this.jumar = jumar;\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ // @Override\r
+ public T objectify(Env env, String input) throws APIException {\r
+ TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);\r
+ try {\r
+ tt.size(input.length());\r
+ return (T)jumar.unmarshal(env.debug(), input);\r
+ } catch (JAXBException e) {\r
+ throw new APIException(e);\r
+ } finally {\r
+ tt.done();\r
+ }\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ // @Override\r
+ public T objectify(Env env, Reader rdr) throws APIException {\r
+ //TODO create a Reader that Counts?\r
+ TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);\r
+ try {\r
+ return (T)jumar.unmarshal(env.debug(), rdr);\r
+ } catch (JAXBException e) {\r
+ throw new APIException(e);\r
+ } finally {\r
+ tt.done();\r
+ }\r
+ }\r
+\r
+\r
+ @SuppressWarnings("unchecked")\r
+ // @Override\r
+ public T objectify(Env env, InputStream is) throws APIException {\r
+ //TODO create a Reader that Counts?\r
+ TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);\r
+ try {\r
+ return (T)jumar.unmarshal(env.debug(), is);\r
+ } catch (JAXBException e) {\r
+ throw new APIException(e);\r
+ } finally {\r
+ tt.done();\r
+ }\r
+ }\r
+\r
+\r
+ public void servicePrestart(Env env) throws APIException {\r
+ }\r
+\r
+ public void threadPrestart(Env env) throws APIException {\r
+ }\r
+\r
+ // // @Override\r
+ public void refresh(Env env) throws APIException {\r
+ }\r
+\r
+ // // @Override\r
+ public void threadDestroy(Env env) throws APIException {\r
+ }\r
+\r
+ // // @Override\r
+ public void serviceDestroy(Env env) throws APIException {\r
+ }\r
+\r
+\r
+ @SuppressWarnings("unchecked")\r
+ public T newInstance() throws APIException {\r
+ try {\r
+ return (T)jumar.newInstance();\r
+ } catch (Exception e) {\r
+ throw new APIException(e);\r
+ }\r
+ }\r
\r
}\r
\r