Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 3rd, 2012  |  syntax: None  |  size: 0.87 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //Option #B1 (currently in proposal): Have one single node type with all required attributes
  2.  
  3. interface Node {
  4.  
  5.         String getName();
  6.  
  7.         boolean isInIterable();
  8.  
  9.         Integer getIndex();
  10.  
  11.         Object getKey();
  12.  
  13.         MethodDescriptor getMethodDescriptor();
  14.  
  15.         ConstructorDescriptor getConstructorDescriptor();
  16.  
  17.         ParameterDescriptor getParameterDescriptor();
  18.  
  19.         //currently not in the proposal, but it seems actually more regular to me
  20.         //than representing return value constraints on the method descriptor
  21.         ReturnValueDescriptor getReturnValueDescriptor();
  22. }
  23.  
  24. //Iterating over a Path
  25.  
  26. Path path = ...;
  27. Iterator<Node> nodeIterator = path.iterator();
  28. while(nodeIterator.hasNext()) {
  29.         Node node = nodeIterator.next();
  30.        
  31.         if(node.getMethodDescriptor() != null) {
  32.                 //...
  33.         }
  34.         else if(node.getConstructorDescriptor() != null) {
  35.                 //...
  36.         }
  37. }