From 6b7c6d4922410aa42256784add7d10c1beecc2b7 Mon Sep 17 00:00:00 2001 From: Mehedi Date: Thu, 31 Mar 2016 12:33:15 +0600 Subject: [PATCH] generated interfaces doesn't need to be public. --- README.md | 2 +- resources/META-INF/plugin.xml | 7 ++++++- .../stepbuilder/generator/StepBuilderGenerator.java | 10 +++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4677046..651ca2c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ StepBuilder Generator plugin that adds a 'Step Builder' action to the Generate menu (Alt+Insert) which generates a Builder class which follows the Step Builder pattern. You can read about the Step Builder pattern and why it might be a little more effective than -the usual Builder pattern [here](http://www.jayway.com/2012/02/07/builder-pattern-with-a-twist/). +the usual Builder pattern [here](http://devliving.online/stepbuilder-builder-that-guides-you-through-the-steps/). ![screenshot](screenshot_1.png) diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml index 50d0899..2c5ecd5 100644 --- a/resources/META-INF/plugin.xml +++ b/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ online.devliving.stepbuilder.generator StepBuilder Generator - 1.0 + 1.0.1 Mehedi Hasan Khan 1.0.0 First release + + + 1.0.1 + Generated interfaces aren't public + ]]> diff --git a/src/online/devliving/stepbuilder/generator/StepBuilderGenerator.java b/src/online/devliving/stepbuilder/generator/StepBuilderGenerator.java index 68f895a..bb9fe9f 100644 --- a/src/online/devliving/stepbuilder/generator/StepBuilderGenerator.java +++ b/src/online/devliving/stepbuilder/generator/StepBuilderGenerator.java @@ -213,7 +213,12 @@ public void run() { } private PsiClass createBuildStepInterface(){ - return psiElementFactory.createInterface(INTERFACE_NAME_PREFIX + BUILD_STEP_INTERFACE_NAME); + PsiClass buildStep = psiElementFactory.createInterface(INTERFACE_NAME_PREFIX + BUILD_STEP_INTERFACE_NAME); + if(buildStep.getModifierList() != null){ + buildStep.getModifierList().setModifierProperty(PsiModifier.PUBLIC, false); + } + + return buildStep; } /** @@ -229,6 +234,9 @@ private PsiClass generateMandatoryInterface(PsiFieldMember forMember, PsiType re BUILDER_SETTER_ALTERNATIVE_PARAMETER_NAME:BUILDER_SETTER_DEFAULT_PARAMETER_NAME; PsiClass mInterface = psiElementFactory.createInterface(INTERFACE_NAME_PREFIX + capitalizedFieldName); + if(mInterface.getModifierList() != null){ + mInterface.getModifierList().setModifierProperty(PsiModifier.PUBLIC, false); + } PsiMethod fieldMethod = psiElementFactory.createMethodFromText(String.format("%s %s(%s %s);", returnType.getPresentableText(), methodName, forMember.getElement().getType().getPresentableText(), paramName), mInterface);