JavaField jf = js.newJavaField("jaxbContext", JAXBContextImpl.class, "private");
JavaField properties = js.newJavaField("properties", Map.class, "private");
JavaMethod newInstanceMethod = js.newJavaMethod("newInstance", Object.class, "public");
newInstanceMethod.addThrows(JAXBException.class);
Parameter pElementInterface = newInstanceMethod.addParam(Class.class, "pElementInterface");
newInstanceMethod.addLine("return ", jf, ".getManager(", pElementInterface, ").getElementJ();");
{
JavaMethod getPropertyMethod = js.newJavaMethod("getProperty", Object.class, "public");
Parameter pName = getPropertyMethod.addParam(String.class, "pName");
getPropertyMethod.addIf(properties, " == null");
getPropertyMethod.addLine("return null;");
getPropertyMethod.addEndIf();
getPropertyMethod.addLine("return ", properties, ".get(", pName, ");");
}
{
JavaMethod setPropertyMethod = js.newJavaMethod("setProperty", void.class, "public");
Parameter pName = setPropertyMethod.addParam(String.class, "pName");
Parameter pValue = setPropertyMethod.addParam(Object.class, "pValue");
setPropertyMethod.addIf(properties, " == null");
setPropertyMethod.addLine(properties, " = new ", HashMap.class, "();");
setPropertyMethod.addEndIf();
setPropertyMethod.addLine(properties, ".put(", pName, ", ", pValue, ");");
}