Package org.jboss.errai.codegen

Examples of org.jboss.errai.codegen.CallParameters


          if (extendsBlock == null && (type.isAbstract() || type.isInterface() || type.isPrimitive()))
            throw new InvalidTypeException("Cannot instantiate type:" + type, blame);

          writer.reset();

          final CallParameters callParameters = (parameters != null) ?
              fromStatements(GenUtil.generateCallParameters(context, parameters)) : CallParameters.none();

          if (!type.isInterface() && type.getBestMatchingConstructor(callParameters.getParameterTypes()) == null) {
            if (context.isPermissiveMode()) {
              // fall-through
            }
            else {
              throw new UndefinedConstructorException(type, blame, callParameters.getParameterTypes());
            }
          }

          final StringBuilder buf = new StringBuilder();
          buf.append("new ").append(LoadClassReference.getClassReference(type, context, true));
          if (callParameters != null) {
            buf.append(callParameters.generate(Context.create(context)));
          }
          if (extendsBlock != null) {
            for (final MetaField field : type.getDeclaredFields()) {
              context.addVariable(Variable.create(field.getName(), field.getType()));
            }
View Full Code Here


  }

  @Override
  public void handleCall(final CallWriter writer, final Context context, Statement statement) {
    try {
      CallParameters callParams = fromStatements(GenUtil.generateCallParameters(context, parameters));

      statement.generate(context);

      final MetaClass callType = statement.getType();

      final MetaClass[] parameterTypes = callParams.getParameterTypes();
      final MetaMethod method = (staticMethod) ? callType.getBestMatchingStaticMethod(methodName, parameterTypes)
              : callType.getBestMatchingMethod(methodName, parameterTypes);

      if (method == null) {
        if (context.isPermissiveMode()) {
View Full Code Here

  }

  @Override
  public void handleCall(CallWriter writer, Context context, Statement statement) {
    try {
      CallParameters callParams = fromStatements(GenUtil.generateCallParameters(context, parameters));

      statement.generate(context);

      MetaClass callType = statement.getType();

      MetaClass[] parameterTypes = callParams.getParameterTypes();
      final MetaMethod method = (staticMethod) ? callType.getBestMatchingStaticMethod(methodName, parameterTypes)
              : callType.getBestMatchingMethod(methodName, parameterTypes);

      if (method == null) {
        callType.getBestMatchingMethod(methodName, parameterTypes);
View Full Code Here

      appendCallElement(new DeferredCallElement(new DeferredCallback() {
        @Override
        public void doDeferred(CallWriter writer, Context context, Statement statement) {
          writer.reset();

          CallParameters callParameters = (parameters != null) ?
                  fromStatements(GenUtil.generateCallParameters(context, parameters)) : CallParameters.none();

          if (!type.isInterface() && type.getBestMatchingConstructor(callParameters.getParameterTypes()) == null) {
            if (GenUtil.isPermissiveMode()) {
               // fall-through
            }
            else {
              throw new UndefinedConstructorException(type, callParameters.getParameterTypes());
            }
          }

          StringBuilder buf = new StringBuilder();
          buf.append("new ").append(LoadClassReference.getClassReference(type, context, true));
          if (callParameters != null) {
            buf.append(callParameters.generate(Context.create(context)));
          }
          if (extendsBlock != null) {
            for (MetaField field : type.getDeclaredFields()) {
              context.addVariable(Variable.create(field.getName(), field.getType()));
            }
View Full Code Here

          if (extendsBlock == null && (type.isAbstract() || type.isInterface() || type.isPrimitive()))
            throw new InvalidTypeException("Cannot instantiate type:" + type);

          writer.reset();

          final CallParameters callParameters = (parameters != null) ?
              fromStatements(GenUtil.generateCallParameters(context, parameters)) : CallParameters.none();

          if (!type.isInterface() && type.getBestMatchingConstructor(callParameters.getParameterTypes()) == null) {
            if (context.isPermissiveMode()) {
              // fall-through
            }
            else {
              throw new UndefinedConstructorException(type, callParameters.getParameterTypes());
            }
          }

          final StringBuilder buf = new StringBuilder();
          buf.append("new ").append(LoadClassReference.getClassReference(type, context, true));
          if (callParameters != null) {
            buf.append(callParameters.generate(Context.create(context)));
          }
          if (extendsBlock != null) {
            for (final MetaField field : type.getDeclaredFields()) {
              context.addVariable(Variable.create(field.getName(), field.getType()));
            }
View Full Code Here

          if (extendsBlock == null && (type.isAbstract() || type.isInterface() || type.isPrimitive()))
            throw new InvalidTypeException("Cannot instantiate type:" + type);

          writer.reset();

          final CallParameters callParameters = (parameters != null) ?
                  fromStatements(GenUtil.generateCallParameters(context, parameters)) : CallParameters.none();

          if (!type.isInterface() && type.getBestMatchingConstructor(callParameters.getParameterTypes()) == null) {
            if (context.isPermissiveMode()) {
              // fall-through
            }
            else {
              throw new UndefinedConstructorException(type, callParameters.getParameterTypes());
            }
          }

          final StringBuilder buf = new StringBuilder();
          buf.append("new ").append(LoadClassReference.getClassReference(type, context, true));
          if (callParameters != null) {
            buf.append(callParameters.generate(Context.create(context)));
          }
          if (extendsBlock != null) {
            for (final MetaField field : type.getDeclaredFields()) {
              context.addVariable(Variable.create(field.getName(), field.getType()));
            }
View Full Code Here

  }

  @Override
  public void handleCall(CallWriter writer, Context context, Statement statement) {
    try {
      CallParameters callParams = fromStatements(GenUtil.generateCallParameters(context, parameters));

      statement.generate(context);

      MetaClass callType = statement.getType();

      MetaClass[] parameterTypes = callParams.getParameterTypes();
      final MetaMethod method = (staticMethod) ? callType.getBestMatchingStaticMethod(methodName, parameterTypes)
              : callType.getBestMatchingMethod(methodName, parameterTypes);

      if (method == null) {
View Full Code Here

TOP

Related Classes of org.jboss.errai.codegen.CallParameters

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.