public StringBuilder getQualifiedName(StringBuilder b, boolean generic) { if (getEnclosingType() instanceof ClassRef) { getEnclosingType().getQualifiedName(b, generic).append('$'); } else if (getEnclosingType() instanceof NamespaceRef) { getEnclosingType().getQualifiedName(b, generic).append('.'); } b.append(ident.simpleName); if (generic && ident.templateArguments != null) { int args = 0; for (int i = 0, n = ident.templateArguments.length; i < n; i++) { TemplateArg arg = ident.templateArguments[i]; if (!(arg instanceof TypeRef)) { continue; } if (args == 0) { b.append('<'); } else { b.append(", "); } ((TypeRef) arg).getQualifiedName(b, generic); args++; } if (args > 0) { b.append('>'); } } return b; }
@Override public String toString() { StringBuilder b = new StringBuilder(); b.append(simpleName); appendTemplateArgs(b, templateArguments); return b.toString(); }
@Override public String toString() { StringBuilder b = new StringBuilder(); for (Class<?> ann : annotations) { b.append(ann.getSimpleName()).append(' '); } b.append((type instanceof Class<?>) ? ((Class<?>) type).getSimpleName() : type.toString()); return b.toString(); }
@Override public String toString() { StringBuilder b = new StringBuilder(); if (enclosingType != null) { b.append(enclosingType).append('.'); } b.append(ident); return b.toString(); }
static void appendArgs(StringBuilder b, char pre, char post, Object[] params) { b.append(pre); if (params != null) { for (int i = 0; i < params.length; i++) { if (i != 0) { b.append(", "); } b.append(params[i]); } } b.append(post); }
public static StringBuilder implode(StringBuilder b, Iterable<?> items, String sep) { boolean first = true; for (Object item : items) { if (first) { first = false; } else { b.append(sep); } b.append(item); } return b; }
@Override public String toString() { StringBuilder b = new StringBuilder(); b.append(valueType).append(' '); boolean nameWritten = false; if (enclosingType != null) { b.append(enclosingType); b.append('.'); if (memberName instanceof SpecialName) { switch ((SpecialName) memberName) { case Destructor: b.append('~'); case Constructor: b.append(((ClassRef) enclosingType).ident.simpleName); nameWritten = true; break; } } } if (!nameWritten) { b.append(memberName); } appendTemplateArgs(b, templateArguments); appendArgs(b, '(', ')', paramTypes); return b.toString(); }
protected DemanglingException error(String mess, int deltaPosition) { StringBuilder err = new StringBuilder(position + 1); int position = this.position + deltaPosition; for (int i = 0; i < position; i++) { err.append(' '); } err.append('^'); return new DemanglingException( "Parsing error at position " + position + (mess == null ? "" : ": " + mess) + " \n\t" + str + "\n\t" + err); }
public String generateCreateCommand() throws NotImplementedTypesException { StringBuilder builder = new StringBuilder().append("create table ").append(tableName).append(" ("); for (int i = 0; i + 1 < fields.size(); i++) { builder.append(fields.get(i).generateDeclaration()); builder.append(", "); } builder.append(fields.get(fields.size() - 1).generateDeclaration()); builder.append(")"); return builder.toString(); }
public String generateInsertCommand(T item) throws NotImplementedTypesException { StringBuilder builder = new StringBuilder().append("insert into ").append(tableName).append(" values ("); for (int i = 0; i + 1 < fields.size(); i++) { builder.append(fields.get(i).stringValueOf(item)); builder.append(", "); } builder.append(fields.get(fields.size() - 1).stringValueOf(item)); builder.append(")"); return builder.toString(); }
public String generateUpdateCommand(T item) throws NotImplementedTypesException { StringBuilder builder = new StringBuilder().append("update ").append(tableName).append(" set "); for (int i = 0; i + 1 < fields.size(); i++) { builder .append(fields.get(i).getName()) .append(" = ") .append(fields.get(i).stringValueOf(item)) .append(", "); } builder .append(fields.get(fields.size() - 1).getName()) .append(" = ") .append(fields.get(fields.size() - 1).stringValueOf(item)); builder.append(" where "); builder .append(primaryKeyFieldConverter.getName()) .append(" = ") .append(primaryKeyFieldConverter.stringValueOf(item)); return builder.toString(); }
@Override public StringBuilder getQualifiedName(StringBuilder b, boolean generic) { return b.append(getTypeClass(this.type).getName()); }
@Override public StringBuilder getQualifiedName(StringBuilder b, boolean generic) { return b.append("org.bridj.Pointer"); }