Java8 Archive

Rest Documentation with Swagger And Spring boot

Simple Spring-boot Swagger Documentation Learning Swagger documentation for rest. To Add Swagger to your application add the depedencies   <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.7.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.7.0</version> <scope>compile</scope> </dependency>   create SwaggerConfiguration class @EnableSwagger2 @Configuration public class SwaggerConfig { @Bean public Docket productAPI(){ return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.basePackage(“com.putracode”)) .paths(PathSelectors.regex(“/api.*”)) .build() .apiInfo(metaInfo()); } private […]

Persist LocalDateTime Using Java 8 And Hibernate

When i learn about java 8, I have thinking about how to use Java Date and Time in POJOs. i have tried using converters,but i’d don’t satisfied using it. Timeline in twitter gave me information, Hibernate ORM 5.0.0 release. I Reading the spesification And… Java 8 support Well, ok.. not all of Java 8. Specifically we […]

How to i Change Format Symbol Currency by Locale

First  Thanks to Mr. Wayan Saryada for advice to Change Symbol of Currency Format. In this code snippet you will learn how to change Currency Symbol Locale by  DecimalFormat. First Of All we need create an instance of object Locale (we use US Locale).  Then make e object DecimalFormat using static method getCurrencyInstance.  DecimalFormatSymbols is […]

How to Format Java LocalDate using Locale

Hii… This Code will show us how to format Java LocalDate. DateTimeFormatter will help to convert LocalDate to String. import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Arrays; import java.util.Locale; public class LocalDateFormatterMain {     public static void main(String[] args) {         //get date today         LocalDate _now=LocalDate.now();         // DateTimeFormatter.ofPattern(PATTTERN_DATE, LOCALE )        […]

Java 8 LocalDate By Example

Java Util Date is Past, Now is a new Era, Java Time is a Future, my teacher say like that Java 8 come with the new Api for Date. LocalDate is an immutable date-time object that represents a date, often viewed as year-month-day. Other date fields, such as day-of-year, day-of-week and week-of-year, can also be […]

Hello World In Java8 Lambdas

In this code snippet example you will learn how implement the Interface with Syntax java Lambdas, Old Way and New Ways in Java8 Lambdas. Let’s see the code snippet below as an example: package com.putracode._01_helloworld; public class HelloWorld_Lambdas { public static void main(String[] args) { // Old ways, Implementatios The Interface IHelloWorld IHelloWorld oldWays=new IHelloWorld() […]