Stmt.invokeStatic
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using org.jboss.errai.codegen.util.Stmt.invokeStatic (Showing top 20 results out of 315)

origin: org.jboss.errai/errai-bus

    .finish();
loadProxies.append(Stmt.invokeStatic(RemoteServiceProxyFactory.class, "addRemoteProxy", remote, proxyProvider));
origin: org.uberfire/uberfire-security-codegen

  public Statement createGlobalActionCheck(String resourceType,
                       String resourceAction,
                       String onGranted,
                       String onDenied) {
    return buildCheckStatement(Stmt.invokeStatic(AuthorizationManagerHelper.class,
                           "authorize",
                           resourceType,
                           resourceAction),
                  onGranted,
                  onDenied);
  }
}
origin: org.jboss.errai/errai-bus

 private Statement generateRequest(ClassStructureBuilder<?> classBuilder,
   MetaMethod method, Statement methodParams, boolean intercepted) {
  
  final Statement sendable = Stmt
      .invokeStatic(MessageBuilder.class, "createCall")
      .invoke("call", remote.getFullyQualifiedName())
      .invoke("endpoint", ProxyUtil.createCallSignature(method),
        Stmt.loadClassMember("qualifiers"),
        methodParams)
      .invoke("respondTo", method.getReturnType().asBoxed(), Stmt.loadVariable("remoteCallback"))
      .invoke("errorsHandledBy", Stmt.loadVariable("errorCallback"));

  final BlockStatement requestBlock = new BlockStatement();
  requestBlock.addStatement(Stmt.declareVariable("sendable", RemoteCallSendable.class, sendable));
  requestBlock.addStatement(Stmt.loadStatic(classBuilder.getClassDefinition(), "this")
    .invoke("sendRequest", Variable.get("bus"), Variable.get("sendable")));

  return requestBlock;
 }
}
origin: errai/errai

public static Statement annotationLiteral(final Annotation qual) {
 if (qual.annotationType().equals(Any.class)) {
  return loadStatic(QualifierUtil.class, "ANY_ANNOTATION");
 } else if (qual.annotationType().equals(Default.class)) {
  return loadStatic(QualifierUtil.class, "DEFAULT_ANNOTATION");
 } else if (qual.annotationType().equals(Named.class)) {
  return invokeStatic(QualifierUtil.class, "createNamed", ((Named) qual).value());
 } else {
  return LiteralFactory.getLiteral(qual);
 }
}
origin: errai/errai

/**
 * This should only be called for non-public constructors. This method forces a
 * private accessor to be generated for the constructor.
 *
 * @param constructor
 *          A non-public constructor.
 * @return A statement for invoking the given constructor.
 */
public ContextualStatementBuilder exposedConstructorStmt(final MetaConstructor constructor, final Statement... params) {
 addExposedConstructor(constructor);
 return invokeStatic(factory, getPrivateMethodName(constructor), (Object[]) params);
}
origin: org.uberfire/uberfire-security-codegen

public Statement createResourceActionCheck(String resourceName,
                      String resourceAction,
                      String onGranted,
                      String onDenied) {
  return buildCheckStatement(Stmt.invokeStatic(AuthorizationManagerHelper.class,
                         "authorize",
                         Stmt.loadVariable(resourceName),
                         resourceAction),
                onGranted,
                onDenied);
}
origin: errai/errai

private ContextualStatementBuilder createConstraintViolation() {
 return invokeStatic(ConstraintViolationImpl.class, "builder").invoke("setInvalidValue", loadVariable("value"))
     .invoke("setMessage", Stmt.invokeStatic(DynamicValidatorUtil.class, "interpolateMessage", Refs.get("parameters"), Refs.get("message")))
     .invoke("build");
}
origin: errai/errai

private static void addCleanup(final Decorable decorable, final FactoryController controller, final List<Statement> destructionStmts) {
 final DataBindingUtil.DataBinderRef dataBinder = DataBindingUtil.lookupDataBinderRef(decorable, controller);
 if (!controller.hasAttribute(STYLE_BINDING_HOUSEKEEPING_ATTR)) {
  destructionStmts.add(
      Stmt.invokeStatic(StyleBindingsRegistry.class, "get").invoke("cleanAllForBean", Refs.get("instance")));
  if (dataBinder != null) {
   destructionStmts.add(controller.getReferenceStmt("styleBindingChangeHandlerUnsub", PropertyChangeUnsubscribeHandle.class).invoke("unsubscribe"));
  }
  controller.setAttribute(STYLE_BINDING_HOUSEKEEPING_ATTR, Boolean.TRUE);
 }
}
origin: org.jboss.errai/errai-ui

