當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。