Saturday, January 27, 2018

ObjectAid UML Explorer for Eclipse


The ObjectAid UML Explorer for Eclipse

The ObjectAid UML Explorer is an agile and lightweight code visualization tool for the Eclipse IDE. It shows your Java source code and libraries in live UML class and sequence diagrams that automatically update as your code changes.

Why Another UML Tool?


The ObjectAid UML Explorer is different from other UML tools. It uses the UML notation to show a graphical representation of existing code that is as accurate and up-to-date as your text editor, while being very easy to use. Several unique features make this possible:
  • You simply drag your Java classes onto a diagram from other Eclipse views; no need to start a lengthy reverse engineering job.
  • Your source code and libraries are the model that is displayed, they are not reverse engineered into a different format.
  • If you update your code in Eclipse, your diagram is updated as well; there is no need to reverse engineer source code.
  • Refactoring updates your diagram as well as your source code. When you rename a field or move a class, your diagram simply reflects the changes without going out of sync.
  • All diagrams in your Eclipse workspace are updated with refactoring changes as appropriate. If necessary, they are checked out of your version control system.
  • Diagrams are fully integrated into the Eclipse IDE. You can drag Java classes from any other view onto the diagram, and diagram-related information is shown in other views wherever applicable.
The ObjectAid UML Explorer achieves all this while staying light, fast and easy to use. In addition, exploring code is easy because you can find and add related classes with a right-click from the context menu.

Installation

1- In the Eclipse main menu, go to Help > Install New Software...
2- In the 'Available Software' page of the 'Install' wizard, press the 'Add...' button.
3- In the 'Add Repository' dialog, enter this information and press 'OK':
Name: ObjectAid UML Explorer
URLhttp://www.objectaid.com/update/current
4- The 'Install' dialog will now show the available ObjectAid plug-ins. Please select what you would like to install and press 'Next'. You may want to turn off the check box 'Contact all update sites during install to find required software' to speed up the download.
5- On the 'Install Details' page you should be able to simply press 'Next'.
6- On the 'Review Licenses' page you need to accept the ObjectAid license and press 'Finish' to begin the installation.
7- You will receive a 'Security Warning' message because the ObjecyAid JARs are not signed. Please press 'OK' to continue.
8- Once the installation is complete, you will be asked if you want to 'Restart Now', 'Not Now' or 'Apply Changes Now'. To be safe, please press the 'Restart Now' button and the ObjectAid UML Explorer will be available after the restart.

Wednesday, January 3, 2018

String in java

  • In java, strings are objects that represents a sequence of characters. 
  • java.lang.String class is used to create string object. 
  • String objects are immutable. 
  • java.lang.String class is final. 
  • java.lang.String class is Serializable.


Create String object

In java, there are 2 ways to create String object:
  1. By using string literal
  2. By using new keyword

1- String literal

In Java String literals are created by using double quotes.

String str="india";

When we create a string literal, the JVM checks the string in constant pool first. If the string already available in the pool, a reference of the pooled instance is returned. If string doesn't available in the pool then a new string instance will created and stored in the constant pool.

String str1="india"; 
String str2="india";  // No new instance created


In this case only one object will be created. Firstly JVM will not find any string object with the value "india" in string constant pool, so that it will create a new object. After that it will find the string with the value "india" in the pool then it will not create any new object but will return the reference of the same available instance.

Note: String objects are stored in a special kind of memory area known as string constant pool.

2- new keyword

String str=new String("india");   // Creates 2 objects and 1 reference variable    


In this case, JVM will create a new string object "india" in (non pool) heap memory and checks the availability in String constant pool area. If not exists then store the one copy of literal "india" in String constant pool area for future reference. The variable "str" will refer to the object in heap(non pool).

Java String sample example

public class SampleExample {  
  
public static void main(String args[]) {  
    String str1 = "india";  
    String str2 = new String("sample example");  
    System.out.println(str1);  
    System.out.println(str2);  
}  

Output:
india
sample example

Note:
Java Library provides 4 classes to represent & manipulate a string:
    1. String
    2. StringBuffer
    3. StringBuilder
    4. StringTokenizer
We will discuss in upcoming topics.

Tuesday, January 2, 2018

Java Functional Interface

Java Lambda expression Lambda expression came to enable to use functional programming feature in java. It provides the facility t...