diff options
author | Emil Lundberg <emil@emlun.se> | 2019-01-10 04:33:16 +0100 |
---|---|---|
committer | Emil Lundberg <emil@emlun.se> | 2019-01-13 02:25:26 +0100 |
commit | 3c28cf93ff79fb8f0c1c46c64a5851d235179700 (patch) | |
tree | 8bc05c4d51d7c828160438a952e596ab14dbc826 /src | |
parent | bbaa932c11dbe70bb14ec49434df9ef5196b04cc (diff) | |
download | lombok-3c28cf93ff79fb8f0c1c46c64a5851d235179700.tar.gz lombok-3c28cf93ff79fb8f0c1c46c64a5851d235179700.tar.bz2 lombok-3c28cf93ff79fb8f0c1c46c64a5851d235179700.zip |
Extract function generateSingularMethodParameterNames
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java | 21 |
1 files changed, 13 insertions, 8 deletions
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<String> 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<JCStatement> statements = new ListBuffer<JCStatement>(); 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<String> 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); |