@Override public boolean equals(Object obj) { if (!(obj instanceof Decorable)) { return false; } final Decorable other = (Decorable) obj; return decorableType.equals(other.decorableType) && CDIAnnotationUtils.equals(annotation, other.annotation) && annotated.equals(other.annotated) && injectable.equals(other.injectable); }
controller.addInitializationStatements( Collections.<Statement>singletonList( controller.setReferenceStmt(MODEL_VAR_NAME, DecorableType.PARAM.getAccessStatement(mp, decorable.getFactoryMetaClass())))); dataBinderRef = controller.getInstancePropertyStmt( controller.getReferenceStmt(MODEL_VAR_NAME, dataModelType), BINDER_VAR_NAME, DecorableType.FIELD.getAccessStatement(field, decorable.getFactoryMetaClass()), BINDER_VAR_NAME, DataBinder.class);
() -> { final Decorable decorable = new Decorable(annotated, annotated.getAnnotation(annoType), Decorable.DecorableType.fromElementType(elemType), injectionContext, builder.getClassDefinition().getContext(), builder.getClassDefinition(), injectable); if (isNonPublicField(annotated) && !createdAccessors.contains(annotated)) {
if (componentType.isAssignableTo(Widget.class)) { if (!decorable.get().isAnnotationPresent(Inject.class) && decorable.decorableType().equals(DecorableType.FIELD) && componentType.isDefaultInstantiable()) { Statement widgetInit = Stmt.loadVariable("this").invoke( PrivateAccessUtil.getPrivateFieldAccessorName(decorable.getAsField()),
if (componentType.isAssignableTo(Widget.class)) { if (!decorable.get().isAnnotationPresent(Inject.class) && decorable.decorableType().equals(DecorableType.FIELD) && componentType.isDefaultInstantiable()) { Statement widgetInit = Stmt.loadVariable("this").invoke( PrivateAccessUtil.getPrivateFieldAccessorName(decorable.getAsField()),
controller.addInitializationStatements( Collections.<Statement>singletonList( controller.setReferenceStmt(MODEL_VAR_NAME, DecorableType.PARAM.getAccessStatement(mp, decorable.getFactoryMetaClass())))); dataBinderRef = controller.getInstancePropertyStmt( controller.getReferenceStmt(MODEL_VAR_NAME, dataModelType), BINDER_VAR_NAME, DecorableType.FIELD.getAccessStatement(field, decorable.getFactoryMetaClass()), BINDER_VAR_NAME, DataBinder.class);
dataBinderRef = DecorableType.FIELD.getAccessStatement(field, decorable.getFactoryMetaClass()); if (!field.isPublic()) { controller.addExposedField(field);
dataBinderRef = DecorableType.FIELD.getAccessStatement(field, decorable.getFactoryMetaClass()); if (!field.isPublic()) { controller.addExposedField(field);
return DecorableType.PARAM.getAccessStatement(paramDep.getParameter(), decorable.getFactoryMetaClass()); } else { break; controller.exposedFieldStmt(fieldDep.getField()); return DecorableType.FIELD.getAccessStatement(fieldDep.getField(), decorable.getFactoryMetaClass());
return DecorableType.PARAM.getAccessStatement(paramDep.getParameter(), decorable.getFactoryMetaClass()); } else { break; controller.exposedFieldStmt(fieldDep.getField()); return DecorableType.FIELD.getAccessStatement(fieldDep.getField(), decorable.getFactoryMetaClass());
/** * For all but parameters, this access statement can be used in generated * implementations for * {@link Factory#createInstance(org.jboss.errai.ioc.client.container.ContextManager)} * and * {@link Factory#destroyInstance(Object, org.jboss.errai.ioc.client.container.ContextManager)} * . For parameters it is only valid in the former. * * @param params * If this decorable is a method these parameters are used in the * generated invocation. Otherwise they are ignored. * @return A reference to the decorated value. For fields or methods, the * member is loaded/invoked. For types a reference to the constructed * type. For parameters, a reference to a local variable of the value that was passed in to the parameter. */ public Statement getAccessStatement(Statement... params) { return decorableType().getAccessStatement(annotated, factory, params); }
/** * This should only be called for non-public methods. This method forces a * private accessor to be generated for the method. * * @param instance * A statement for the instance on which this method will be called. * @param method * A non-static method. * @param params * Statements for the values to be passed in as parameters. * @return A statement for accessing invoking the given method. */ public ContextualStatementBuilder exposedMethodStmt(final Statement instance, final MetaMethod method, final Statement... params) { if (!method.isPublic()) { addExposedMethod(method); } return DecorableType.METHOD.call(instance, method, factory, params); }
/** * This should only be called for non-public methods. This method forces a * private accessor to be generated for the method. Dispatches to variable * {@code instance}. * * @param method * A method, static or non-static. * @param params * Statements for the values to be passed in as parameters. * @return A statement for accessing invoking the given method. */ public ContextualStatementBuilder exposedMethodStmt(final MetaMethod method, final Statement... params) { if (!method.isPublic()) { addExposedMethod(method); } return DecorableType.METHOD.getAccessStatement(method, factory, params); }
/** * This should only be called for non-public fields. This method forces a * private accessor to be generated for the field. * * @param field * A field, static or non-static. * @return A statement for accessing the value of a field. */ public ContextualStatementBuilder exposedFieldStmt(final MetaField field) { if (!field.isPublic()) { addExposedField(field); } return DecorableType.FIELD.getAccessStatement(field, factory); }
public abstract ContextualStatementBuilder getAccessStatement(final HasAnnotations annotated, final BuildMetaClass factory); public abstract ContextualStatementBuilder call(final Statement instance, final HasAnnotations annotated, final BuildMetaClass factory, Statement... params);
public ContextualStatementBuilder call(final HasAnnotations annotated, final BuildMetaClass factory, Statement... params) { return getAccessStatement(annotated, factory, params); } public String getName(HasAnnotations annotated) {
@Override public int hashCode() { return decorableType.hashCode() ^ CDIAnnotationUtils.hashCode(annotation) ^ annotated.hashCode() ^ injectable.hashCode(); }
/** * This should only be called for non-public fields. This method forces a * private accessor to be generated for the field. * * @param field * A non-static field. * @return A statement for accessing the value of a field. */ public ContextualStatementBuilder exposedFieldStmt(final Statement instance, final MetaField field) { if (!field.isPublic()) { addExposedField(field); } return DecorableType.FIELD.call(instance, field, factory); }
/** * @return The name of the annotated element. Calls * {@link MetaClassMember#getName()} for fields and methods. The * source code name for parameter, and the simple class name for * types. */ public String getName() { return decorableType().getName(annotated); }
public Statement call(final Statement... values) { return decorableType().call(annotated, factory, values); }