static String getSimpleResolveClassName(TypeElement innerClass) { String generatedClassName = ElementUtils.getSimpleName(innerClass); if (generatedClassName.endsWith("Node")) { generatedClassName = generatedClassName.substring(0, generatedClassName.length() - "Node".length()); } return generatedClassName + "SubNode"; }
public static String createReferenceName(ExecutableElement method) { StringBuilder b = new StringBuilder(); b.append(method.getSimpleName().toString()); b.append("("); String sep = ""; for (VariableElement parameter : method.getParameters()) { b.append(sep); b.append(ElementUtils.getSimpleName(parameter.asType())); sep = ", "; } b.append(")"); return b.toString(); }
public static String getReadableSignature(ExecutableElement method) { StringBuilder builder = new StringBuilder(); builder.append(method.getSimpleName().toString()); builder.append("("); String sep = ""; for (VariableElement var : method.getParameters()) { builder.append(sep); builder.append(getSimpleName(var.asType())); sep = ", "; } builder.append(")"); return builder.toString(); }
public static String createReferenceName(ExecutableElement method) { StringBuilder b = new StringBuilder(); b.append(method.getSimpleName().toString()); b.append("("); String sep = ""; for (VariableElement parameter : method.getParameters()) { b.append(sep); b.append(ElementUtils.getSimpleName(parameter.asType())); sep = ", "; } b.append(")"); return b.toString(); }
public static String getReadableSignature(ExecutableElement method) { StringBuilder builder = new StringBuilder(); builder.append(method.getSimpleName().toString()); builder.append("("); String sep = ""; for (VariableElement var : method.getParameters()) { builder.append(sep); builder.append(getSimpleName(var.asType())); sep = ", "; } builder.append(")"); return builder.toString(); }
public String getName() { StringBuilder b = new StringBuilder(); String sep = ""; for (TypeMirror typeMirror : primitiveSignature) { b.append(sep).append(ElementUtils.firstLetterLowerCase(ElementUtils.getSimpleName(typeMirror))); sep = "_"; } return b.toString(); }
private String useImport(Element enclosedType, TypeMirror type) { if (imports != null) { return imports.createTypeReference(enclosedType, type); } else { return ElementUtils.getSimpleName(type); } }
private String useImport(Element enclosedType, TypeMirror type) { if (imports != null) { return imports.createTypeReference(enclosedType, type); } else { return ElementUtils.getSimpleName(type); } }
@Override public String toString() { return getClass().getSimpleName() + "[" + ElementUtils.getSimpleName(getTemplateType()) + "]"; }
@Override public String toString() { return super.toString() + "/* " + ElementUtils.getSimpleName(type) + "*/"; }
private static String createSourceTypeLocalName(LocalVariable targetValue, TypeMirror sType) { return targetValue.getName() + ElementUtils.getSimpleName(sType); }
private static String getWildcardName(WildcardType type) { StringBuilder b = new StringBuilder(); if (type.getExtendsBound() != null) { b.append("? extends ").append(getSimpleName(type.getExtendsBound())); } else if (type.getSuperBound() != null) { b.append("? super ").append(getSimpleName(type.getExtendsBound())); } return b.toString(); }
private static String getWildcardName(WildcardType type) { StringBuilder b = new StringBuilder(); if (type.getExtendsBound() != null) { b.append("? extends ").append(getSimpleName(type.getExtendsBound())); } else if (type.getSuperBound() != null) { b.append("? super ").append(getSimpleName(type.getExtendsBound())); } return b.toString(); }
ForeignAccessFactoryGenerator(ProcessingEnvironment processingEnv, MessageResolution messageResolutionAnnotation, TypeElement element) { this.processingEnv = processingEnv; this.element = element; this.packageName = ElementUtils.getPackageName(element); this.simpleClassName = ElementUtils.getSimpleName(element) + "Foreign"; this.receiverTypeClass = Utils.getReceiverTypeFullClassName(messageResolutionAnnotation); this.imports = new TreeSet<>(); this.messageGenerators = new HashMap<>(); this.languageCheckGenerator = null; }
public void visitNegate(Negate negate) { TypeMirror booleanType = context.getType(boolean.class); TypeMirror resolvedType = negate.getResolvedType(); if (!ElementUtils.typeEquals(resolvedType, booleanType)) { throw new InvalidExpressionException(String.format("The operator %s is undefined for the argument type %s.", "!", ElementUtils.getSimpleName(resolvedType))); } }
public void visitNegate(Negate negate) { TypeMirror booleanType = context.getType(boolean.class); TypeMirror resolvedType = negate.getResolvedType(); if (!ElementUtils.typeEquals(resolvedType, booleanType)) { throw new InvalidExpressionException(String.format("The operator %s is undefined for the argument type %s.", "!", ElementUtils.getSimpleName(resolvedType))); } }
public NodeData(ProcessorContext context, TypeElement type, TypeSystemData typeSystem, boolean generateFactory) { super(context, type, null); this.nodeId = ElementUtils.getSimpleName(type); this.typeSystem = typeSystem; this.fields = new ArrayList<>(); this.children = new ArrayList<>(); this.childExecutions = new ArrayList<>(); this.thisExecution = new NodeExecutionData(new NodeChildData(null, null, "this", getNodeType(), getNodeType(), null, Cardinality.ONE, null), -1, -1); this.thisExecution.getChild().setNode(this); this.generateFactory = generateFactory; }
public NodeData(ProcessorContext context, TypeElement type, String shortName, TypeSystemData typeSystem, boolean generateFactory) { super(context, type, null); this.nodeId = ElementUtils.getSimpleName(type); this.shortName = shortName; this.typeSystem = typeSystem; this.fields = new ArrayList<>(); this.children = new ArrayList<>(); this.childExecutions = new ArrayList<>(); this.thisExecution = new NodeExecutionData(new NodeChildData(null, null, "this", getNodeType(), getNodeType(), null, Cardinality.ONE), -1, -1, false); this.thisExecution.getChild().setNode(this); this.generateFactory = generateFactory; }
private CodeExecutableElement createAsTypeMethod(TypeMirror type) { if (typeSystem.getCast(type) != null) { return null; } CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC, STATIC), type, TypeSystemCodeGenerator.asTypeMethodName(typeSystem, type)); method.addParameter(new CodeVariableElement(context.getType(Object.class), LOCAL_VALUE)); CodeTreeBuilder body = method.createBuilder(); String assertMessage = typeName(typeSystem) + "." + asTypeMethodName(typeSystem, type) + ": " + ElementUtils.getSimpleName(type) + " expected"; body.startAssert().tree(check(typeSystem, type, LOCAL_VALUE)).string(" : ").doubleQuote(assertMessage).end(); body.startReturn().tree(cast(typeSystem, type, LOCAL_VALUE)).end(); return method; }
private CodeExecutableElement createAsTypeMethod(TypeMirror type) { if (typeSystem.getCast(type) != null) { return null; } CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC, STATIC), type, TypeSystemCodeGenerator.asTypeMethodName(typeSystem, type)); method.addParameter(new CodeVariableElement(context.getType(Object.class), LOCAL_VALUE)); CodeTreeBuilder body = method.createBuilder(); String assertMessage = typeName(typeSystem) + "." + asTypeMethodName(typeSystem, type) + ": " + ElementUtils.getSimpleName(type) + " expected"; body.startAssert().tree(check(typeSystem, type, LOCAL_VALUE)).string(" : ").doubleQuote(assertMessage).end(); body.startReturn().tree(cast(typeSystem, type, LOCAL_VALUE)).end(); return method; }