else
{
// Try to derive element type from generics info
if (member.getGenericType() instanceof ParameterizedType)
{
ParameterizedType paramtype = (ParameterizedType)member.getGenericType();
if (paramtype.getActualTypeArguments().length == 1)
{
collectionElementType = ((Class)paramtype.getActualTypeArguments()[0]);
elementTypeStr.append(collectionElementType.getName());
}
}
}
contmd = new CollectionMetaData(mmd, elementTypeStr.toString(),
embeddedElement, dependentElement, serializedElement);
// Add any embedded element mappings
if (embeddedElementMembers != null)
{
EmbeddedMetaData embmd = elemmd.getEmbeddedMetaData();
for (int j=0;j<embeddedElementMembers.length;j++)
{
// Add the metadata for the embedded element to the embedded metadata
String memberName = embeddedElementMembers[j].name();
if (memberName.indexOf('.') > 0)
{
memberName = memberName.substring(memberName.lastIndexOf('.')+1);
}
AbstractMemberMetaData embfmd = getFieldMetaDataForPersistent(embmd, embeddedElementMembers[j],
isMemberOfClassAField(collectionElementType, memberName));
embmd.addMember(embfmd);
}
}
}
else if (member.getType().isArray())
{
StringBuffer elementTypeStr = new StringBuffer();
if (elementTypes != null && elementTypes.length > 0 && elementTypes[0] != void.class)
{
// User-specified element type(s)
for (int j=0;j<elementTypes.length;j++)
{
if (elementTypeStr.length() > 0)
{
elementTypeStr.append(',');
}
elementTypeStr.append(elementTypes[j].getName());
}
}
else
{
// Derive from component type
elementTypeStr.append(member.getType().getComponentType().getName());
}
contmd = new ArrayMetaData(mmd, elementTypeStr.toString(),
embeddedElement, dependentElement, serializedElement);
}
else if (Map.class.isAssignableFrom(member.getType()))
{
Class mapKeyType = null;
if (keyType != null && keyType != void.class)
{
// User-specified key type
mapKeyType = keyType;
}
else
{
// Try to derive key type from generics info
if (member.getGenericType() instanceof ParameterizedType)
{
ParameterizedType paramtype = (ParameterizedType)member.getGenericType();
if (paramtype.getActualTypeArguments().length == 2)
{
mapKeyType = ((Class)paramtype.getActualTypeArguments()[0]);
}
}
}
Class mapValueType = null;
if (valueType != null && valueType != void.class)
{
// User-specified value type
mapValueType = valueType;
}
else
{
// Try to derive value type from generics info
if (member.getGenericType() instanceof ParameterizedType)
{
ParameterizedType paramtype = (ParameterizedType)member.getGenericType();
if (paramtype.getActualTypeArguments().length == 2)
{
mapValueType = ((Class)paramtype.getActualTypeArguments()[1]);
}
}
}
contmd = new MapMetaData(mmd,