@Override public String getName() { return m.getName(); }
/** * Returns the a method with the specified signature exists. * * @param model the model * @param method the method name to look for * @param params the number of parameters in the signature * @return <code>true</code> if found, else <code>false</code> */ protected boolean hasMethod(T model, String method, int params) { requireNonNull(model); requireNonNull(method); requireNonNull(params); Method found = null; for (Method m : model.getMethods()) { if (method.equals(m.getName()) && m.getFields().size() == params) { found = m; break; } } return found != null; } }
/** * Copy constructor. * * @param prototype the prototype */ protected MethodImpl(final Method prototype) { parent = prototype.getParent().orElse(null); name = requireNonNull(prototype).getName(); type = requireNonNull(prototype.getType()); javadoc = prototype.getJavadoc().map(Copier::copy).orElse(null); annotations = Copier.copy(prototype.getAnnotations()); imports = Copier.copy(prototype.getImports()); generics = Copier.copy(prototype.getGenerics()); params = Copier.copy(prototype.getFields()); code = Copier.copy(prototype.getCode(), s -> s); modifiers = Copier.copy(prototype.getModifiers(), c -> c.copy(), EnumSet.noneOf(Modifier.class)); exceptions = new HashSet<>(prototype.getExceptions()); }
initializer.add("final StringBuilder " + STRING_BUILDER_NAME + " = new StringBuilder();"); subInitializers.stream().forEachOrdered(si -> { initializer.add(si.getName() + "(" + STRING_BUILDER_NAME + ");"); }); initializer.add("return " + STRING_BUILDER_NAME + ".toString();");
@Override public String getName() { return m.getName(); }
@Override public String getName() { return m.getName(); }
/** * Returns the a method with the specified signature exists. * * @param model the model * @param method the method name to look for * @param params the number of parameters in the signature * @return <code>true</code> if found, else <code>false</code> */ protected boolean hasMethod(T model, String method, int params) { requireNonNull(model); requireNonNull(method); requireNonNull(params); Method found = null; for (Method m : model.getMethods()) { if (method.equals(m.getName()) && m.getFields().size() == params) { found = m; break; } } return found != null; } }
/** * Returns the a method with the specified signature exists. * * @param model the model * @param method the method name to look for * @param params the number of parameters in the signature * @return <code>true</code> if found, else <code>false</code> */ protected boolean hasMethod(T model, String method, int params) { requireNonNull(model); requireNonNull(method); requireNonNull(params); Method found = null; for (Method m : model.getMethods()) { if (method.equals(m.getName()) && m.getFields().size() == params) { found = m; break; } } return found != null; } }
/** * Copy constructor. * * @param prototype the prototype */ protected MethodImpl(final Method prototype) { name = requireNonNull(prototype).getName(); type = requireNonNull(prototype.getType()); javadoc = prototype.getJavadoc().map(Copier::copy).orElse(null); annotations = Copier.copy(prototype.getAnnotations()); generics = Copier.copy(prototype.getGenerics()); params = Copier.copy(prototype.getFields()); code = Copier.copy(prototype.getCode(), s -> s); modifiers = Copier.copy(prototype.getModifiers(), c -> c.copy(), EnumSet.noneOf(Modifier.class)); exceptions = new HashSet<>(prototype.getExceptions()); }
/** * Copy constructor. * * @param prototype the prototype */ protected MethodImpl(final Method prototype) { parent = prototype.getParent().orElse(null); name = requireNonNull(prototype).getName(); type = requireNonNull(prototype.getType()); javadoc = prototype.getJavadoc().map(Copier::copy).orElse(null); annotations = Copier.copy(prototype.getAnnotations()); imports = Copier.copy(prototype.getImports()); generics = Copier.copy(prototype.getGenerics()); params = Copier.copy(prototype.getFields()); code = Copier.copy(prototype.getCode(), s -> s); modifiers = Copier.copy(prototype.getModifiers(), c -> c.copy(), EnumSet.noneOf(Modifier.class)); exceptions = new HashSet<>(prototype.getExceptions()); }
initializer.add("final StringBuilder " + STRING_BUILDER_NAME + " = new StringBuilder();"); subInitializers.stream().forEachOrdered(si -> { initializer.add(si.getName() + "(" + STRING_BUILDER_NAME + ");"); }); initializer.add("return " + STRING_BUILDER_NAME + ".toString();");