• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Constant类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.api.server.spi.Constant的典型用法代码示例。如果您正苦于以下问题:Java Constant类的具体用法?Java Constant怎么用?Java Constant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Constant类属于com.google.api.server.spi包,在下文中一共展示了Constant类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testSetScopesIfSpecified_unspecified

import com.google.api.server.spi.Constant; //导入依赖的package包/类
@Test
public void testSetScopesIfSpecified_unspecified() throws Exception {
  String[] unspecified = {Api.UNSPECIFIED_STRING_FOR_LIST};

  EndpointMethod method = getResultNoParamsMethod();
  annotationConfig.setScopesIfSpecified(unspecified);
  ApiMethodConfig methodConfig = config.getApiClassConfig().getMethods().getOrCreate(method);
  assertEquals(toScopeExpression(Constant.API_EMAIL_SCOPE), methodConfig.getScopeExpression());

  String[] scopes = {"bleh", "more bleh"};
  annotationConfig.setScopesIfSpecified(scopes);
  annotationConfig.setScopesIfSpecified(null);
  assertEquals(toScopeExpression(scopes), config.getScopeExpression());

  annotationConfig.setScopesIfSpecified(scopes);
  annotationConfig.setScopesIfSpecified(unspecified);
  assertEquals(toScopeExpression(scopes), config.getScopeExpression());
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:19,代码来源:ApiAnnotationConfigTest.java


示例2: testSetClientIdsIfSpecified_unspecified

import com.google.api.server.spi.Constant; //导入依赖的package包/类
@Test
public void testSetClientIdsIfSpecified_unspecified() throws Exception {
  String[] unspecified = {Api.UNSPECIFIED_STRING_FOR_LIST};

  EndpointMethod method = getResultNoParamsMethod();
  annotationConfig.setScopesIfSpecified(unspecified);
  ApiMethodConfig methodConfig = config.getApiClassConfig().getMethods().getOrCreate(method);
  assertEquals(ImmutableList.of(Constant.API_EXPLORER_CLIENT_ID), methodConfig.getClientIds());

  String[] clientIds = {"bleh", "more bleh"};
  annotationConfig.setClientIdsIfSpecified(clientIds);
  annotationConfig.setClientIdsIfSpecified(null);
  assertEquals(Arrays.asList(clientIds), config.getClientIds());

  annotationConfig.setClientIdsIfSpecified(clientIds);
  annotationConfig.setClientIdsIfSpecified(unspecified);
  assertEquals(Arrays.asList(clientIds), config.getClientIds());
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:19,代码来源:ApiAnnotationConfigTest.java


示例3: writeError

import com.google.api.server.spi.Constant; //导入依赖的package包/类
@Override
public void writeError(ServiceException e) throws IOException {
  Map<String, String> errors = new HashMap<>();
  errors.put(Constant.ERROR_MESSAGE, e.getMessage());
  write(e.getStatusCode(), e.getHeaders(),
      writeValueAsString(errors));
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:8,代码来源:ServletResponseResultWriter.java


示例4: wrapCollection

import com.google.api.server.spi.Constant; //导入依赖的package包/类
/**
 * Wraps a collection in an "items" property.
 */
static Object wrapCollection(Object value) {
  if (isCollection(value)) {
    Map<String, Object> wrapped = new HashMap<String, Object>();
    wrapped.put(Constant.ITEMS, value);
    return wrapped;
  } else {
    return value;
  }
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:13,代码来源:ResponseUtil.java


示例5: setIssuerAudiences

import com.google.api.server.spi.Constant; //导入依赖的package包/类
public void setIssuerAudiences(ApiIssuerAudienceConfig issuerAudiences) {
  Preconditions.checkNotNull(issuerAudiences, "issuerAudiences should never be null");
  this.issuerAudiences = issuerAudiences;
  if (issuerAudiences.hasIssuer(Constant.GOOGLE_ID_TOKEN_NAME)) {
    getApiClassConfig().getApiConfig().ensureGoogleIssuer();
  }
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:8,代码来源:ApiMethodConfig.java


示例6: setIssuerAudiences

import com.google.api.server.spi.Constant; //导入依赖的package包/类
public void setIssuerAudiences(ApiIssuerAudienceConfig issuerAudiences) {
  Preconditions.checkNotNull(issuerAudiences, "issuerAudiences should never be null");
  this.issuerAudiences = issuerAudiences;
  if (issuerAudiences.hasIssuer(Constant.GOOGLE_ID_TOKEN_NAME)) {
    getApiConfig().ensureGoogleIssuer();
  }
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:8,代码来源:ApiClassConfig.java


示例7: setIssuerAudiences

import com.google.api.server.spi.Constant; //导入依赖的package包/类
public void setIssuerAudiences(ApiIssuerAudienceConfig issuerAudiences) {
  Preconditions.checkNotNull(issuerAudiences, "issuerAudiences should never be null");
  this.issuerAudiences = issuerAudiences;
  if (issuerAudiences.hasIssuer(Constant.GOOGLE_ID_TOKEN_NAME)) {
    ensureGoogleIssuer();
  }
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:8,代码来源:ApiConfig.java


示例8: withGoogleIdToken

import com.google.api.server.spi.Constant; //导入依赖的package包/类
public ApiIssuerConfigs withGoogleIdToken() {
  if (hasIssuer(Constant.GOOGLE_ID_TOKEN_NAME) 
      && hasIssuer(Constant.GOOGLE_ID_TOKEN_NAME_HTTPS)) {
    return this;
  }
  Builder builder = builder();
  if (isSpecified()) {
    builder.issuerConfigs.putAll(issuerConfigs);
  }
  builder.addIssuer(GOOGLE_ID_TOKEN_ISSUER);
  builder.addIssuer(GOOGLE_ID_TOKEN_ISSUER_ALT);
  return builder.build();
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:14,代码来源:ApiIssuerConfigs.java


示例9: addTypeToNode

import com.google.api.server.spi.Constant; //导入依赖的package包/类
/**
 * Adds a schema for a type into an output node. For arrays, this generates nested schemas inline
 * for however many dimensions are necessary.
 *
 * @return an appropriate name for the schema if one isn't already assigned
 */
private String addTypeToNode(ObjectNode schemasNode, TypeToken<?> type,
    TypeToken<?> enclosingType, ObjectNode node, ApiConfig apiConfig,
    List<ApiParameterConfig> parameterConfigs) throws ApiConfigException {
  TypeToken<?> itemType = Types.getArrayItemType(type);

  if (typeLoader.isSchemaType(type)) {
    String basicTypeName = typeLoader.getSchemaType(type);
    addElementTypeToNode(schemasNode, type, basicTypeName, node, apiConfig);
    return basicTypeName;
  } else if (itemType != null) {
    ObjectNode items = objectMapper.createObjectNode();
    node.put("type", "array");
    node.set(Constant.ITEMS, items);

    String itemTypeName = addTypeToNode(schemasNode, itemType, enclosingType, items, apiConfig,
        parameterConfigs);
    String arraySuffix = "Collection";
    StringBuilder sb = new StringBuilder(itemTypeName.length() + arraySuffix.length());
    sb.append(itemTypeName).append(arraySuffix);
    sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
    return sb.toString();
  } else if (type instanceof TypeVariable) {
    throw new IllegalArgumentException(
        String.format("Object type %s not supported.", type));
  } else {
    String typeName = addTypeToSchema(schemasNode, type, enclosingType, apiConfig,
        parameterConfigs);
    addElementTypeToNode(schemasNode, type, typeName, node, apiConfig);
    return typeName;
  }
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:38,代码来源:JsonConfigWriter.java


示例10: googleAuth

import com.google.api.server.spi.Constant; //导入依赖的package包/类
@ApiMethod(
    issuerAudiences = {
        @ApiIssuerAudience(name = Constant.GOOGLE_ID_TOKEN_NAME, audiences = "googleaud")
    }
)
public void googleAuth() { }
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:7,代码来源:SwaggerGeneratorTest.java



注:本文中的com.google.api.server.spi.Constant类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PathResolver类代码示例发布时间:2022-05-22
下一篇:
Java WaterFilter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap