maandag 9 mei 2011

Updates incoming in 3.6

Hi all,

version 3.6 of SennMagic is currently in the making and there's some nice new stuff in there!

AutowiredHttpServlet: an HttpServlet that allows your Spring beans to be automatically injected if you annotate them with the Spring @Autowired annotation.


The Directory class has been retrofitted to extend java.io.File.  Some methods have been removed to avoid duplicate methods with java.io.File.


The Chainable Collections API has some new stuff aswell! 

First of all, the implementations have been changed so they return their own implementation instead of the interface.  This way specific implementation methods can be added to the end of the chain if needed.
For example in ChainableHashMap:

public ChainableMap<K, V> add(K key, V value) {...}

has been changed to:

public ChainableHashMap<K, V> add(K key, V value) {...}

Second, I've added ChainableVector and ChainableHashtable to the CCA.

And as always methods have been added to various existing classes.


Stay tuned!

Bart

zondag 23 januari 2011

Not dead but very much alive!

It's been a while since I updated anything on the SennMagic project, but here it is!

Version 3.5 has some minor changes and additions in existing classes (DFCUtils, GeneralUtils) but most importantly:
The 'chainable' collections api!

Don't you just hate it when you are instantiating objects and you have to pass a Collection instance and you can't do it in one line because the collection needs one or more items in it, like this:

car.setPassengers(new ArrayList<Passenger>()); // you can only add an empty list
//so you have to do:
List<Passenger> passengers = new ArrayList<Passenger>();
passengers.add(new Passenger("Bart"));
car.setPassengers(passengers);

That's all in the past with the chainable collections api!

The chainable collections api has extra methods (with very recognizable, straightforward names) to add/remove/replace items in the collections, but instead of the normal return value, it returns the collection itself.  This enables you to 'chain' actions like this:

//same as previous example:
car.setPassengers(new ChainableArrayList<Passenger>().put(new Passenger("Bart")));

I have created implementations for the most commonly used collections (+maps):
  • ChainableList extends List
    • ChainableArrayList extends ArrayList implements ChainableList
    • ChainableLinkedList extends LinkedList implements ChainableList
  • ChainableMap extends Map
    • ChainableHashMap extends HashMap implements ChainableMap
    • ChainableLinkedHashMap extends LinkedHashMap implements ChainableMap
    • ChainableTreeMap extends TreeMap implements ChainableMap
  • ChainableQueue extends Queue
    • ChainablePriorityQueue extends PriorityQueue implements ChainableQueue
  • ChainableSet extends Set
    • ChainableHashSet extends HashSet implements ChainableSet
    • ChainableLinkedHashSet extends LinkedHashSet implements ChainableSet
    • ChainableTreeSet extends TreeSet implements ChainableSet
It's already proven to be quite handy, especially when creating unit tests, in multiple projects, by multiple developers.

Get it while it's still hot! 

Bart