Examples of Builder


Examples of com.google.appengine.api.search.Document.Builder

    public void testDocFields() throws Exception {
        String indexName = "test-doc-fields";
        Index index = searchService.getIndex(IndexSpec.newBuilder().setName(indexName));
        delDocs(index);

        Builder docBuilder = Document.newBuilder();
        Field field = Field.newBuilder().setName("textfield").setText("text field").build();
        docBuilder.addField(field);
        field = Field.newBuilder().setName("numberfield").setNumber(123).build();
        docBuilder.addField(field);
        Date now = new Date();
        field = Field.newBuilder().setName("datefield").setDate(now).build();
        docBuilder.addField(field);
        field = Field.newBuilder().setName("htmlfield").setHTML("<html>html field</html>").build();
        docBuilder.addField(field);
        User currentUser = new User("prometheus-qa@appenginetest.com", "appenginetest.com");
        field = Field.newBuilder().setName("atomfield").setAtom(currentUser.getAuthDomain()).build();
        docBuilder.addField(field);
        GeoPoint geoPoint = new GeoPoint((double) -10, 10.000001);
        field = Field.newBuilder().setName("geofield").setGeoPoint(geoPoint).build();
        docBuilder.addField(field);
        index.put(docBuilder);
        sync();

        Results<ScoredDocument> result = searchDocs(index, "", 0);
        assertEquals(1, result.getNumberReturned());
View Full Code Here

Examples of com.google.appengine.tools.appstats.StatsProtos.RequestStatProto.Builder

      log.warning("Stats data was too big, " + action + ".");
    }
  }

  private RequestStatProto removeStackTraces(RequestStatProto proto) {
    Builder builder = proto.toBuilder().clearIndividualStats();
    for (IndividualRpcStatsProto stat : proto.getIndividualStatsList()) {
      builder.addIndividualStats(stat.toBuilder().clearCallStack());
    }
    return builder.build();
  }
View Full Code Here

