cf.addField("_targetService", targetServiceClass);
cf.addConstructor(new Class[]
{ targetServiceClass }, null, "{ super(); _targetService = $1; }");
BodyBuilder b = new BodyBuilder();
b.begin();
b.addln(
"{0} property = _targetService.{1}();",
serviceInterface.getName(),
readPropertyMethodName);
b.addln("if (property == null)");
b.add(" throw new java.lang.NullPointerException(");
b.addQuoted(ImplMessages.servicePropertyWasNull(propertyName, targetService));
b.addln(");");
b.addln("return property;");
b.end();
MethodSignature sig = new MethodSignature(serviceInterface, "_targetServiceProperty", null,
null);
cf.addMethod(Modifier.FINAL | Modifier.PRIVATE, sig, b.toString());
}