Polish the javadoc in spring-boot-cli

Add missing @param and @return elements
This commit is contained in:
Andy Wilkinson 2015-02-04 14:00:44 +00:00
parent 17f05467bc
commit 54e90c03fc
18 changed files with 129 additions and 37 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -33,11 +33,13 @@ public interface Command {
/**
* Returns the name of the command.
* @return the command's name
*/
String getName();
/**
* Returns a description of the command.
* @return the command's description
*/
String getDescription();
@ -45,29 +47,34 @@ public interface Command {
* Returns usage help for the command. This should be a simple one-line string
* describing basic usage. e.g. '[options] <file>'. Do not include the name of
* the command in this string.
* @return the command's usage help
*/
String getUsageHelp();
/**
* Gets full help text for the command, e.g. a longer description and one line per
* option.
* @return the command's help text
*/
String getHelp();
/**
* Returns help for each supported option.
* @return help for each of the command's options
*/
Collection<OptionHelp> getOptionsHelp();
/**
* Return some examples for the command.
* @return the command's examples
*/
Collection<HelpExample> getExamples();
/**
* Run the command.
* @param args command arguments (this will not include the command itself)
* @throws Exception
* @throws Exception if the command fails
* @return the outcome of the command
*/
ExitStatus run(String... args) throws Exception;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -80,7 +80,8 @@ public class CommandException extends RuntimeException {
}
/**
* Returns options a set of options that are understood by the {@link CommandRunner}.
* Returns a set of options that are understood by the {@link CommandRunner}.
* @return the options understood by the runner
*/
public Set<Option> getOptions() {
return Collections.unmodifiableSet(this.options);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -61,6 +61,7 @@ public class CommandRunner implements Iterable<Command> {
/**
* Return the name of the runner or an empty string. Non-empty names will include a
* trailing space character so that they can be used as a prefix.
* @return the name of the runner
*/
public String getName() {
return this.name;
@ -179,7 +180,7 @@ public class CommandRunner implements Iterable<Command> {
showUsage();
return 1;
}
catch(TestFailedException e) {
catch (TestFailedException e) {
return 1;
}
catch (Exception ex) {
@ -204,7 +205,8 @@ public class CommandRunner implements Iterable<Command> {
/**
* Parse the arguments and run a suitable command.
* @param args the arguments
* @throws Exception
* @throws Exception if the command fails
* @return the outcome of the command
*/
protected ExitStatus run(String... args) throws Exception {
if (args.length == 0) {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -69,7 +69,9 @@ class InitializrService {
/**
* Generate a project based on the specified {@link ProjectGenerationRequest}
* @param request the generation request
* @return an entity defining the project
* @throws IOException if generation fails
*/
public ProjectGenerationResponse generate(ProjectGenerationRequest request)
throws IOException {
@ -89,6 +91,9 @@ class InitializrService {
/**
* Load the {@link InitializrServiceMetadata} at the specified url.
* @param serviceUrl to url of the initializer service
* @return the metadata describing the service
* @throws IOException if the service's metadata cannot be loaded
*/
public InitializrServiceMetadata loadMetadata(String serviceUrl) throws IOException {
CloseableHttpResponse httpResponse = executeInitializrMetadataRetrieval(serviceUrl);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -57,6 +57,7 @@ class InitializrServiceMetadata {
/**
* Creates a new instance using the specified root {@link JSONObject}.
* @param root the root JSONObject
*/
public InitializrServiceMetadata(JSONObject root) {
this.dependencies = parseDependencies(root);
@ -75,6 +76,7 @@ class InitializrServiceMetadata {
/**
* Return the dependencies supported by the service.
* @return the supported dependencies
*/
public Collection<Dependency> getDependencies() {
return this.dependencies.values();
@ -83,6 +85,8 @@ class InitializrServiceMetadata {
/**
* Return the dependency with the specified id or {@code null} if no such dependency
* exists.
* @param id the id
* @return the dependency or {@code null}
*/
public Dependency getDependency(String id) {
return this.dependencies.get(id);
@ -90,14 +94,16 @@ class InitializrServiceMetadata {
/**
* Return the project types supported by the service.
* @return the supported project types
*/
public Map<String, ProjectType> getProjectTypes() {
return this.projectTypes.getContent();
}
/**
* Return the default type to use or {@code null} or the metadata does not define any
* Return the default type to use or {@code null} if the metadata does not define any
* default.
* @return the default project type or {@code null}
*/
public ProjectType getDefaultType() {
if (this.projectTypes.getDefaultItem() != null) {
@ -112,6 +118,7 @@ class InitializrServiceMetadata {
/**
* Returns the defaults applicable to the service.
* @return the defaults of the service
*/
public Map<String, String> getDefaults() {
return this.defaults;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -60,8 +60,9 @@ class ProjectGenerationRequest {
private String type;
/**
* The url of the service to use.
* The URL of the service to use.
* @see #DEFAULT_SERVICE_URL
* @return the service URL
*/
public String getServiceUrl() {
return this.serviceUrl;
@ -73,6 +74,7 @@ class ProjectGenerationRequest {
/**
* The location of the generated project.
* @return the location of the generated project
*/
public String getOutput() {
return this.output;
@ -89,8 +91,10 @@ class ProjectGenerationRequest {
}
/**
* Specify if the project archive should be extract in the output location. If the
* {@link #getOutput() output} ends with "/", the project is extracted automatically.
* Whether or not the project archive should be extracted in the output location. If
* the {@link #getOutput() output} ends with "/", the project is extracted
* automatically.
* @return {@code true} if the archive should be extracted, otherwise {@code false}
*/
public boolean isExtract() {
return this.extract;
@ -102,6 +106,7 @@ class ProjectGenerationRequest {
/**
* The Spring Boot version to use or {@code null} if it should not be customized.
* @return the Spring Boot version of {@code null}
*/
public String getBootVersion() {
return this.bootVersion;
@ -113,6 +118,7 @@ class ProjectGenerationRequest {
/**
* The identifiers of the dependencies to include in the project.
* @return the dependency identifiers
*/
public List<String> getDependencies() {
return this.dependencies;
@ -120,6 +126,7 @@ class ProjectGenerationRequest {
/**
* The Java version to use or {@code null} if it should not be customized.
* @return the Java version or {@code null}
*/
public String getJavaVersion() {
return this.javaVersion;
@ -131,6 +138,7 @@ class ProjectGenerationRequest {
/**
* The packaging type or {@code null} if it should not be customized.
* @return the packaging type or {@code null}
*/
public String getPackaging() {
return this.packaging;
@ -143,6 +151,7 @@ class ProjectGenerationRequest {
/**
* The build type to use. Ignored if a type is set. Can be used alongside the
* {@link #getFormat() format} to identify the type to use.
* @return the build type
*/
public String getBuild() {
return this.build;
@ -155,6 +164,7 @@ class ProjectGenerationRequest {
/**
* The project format to use. Ignored if a type is set. Can be used alongside the
* {@link #getBuild() build} to identify the type to use.
* @return the project format
*/
public String getFormat() {
return this.format;
@ -165,7 +175,8 @@ class ProjectGenerationRequest {
}
/**
* Specify if the type should be detected based on the build and format value.
* Whether or not the type should be detected based on the build and format value.
* @return {@code true} if type detection will be performed, otherwise {@code false}
*/
public boolean isDetectType() {
return this.detectType;
@ -178,6 +189,7 @@ class ProjectGenerationRequest {
/**
* The type of project to generate. Should match one of the advertized type that the
* service supports. If not set, the default is retrieved from the service metadata.
* @return the project type
*/
public String getType() {
return this.type;
@ -188,7 +200,9 @@ class ProjectGenerationRequest {
}
/**
* Generates the URL to use to generate a project represented by this request
* Generates the URI to use to generate a project represented by this request
* @param metadata the metadata that describes the service
* @return the project generation URI
*/
URI generateUrl(InitializrServiceMetadata metadata) {
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -38,6 +38,7 @@ class ProjectGenerationResponse {
/**
* Return the {@link ContentType} of this instance
* @return the content type
*/
public ContentType getContentType() {
return this.contentType;
@ -45,6 +46,7 @@ class ProjectGenerationResponse {
/**
* The generated project archive or file.
* @return the content
*/
public byte[] getContent() {
return this.content;
@ -57,6 +59,7 @@ class ProjectGenerationResponse {
/**
* The preferred file name to use to store the entity on disk or {@code null} if no
* preferred value has been set.
* @return the file name, or {@code null}
*/
public String getFileName() {
return this.fileName;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,7 +24,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.http.impl.client.CloseableHttpClient;
import org.codehaus.plexus.util.StringUtils;
/**
@ -40,7 +39,8 @@ class ServiceCapabilitiesReportGenerator {
private final InitializrService initializrService;
/**
* Creates an instance using the specified {@link CloseableHttpClient}.
* Creates an instance using the specified {@link InitializrService}.
* @param initializrService the initialzr service
*/
ServiceCapabilitiesReportGenerator(InitializrService initializrService) {
this.initializrService = initializrService;
@ -49,6 +49,9 @@ class ServiceCapabilitiesReportGenerator {
/**
* Generate a report for the specified service. The report contains the available
* capabilities as advertized by the root endpoint.
* @param url the url of the service
* @return the report that describes the service
* @throws IOException if the report cannot be generated
*/
public String generate(String url) throws IOException {
InitializrServiceMetadata metadata = this.initializrService.loadMetadata(url);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,11 +27,13 @@ public interface OptionHelp {
/**
* Returns the set of options that are mutually synonymous.
* @return the options
*/
Set<String> getOptions();
/**
* Returns usage help for the option.
* @return the usage help
*/
String getUsageHelp();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -30,11 +30,13 @@ public interface SpringApplicationRunnerConfiguration extends GroovyCompilerConf
/**
* Returns {@code true} if the source file should be monitored for changes and
* automatically recompiled.
* @return {@code true} if file watching should be performed, otherwise {@code false}
*/
boolean isWatchForFileChanges();
/**
* Returns the logging level to use.
* @return the logging level
*/
Level getLogLevel();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -50,6 +50,7 @@ public class ShellPrompts {
/**
* Returns the current prompt.
* @return the current prompt
*/
public String getPrompt() {
return this.prompts.isEmpty() ? DEFAULT_PROMPT : this.prompts.peek();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -49,6 +49,10 @@ public abstract class AstUtils {
* Determine if a {@link ClassNode} has one or more of the specified annotations on
* the class or any of its methods. N.B. the type names are not normally fully
* qualified.
* @param node the class to examine
* @param annotations the annotations to look for
* @return {@code true} if at least one of the annotations is found, otherwise
* {@code false}
*/
public static boolean hasAtLeastOneAnnotation(ClassNode node, String... annotations) {
if (hasAtLeastOneAnnotation((AnnotatedNode) node, annotations)) {
@ -65,6 +69,10 @@ public abstract class AstUtils {
/**
* Determine if an {@link AnnotatedNode} has one or more of the specified annotations.
* N.B. the annotation type names are not normally fully qualified.
* @param node the node to examine
* @param annotations the annotations to look for
* @return {@code true} if at least one of the annotations is found, otherwise
* {@code false}
*/
public static boolean hasAtLeastOneAnnotation(AnnotatedNode node,
String... annotations) {
@ -83,6 +91,9 @@ public abstract class AstUtils {
* Determine if a {@link ClassNode} has one or more fields of the specified types or
* method returning one or more of the specified types. N.B. the type names are not
* normally fully qualified.
* @param node the class to examine
* @param types the types to look for
* @return {@code true} if at least one of the types is found, otherwise {@code false}
*/
public static boolean hasAtLeastOneFieldOrMethod(ClassNode node, String... types) {
Set<String> typesSet = new HashSet<String>(Arrays.asList(types));
@ -102,6 +113,10 @@ public abstract class AstUtils {
/**
* Determine if a {@link ClassNode} subclasses any of the specified types N.B. the
* type names are not normally fully qualified.
* @param node the class to examine
* @param types the types that may have been sub-classed
* @return {@code true} if the class subclasses any of the specified types, otherwise
* {@code false}
*/
public static boolean subclasses(ClassNode node, String... types) {
for (String type : types) {
@ -124,8 +139,10 @@ public abstract class AstUtils {
/**
* Extract a top-level <code>name</code> closure from inside this block if there is
* one. Removes it from the block at the same time.
* one, optionally removing it from the block at the same time.
* @param block a block statement (class definition)
* @param name the name to look for
* @param remove whether or not the extracted closure should be removed
* @return a beans Closure if one can be found, null otherwise
*/
public static ClosureExpression getClosure(BlockStatement block, String name,

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -48,7 +48,7 @@ public abstract class CompilerAutoConfiguration {
* Apply any dependency customizations. This method will only be called if
* {@link #matches} returns {@code true}.
* @param dependencies dependency customizer
* @throws CompilationFailedException
* @throws CompilationFailedException if the dependencies cannot be applied
*/
public void applyDependencies(DependencyCustomizer dependencies)
throws CompilationFailedException {
@ -58,7 +58,7 @@ public abstract class CompilerAutoConfiguration {
* Apply any import customizations. This method will only be called if
* {@link #matches} returns {@code true}.
* @param imports import customizer
* @throws CompilationFailedException
* @throws CompilationFailedException if the imports cannot be applied
*/
public void applyImports(ImportCustomizer imports) throws CompilationFailedException {
}
@ -67,6 +67,12 @@ public abstract class CompilerAutoConfiguration {
* Apply any customizations to the main class. This method will only be called if
* {@link #matches} returns {@code true}. This method is useful when a groovy file
* defines more than one class but customization only applies to the first class.
* @param loader the class loader being used during compilation
* @param configuration the compiler configuration
* @param generatorContext the current context
* @param source the source unit
* @param classNode the main class
* @throws CompilationFailedException if the customizations cannot be applied
*/
public void applyToMainClass(GroovyClassLoader loader,
GroovyCompilerConfiguration configuration, GeneratorContext generatorContext,
@ -75,6 +81,13 @@ public abstract class CompilerAutoConfiguration {
/**
* Apply any additional configuration.
*
* @param loader the class loader being used during compilation
* @param configuration the compiler configuration
* @param generatorContext the current context
* @param source the source unit
* @param classNode the class
* @throws CompilationFailedException if the configuration cannot be applied
*/
public void apply(GroovyClassLoader loader,
GroovyCompilerConfiguration configuration, GeneratorContext generatorContext,

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -47,7 +47,9 @@ public class DependencyCustomizer {
/**
* Create a new {@link DependencyCustomizer} instance.
* @param loader
* @param loader the current classloader
* @param moduleNode the current module
* @param dependencyResolutionContext the context for dependency resolution
*/
public DependencyCustomizer(GroovyClassLoader loader, ModuleNode moduleNode,
DependencyResolutionContext dependencyResolutionContext) {
@ -250,7 +252,9 @@ public class DependencyCustomizer {
/**
* Strategy called to test if dependencies can be added. Subclasses override as
* required.
* required. Returns {@code true} by default.
*
* @return {@code true} if dependencies can be added, otherwise {@code false}
*/
protected boolean canAdd() {
return true;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -123,6 +123,7 @@ public class GroovyCompiler {
/**
* Return a mutable list of the {@link ASTTransformation}s to be applied during
* {@link #compile(String...)}.
* @return the AST transformations to apply
*/
public List<ASTTransformation> getAstTransformations() {
return this.transformations;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -35,32 +35,39 @@ public interface GroovyCompilerConfiguration {
/**
* Returns the scope in which the compiler operates.
* @return the scope of the compiler
*/
GroovyCompilerScope getScope();
/**
* Returns if import declarations should be guessed.
* @return {@code true} if imports should be guessed, otherwise {@code false}
*/
boolean isGuessImports();
/**
* Returns if jar dependencies should be guessed.
* @return {@code true} if dependencies should be guessed, otherwise {@code false}
*/
boolean isGuessDependencies();
/**
* Returns true if autoconfiguration transformations should be applied.
* Returns true if auto-configuration transformations should be applied.
* @return {@code true} if auto-configuration transformations should be applied,
* otherwise {@code false}
*/
boolean isAutoconfigure();
/**
* Returns the classpath for local resources
* @return a path for local resources
*/
String[] getClasspath();
/**
* @return the configuration for the repositories that will be used by the compiler to
* Returns the configuration for the repositories that will be used by the compiler to
* resolve dependencies.
* @return the repository configurations
*/
List<RepositoryConfiguration> getRepositoryConfiguration();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -45,6 +45,7 @@ public class ManagedDependenciesFactory {
/**
* Return a list of the managed dependencies.
* @return the managed dependencies
*/
public List<Dependency> getManagedDependencies() {
List<Dependency> result = new ArrayList<Dependency>();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -29,6 +29,8 @@ public interface RepositorySystemSessionAutoConfiguration {
/**
* Apply the configuration
* @param session the repository system session
* @param repositorySystem the repository system
*/
void apply(DefaultRepositorySystemSession session, RepositorySystem repositorySystem);