private static void addCleanup(final Decorable decorable, final FactoryController controller, final List<Statement> destructionStmts) {
 final DataBindingUtil.DataBinderRef dataBinder = DataBindingUtil.lookupDataBinderRef(decorable, controller);
 if (!controller.hasAttribute(STYLE_BINDING_HOUSEKEEPING_ATTR)) {
  destructionStmts.add(
      Stmt.invokeStatic(StyleBindingsRegistry.class, "get").invoke("cleanAllForBean", Refs.get("instance")));
  if (dataBinder != null) {
   destructionStmts.add(controller.getReferenceStmt("styleBindingChangeHandlerUnsub", PropertyChangeUnsubscribeHandle.class).invoke("unsubscribe"));
  }
  controller.setAttribute(STYLE_BINDING_HOUSEKEEPING_ATTR, Boolean.TRUE);
 }
}
origin: errai/errai

@Override
protected List<Statement> generateCreateInstanceStatements(final ClassStructureBuilder<?> bodyBlockBuilder,
    final Injectable injectable, final DependencyGraph graph, final InjectionContext injectionContext) {
 return Collections.<Statement> singletonList(
     Stmt.castTo(injectable.getInjectedType(), invokeStatic(WindowInjectionContextStorage.class, "createOrGet")
         .invoke("getBean", injectable.getInjectedType().getFullyQualifiedName())).returnValue());
}
origin: errai/errai

@SuppressWarnings("unchecked")
private void declareAsyncBeanManagerSetupField(final IOCProcessingContext processingContext) {
 processingContext.getBootstrapBuilder()
  .privateField("asyncBeanManagerSetup", AsyncBeanManagerSetup.class)
  .initializesWith(castTo(AsyncBeanManagerSetup.class, invokeStatic(IOC.class, "getAsyncBeanManager")))
  .finish();
}
origin: errai/errai

@SuppressWarnings("unchecked")
private void declareStaticLogger(final IOCProcessingContext processingContext) {
 processingContext.getBootstrapBuilder()
  .privateField("logger", Logger.class)
  .modifiers(Modifier.Static, Modifier.Final)
  .initializesWith(invokeStatic(LoggerFactory.class, "getLogger", Bootstrapper.class))
  .finish();
}
origin: errai/errai

 private static Statement hashArith(final MetaMethod method) {
  return Arith.expr(
    Arith.expr(31, ArithmeticOperator.Multiplication, Refs.get("hash")),
    ArithmeticOperator.Addition,
    Stmt.invokeStatic(QualifierUtil.class, "hashValueFor", Stmt.loadVariable("a1").invoke(method))
  );
 }
}
origin: errai/errai

private Statement generateFactoryLoader(final Injectable injectable, final MetaClass factoryClass) {
 final Statement runAsyncCallback = ObjectBuilder.newInstanceOf(DefaultRunAsyncCallback.class).extend()
     .publicOverridesMethod("onSuccess").append(loadVariable("callback").invoke("callback",
         castTo(Factory.class, invokeStatic(GWT.class, "create", loadLiteral(factoryClass)))))
     .finish().finish();
 final Class<?> fragmentId = getAsyncFragmentId(injectable);
 final Object[] runAsyncParams = (fragmentId.equals(LoadAsync.NO_FRAGMENT.class) ? new Object[] { runAsyncCallback }
     : new Object[] { fragmentId, runAsyncCallback });
 return ObjectBuilder.newInstanceOf(FactoryLoader.class).extend()
     .publicOverridesMethod("call", finalOf(FactoryLoaderCallback.class, "callback"))
     .append(invokeStatic(GWT.class, "runAsync", runAsyncParams)).finish().finish();
}
origin: errai/errai

