How do I set up an inferred type list getter and setter?

Question!
List<T> objectList = null;
public <T> List<T> getObjectList() { return this.objectList; }
public <T> void setObjectList(List<T> objList) { this.objectList = objList; }

The problem appears to be the field declaration. Semantically, I am wondering why, since the goal is to infer the type, this doesn't work.

From a short term gain point of view, I just want something that works.

Icing on the cake would be if someone would point me to a detailed, i.e. in-depth, discussion of inferred types with examples.

The context is a raw string returned from a request-reply bus message that needs to be de-serialized into a list of like javabean objects. I realize I could just create a marker interface and make all of my javabeans impl it, however, that seems like kind of a wanky solution to me.

JDK 1.6 (no chance of moving up to 7 or 8)

By : rakehell


Answers

You have typed your methods... don't - remove

By : Bohemian


This video can help you solving your question :)
By: admin