private void appendPageShownMethod(AnonymousClassStructureBuilder pageImplBuilder, MetaClass pageClass) { BlockBuilder<?> method = pageImplBuilder.publicMethod(void.class, createMethodNameFromAnnotation(PageShown.class), Parameter.of(pageClass, "widget"), Parameter.of(HistoryToken.class, "state")) .body(); appendPageShowMethod(method, pageImplBuilder, pageClass, PageShown.class, false, Parameter.of(HistoryToken.class, "state")); method.finish(); }
private void appendPageUpdateMethod(AnonymousClassStructureBuilder pageImplBuilder, MetaClass pageClass) { BlockBuilder<?> method = pageImplBuilder.publicMethod(void.class, createMethodNameFromAnnotation(PageUpdate.class), Parameter.of(pageClass, "widget"), Parameter.of(HistoryToken.class, "state")) .body(); appendPageShowMethod(method, pageImplBuilder, pageClass, PageUpdate.class, false, Parameter.of(HistoryToken.class, "state")); method.finish(); }
private void appendPageUpdateMethod(AnonymousClassStructureBuilder pageImplBuilder, MetaClass pageClass) { BlockBuilder<?> method = pageImplBuilder.publicMethod(void.class, createMethodNameFromAnnotation(PageUpdate.class), Parameter.of(pageClass, "widget"), Parameter.of(HistoryToken.class, "state")) .body(); appendPageShowMethod(method, pageImplBuilder, pageClass, PageUpdate.class, false, Parameter.of(HistoryToken.class, "state")); method.finish(); }
private void appendPageShownMethod(AnonymousClassStructureBuilder pageImplBuilder, MetaClass pageClass) { BlockBuilder<?> method = pageImplBuilder.publicMethod(void.class, createMethodNameFromAnnotation(PageShown.class), Parameter.of(pageClass, "widget"), Parameter.of(HistoryToken.class, "state")) .body(); appendPageShowMethod(method, pageImplBuilder, pageClass, PageShown.class, false, Parameter.of(HistoryToken.class, "state")); method.finish(); }
/** * Appends the method that calls the {@code @PageHidden} method of the widget. * * @param pageImplBuilder * The class builder for the implementation of PageNode we are adding the method to. * @param pageClass * The "content type" (Widget subclass) of the page. This is the type the user annotated * with {@code @Page}. */ private void appendPageHiddenMethod(AnonymousClassStructureBuilder pageImplBuilder, MetaClass pageClass) { BlockBuilder<?> method = pageImplBuilder.publicMethod( void.class, createMethodNameFromAnnotation(PageHidden.class), Parameter.of(pageClass, "widget")).body(); checkMethodAndAddPrivateAccessors(pageImplBuilder, method, pageClass, PageHidden.class, Parameter.of(HistoryToken.class, "state")); method.finish(); }
/** * Appends the method that calls the {@code @PageHidden} method of the widget. * * @param pageImplBuilder * The class builder for the implementation of PageNode we are adding the method to. * @param pageClass * The "content type" (Widget subclass) of the page. This is the type the user annotated * with {@code @Page}. */ private void appendPageHiddenMethod(AnonymousClassStructureBuilder pageImplBuilder, MetaClass pageClass) { BlockBuilder<?> method = pageImplBuilder.publicMethod( void.class, createMethodNameFromAnnotation(PageHidden.class), Parameter.of(pageClass, "widget")).body(); checkMethodAndAddPrivateAccessors(pageImplBuilder, method, pageClass, PageHidden.class, Parameter.of(HistoryToken.class, "state")); method.finish(); }
private static Object createAccessorImpl(final MetaClass type, final String varName) { final MetaClass propertyType = type.getMethod("getValue", new Class[0]).getReturnType(); return ObjectBuilder.newInstanceOf(NativeHasValueAccessors.Accessor.class) .extend() .publicMethod(Object.class, "get") .append(loadVariable(varName).invoke("getValue").returnValue()) .finish() .publicMethod(void.class, "set", finalOf(Object.class, "value")) .append(loadVariable(varName).invoke("setValue", castTo(propertyType, loadVariable("value")))) .finish() .finish(); } }
private static Object createAccessorImpl(final MetaClass type, final String varName) { final MetaClass propertyType = type.getMethod("getValue", new Class[0]).getReturnType(); return ObjectBuilder.newInstanceOf(NativeHasValueAccessors.Accessor.class) .extend() .publicMethod(Object.class, "get") .append(loadVariable(varName).invoke("getValue").returnValue()) .finish() .publicMethod(void.class, "set", finalOf(Object.class, "value")) .append(loadVariable(varName).invoke("setValue", castTo(propertyType, loadVariable("value")))) .finish() .finish(); } }
.publicMethod(String.class, "name") .append(Stmt.loadLiteral(pageName).returnValue()).finish() .publicMethod(String.class, "toString") .append(Stmt.loadLiteral(pageName).returnValue()).finish() .publicMethod(String.class, "getURL") .append(Stmt.loadLiteral(getPageURL(pageClass, pageName)).returnValue()).finish() .publicMethod(Class.class, "contentType") .append(Stmt.loadLiteral(pageClass).returnValue()).finish() .publicMethod(void.class, "produceContent", Parameter.of(CreationalCallback.class, "callback")) .append(Stmt.nestedCall(Refs.get("bm")) .invoke("lookupBean", Stmt.loadLiteral(pageClass))
.publicMethod(String.class, "name") .append(Stmt.loadLiteral(pageName).returnValue()).finish() .publicMethod(String.class, "toString") .append(Stmt.loadLiteral(pageName).returnValue()).finish() .publicMethod(String.class, "getURL") .append(Stmt.loadLiteral(getPageURL(pageClass, pageName)).returnValue()).finish() .publicMethod(Class.class, "contentType") .append(Stmt.loadLiteral(pageClass).returnValue()).finish() .publicMethod(void.class, "produceContent", Parameter.of(CreationalCallback.class, "callback")) .append(Stmt.nestedCall(Refs.get("bm")) .invoke("lookupBean", Stmt.loadLiteral(pageClass))
/** * Appends a method that destroys the IOC bean associated with a page node if the bean is * dependent scope. * * @param pageImplBuilder * The class builder for the implementation of PageNode we are adding the method to. * @param pageClass * The "content type" (Widget subclass) of the page. This is the type the user annotated * with {@code @Page}. */ private void appendDestroyMethod(AnonymousClassStructureBuilder pageImplBuilder, MetaClass pageClass) { BlockBuilder<?> method = pageImplBuilder.publicMethod( void.class, "destroy", Parameter.of(pageClass, "widget")).body(); if (pageClass.getAnnotation(Singleton.class) == null && pageClass.getAnnotation(ApplicationScoped.class) == null && pageClass.getAnnotation(EntryPoint.class) == null) { method.append(Stmt.loadVariable("bm").invoke("destroyBean", Stmt.loadVariable("widget"))); } method.finish(); }
/** * Appends a method that destroys the IOC bean associated with a page node if the bean is * dependent scope. * * @param pageImplBuilder * The class builder for the implementation of PageNode we are adding the method to. * @param pageClass * The "content type" (Widget subclass) of the page. This is the type the user annotated * with {@code @Page}. */ private void appendDestroyMethod(AnonymousClassStructureBuilder pageImplBuilder, MetaClass pageClass) { BlockBuilder<?> method = pageImplBuilder.publicMethod( void.class, "destroy", Parameter.of(pageClass, "widget")).body(); if (pageClass.getAnnotation(Singleton.class) == null && pageClass.getAnnotation(ApplicationScoped.class) == null && pageClass.getAnnotation(EntryPoint.class) == null) { method.append(Stmt.loadVariable("bm").invoke("destroyBean", Stmt.loadVariable("widget"))); } method.finish(); }
private void appendPageShowingMethod(AnonymousClassStructureBuilder pageImplBuilder, MetaClass pageClass) { BlockBuilder<?> method = pageImplBuilder.publicMethod(void.class, createMethodNameFromAnnotation(PageShowing.class), Parameter.of(pageClass, "widget"), Parameter.of(HistoryToken.class, "state"), Parameter.of(NavigationControl.class, "control")) .body(); MetaMethod pageShowMethod = appendPageShowMethod(method, pageImplBuilder, pageClass, PageShowing.class, true, Parameter.of(HistoryToken.class, "state"), Parameter.of(NavigationControl.class, "control")); /* * If the user did not provide a control parameter, we must proceed for them after the method is invoked. */ if (pageShowMethod == null || pageShowMethod.getParameters().length != 2) { method.append(Stmt.loadVariable("control").invoke("proceed")); } method.finish(); }
private void appendPageShowingMethod(AnonymousClassStructureBuilder pageImplBuilder, MetaClass pageClass) { BlockBuilder<?> method = pageImplBuilder.publicMethod(void.class, createMethodNameFromAnnotation(PageShowing.class), Parameter.of(pageClass, "widget"), Parameter.of(HistoryToken.class, "state"), Parameter.of(NavigationControl.class, "control")) .body(); MetaMethod pageShowMethod = appendPageShowMethod(method, pageImplBuilder, pageClass, PageShowing.class, true, Parameter.of(HistoryToken.class, "state"), Parameter.of(NavigationControl.class, "control")); /* * If the user did not provide a control parameter, we must proceed for them after the method is invoked. */ if (pageShowMethod == null || pageShowMethod.getParameters().length != 2) { method.append(Stmt.loadVariable("control").invoke("proceed")); } method.finish(); }
/** * Appends the method that calls the {@code @PageHiding} method of the widget. * * @param pageImplBuilder * The class builder for the implementation of PageNode we are adding the method to. * @param pageClass * The "content type" (Widget subclass) of the page. This is the type the user annotated * with {@code @Page}. */ private void appendPageHidingMethod(AnonymousClassStructureBuilder pageImplBuilder, MetaClass pageClass) { BlockBuilder<?> method = pageImplBuilder.publicMethod( void.class, createMethodNameFromAnnotation(PageHiding.class), Parameter.of(pageClass, "widget"), Parameter.of(NavigationControl.class, "control")).body(); final MetaMethod pageHidingMethod = checkMethodAndAddPrivateAccessors(pageImplBuilder, method, pageClass, PageHiding.class, Parameter.of(NavigationControl.class, "control")); /* * If the user did not provide a control parameter, we must proceed for them after the method is invoked. */ if (pageHidingMethod == null || pageHidingMethod.getParameters().length != 1) { method.append(Stmt.loadVariable("control").invoke("proceed")); } method.finish(); }
/** * Appends the method that calls the {@code @PageHiding} method of the widget. * * @param pageImplBuilder * The class builder for the implementation of PageNode we are adding the method to. * @param pageClass * The "content type" (Widget subclass) of the page. This is the type the user annotated * with {@code @Page}. */ private void appendPageHidingMethod(AnonymousClassStructureBuilder pageImplBuilder, MetaClass pageClass) { BlockBuilder<?> method = pageImplBuilder.publicMethod( void.class, createMethodNameFromAnnotation(PageHiding.class), Parameter.of(pageClass, "widget"), Parameter.of(NavigationControl.class, "control")).body(); final MetaMethod pageHidingMethod = checkMethodAndAddPrivateAccessors(pageImplBuilder, method, pageClass, PageHiding.class, Parameter.of(NavigationControl.class, "control")); /* * If the user did not provide a control parameter, we must proceed for them after the method is invoked. */ if (pageHidingMethod == null || pageHidingMethod.getParameters().length != 1) { method.append(Stmt.loadVariable("control").invoke("proceed")); } method.finish(); }
entityTypeSubclass.publicMethod(et.getJavaType(), "newInstance") .append(Stmt.nestedCall(Stmt.newObject(et.getJavaType())).returnValue()) .finish();
classBuilder.publicMethod( Void.TYPE, "deliver" + eventType.getSimpleName(),
.publicMethod(boolean.class, "isEqual", Parameter.of(MC_annotationClass, "a1"), Parameter.of(MC_annotationClass, "a2")) .annotatedWith(new Override() {