Posts

Interfaces just got much better in Java 8

                             We all know that Interface contains methods and variables, but the methods declared in an interface are by default abstract (only method signature nobody).If a class is implementing an interface it must provide method implementation of the methods in the interface, otherwise, the class must be declared as abstract. Now imagine a situation where you want to add a new method to an interface later.Modifying one interface breaks all classes that implement the interface.which means adding a single method can break millions of lines of code. In order to address this problem, Java8 introduced "Default Method" or Defender methods, which allows the user to enter a new method in the interface without breaking existing implementation of these interfaces.It provides flexibility to allow Interface define implementation which will use as default in the situation where a concrete Class fails to provide an implementation for that method. Let's under

Automate File Classification with Apache Camel

We usually download several files to the Downloads folder, you might find various files in diverse formats like MP3, PDF, docs, srt , MP4 etc.Then you start moving the files from download folder to other folders, which can be very tiresome and monotonous task. In this post i am gonna show how to shift all your files from Downloads folder to respective folder, by using a simple Apache Camel route. Apache Camel is a rule-based routing and mediation engine that provides a Java object-based implementation of the Enterprise Integration Patterns using an API (or declarative Java Domain Specific Language) to configure routing and mediation rules. Lets first create a simple Spring Boot maven project Create a maven project and include spring Boot and Apache Camel dependencies. Now create the Spring Boot main file as Next, we add a class with the Camel routes.This routes will be started automatically. To keep the main thread blocked so that Camel stays up, add camel.spri