public CodeVariableElement(Set<Modifier> modifiers, TypeMirror type, String name) { super(modifiers); this.type = type; this.name = CodeNames.of(name); }
public CodeVariableElement(Set<Modifier> modifiers, TypeMirror type, String name) { super(modifiers); this.type = type; this.name = CodeNames.of(name); }
public void setName(String name) { this.name = CodeNames.of(name); }
public void setName(String name) { this.name = CodeNames.of(name); }
public GeneratedPackageElement(String qualifiedName) { super(Collections.<Modifier> emptySet()); this.qualifiedName = CodeNames.of(qualifiedName); int lastIndex = qualifiedName.lastIndexOf('.'); if (lastIndex == -1) { simpleName = CodeNames.of(""); } else { simpleName = CodeNames.of(qualifiedName.substring(lastIndex, qualifiedName.length())); } }
public GeneratedPackageElement(String qualifiedName) { super(Collections.<Modifier> emptySet()); this.qualifiedName = CodeNames.of(qualifiedName); int lastIndex = qualifiedName.lastIndexOf('.'); if (lastIndex == -1) { simpleName = CodeNames.of(""); } else { simpleName = CodeNames.of(qualifiedName.substring(lastIndex, qualifiedName.length())); } }
public CodeTypeElement(Set<Modifier> modifiers, ElementKind kind, PackageElement packageElement, String simpleName) { super(modifiers); this.kind = kind; this.packageElement = packageElement; this.simpleName = CodeNames.of(simpleName); if (this.packageElement != null) { this.packageName = packageElement.getQualifiedName(); } else { this.packageName = CodeNames.of("default"); } this.qualifiedName = createQualifiedName(); }
public CodeTypeElement(Set<Modifier> modifiers, ElementKind kind, PackageElement packageElement, String simpleName) { super(modifiers); this.kind = kind; this.packageElement = packageElement; this.simpleName = CodeNames.of(simpleName); if (this.packageElement != null) { this.packageName = packageElement.getQualifiedName(); } else { this.packageName = CodeNames.of("default"); } this.qualifiedName = createQualifiedName(); }
public CodeExecutableElement(TypeMirror returnType, String name) { super(ElementUtils.modifiers()); this.returnType = returnType; this.name = CodeNames.of(name); }
public CodeVariableElement(TypeMirror type, String name) { super(ElementUtils.modifiers()); this.type = type; this.name = CodeNames.of(name); }
public CodeTypeParameterElement(String name, TypeMirror... bounds) { super(ElementUtils.modifiers()); this.simpleName = CodeNames.of(name); this.bounds = Arrays.asList(bounds); }
public CodeExecutableElement(TypeMirror returnType, String name) { super(ElementUtils.modifiers()); this.returnType = returnType; this.name = CodeNames.of(name); }
public CodeVariableElement(TypeMirror type, String name) { super(ElementUtils.modifiers()); this.type = type; this.name = CodeNames.of(name); }
public CodeExecutableElement(Set<Modifier> modifiers, TypeMirror returnType, String name, CodeVariableElement... parameters) { super(modifiers); this.returnType = returnType; this.name = CodeNames.of(name); for (CodeVariableElement codeParameter : parameters) { addParameter(codeParameter); } }
public CodeExecutableElement(Set<Modifier> modifiers, TypeMirror returnType, String name, CodeVariableElement... parameters) { super(modifiers); this.returnType = returnType; this.name = CodeNames.of(name); for (CodeVariableElement codeParameter : parameters) { addParameter(codeParameter); } }
private Name createQualifiedName() { TypeElement enclosingType = getEnclosingClass(); String name; if (enclosingType == null) { if (packageName == null || packageName.length() == 0) { name = simpleName.toString(); } else { name = packageName + "." + simpleName; } } else { name = enclosingType.getQualifiedName() + "." + simpleName; } return CodeNames.of(name); }
public static CodeExecutableElement createSuperConstructor(ProcessorContext context, TypeElement type, ExecutableElement element) { if (element.getModifiers().contains(Modifier.PRIVATE)) { return null; } CodeExecutableElement executable = CodeExecutableElement.clone(context.getEnvironment(), element); executable.setReturnType(null); executable.setSimpleName(CodeNames.of(type.getSimpleName().toString())); CodeTreeBuilder b = executable.createBuilder(); b.startStatement(); b.startSuperCall(); for (VariableElement v : element.getParameters()) { b.string(v.getSimpleName().toString()); } b.end(); b.end(); return executable; }
private CodeExecutableElement createCreateMethod(ExecutableElement constructor) { CodeExecutableElement method = CodeExecutableElement.clone(context.getEnvironment(), constructor); method.setSimpleName(CodeNames.of("create")); method.getModifiers().clear(); method.getModifiers().add(Modifier.PUBLIC); method.getModifiers().add(Modifier.STATIC); method.setReturnType(node.getNodeType()); CodeTreeBuilder body = method.createBuilder(); body.startReturn(); if (node.getSpecializations().isEmpty()) { body.nullLiteral(); } else { body.startNew(NodeGenFactory.nodeType(node)); for (VariableElement var : method.getParameters()) { body.string(var.getSimpleName().toString()); } body.end(); } body.end(); return method; } }
private Element createSpecializationCreateMethod(SpecializationData specialization, CodeExecutableElement constructor) { if (!useLazyClassLoading()) { return null; } CodeExecutableElement executable = CodeExecutableElement.clone(context.getEnvironment(), constructor); executable.setReturnType(specializationType(null)); executable.setSimpleName(CodeNames.of("create")); executable.getModifiers().add(STATIC); CodeTreeBuilder builder = executable.createBuilder(); builder.startReturn().startNew(specializationType(specialization)); for (VariableElement parameter : executable.getParameters()) { builder.string(parameter.getSimpleName().toString()); } builder.end().end(); return executable; }