private void addInitialValue(EnhancementOperation op, String propertyName, Class propertyType, String fieldName, String initialValue, boolean persistent, Location location) { String description = EnhanceMessages.initialValueForProperty(propertyName); InitialValueBindingCreator creator = new InitialValueBindingCreator(_bindingSource, description, initialValue, location); String creatorField = op.addInjectedField(fieldName + "$initialValueBindingCreator", InitialValueBindingCreator.class, creator); String bindingField = fieldName + "$initialValueBinding"; op.addField(bindingField, IBinding.class); BodyBuilder builder = new BodyBuilder(); builder.addln("{0} = {1}.createBinding(this);", bindingField, creatorField); op.extendMethodImplementation(IComponent.class, EnhanceUtils.FINISH_LOAD_SIGNATURE, builder.toString()); builder.clear(); builder.addln("{0} = {1};", fieldName, EnhanceUtils.createUnwrapExpression(op, bindingField, propertyType)); String code = builder.toString(); // In finishLoad() and pageDetach(), de-reference the binding to get the // value // for the property. op.extendMethodImplementation(IComponent.class, EnhanceUtils.FINISH_LOAD_SIGNATURE, code); op.extendMethodImplementation(PageDetachListener.class, EnhanceUtils.PAGE_DETACHED_SIGNATURE, code); }
private void addInitialValue(EnhancementOperation op, String propertyName, Class propertyType, String fieldName, String initialValue, boolean persistent, Location location) { String description = EnhanceMessages.initialValueForProperty(propertyName); InitialValueBindingCreator creator = new InitialValueBindingCreator(_bindingSource, description, initialValue, location); String creatorField = op.addInjectedField(fieldName + "$initialValueBindingCreator", InitialValueBindingCreator.class, creator); String bindingField = fieldName + "$initialValueBinding"; op.addField(bindingField, IBinding.class); BodyBuilder builder = new BodyBuilder(); builder.addln("{0} = {1}.createBinding(this);", bindingField, creatorField); op.extendMethodImplementation(IComponent.class, EnhanceUtils.FINISH_LOAD_SIGNATURE, builder.toString()); builder.clear(); builder.addln("{0} = {1};", fieldName, EnhanceUtils.createUnwrapExpression(op, bindingField, propertyType)); String code = builder.toString(); // In finishLoad() and pageDetach(), de-reference the binding to get the // value // for the property. op.extendMethodImplementation(IComponent.class, EnhanceUtils.FINISH_LOAD_SIGNATURE, code); op.extendMethodImplementation(PageDetachListener.class, EnhanceUtils.PAGE_DETACHED_SIGNATURE, code); }
if( !_classFab.containsMethod( m ) ) builder.clear(); builder.begin(); builder.add("return ($r) ");
builder.clear(); builder.begin(); builder.addln("{0}.store(\"{1}\", $1);", managerField, objectName);
builder.clear(); builder.begin(); builder.addln("{0}.store(\"{1}\", $1);", managerField, objectName);