public void build()
{
Class<?> currentType = container.getType();
Class<?> tempType;
Type aTempType;
ClassContainer tempContainer;
do
{
// Locate all members that are saveable.
for (Field f : currentType.getDeclaredFields())
{
// if its a saveable field
if (!Modifier.isTransient(f.getModifiers()) && !Modifier.isStatic(f.getModifiers()))
{
tempType = f.getType();
aTempType = f.getGenericType();
if (aTempType instanceof ParameterizedType)
{
Type[] types = ((ParameterizedType) aTempType).getActualTypeArguments();
Class[] params = new Class[types.length];
for (int i = 0; i < types.length; i++)
{
if (types[i] instanceof Class)
{
params[i] = (Class<?>) types[i];
}
else if (types[i] instanceof ParameterizedType)
{
params[i] = (Class<?>) ((ParameterizedType) types[i]).getRawType();
}
}
tempContainer = new ClassContainer(tempType, params);
fields.put(f.getName(), tempContainer);
}
else
{
tempContainer = new ClassContainer(tempType);
fields.put(f.getName(), tempContainer);
}
}
// check for UniqueKey