private List createPropertiesForHasManyExpression(Expression e, ClassNode classNode) { List properties = new ArrayList(); if (e instanceof MapExpression) { MapExpression me = (MapExpression) e; List mapEntries = me.getMapEntryExpressions(); for (Iterator j = mapEntries.iterator(); j.hasNext(); ) { MapEntryExpression mee = (MapEntryExpression) j.next(); Expression keyExpression = mee.getKeyExpression(); String key = keyExpression.getText(); addAssociationForKey(key, properties, classNode); } } return properties; }
private Collection createPropertiesForBelongsToExpression(Expression e, ClassNode classNode) { List properties = new ArrayList(); if (e instanceof MapExpression) { MapExpression me = (MapExpression) e; List mapEntries = me.getMapEntryExpressions(); for (Iterator i = mapEntries.iterator(); i.hasNext(); ) { MapEntryExpression mme = (MapEntryExpression) i.next(); String key = mme.getKeyExpression().getText(); String type = mme.getValueExpression().getText(); properties.add( new PropertyNode( key, Modifier.PUBLIC, ClassHelper.make(type), classNode, null, null, null)); } } return properties; }