List of usage examples for java.time LocalDate now
public static LocalDate now()
From source file:dijalmasilva.core.service.VisitaServiceImpl.java
@Override public void visitou(Long visitante, Long visitado) { Visita v = new Visita(visitante, visitado, LocalDate.now()); dao.save(v); }
From source file:net.ceos.project.poi.annotated.bean.MultiTypeObjectBuilder.java
/** * Create a MultiTypeObject for tests./* ww w . ja v a 2 s. co m*/ * * @return the {@link MultiTypeObject} */ public static MultiTypeObject buildMultiTypeObject(int multiplier) { MultiTypeObject toValidate = new MultiTypeObject(); toValidate.setDateAttribute(new Date()); toValidate.setLocalDateAttribute(LocalDate.now()); toValidate.setLocalDateTimeAttribute(LocalDateTime.now()); toValidate.setStringAttribute("some string"); toValidate.setIntegerAttribute(46 * multiplier); toValidate.setDoubleAttribute(Double.valueOf("25.3") * multiplier); toValidate.setLongAttribute(Long.valueOf("1234567890") * multiplier); toValidate.setBooleanAttribute(Boolean.FALSE); /* create sub object Job */ Job job = new Job(); job.setJobCode(0005); job.setJobFamily("Family Job Name"); job.setJobName("Job Name"); toValidate.setJob(job); toValidate.setIntegerPrimitiveAttribute(121 * multiplier); toValidate.setDoublePrimitiveAttribute(44.6 * multiplier); toValidate.setLongPrimitiveAttribute(987654321L * multiplier); toValidate.setBooleanPrimitiveAttribute(true); /* create sub object AddressInfo */ AddressInfo ai = new AddressInfo(); ai.setAddress("this is the street"); ai.setNumber(99); ai.setCity("this is the city"); ai.setCityCode(70065); ai.setCountry("This is a Country"); toValidate.setAddressInfo(ai); toValidate.setFloatAttribute(14.765f * multiplier); toValidate.setFloatPrimitiveAttribute(11.1125f * multiplier); toValidate.setUnitFamily(UnitFamily.COMPONENTS); toValidate.setBigDecimalAttribute(BigDecimal.valueOf(24.777).multiply(BigDecimal.valueOf(multiplier))); toValidate.setShortAttribute((short) 17); toValidate.setShortPrimitiveAttribute((short) 4); // TODO add new fields below return toValidate; }
From source file:OrderDAOEmptyTests.java
@Before public void setup() { ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml"); orderTest = (OrderDAO) ctx.getBean("orderTest"); LocalDate currentDate = LocalDate.now(); currentDateString = currentDate.toString(); }
From source file:OrderItemDAOTests.java
@Before public void setup() { ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml"); orderItemTest = (OrderItemDAO) ctx.getBean("orderItemTest"); LocalDate currentDate = LocalDate.now(); currentDateString = currentDate.toString(); }
From source file:OrderDAOTests.java
@Before public void setup() { ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml"); orderDAOTests = (OrderDAO) ctx.getBean("orderTest"); LocalDate currentDate = LocalDate.now(); currentDateString = currentDate.toString(); // Add 50 orders for setup for (int i = 1; i <= 50; i++) { Order testOrder = new Order(); testOrder.setCustomerName("Customer" + i); testOrder.setCustomerState("OH"); testOrder.setTaxRate(6.5);//w w w. j a v a 2 s . c o m testOrder.setTotalCost(50.00 + i); testOrder.setOrderID(orderDAOTests.assignID(currentDateString)); orderDAOTests.addOrder(currentDateString, testOrder); } // Add one different order to test search functionality Order testOrder = new Order(); testOrder.setCustomerName("Larry"); testOrder.setCustomerState("MI"); testOrder.setTaxRate(6.5); testOrder.setTotalCost(50.00); testOrder.setOrderID(orderDAOTests.assignID(currentDateString)); orderDAOTests.addOrder(currentDateString, testOrder); }
From source file:com.clearprecision.microservices.reference.jetty.service.BirthdayService.java
public Birthday getNumberOfDaysUntilBirthday(Integer day, Integer month) { Birthday bd = new Birthday(); LocalDate date = LocalDate.now(); LocalDate birthday = LocalDate.of(date.getYear(), month, day); long days = date.until(birthday, ChronoUnit.DAYS); bd.setDate(days + " days until your birthday"); return bd;//from w w w. j a v a2 s. com }
From source file:works.bill.web.beans.SpinUpBean.java
public DateThingGroupSet getDatedThings() { DateThingGroupSet dateThingGroupSet = new DateThingGroupSet(); DatedThing thing6 = new DatedThing("Baz", LocalDate.now().minusDays(2), EnumSet.allOf(MyEnum.class)); DatedThing thing1 = new DatedThing("Foo", LocalDate.now(), EnumSet.allOf(MyEnum.class)); DatedThing thing5 = new DatedThing("Bar", LocalDate.now(), EnumSet.allOf(MyEnum.class)); DatedThing thing2 = new DatedThing("Woo", LocalDate.now(), EnumSet.of(MyEnum.FIRST, MyEnum.SECOND)); DatedThing thing3 = new DatedThing("Yay", LocalDate.now(), EnumSet.of(MyEnum.SECOND, MyEnum.FIRST)); DatedThing thing4 = new DatedThing("Hoopla", LocalDate.now().plusDays(3), EnumSet.allOf(MyEnum.class)); dateThingGroupSet.add(thing1);//from w w w. j av a 2 s. com dateThingGroupSet.add(thing2); dateThingGroupSet.add(thing3); dateThingGroupSet.add(thing4); dateThingGroupSet.add(thing5); dateThingGroupSet.add(thing6); return dateThingGroupSet; }
From source file:mServer.tool.MserverDatumZeit.java
public static long getSecondsUntilNextDay() { // now//from www . ja va2 s . c om LocalDateTime now = LocalDateTime.now(); // tomorrow 0:00 LocalDateTime future = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT).plusDays(1L); Duration duration = Duration.between(now, future); return duration.getSeconds(); }
From source file:demo.Message.java
public Message() { this.created = LocalDate.now(); }
From source file:ch.thp.proto.spring.time.hello.dataloader.HelloWorldLoader.java
@Transactional @Override//from w ww .ja v a2 s .c o m public void load() { HelloWorld entityOne = new HelloWorld("one", LocalDate.now()); HelloWorld entityTwo = new HelloWorld("two", LocalDate.now()); em.persist(entityOne); em.persist(entityTwo); }