Examples of Builder


Examples of com.google.protobuf.MessageLite.Builder

  public Connection doTestFactoryTest(RpcConnectionFactory persistentFactory)
      throws IOException {
    // Send and receive first
    Connection persistent = persistentFactory.createConnection();
    persistent.sendProtoMessage(MESSAGE2);
    Builder builder = Request.newBuilder();
    persistent.receiveProtoMessage(builder);
    assertEquals(MESSAGE1, builder.build());
    persistent.close();

    // Receive and send second
    persistent = persistentFactory.createConnection();
    builder = Request.newBuilder();
    persistent.receiveProtoMessage(builder);
    assertEquals(MESSAGE2, builder.build());
    persistent.sendProtoMessage(MESSAGE1);
    persistent.close();

    // Send and receive third
    persistent = persistentFactory.createConnection();
    persistent.sendProtoMessage(MESSAGE2);
    builder = Request.newBuilder();
    persistent.receiveProtoMessage(builder);
    assertEquals(MESSAGE1, builder.build());
    persistent.close();

    // Get 3 messages from output
    ByteArrayInputStream is = new ByteArrayInputStream(
        socket.getOutputBytes());
View Full Code Here

Examples of com.googlecode.jslint4java.JSFunction.Builder

    private static final class JSFunctionConverter implements Util.Converter<JSFunction> {
        public JSFunction convert(Object obj) {
            Scriptable scope = (Scriptable) obj;
            String name = Util.stringValue("name", scope);
            int line = Util.intValue("line", scope);
            Builder b = new JSFunction.Builder(name, line);
            b.last(Util.intValue("last", scope));
            for (String param : Util.listValueOfType("parameter", String.class, scope)) {
                b.addParam(param);
            }
            for (String closure : Util.listValueOfType("closure", String.class, scope)) {
                b.addClosure(closure);
            }
            for (String var : Util.listValueOfType("var", String.class, scope)) {
                b.addVar(var);
            }
            for (String exception : Util.listValueOfType("exception", String.class, scope)) {
                b.addException(exception);
            }
            for (String outer : Util.listValueOfType("outer", String.class, scope)) {
                b.addOuter(outer);
            }
            for (String unused : Util.listValueOfType("unused", String.class, scope)) {
                b.addUnused(unused);
            }
            for (String global : Util.listValueOfType("global", String.class, scope)) {
                b.addGlobal(global);
            }
            for (String label : Util.listValueOfType("label", String.class, scope)) {
                b.addLabel(label);
            }
            return b.build();
        }
View Full Code Here

Examples of com.googlecode.protobuf.socketrpc.SocketRpcProtos.Response.Builder

  /**
   * Create RPC response protobuf from method invocation results.
   */
  private SocketRpcProtos.Response createRpcResponse(Message response,
      boolean callbackInvoked, SocketRpcController socketController) {
    Builder responseBuilder = SocketRpcProtos.Response.newBuilder();
    if (response != null) {
      responseBuilder.setCallback(true).setResponseProto(
          response.toByteString());
    } else {
      // Set whether callback was called (in case of async)
      responseBuilder.setCallback(callbackInvoked);
    }
    if (socketController.failed()) {
      responseBuilder.setError(socketController.errorText());
      responseBuilder.setErrorReason(ErrorReason.RPC_FAILED);
    }
    return responseBuilder.build();
  }
View Full Code Here

Examples of com.googlecode.protobuf.socketrpc.TestProtos.Request.Builder

    connection.sendProtoMessage(MESSAGE);
    ByteArrayInputStream is = new ByteArrayInputStream(socket.getOutputBytes());
    assertEquals(MESSAGE, Request.parseDelimitedFrom(is));

    Builder builder = Request.newBuilder();
    connection.receiveProtoMessage(builder);
    assertEquals(MESSAGE, builder.build());
  }
View Full Code Here

Examples of com.gwtplatform.dispatch.rest.client.interceptor.InterceptorContext.Builder

    }

    @Test
     public void register_interceptor() {
        // Given
        InterceptorContext context = new Builder()
            .path(PATH_1)
            .httpMethod(HttpMethod.GET)
            .build();

        // When
View Full Code Here

Examples of com.gwtplatform.mvp.client.proxy.PlaceRequest.Builder

            article.setDate(date);
            article.setName(name);
            article.setTag(tag);
            article.setKeyHash(result.getIdHash());
            AddArticleEvent.fire(AddArticlesPresenter.this, article);
            Builder request = new PlaceRequest.Builder().nameToken(
                NameTokens.getLookfor()).with(
                LookforPresenter.Parameters.id.name(),
                result.getIdHash());

            placeManager.revealPlace(request.build());
          }
        });
  }
View Full Code Here

