EClass propertyEClass = (EClass)eClasses.get(propertyClass);
if (propertyEClass != null)
{
// The property is another SDO, create an EReference to represent the property
EReference reference = EcoreFactory.eINSTANCE.createEReference();
reference.setName(propertyName);
reference.setContainment(true);
reference.setEType(propertyEClass);
implEClass.getEStructuralFeatures().add(reference);
}
else
{
// The property is a List<T> and T is an SDO, created a 0..many EReference to represent the property
if (propertyClass == List.class)
{
Type genericType = method.getGenericReturnType();
if (genericType instanceof ParameterizedType)
{
ParameterizedType parameterizedType = (ParameterizedType)genericType;
Type[] targs = parameterizedType.getActualTypeArguments();
if (targs.length != 0 && eClasses.containsKey(targs[0]))
{
propertyEClass = (EClass)eClasses.get(targs[0]);
if (propertyEClass != null)
{
EReference reference = EcoreFactory.eINSTANCE.createEReference();
reference.setName(propertyName);
reference.setContainment(true);
reference.setEType(propertyEClass);
reference.setUpperBound(-1);
implEClass.getEStructuralFeatures().add(reference);
}
}
}
continue;