本文整理匯總了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());
}
示例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);
}
示例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;
}