public <T extends JCTree> T build(final lombok.ast.Node<?> node, final Class<T> extectedType) {
   if (node == null) return null;
   JCTree tree = node.accept(this, null);
   if ((JCStatement.class == extectedType) && (tree instanceof JCExpression)) {
     tree = M(node).Exec((JCExpression) tree);
   }
   return Cast.<T>uncheckedCast(tree);
 }
Exemple #2
0
 public <T extends lombok.ast.pg.IType<?, ?, ?, ?, ?, ?>> T memberType(final String typeName) {
   for (EclipseNode child : node().down()) {
     if (child.getKind() != Kind.TYPE) continue;
     if (child.getName().equals(typeName)) {
       return Cast.<T>uncheckedCast(EclipseType.typeOf(child, source));
     }
   }
   throw new IllegalArgumentException();
 }
Exemple #3
0
 public <T extends IType<?, ?, ?, ?, ?, ?>> T surroundingType() {
   final EclipseNode parent = node().directUp();
   if (parent == null) return null;
   return Cast.<T>uncheckedCast(EclipseType.typeOf(parent, source));
 }