本文整理汇总了Java中javax.validation.constraints.Min类的典型用法代码示例。如果您正苦于以下问题:Java Min类的具体用法?Java Min怎么用?Java Min使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Min类属于javax.validation.constraints包,在下文中一共展示了Min类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateOtherTitle
import javax.validation.constraints.Min; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void updateOtherTitle(
@NotNull @Valid final OtherTitle otherTitle,
@Min(1) final Long otherTitleId,
@NotNull final MovieEntity movie
) throws ResourceConflictException {
log.info("Called with otherTitle {}, otherTitleId {}, movie {}", otherTitle, otherTitleId, movie);
this.existsOtherTile(movie.getOtherTitles()
.stream()
.filter(ot -> ot.getStatus() == DataStatus.ACCEPTED)
.collect(Collectors.toList()), otherTitle);
final MovieOtherTitleEntity movieOtherTitle = this.entityManager.find(MovieOtherTitleEntity.class, otherTitleId);
movieOtherTitle.setTitle(otherTitle.getTitle());
movieOtherTitle.setCountry(otherTitle.getCountry());
}
示例2: updateReleaseDate
import javax.validation.constraints.Min; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void updateReleaseDate(
@NotNull @Valid final ReleaseDate releaseDate,
@Min(1) final Long releaseDateId,
@NotNull final MovieEntity movie
) throws ResourceConflictException {
log.info("Called with releaseDate {}, releaseDateId {}, movie {}", releaseDate, releaseDateId, movie);
this.existsReleaseDate(movie.getReleaseDates()
.stream()
.filter(rd -> rd.getStatus() == DataStatus.ACCEPTED)
.collect(Collectors.toList()), releaseDate);
final MovieReleaseDateEntity movieReleaseDate = this.entityManager.find(MovieReleaseDateEntity.class, releaseDateId);
movieReleaseDate.setDate(releaseDate.getDate());
movieReleaseDate.setCountry(releaseDate.getCountry());
}
示例3: updateStoryline
import javax.validation.constraints.Min; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void updateStoryline(
@NotNull @Valid final Storyline storyline,
@Min(1) final Long storylineId,
@NotNull final MovieEntity movie
) throws ResourceConflictException {
log.info("Called with storyline {}, storylineId {}, movie {}", storyline, storylineId, movie);
this.existsStoryline(movie.getStorylines()
.stream()
.filter(s -> s.getStatus() == DataStatus.ACCEPTED)
.collect(Collectors.toList()), storyline);
final MovieStorylineEntity movieStoryline = this.entityManager.find(MovieStorylineEntity.class, storylineId);
movieStoryline.setStoryline(storyline.getStoryline());
}
示例4: updateBoxOffice
import javax.validation.constraints.Min; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void updateBoxOffice(
@NotNull @Valid final BoxOffice boxOffice,
@Min(1) final Long boxOfficeId,
@NotNull final MovieEntity movie
) throws ResourceConflictException {
log.info("Called with boxOffice {}, boxOfficeId {}, movie {}", boxOffice, boxOfficeId, movie);
this.existsBoxOffice(movie.getBoxOffices()
.stream()
.filter(bo -> bo.getStatus() == DataStatus.ACCEPTED)
.collect(Collectors.toList()), boxOffice);
final MovieBoxOfficeEntity movieBoxOffice = this.entityManager.find(MovieBoxOfficeEntity.class, boxOfficeId);
movieBoxOffice.setBoxOffice(boxOffice.getBoxOffice());
movieBoxOffice.setCountry(boxOffice.getCountry());
}
示例5: updateCountry
import javax.validation.constraints.Min; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void updateCountry(
@NotNull @Valid final Country country,
@Min(1) final Long countryId,
@NotNull final MovieEntity movie
) throws ResourceConflictException {
log.info("Called with country {}, countryId {}, movie {}", country, countryId, movie);
this.existsCountry(movie.getCountries()
.stream()
.filter(c -> c.getStatus() == DataStatus.ACCEPTED)
.collect(Collectors.toList()), country);
final MovieCountryEntity movieCountry = this.entityManager.find(MovieCountryEntity.class, countryId);
movieCountry.setCountry(country.getCountry());
}
示例6: updateLanguage
import javax.validation.constraints.Min; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void updateLanguage(
@NotNull @Valid final Language language,
@Min(1) final Long languageId,
@NotNull final MovieEntity movie
) throws ResourceConflictException {
log.info("Called with language {}, languageId {}, movie {}", language, languageId, movie);
this.existsLanguage(movie.getLanguages()
.stream()
.filter(l -> l.getStatus() == DataStatus.ACCEPTED)
.collect(Collectors.toList()), language);
final MovieLanguageEntity movieLanguage = this.entityManager.find(MovieLanguageEntity.class, languageId);
movieLanguage.setLanguage(language.getLanguage());
}
示例7: updateReview
import javax.validation.constraints.Min; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void updateReview(
@NotNull @Valid final Review review,
@Min(1) final Long reviewId,
@NotNull final MovieEntity movie
) throws ResourceConflictException {
log.info("Called with review {}, reviewId {}, movie {}", review, reviewId, movie);
this.existsReview(movie.getReviews()
.stream()
.filter(r -> r.getStatus() == DataStatus.ACCEPTED)
.collect(Collectors.toList()), review);
final MovieReviewEntity movieReview = this.entityManager.find(MovieReviewEntity.class, reviewId);
movieReview.setTitle(review.getTitle());
movieReview.setReview(review.getReview());
}
示例8: getTitles
import javax.validation.constraints.Min; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Set<OtherTitle> getTitles(
@Min(1) final Long id
) throws ResourceNotFoundException {
log.info("Called with id {}", id);
return this.findMovie(id).getOtherTitles()
.stream()
.filter(title -> title.getStatus() == DataStatus.ACCEPTED)
.map(ServiceUtils::toOtherTitleDto)
.collect(Collectors.toSet());
}
示例9: getReleaseDates
import javax.validation.constraints.Min; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Set<ReleaseDate> getReleaseDates(
@Min(1) final Long id
) throws ResourceNotFoundException {
log.info("Called with id {}", id);
return this.findMovie(id).getReleaseDates()
.stream()
.filter(releaseDate -> releaseDate.getStatus() == DataStatus.ACCEPTED)
.map(ServiceUtils::toReleaseDateDto)
.collect(Collectors.toSet());
}
示例10: process
import javax.validation.constraints.Min; //导入依赖的package包/类
@Override
public Object process(AnnotationInfo ctx, Object value) throws Exception {
if (!ctx.isAnnotationPresent(Min.class)
&& !ctx.isAnnotationPresent(Max.class)) {
return value;
}
long minValue = 1;
if (ctx.isAnnotationPresent(Min.class)) {
minValue = ctx.getAnnotation(Min.class).value();
}
long maxValue = 50;
if (ctx.isAnnotationPresent(Max.class)) {
maxValue = ctx.getAnnotation(Max.class).value();
}
if (Number.class.isAssignableFrom(value.getClass())) {
return range(String.valueOf(minValue), String.valueOf(maxValue), value.getClass());
} else if (value instanceof String) {
String strVal = (String) value;
if (strVal.length() < minValue) {
strVal += RandomStringUtils.randomAlphabetic((int) minValue - strVal.length());
} else if (strVal.length() > maxValue) {
strVal = strVal.substring(0, (int) maxValue);
}
return strVal;
}
return value;
}
示例11: getUser
import javax.validation.constraints.Min; //导入依赖的package包/类
@Override
public User getUser(@Min(value = 1L, message = "User ID must be greater than 1") @PathParam("id") Long id) {
// test context injection
// System.out.println("Client address from @Context injection: " + (request != null ? request.getRemoteAddr() : ""));
// System.out.println("Client address from RpcContext: " + RpcContext.getContext().getRemoteAddressString());
if (RpcContext.getContext().getRequest(HttpServletRequest.class) != null) {
System.out.println("Client IP address from RpcContext: " + RpcContext.getContext().getRequest(HttpServletRequest.class).getRemoteAddr());
}
if (RpcContext.getContext().getResponse(HttpServletResponse.class) != null) {
System.out.println("Response object from RpcContext: " + RpcContext.getContext().getResponse(HttpServletResponse.class));
}
return userService.getUser(id);
}
示例12: getSites
import javax.validation.constraints.Min; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Set<Site> getSites(
@Min(1) final Long id
) throws ResourceNotFoundException {
log.info("Called with id {}", id);
return this.findMovie(id).getSites()
.stream()
.filter(site -> site.getStatus() == DataStatus.ACCEPTED)
.map(ServiceUtils::toSiteDto)
.collect(Collectors.toSet());
}
示例13: getCountries
import javax.validation.constraints.Min; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Set<Country> getCountries(
@Min(1) final Long id
) throws ResourceNotFoundException {
log.info("Called with id {}", id);
return this.findMovie(id).getCountries()
.stream()
.filter(review -> review.getStatus() == DataStatus.ACCEPTED)
.map(ServiceUtils::toCountryDto)
.collect(Collectors.toSet());
}
示例14: getGenres
import javax.validation.constraints.Min; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Set<Genre> getGenres(
@Min(1) final Long id
) throws ResourceNotFoundException {
log.info("Called with id {}", id);
return this.findMovie(id).getGenres()
.stream()
.filter(review -> review.getStatus() == DataStatus.ACCEPTED)
.map(ServiceUtils::toGenreDto)
.collect(Collectors.toSet());
}
示例15: getPosters
import javax.validation.constraints.Min; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Set<ImageResponse> getPosters(
@Min(1) final Long id
) throws ResourceNotFoundException {
log.info("Called with id {}", id);
return this.findMovie(id).getPosters()
.stream()
.filter(poster -> poster.getStatus() == DataStatus.ACCEPTED)
.map(ServiceUtils::toImageResponseDto)
.collect(Collectors.toSet());
}