private static void generateClearsFromParameters(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method) { for (ParameterDeclaration param : method.getParameters()) { CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class); if (cached_reference_annotation != null && cached_reference_annotation.name().length() == 0) { Class nio_type = Utils.getNIOBufferType(param.getType()); String reference_name = Utils.getReferenceName(interface_decl, method, param); writer.println("\t\tthis." + reference_name + " = null;"); } } }
private static void generateCopiesFromParameters(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method) { for (ParameterDeclaration param : method.getParameters()) { CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class); if (cached_reference_annotation != null && cached_reference_annotation.name().length() == 0) { Class nio_type = Utils.getNIOBufferType(param.getType()); String reference_name = Utils.getReferenceName(interface_decl, method, param); writer.print("\t\t\tthis." + reference_name + " = "); writer.println(REFERENCES_PARAMETER_NAME + "." + reference_name + ";"); } } }
private static void generateReferencesFromParameters(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method) { for (ParameterDeclaration param : method.getParameters()) { CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class); if (cached_reference_annotation != null && cached_reference_annotation.name().length() == 0) { Class nio_type = Utils.getNIOBufferType(param.getType()); if (nio_type == null) throw new RuntimeException(param + " in method " + method + " in " + interface_decl + " is annotated with " + cached_reference_annotation.annotationType().getSimpleName() + " but the parameter is not a NIO buffer"); writer.print("\t" + nio_type.getName() + " " + Utils.getReferenceName(interface_decl, method, param)); writer.println(";"); } } }