當前位置: 首頁>>代碼示例>>Java>>正文


Java Min類代碼示例

本文整理匯總了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());
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:21,代碼來源:MoviePersistenceServiceImpl.java

示例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());
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:21,代碼來源:MoviePersistenceServiceImpl.java

示例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());
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:20,代碼來源:MoviePersistenceServiceImpl.java

示例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());
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:21,代碼來源:MoviePersistenceServiceImpl.java

示例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());
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:20,代碼來源:MoviePersistenceServiceImpl.java

示例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());
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:20,代碼來源:MoviePersistenceServiceImpl.java

示例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());
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:21,代碼來源:MoviePersistenceServiceImpl.java

示例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());
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:16,代碼來源:MovieSearchServiceImpl.java

示例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());
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:16,代碼來源:MovieSearchServiceImpl.java

示例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;
}
 
開發者ID:randomito,項目名稱:randomito-all,代碼行數:28,代碼來源:MinMaxAnnotationPostProcessor.java

示例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);
    }
 
開發者ID:yunhaibin,項目名稱:dubbox-hystrix,代碼行數:14,代碼來源:UserRestServiceImpl.java

示例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());
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:16,代碼來源:MovieSearchServiceImpl.java

示例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());
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:16,代碼來源:MovieSearchServiceImpl.java

示例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());
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:16,代碼來源:MovieSearchServiceImpl.java

示例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());
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:16,代碼來源:MovieSearchServiceImpl.java


注:本文中的javax.validation.constraints.Min類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。