当前位置: 首页>>代码示例>>Java>>正文


Java Validate类代码示例

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


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

示例1: configure

import org.apache.bval.guice.Validate; //导入依赖的package包/类
@Override
protected void configure() {
  bindInterceptor(annotatedWith(Api.class), AUTH_MATCHER, new AuthInterceptor());

  // We must respect this interceptor order.
  bindInterceptor(annotatedWith(Api.class), annotatedWith(Validate.class),
      new ValidationTranslationInterceptor());
  install(new ValidationModule());
}
 
开发者ID:andrestesti,项目名称:blobstoretest,代码行数:10,代码来源:BlobstoretestValidationModule.java

示例2: listFiles

import org.apache.bval.guice.Validate; //导入依赖的package包/类
/**
 * Returns the paginated list of uploaded files.
 * 
 * @param user the authenticated user.
 * @param offset the file list offset.
 * @param limit the file list limit.
 * @return the paginated list of uploaded files.
 */
@ApiMethod(name = "listFiles", path = "files", httpMethod = HttpMethod.GET)
@Validate
public List<FileData> listFiles(
    @Auth User user, 
    @Named("offset") @DefaultValue("0") @Min(0) int offset, 
    @Named("limit") @DefaultValue("100") @Min(0) @Max(100) int limit) {
  
  Query q = new Query(Constants.ENTITY_NAME);
  PreparedQuery pq = datastore.prepare(q);
  Iterable<Entity> entities = pq.asIterable(FetchOptions.Builder.withOffset(offset).limit(limit));
  Iterable<FileData> files = Iterables.transform(entities, entityToFileData());
  return Lists.newArrayList(files);
}
 
开发者ID:andrestesti,项目名称:blobstoretest,代码行数:22,代码来源:Blobstoretest.java

示例3: startDownload

import org.apache.bval.guice.Validate; //导入依赖的package包/类
@POST
@Validate
public String startDownload(@Valid DownloadRequest request, @Context SecurityContext security) {
  LOG.debug("Download: [{}]", request);
  // assert authenticated user is the same as in download
  assertLoginMatches(request, security);
  String downloadKey = requestService.create(request);
  LOG.info("Created new download job with key [{}]", downloadKey);
  return downloadKey;
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:11,代码来源:DownloadResource.java


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