From 3c28cf93ff79fb8f0c1c46c64a5851d235179700 Mon Sep 17 00:00:00 2001 From: Emil Lundberg Date: Thu, 10 Jan 2019 04:33:16 +0100 Subject: Extract function generateSingularMethodParameterNames --- .../handlers/singulars/JavacGuavaSingularizer.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/core') diff --git a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java index d4becda7..bf2e1cbc 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java @@ -82,13 +82,7 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer { @Override protected void generateSingularMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source, boolean fluent) { - LombokImmutableList suffixes = getArgumentSuffixes(); - Name[] names = new Name[suffixes.size()]; - for (int i = 0; i < names.length; i++) { - String s = suffixes.get(i); - Name n = data.getSingularName(); - names[i] = s.isEmpty() ? n : builderType.toName(s); - } + Name[] names = generateSingularMethodParameterNames(data, builderType); ListBuffer statements = new ListBuffer(); statements.append(createConstructBuilderVarIfNeeded(maker, data, builderType, source)); @@ -109,7 +103,18 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer { finishAndInjectSingularMethod(maker, returnType, returnStatement, data, builderType, source, fluent, deprecate, statements, params.toList(), getAddMethodName()); } - + + private Name[] generateSingularMethodParameterNames(SingularData data, JavacNode builderType) { + LombokImmutableList suffixes = getArgumentSuffixes(); + Name[] names = new Name[suffixes.size()]; + for (int i = 0; i < names.length; i++) { + String s = suffixes.get(i); + Name n = data.getSingularName(); + names[i] = s.isEmpty() ? n : builderType.toName(s); + } + return names; + } + @Override protected void generatePluralMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source, boolean fluent) { JCModifiers mods = makeMods(maker, builderType, deprecate); -- cgit