code: public static Element getDeclaredElement(TreeNode node) {
      if (node instanceof AbstractTypeDeclaration) {
        return ((AbstractTypeDeclaration) node).getTypeElement();
      } else if (node instanceof MethodDeclaration) {
        return ((MethodDeclaration) node).getExecutableElement();
      } else if (node instanceof VariableDeclaration) {
        return ((VariableDeclaration) node).getVariableElement();
      }
      return null;
    }
docs: Gets the element that is declared by this node.