Examples of com.google.caliper.config.VmConfig.Builder

  /**
   * Returns the configuration of the current host JVM (including the flags used to create it). Any
   * args specified using {@code vm.args} will also be applied
   */
  public VmConfig getDefaultVmConfig() {
    return new Builder(new File(System.getProperty("java.home")))
        .addAllOptions(Collections2.filter(ManagementFactory.getRuntimeMXBean().getInputArguments(),
            new Predicate<String>() {
              @Override public boolean apply(@Nullable String input) {
                // Exclude the -agentlib:jdwp param which configures the socket debugging protocol.
                // If this is set in the parent VM we do not want it to be inherited by the child
View Full Code Here

Examples of com.google.common.collect.ImmutableList.Builder

            return new StdCORSAuthorizer(originMatcher, pathMatcher, allowedMethods, allowedHeaders, allowCredentials, maxAge);
        }
    }

    public static Builder builder() {
        return new Builder();
    }
View Full Code Here

Examples of com.google.debugging.sourcemap.proto.Mapping.OriginalMapping.Builder

  private OriginalMapping getOriginalMappingForEntry(Entry entry) {
    if (entry.getSourceFileId() == UNMAPPED) {
      return null;
    } else {
      // Adjust the line/column here to be start at 1.
      Builder x = OriginalMapping.newBuilder()
        .setOriginalFile(sources[entry.getSourceFileId()])
        .setLineNumber(entry.getSourceLine() + 1)
        .setColumnPosition(entry.getSourceColumn() + 1);
      if (entry.getNameId() != UNMAPPED) {
        x.setIdentifier(names[entry.getNameId()]);
      }
      return x.build();
    }
  }
View Full Code Here

Examples of com.google.greaze.definition.rest.RestCallSpec.Builder

    this.inlined = inlined;
  }

  public static RestCallSpec generateRestCallSpec(
      CallPath callPath, Type resourceType, WebContextSpec webContextSpec) {
    Builder builder = new RestCallSpec.Builder(callPath, resourceType)
      .setWebContextSpec(webContextSpec);
    if (callPath.hasVersion()) {
      builder.setVersion(callPath.getVersion());
    }
    return builder.build();
  }
View Full Code Here

Examples of com.google.greaze.definition.webservice.WebServiceCallSpec.Builder

*/
public final class ResourceQueryUtils {

  public static WebServiceCallSpec generateCallSpec(CallPath callPath, Type resourceType,
    Type resourceQueryParamsType, WebContextSpec webContextSpec) {
    Builder builder = new WebServiceCallSpec.Builder(callPath)
      .addAllRequestParams(webContextSpec.getRequestHeaderSpec())
      .setListBody(resourceType)
      .setUrlParams(resourceQueryParamsType)
      .supportsHttpMethod(HttpMethod.GET);
    if (callPath.hasVersion()) {
      builder.setVersion(callPath.getVersion());
    }
    return builder
      .build();
  }
View Full Code Here

Examples of com.google.gwt.rpc.server.WebModeClientOracle.Builder

      for (RpcDataArtifact data : artifacts.find(RpcDataArtifact.class)) {
        allSerializableFields.putAll(data.getOperableFields());
      }

      for (CompilationResult result : artifacts.find(CompilationResult.class)) {
        Builder builder = new Builder();

        for (Map.Entry<String, List<String>> entry : allSerializableFields.entrySet()) {
          builder.setSerializableFields(entry.getKey(), entry.getValue());
        }

        for (SymbolData symbolData : result.getSymbolMap()) {
          builder.add(symbolData.getSymbolName(), symbolData.getJsniIdent(),
              symbolData.getClassName(), symbolData.getMemberName(),
              symbolData.getTypeId());
        }

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
          builder.getOracle().store(out);
        } catch (IOException e) {
          // Should generally not happen
          logger.log(TreeLogger.ERROR, "Unable to store deRPC data", e);
          throw new UnableToCompleteException();
        }
View Full Code Here

Examples of com.google.javascript.jscomp.JsMessage.Builder

          MESSAGE_NOT_INITIALIZED_USING_NEW_SYNTAX));
    }

    boolean isUnnamedMsg = isUnnamedMessageName(messageKey);

    Builder builder = new Builder(
        isUnnamedMsg ? null : messageKey);
    OriginalMapping mapping = compiler.getSourceMapping(
        traversal.getSourceName(), traversal.getLineNumber(),
        traversal.getCharno());
    if (mapping != null) {
      builder.setSourceName(mapping.getOriginalFile());
    } else {
      builder.setSourceName(traversal.getSourceName());
    }

    try {
      if (isVar) {
        extractMessageFromVariable(builder, node, parent, parent.getParent());
      } else {
        extractMessageFrom(builder, msgNode, node);
      }
    } catch (MalformedException ex) {
      compiler.report(traversal.makeError(ex.getNode(),
          MESSAGE_TREE_MALFORMED, ex.getMessage()));
      return;
    }

    JsMessage extractedMessage = builder.build(idGenerator);

    // If asked to check named internal messages.
    if (needToCheckDuplications
        && !isUnnamedMsg
        && !extractedMessage.isExternal()) {
View Full Code Here

Examples of com.google.protobuf.Message.Builder

      Message param = null;
      CellScanner cellScanner = null;
      try {
        if (header.hasRequestParam() && header.getRequestParam()) {
          md = this.service.getDescriptorForType().findMethodByName(header.getMethodName());
          Builder builder = this.service.getRequestPrototype(md).newBuilderForType();
          // To read the varint, I need an inputstream; might as well be a CIS.
          cis = CodedInputStream.newInstance(buf, offset, buf.length);
          int paramSize = cis.readRawVarint32();
          offset += cis.getTotalBytesRead();
          if (builder != null) {
            param = builder.mergeFrom(buf, offset, paramSize).build();
          }
          offset += paramSize;
        }
        if (header.hasCellBlockMeta()) {
          cellScanner = ipcUtil.createCellScanner(this.codec, this.compressionCodec,
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.