PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/plugin-module-codegen-maven-client/src/main/java/com/atlassian/maven/plugins/amps/codegen/prompter/common/moduletype/ModuleTypePrompter.java

https://bitbucket.org/mmeinhold/amps
Java | 43 lines | 30 code | 10 blank | 3 comment | 0 complexity | 580f10b14bc3c9b82da1069eb8ed44fd MD5 | raw file
 1package com.atlassian.maven.plugins.amps.codegen.prompter.common.moduletype;
 2
 3import com.atlassian.maven.plugins.amps.codegen.annotations.ModuleCreatorClass;
 4import com.atlassian.maven.plugins.amps.codegen.prompter.AbstractModulePrompter;
 5import com.atlassian.plugins.codegen.modules.PluginModuleLocation;
 6import com.atlassian.plugins.codegen.modules.common.moduletype.ModuleTypeModuleCreator;
 7import com.atlassian.plugins.codegen.modules.common.moduletype.ModuleTypeProperties;
 8import com.atlassian.plugins.codegen.util.ClassnameUtil;
 9
10import org.codehaus.plexus.components.interactivity.Prompter;
11import org.codehaus.plexus.components.interactivity.PrompterException;
12
13/**
14 * @since 3.6
15 */
16@ModuleCreatorClass(ModuleTypeModuleCreator.class)
17public class ModuleTypePrompter extends AbstractModulePrompter<ModuleTypeProperties>
18{
19
20    public ModuleTypePrompter(Prompter prompter)
21    {
22        super(prompter);
23
24    }
25
26    @Override
27    public ModuleTypeProperties promptForBasicProperties(PluginModuleLocation moduleLocation) throws PrompterException
28    {
29        String interfaceName = promptJavaClassname("Enter Interface name", "MYModule");
30        String interfacePackage = promptJavaPackagename("Enter Interface package", getDefaultBasePackage() + ".modules");
31
32        String className = promptJavaClassname("Enter Class name", interfaceName + "ModuleDescriptor");
33        String packageName = promptJavaPackagename("Enter Package Name", interfacePackage);
34
35        String fqClass = ClassnameUtil.fullyQualifiedName(packageName, className);
36        String fqInterface = ClassnameUtil.fullyQualifiedName(interfacePackage, interfaceName);
37
38        ModuleTypeProperties props = new ModuleTypeProperties(fqClass);
39        props.setFullyQualifiedInterface(fqInterface);
40
41        return props;
42    }
43}