No new plugin for this release but a new shared feature: Formatters!
Shared feature: Formatters
What are Formatters? Well, Formatters have the same exact purpose as the toString() method: they are here to describe your objects.
The good news with Formatters is that you can display an object’s data as you wish. For instance, you may have a User object.
With the toString() method, you are limited to only one way to describe your user. Either you’re lazy and you decide to just return its name, either you want to be explicit and you may return a String containing all of its properties’ values.
With Formatters, you are free to do what you want. You could create a UserNameFormatter that will return the user’s name. But also a UserFormatter that will return a full description of your User object.
Also, Formatters are not tied to your User object. You could decide to create a Formatter to describe a UserInterface object implementation if you wanted to.
Formatters are going to be very useful when used in conjunction with the Logger and SessionManager plugins.
Let’s say you need to log some dates. A date can be an int, a long, a Date or Calendar object. Or even some other object from some third-party date-time library like Joda time for example.
We all know how painful it is to display human-readable dates. So why not create a Formatter? Well, the Formatter module already has a DateFormatter class to handle the previous, non-third-party, types listed earlier.
Now you could call:
flog(myDateObject, formatter = DateFormatter())
to quickly log a human-readable date.
You could also use whatever Formatter you need to visualize information on your user depending on your current use-case:
// Log only the user’s name flog(myUser, formatter = UserNameFormatter()) // Log full user’s description flog(myUser, formatter = UserFormatter())
Formatters are a quick and easy way to either display human-readable information or to display only the needed information.
Think of it as a better and more flexible toString() method.
New Copy capabilities
Three plugins have been updated to take advantage of the new copy feature of the previous releases.
You will be able to copy your log’s values (either raw or formatted) in the Logger plugin.
You will be able to copy your application, activities, services, … values in the Manifest Explorer plugin.
And finally, you will be able to copy the headers’ values as well as the request/response body in the Network Explorer plugin.