Examples of com.gwtplatform.mvp.shared.proxy.PlaceRequest.Builder

        delayTestFinish(1000);
    }

    private void revealAdmin() {
        PlaceRequest placeRequest = new Builder().nameToken("admin").build();
        ginjector.getPlaceManager().revealPlace(placeRequest);

        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
            @Override
            public void execute() {
View Full Code Here

Examples of com.ib.client.Builder

    if (serverVersion() < 66) {
            error( EClientErrors.NO_VALID_ID, EClientErrors.UPDATE_TWS, "ApiController requires TWS build 932 or higher to place orders.");
            return;
    }

    Builder b = new Builder();

    int VERSION = 38;

    // send place order msg
    try {
      b.send( 3);
      b.send( VERSION);
      b.send( order.orderId() );
      b.send( contract.conid() );
      b.send( contract.symbol());
      b.send( contract.secType() );
      b.send( contract.expiry());
      b.send( contract.strike());
      b.send( contract.right().getApiString() );
      b.send( contract.multiplier() );
      b.send( contract.exchange() );
      b.send( contract.primaryExch() );
      b.send( contract.currency() );
      b.send( contract.localSymbol() );
      b.send( contract.secIdType() );
      b.send( contract.secId() );
      b.send( order.action() );
      b.send( order.totalQuantity() );
      b.send( order.orderType() );
      b.send( order.lmtPrice() );
      b.send( order.auxPrice() );
      b.send( order.tif() );
      b.send( order.ocaGroup() );
      b.send( order.account() );
      b.send( ""); // open/close
      b.send( ""); // origin
      b.send( order.orderRef() );
      b.send( order.transmit() );
      b.send( order.parentId() );
      b.send( order.blockOrder() );
      b.send( order.sweepToFill() );
      b.send( order.displaySize() );
      b.send( order.triggerMethod() );
      b.send( order.outsideRth() );
      b.send( order.hidden() );

      // send combo legs for BAG orders
      if(contract.secType() == SecType.BAG) {
        b.send( contract.comboLegs().size());

        for (NewComboLeg leg : contract.comboLegs() ) {
          b.send( leg.conid() );
          b.send( leg.ratio() );
          b.send( leg.action().getApiString() );
          b.send( leg.exchange() );
          b.send( leg.openClose().getApiString() );
          b.send( leg.shortSaleSlot() );
          b.send( leg.designatedLocation() );
          b.send( leg.exemptCode() );
        }

        b.send( order.orderComboLegs().size());
        for (Double orderComboLeg : order.orderComboLegs() ) {
          b.send( orderComboLeg);
        }

        b.send( order.smartComboRoutingParams().size() );
        for (TagValue tagValue : order.smartComboRoutingParams() ) {
          b.send( tagValue.m_tag);
          b.send( tagValue.m_value);
        }
      }

      b.send( ""); // obsolete field
      b.send( order.discretionaryAmt() );
      b.send( order.goodAfterTime() );
      b.send( order.goodTillDate() );
      b.send( order.faGroup());
      b.send( order.faMethod() );
      b.send( order.faPercentage() );
      b.send( order.faProfile());
      b.send( 0); // short sale slot
      b.send( ""); // designatedLocation
      b.send( ""); // exemptCode
      b.send( order.ocaType() );
      b.send( order.rule80A() );
      b.send( ""); // settlingFirm
      b.send( order.allOrNone() );
      b.send( order.minQty() );
      b.send( order.percentOffset() );
      b.send( order.eTradeOnly() );
      b.send( order.firmQuoteOnly() );
      b.send( order.nbboPriceCap() );
      b.send( order.auctionStrategy() );
      b.send( order.startingPrice() );
      b.send( order.stockRefPrice() );
      b.send( order.delta() );
      b.send( order.stockRangeLower() );
      b.send( order.stockRangeUpper() );
      b.send( order.overridePercentageConstraints() );
      b.send( order.volatility() );
      b.send( order.volatilityType() );
      b.send( order.deltaNeutralOrderType() );
      b.send( order.deltaNeutralAuxPrice() );

      if (order.deltaNeutralOrderType() != OrderType.None) {
        b.send( order.deltaNeutralConId() );
        b.send( ""); //deltaNeutralSettlingFirm
        b.send( ""); //deltaNeutralClearingAccount
        b.send( ""); //deltaNeutralClearingIntent
      }

      b.send( order.continuousUpdate() );
      b.send( order.referencePriceType() );
      b.send( order.trailStopPrice() );
      b.send( order.trailingPercent() );
      b.send (order.scaleInitLevelSize() );
      b.send (order.scaleSubsLevelSize() );
      b.send (order.scalePriceIncrement() );

      if (order.scalePriceIncrement() != 0 && order.scalePriceIncrement() != Double.MAX_VALUE) {
        b.send( order.scalePriceAdjustValue() );
        b.send( order.scalePriceAdjustInterval() );
        b.send( order.scaleProfitOffset() );
        b.send( order.scaleAutoReset() );
        b.send( order.scaleInitPosition() );
        b.send( order.scaleInitFillQty() );
        b.send( order.scaleRandomPercent() );
      }

      b.send( order.hedgeType() );
      if (order.hedgeType() != HedgeType.None) {
        b.send( order.hedgeParam() );
      }

      b.send( order.optOutSmartRouting() );
      b.send( "");//clearingAccount
      b.send( "");//clearingIntent
      b.send( order.notHeld() );

      b.send( contract.underComp() != null);
      if (contract.underComp() != null) {
        b.send( contract.underComp().conid() );
        b.send( contract.underComp().delta() );
        b.send( contract.underComp().price() );
      }

      b.send( order.algoStrategy() );
      if( order.algoStrategy() != AlgoStrategy.None) {
        b.send( order.algoParams().size() );
        for( TagValue tagValue : order.algoParams() ) {
          b.send( tagValue.m_tag);
          b.send( tagValue.m_value);
        }
      }

      b.send( order.whatIf() );

      m_dos.write( b.getBytes() );
    }
    catch( Exception e) {
      e.printStackTrace();
      error( order.orderId(), 512, "Order sending error - " + e);
      close();
View Full Code Here

Examples of com.ibm.icu.util.ULocale.Builder

            {"L", "en", "K", "tz", "usnyc", "R", "US", "T", "en-us-u-tz-usnyc", "en_US@timezone=america/new_york"},
            {"L", "de", "K", "co", "phonebk", "K", "ks", "level1", "K", "kk", "true", "T", "de-u-co-phonebk-kk-true-ks-level1", "de@collation=phonebook;colnormalization=yes;colstrength=primary"},
//          {"L", "en", "V", "foooo_barrr", "T", "en-foooo-barrr", "en__FOOOO_BARRR"},
        };

        Builder bld = new Builder();
        for (int tidx = 0; tidx < TESTCASE.length; tidx++) {
            bld.clear();
            int i = 0;
            String[] expected = null;
            while (true) {
                String method = TESTCASE[tidx][i++];
                try {
                    if (method.equals("L")) {
                        bld.setLanguage(TESTCASE[tidx][i++]);
                    } else if (method.equals("S")) {
                        bld.setScript(TESTCASE[tidx][i++]);
                    } else if (method.equals("R")) {
                        bld.setRegion(TESTCASE[tidx][i++]);
                    } else if (method.equals("V")) {
                        bld.setVariant(TESTCASE[tidx][i++]);
                    } else if (method.equals("K")) {
                        String key = TESTCASE[tidx][i++];
                        String type = TESTCASE[tidx][i++];
                        bld.setLDMLExtensionValue(key, type);
                    } else if (method.equals("E")) {
                        String key = TESTCASE[tidx][i++];
                        String value = TESTCASE[tidx][i++];
                        bld.setExtension(key.charAt(0), value);
                    } else if (method.equals("P")) {
                        bld.setExtension(ULocale.PRIVATE_USE_EXTENSION, TESTCASE[tidx][i++]);
                    } else if (method.equals("X")) {
                        errln("FAIL: No excetion was thrown - test csae: "
                                + Utility.arrayToString(TESTCASE[tidx]));
                    } else if (method.equals("T")) {
                        expected = new String[2];
                        expected[0] = TESTCASE[tidx][i];
                        expected[1] = TESTCASE[tidx][i + 1];
                        break;
                    }
                } catch (IllformedLocaleException e) {
                    if (TESTCASE[tidx][i].equals("X")) {
                        // This exception is expected
                        break;
                    } else {
                        errln("FAIL: IllformedLocaleException at offset " + i
                                + " in test case: " + Utility.arrayToString(TESTCASE[tidx]));
                    }
                }
            }
            if (expected != null) {
                ULocale loc = bld.create();
                if (!expected[1].equals(loc.toString())) {
                    errln("FAIL: Wrong locale ID - " + loc +
                            " for test case: " + Utility.arrayToString(TESTCASE[tidx]));
                }
                String langtag = loc.toLanguageTag();
View Full Code Here

Examples of com.intellij.codeInsight.daemon.impl.HighlightInfo.Builder

public class HighlightInfoFactory13 extends HighlightInfoFactory {

    @Override
    public HighlightInfo createHighlightInfo(@NotNull HighlightInfoType type, @NotNull PsiElement element, @Nullable String message, @Nullable TextAttributes attributes) {
        Builder builder = HighlightInfo.newHighlightInfo(type)
                .range(element);
        if(message != null) {
            builder.description(message);
        }
        if(attributes != null) {
            builder.textAttributes(attributes);
        }
        return builder.create();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.