1 21 22 23 package org.jacorb.ir.gui.remoteobject; 24 25 26 27 28 29 import org.jacorb.ir.gui.typesystem.*; 30 31 import org.jacorb.ir.gui.typesystem.remote.*; 32 33 import org.omg.CORBA.*; 34 35 import java.lang.reflect.*; 37 44 45 public class Struct extends ObjectRepresentant implements AbstractContainer{ 46 47 48 49 50 51 52 53 60 61 protected Struct(java.lang.Object counterPart, IRStruct typeSystemNode, String name) { 62 63 super(counterPart,typeSystemNode,name); 64 65 } 66 67 74 75 public ModelParticipant[] contents() { 76 77 if (counterPart!=null) { 78 79 81 IRStructMember[] members = (IRStructMember[])((AbstractContainer)typeSystemNode).contents(); 82 83 ModelParticipant[] result = new ModelParticipant[members.length]; 84 85 for (int i=0; i<members.length; i++) { 86 87 try { 88 89 Field field = counterPart.getClass().getDeclaredField(members[i].getName()); 90 91 result[i] = ObjectRepresentantFactory.create( 92 93 field.get(counterPart), 95 members[i].getAssociatedTypeSystemNode(), 96 97 members[i]); 98 99 } 100 101 catch (Exception e) { 102 103 e.printStackTrace(); 104 105 } 106 107 } 108 109 return result; 110 111 } 113 else { 114 115 return new ModelParticipant[0]; 116 117 } 118 119 } 120 121 } 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | Popular Tags |