Home » Tag Archives: Reflection

Tag Archives: Reflection

Java Reflection Tutorial – The ULTIMATE Guide (PDF Download)

java-logo

This tutorial is about reflection, the ability of a computer program to examine and modify the structure and behavior (specifically the values, meta-data, properties and functions) of the program at runtime. We are going to explain what reflection is in general and how can be used in Java. Real uses cases about different reflection uses are listed in the next ...

Read More »

Processing Java Annotations Using Reflection

java-logo

In my previous article covering Java Annotations, I outlined a recent use case and provided you with some examples of custom annotations and how they might be used. In this article, I’m going to take that a step further and give you a few examples of custom annotations and how you would process these custom annotations using the Java Reflection API. ...

Read More »

Using Reflection for Testing

java-logo

I am working on a presentation about the ‘Single Responsibility Principle’, based on my previous post. It take most of my time. In the meantime, I want to share a sample code of how I use to test inner fields in my classes. I am doing it for a special case of testing, which is more of an integration test. ...

Read More »

Implementing dynamic proxies – a comparison

java-logo

Sometimes there is the need to intercept certain method calls in order to execute your own logic everytime the intercepted method is called. If you are not within in Java EE’s CDI world and don’t want to use AOP frameworks like aspectj, you have a simple and similar effective alternative. Since version 1.5 the JDK comes with the class java.lang.reflect.Proxy ...

Read More »

Java Reflection Tutorial

java-logo

In this tutorial, I mainly write some examples to introduce what Java reflection can do. Hopefully, it can give you an overview of this concept. Please leave your comment for suggestions. What is Reflection? In brief, reflection is the ability of a program to examine and modify the structure and behavior of an object at runtime. This concept is sometimes ...

Read More »

Java’s Reflection API

java-logo

If you have ever asked yourself questions like these: – “How do I invoke a method, having only it’s name in a String?” – “How do I list all the attributes in a class dynamically?” – “How do I write a method that resets the state of any given object to default values?” Then you have probably already heared of ...

Read More »

Duck typing in Java ? Well, not exactly

java-logo

According to Wikipedia duck typing is: style of dynamic typing in which an object’s methods and properties determine the valid semantics, rather than its inheritance from a particular class or implementation of a specific interface In simplier words When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call ...

Read More »

Creating a Java Dynamic Proxy

java-logo

Java Dynamic proxy mechanism provides an interesting way to create proxy instances. The steps to create a dynamic proxy is a little tedious though, consider a proxy to be used for auditing the time taken for a method call for a service instance – public interface InventoryService { public Inventory create(Inventory inventory); public List<Inventory> list(); public Inventory findByVin(String vin); public ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close