private ContextualStatementBuilder proxyHelperInvocation(final MetaMethod method, final BuildMetaClass factoryClass) {
 if (method.isPublic()) {
  return loadVariable("proxiedInstance").invoke(method.getName(), getParametersForInvocation(method));
 } else {
  controller.addExposedMethod(method);
  return invokeStatic(factoryClass, getPrivateMethodName(method), getParametersForInvocation(method, loadVariable("proxiedInstance")));
 }
}
origin: errai/errai

public static String initCachedMethod(final ClassStructureBuilder<?> classBuilder, final MetaConstructor c) {
 createJavaReflectionConstructorInitializerUtilMethod(classBuilder);
 final String fieldName = PrivateAccessUtil.getPrivateMethodName(c) + "_meth";
 classBuilder.privateField(fieldName, Constructor.class).modifiers(Modifier.Static)
     .initializesWith(Stmt.invokeStatic(classBuilder.getClassDefinition(), JAVA_REFL_CONSTRUCTOR_UTIL_METH,
         c.getDeclaringClass(), MetaClassFactory.asClassArray(c.getParameters()))).finish();
 return fieldName;
}
origin: errai/errai

public static String initCachedMethod(final ClassStructureBuilder<?> classBuilder, final MetaMethod m) {
 createJavaReflectionMethodInitializerUtilMethod(classBuilder);
 final String fieldName = PrivateAccessUtil.getPrivateMethodName(m) + "_meth";
 classBuilder.privateField(fieldName, Method.class).modifiers(Modifier.Static)
     .initializesWith(Stmt.invokeStatic(classBuilder.getClassDefinition(), JAVA_REFL_METH_UTIL_METH,
         m.getDeclaringClass(), m.getName(), MetaClassFactory.asClassArray(m.getParameters()))).finish();
 return fieldName;
}
origin: errai/errai

public static String initCachedField(final ClassStructureBuilder<?> classBuilder, final MetaField f) {
 createJavaReflectionFieldInitializerUtilMethod(classBuilder);
 final String fieldName = PrivateAccessUtil.getPrivateFieldAccessorName(f) + "_fld";
 if (classBuilder.getClassDefinition().getField(fieldName) != null) {
  return fieldName;
 }
 classBuilder.privateField(fieldName, Field.class).modifiers(Modifier.Static)
     .initializesWith(Stmt.invokeStatic(classBuilder.getClassDefinition(), JAVA_REFL_FLD_UTIL_METH,
         f.getDeclaringClass(), f.getName())).finish();
 return fieldName;
}
origin: org.jboss.errai/errai-codegen

public static String initCachedField(final ClassStructureBuilder<?> classBuilder, final MetaField f) {
 createJavaReflectionFieldInitializerUtilMethod(classBuilder);
 final String fieldName = PrivateAccessUtil.getPrivateFieldAccessorName(f) + "_fld";
 if (classBuilder.getClassDefinition().getField(fieldName) != null) {
  return fieldName;
 }
 classBuilder.privateField(fieldName, Field.class).modifiers(Modifier.Static)
     .initializesWith(Stmt.invokeStatic(classBuilder.getClassDefinition(), JAVA_REFL_FLD_UTIL_METH,
         f.getDeclaringClass(), f.getName())).finish();
 return fieldName;
}
origin: errai/errai

private void implementEquals(final ClassStructureBuilder<?> proxyImpl) {
 proxyImpl.publicMethod(boolean.class, "equals", Parameter.of(Object.class, "obj")).body()
  .append(loadVariable("obj").assignValue(invokeStatic(Factory.class, "maybeUnwrapProxy", loadVariable("obj"))))
  .append(loadVariable("proxyHelper").invoke("getInstance", loadVariable("this")).invoke("equals", loadVariable("obj")).returnValue())
  .finish();
}
org.jboss.errai.codegen.utilStmtinvokeStatic

Popular methods of Stmt

  • loadVariable
  • newObject
  • nestedCall
  • loadLiteral
  • castTo
  • declareVariable
  • declareFinalVariable
  • load
  • loadStatic
  • if_
  • loadClassMember
  • throw_
  • loadClassMember,
  • throw_,
  • newArray,
  • try_,
  • create,
  • break_,
  • continue_,
  • for_,
  • returnVoid

Popular in Java

  • Running tasks concurrently on multiple threads
  • findViewById (Activity)
  • setRequestProperty (URLConnection)
  • requestLocationUpdates (LocationManager)
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • JPanel (javax.swing)

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)