
package jacorb.ir.gui.remoteobject;


import jacorb.ir.gui.typesystem.*;
import jacorb.ir.gui.typesystem.remote.*;
import org.omg.CORBA.*;
import java.lang.reflect.*;	// zum Auslesen der Felder des Structs
/**
 * This class was generated by a SmartGuide.
 * 
 */
public class Struct extends ObjectRepresentant implements AbstractContainer{



/**
 * Struct constructor comment.
 * @param counterPart java.lang.Object
 */
protected Struct(java.lang.Object counterPart, IRStruct typeSystemNode, String name) {
	super(counterPart,typeSystemNode,name);
}
/**
 * This method was created by a SmartGuide.
 * @return ModelParticipant[]
 */
public ModelParticipant[] contents() {
	if (counterPart!=null) {
		// wir holen uns den Inhalt des Struct per Reflection
		IRStructMember[] members = (IRStructMember[])((AbstractContainer)typeSystemNode).contents();
		ModelParticipant[] result = new ModelParticipant[members.length];
		for (int i=0; i<members.length; i++) {
			try {
				Field field = counterPart.getClass().getDeclaredField(members[i].getName());
				result[i] = ObjectRepresentantFactory.create(
					field.get(counterPart),			// per Reflection auslesen
					members[i].getAssociatedTypeSystemNode(),
					members[i]);
			}
			catch (Exception e) {
				e.printStackTrace();
			}		
		}	
		return result;
	}	// if counterPart!=null
	else  {
		return new ModelParticipant[0];
	}	
}
}




