Netflix/astyanax — pull request #203 by ptgoetz (2013-02-03 04:52:06+00:00)
Title: Fix AnnotatedCompositeSerializer to allow generics.

This is (somewhat of a hack) fix that allows AnnotatedCompositeSerializer to properly handle annotated generic classes, such as:

static class GenericComposite{
@Component(ordinal = 0)
A a;

@Component(ordinal = 1)
B b;

public GenericComposite(){}

public GenericComposite(A a, B b){
this.a = a;
this.b = b;
}
}

Without it, attempts to serialize and instance of the above class would be met with a cryptic error such as "X did not validate".

The solution was to modify AnnotatedCompositeSerializer so that it waits to infer the serializer until it is actually asked to (de)serialize an @Component object.

Dealing with `null` values was a bit hacky since we can't really infer the type of a null, so instead we delegate to the class definition.

My apologies if I violated formatting rules... I use spaces(no tabs), but it looks like Netflix uses a combination. Feel free to kick it back if that's an issue.