javax.json.bind.annotation.JsonbDateFormat Java Examples

The following examples show how to use javax.json.bind.annotation.JsonbDateFormat. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HeroFinder.java    From microprofile-graphql with Apache License 2.0 5 votes vote down vote up
@Mutation
@Description("Check in a superhero") 
public SuperHero checkInWithCorrectDateFormat(@Name("name") String name,
                         @JsonbDateFormat("yy dd MM") // This should be ignored due to DateFormat below
                         @DateFormat("MM/dd/yyyy") @Name("date") LocalDate localDate) throws UnknownHeroException {
    LOG.log(Level.INFO, "checkInWithCorrectDateFormat invoked [{0}],[{1}]", new Object[]{name, localDate});
    SuperHero superHero = heroDB.getHero(name);
    if(superHero!=null){
        superHero.setDateOfLastCheckin(localDate);
    }
    return superHero;
}
 
Example #2
Source File: HeroFinder.java    From microprofile-graphql with Apache License 2.0 5 votes vote down vote up
@Mutation
@Description("Set all the important dates (US format) for a certain hero") 
public SuperHero importantDatesUS(@Name("name") String name,
                         @JsonbDateFormat("yy dd MM") // This should be ignored due to DateFormat below
                         @Name("dates") List<@DateFormat("MM/dd/yyyy") LocalDate> localDates) throws UnknownHeroException {
    LOG.log(Level.INFO, "importantDatesUS invoked [{0}],[{1}]", new Object[]{name, localDates});
    SuperHero superHero = heroDB.getHero(name);
    if(superHero!=null){
        superHero.setImportantDates(localDates);
    }
    return superHero;
}
 
Example #3
Source File: HeroFinder.java    From microprofile-graphql with Apache License 2.0 5 votes vote down vote up
@Mutation
@Description("Set the time a hero started patrolling (using formatted time)") 
public SuperHero startPatrollingWithCorrectDateFormat(@Name("name") String name,
                         @JsonbDateFormat("HH:mm") @Name("time") LocalTime localTime) throws UnknownHeroException {
    LOG.log(Level.INFO, "startPatrollingWithCorrectDateFormat invoked [{0}],[{1}]", new Object[]{name, localTime});
    SuperHero superHero = heroDB.getHero(name);
    if(superHero!=null){
        superHero.setPatrolStartTime(localTime);
    }
    return superHero;
}
 
Example #4
Source File: HeroFinder.java    From microprofile-graphql with Apache License 2.0 5 votes vote down vote up
@Mutation
@Description("Start a battle") 
public SuperHero battleWithCorrectDateFormat(@Name("name") String name,
                         @JsonbDateFormat("HH:mm:ss dd-MM-yyyy") @Name("dateTime") LocalDateTime localDateTime) throws UnknownHeroException {
    LOG.log(Level.INFO, "battleWithCorrectDateFormat invoked [{0}],[{1}]", new Object[]{name, localDateTime});
    SuperHero superHero = heroDB.getHero(name);
    if(superHero!=null){
        superHero.setTimeOfLastBattle(localDateTime);
    }
    return superHero;
}
 
Example #5
Source File: Magazine.java    From Java-EE-8-Sampler with MIT License 4 votes vote down vote up
@JsonbDateFormat(value = "MM/dd/yyyy", locale = "Locale.ENGLISH")
public void setPublished(LocalDate published) {
    this.published = published;
}