public Set<Node> getChildren() { Set<Node> result = new HashSet<Node>(); Class<?>[] interfaces = interf.getInterfaces(); for (int ctr = 0; ctr < interfaces.length; ctr++) { Class<?> cls = interfaces[ctr]; if (Remote.class.isAssignableFrom(cls) && !Remote.class.equals(cls)) result.add(new NodeImpl(cls)); } return result; }
private Class<?>[] getInterfaces(Set<Node> roots) { Class<?>[] classes = new Class[roots.size()]; Iterator<Node> iter = roots.iterator(); int ctr = 0; while (iter.hasNext()) { NodeImpl node = (NodeImpl) iter.next(); classes[ctr++] = node.getInterface(); } return classes; }
private String[] makeTypeIds(NodeImpl root, Graph gr, Set<Node> rootSet) { Set<Node> nonRootSet = new HashSet<Node>(gr); nonRootSet.removeAll(rootSet); // List<String> for the typeids List<String> result = new ArrayList<String>(); if (rootSet.size() > 1) { // If the rootSet has more than one element, we must put the type id of the implementation class first. Root // represents the implementation class here. result.add(root.getTypeId()); } addNodes(result, rootSet); addNodes(result, nonRootSet); return result.toArray(new String[result.size()]); }
private Set<Node> getRootSet(Class<?> target, NodeImpl root, Graph gr) { Set<Node> rootSet = null; if (target.isInterface()) { gr.add(root); rootSet = gr.getRoots(); // rootSet just contains root here } else { // Use this class and its superclasses (not Object) as initial roots Class<?> superclass = target; Set<Node> initialRootSet = new HashSet<Node>(); while ((superclass != null) && !superclass.equals(Object.class)) { Node node = new NodeImpl(superclass); gr.add(node); initialRootSet.add(node); superclass = superclass.getSuperclass(); } // Expand all nodes into the graph gr.getRoots(); // remove the roots and find roots again gr.removeAll(initialRootSet); rootSet = gr.getRoots(); } return rootSet; }
private Set<Node> getRootSet(Class<?> target, NodeImpl root, Graph gr) { Set<Node> rootSet = null; if (target.isInterface()) { gr.add(root); rootSet = gr.getRoots(); // rootSet just contains root here } else { // Use this class and its superclasses (not Object) as initial roots Class<?> superclass = target; Set<Node> initialRootSet = new HashSet<Node>(); while ((superclass != null) && !superclass.equals(Object.class)) { Node node = new NodeImpl(superclass); gr.add(node); initialRootSet.add(node); superclass = superclass.getSuperclass(); } // Expand all nodes into the graph gr.getRoots(); // remove the roots and find roots again gr.removeAll(initialRootSet); rootSet = gr.getRoots(); } return rootSet; }
private String[] makeTypeIds(NodeImpl root, Graph gr, Set<Node> rootSet) { Set<Node> nonRootSet = new HashSet<Node>(gr); nonRootSet.removeAll(rootSet); // List<String> for the typeids List<String> result = new ArrayList<String>(); if (rootSet.size() > 1) { // If the rootSet has more than one element, we must put the type id of the implementation class first. Root // represents the implementation class here. result.add(root.getTypeId()); } addNodes(result, rootSet); addNodes(result, nonRootSet); return result.toArray(new String[result.size()]); }
public ClassDataImpl(Class<?> cls) { this.cls = cls; Graph gr = new GraphImpl(); NodeImpl root = new NodeImpl(cls); Set<Node> rootSet = getRootSet(cls, root, gr); // At this point, rootSet contains those remote interfaces that are not related by inheritance, and gr // contains all reachable remote interfaces. Class<?>[] interfaces = getInterfaces(rootSet); nameTranslator = IDLNameTranslatorImpl.get(interfaces); typeIds = makeTypeIds(root, gr, rootSet); ihfactory = new InvocationHandlerFactoryImpl(PresentationManagerImpl.this, this); dictionary = new HashMap<Object, Object>(); }
public ClassDataImpl(Class<?> cls) { this.cls = cls; Graph gr = new GraphImpl(); NodeImpl root = new NodeImpl(cls); Set<Node> rootSet = getRootSet(cls, root, gr); // At this point, rootSet contains those remote interfaces that are not related by inheritance, and gr // contains all reachable remote interfaces. Class<?>[] interfaces = getInterfaces(rootSet); nameTranslator = IDLNameTranslatorImpl.get(interfaces); typeIds = makeTypeIds(root, gr, rootSet); ihfactory = new InvocationHandlerFactoryImpl(PresentationManagerImpl.this, this); dictionary = new HashMap<Object, Object>(); }
public Set<Node> getChildren() { Set<Node> result = new HashSet<Node>(); Class<?>[] interfaces = interf.getInterfaces(); for (int ctr = 0; ctr < interfaces.length; ctr++) { Class<?> cls = interfaces[ctr]; if (Remote.class.isAssignableFrom(cls) && !Remote.class.equals(cls)) result.add(new NodeImpl(cls)); } return result; }
private void addNodes(List<String> resultList, Set<Node> nodeSet) { Iterator<Node> iter = nodeSet.iterator(); while (iter.hasNext()) { NodeImpl node = (NodeImpl) iter.next(); String typeId = node.getTypeId(); resultList.add(typeId); } }
private void addNodes(List<String> resultList, Set<Node> nodeSet) { Iterator<Node> iter = nodeSet.iterator(); while (iter.hasNext()) { NodeImpl node = (NodeImpl) iter.next(); String typeId = node.getTypeId(); resultList.add(typeId); } }
private Class<?>[] getInterfaces(Set<Node> roots) { Class<?>[] classes = new Class[roots.size()]; Iterator<Node> iter = roots.iterator(); int ctr = 0; while (iter.hasNext()) { NodeImpl node = (NodeImpl) iter.next(); classes[ctr++] = node.getInterface(); } return classes; }