
Untitled
By: a guest on
Aug 3rd, 2012 | syntax:
None | size: 0.87 KB | hits: 9 | expires: Never
//Option #B1 (currently in proposal): Have one single node type with all required attributes
interface Node {
String getName();
boolean isInIterable();
Integer getIndex();
Object getKey();
MethodDescriptor getMethodDescriptor();
ConstructorDescriptor getConstructorDescriptor();
ParameterDescriptor getParameterDescriptor();
//currently not in the proposal, but it seems actually more regular to me
//than representing return value constraints on the method descriptor
ReturnValueDescriptor getReturnValueDescriptor();
}
//Iterating over a Path
Path path = ...;
Iterator<Node> nodeIterator = path.iterator();
while(nodeIterator.hasNext()) {
Node node = nodeIterator.next();
if(node.getMethodDescriptor() != null) {
//...
}
else if(node.getConstructorDescriptor() != null) {
//...
}
}