/** * Prints a blank line, ensuring any indent is included before doing so. */ private ItdSourceFileComposer newLine() { return newLine(true); }
/** * Prints the message, after adding indents and returns to a new line. This * is the most commonly used method. */ private ItdSourceFileComposer appendFormalLine(final String message) { appendIndent(); if (message != null && !"".equals(message)) { pw.append(message); content = true; } return newLine(false); }
private void appendTypeDeclaration() { Validate.isTrue(introductionTo.getPackage().equals(aspect.getPackage()), "Aspect and introduction must be in identical packages"); appendIndent(); if (itdTypeDetails.isPrivilegedAspect()) { append("privileged "); } append("aspect " + aspect.getSimpleTypeName() + " {"); this.newLine(false); indent(); this.newLine(); // Set to false, as it was set true during the above operations content = false; }
private void appendTypeAnnotations() { final List<? extends AnnotationMetadata> typeAnnotations = itdTypeDetails.getAnnotations(); if (typeAnnotations == null || typeAnnotations.isEmpty()) { return; } content = true; for (final AnnotationMetadata typeAnnotation : typeAnnotations) { appendIndent(); append("declare @type: "); append(introductionTo.getSimpleTypeName()); append(": "); outputAnnotation(typeAnnotation); append(";"); this.newLine(false); this.newLine(); } }
private void appendImplementsTypes() { final List<JavaType> implementsTypes = itdTypeDetails.getImplementsTypes(); if (implementsTypes == null || implementsTypes.isEmpty()) { return; } content = true; for (final JavaType extendsType : implementsTypes) { appendIndent(); append("declare parents: "); append(introductionTo.getSimpleTypeName()); append(" implements "); if (resolver.isFullyQualifiedFormRequiredAfterAutoImport(extendsType)) { append(extendsType.getNameIncludingTypeParameters()); } else { append(extendsType.getNameIncludingTypeParameters(false, resolver)); } append(";"); this.newLine(false); this.newLine(); } }
private void appendExtendsTypes() { final List<JavaType> extendsTypes = itdTypeDetails.getExtendsTypes(); if (extendsTypes == null || extendsTypes.isEmpty()) { return; } content = true; for (final JavaType extendsType : extendsTypes) { appendIndent(); append("declare parents: "); append(introductionTo.getSimpleTypeName()); append(" extends "); if (resolver.isFullyQualifiedFormRequiredAfterAutoImport(extendsType)) { append(extendsType.getNameIncludingTypeParameters()); } else { append(extendsType.getNameIncludingTypeParameters(false, resolver)); } append(";"); this.newLine(false); this.newLine(); } }
private void appendFieldAnnotations() { final List<DeclaredFieldAnnotationDetails> fieldAnnotations = itdTypeDetails.getFieldAnnotations(); if (fieldAnnotations == null || fieldAnnotations.isEmpty()) { return; } content = true; for (final DeclaredFieldAnnotationDetails fieldDetails : fieldAnnotations) { appendIndent(); append("declare @field: * "); append(introductionTo.getSimpleTypeName()); append("."); append(fieldDetails.getField().getFieldName().getSymbolName()); append(": "); if (fieldDetails.isRemoveAnnotation()) { append("-"); } outputAnnotation(fieldDetails.getFieldAnnotation()); append(";"); this.newLine(false); this.newLine(); } }
/** * Prints a blank line, ensuring any indent is included before doing so. */ private ItdSourceFileComposer newLine() { return newLine(true); }
private void writeInnerTypeFields(final ClassOrInterfaceTypeDetails innerType) { for (final FieldMetadata field : innerType.getDeclaredFields()) { indent(); this.newLine(false); // Append annotations for (final AnnotationMetadata annotation : field.getAnnotations()) { appendIndent(); outputAnnotation(annotation); this.newLine(false); } appendIndent(); if (field.getModifier() != 0) { append(Modifier.toString(field.getModifier())); append(" "); } append(field.getFieldType().getNameIncludingTypeParameters(false, resolver)); append(" "); append(field.getFieldName().getSymbolName()); // Append initializer, if present if (field.getFieldInitializer() != null) { append(" = "); append(field.getFieldInitializer()); } // Complete the field declaration append(";"); this.newLine(false); indentRemove(); } }
/** * Prints the message, after adding indents and returns to a new line. This * is the most commonly used method. */ private ItdSourceFileComposer appendFormalLine(final String message) { appendIndent(); if (message != null && !"".equals(message)) { pw.append(message); content = true; } return newLine(false); }
private void appendTypeDeclaration() { Validate.isTrue(introductionTo.getPackage().equals(aspect.getPackage()), "Aspect and introduction must be in identical packages"); appendIndent(); if (itdTypeDetails.isPrivilegedAspect()) { append("privileged "); } append("aspect " + aspect.getSimpleTypeName() + " {"); this.newLine(false); indent(); this.newLine(); // Set to false, as it was set true during the above operations content = false; }
private void appendTypeAnnotations() { final List<? extends AnnotationMetadata> typeAnnotations = itdTypeDetails.getAnnotations(); if (typeAnnotations == null || typeAnnotations.isEmpty()) { return; } content = true; for (final AnnotationMetadata typeAnnotation : typeAnnotations) { appendIndent(); append("declare @type: "); append(introductionTo.getSimpleTypeName()); append(": "); outputAnnotation(typeAnnotation); append(";"); this.newLine(false); this.newLine(); } }
private void appendFieldAnnotations() { final List<DeclaredFieldAnnotationDetails> fieldAnnotations = itdTypeDetails.getFieldAnnotations(); if (fieldAnnotations == null || fieldAnnotations.isEmpty()) { return; } content = true; for (final DeclaredFieldAnnotationDetails fieldDetails : fieldAnnotations) { appendIndent(); append("declare @field: * "); append(introductionTo.getSimpleTypeName()); append("."); append(fieldDetails.getField().getFieldName().getSymbolName()); append(": "); if (fieldDetails.isRemoveAnnotation()) { append("-"); } outputAnnotation(fieldDetails.getFieldAnnotation()); append(";"); this.newLine(false); this.newLine(); } }