String (Snippet snippet) { if (snippet instanceof ExpressionSnippet) { final ExpressionSnippet expr = (ExpressionSnippet)snippet; return expr.typeName() + " " + expr.name(); } if (snippet instanceof ImportSnippet) { return ((ImportSnippet)snippet).fullname(); } if (snippet instanceof MethodSnippet) { final MethodSnippet methodSnippet = (MethodSnippet)snippet; final StringBuilder buf = new StringBuilder(getReturnType(methodSnippet)); if (buf.length() > 0) { buf.append(" "); } return buf.append(methodSnippet.name()).append("(").append(methodSnippet.parameterTypes()).append(")").toString(); } if (snippet instanceof TypeDeclSnippet) { return ((TypeDeclSnippet)snippet).name(); } if (snippet instanceof VarSnippet) { final VarSnippet varSnippet = (VarSnippet)snippet; return varSnippet.typeName() + " " + varSnippet.name(); } if (snippet instanceof PersistentSnippet) { return ((PersistentSnippet)snippet).name(); } return null; }