Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
54e90c03
Commit
54e90c03
authored
Feb 04, 2015
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish the javadoc in spring-boot-cli
Add missing @param and @return elements
parent
17f05467
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
129 additions
and
37 deletions
+129
-37
Command.java
...in/java/org/springframework/boot/cli/command/Command.java
+9
-2
CommandException.java
...rg/springframework/boot/cli/command/CommandException.java
+3
-2
CommandRunner.java
...a/org/springframework/boot/cli/command/CommandRunner.java
+5
-3
InitializrService.java
...ingframework/boot/cli/command/init/InitializrService.java
+6
-1
InitializrServiceMetadata.java
...work/boot/cli/command/init/InitializrServiceMetadata.java
+9
-2
ProjectGenerationRequest.java
...ework/boot/cli/command/init/ProjectGenerationRequest.java
+20
-6
ProjectGenerationResponse.java
...work/boot/cli/command/init/ProjectGenerationResponse.java
+4
-1
ServiceCapabilitiesReportGenerator.java
.../cli/command/init/ServiceCapabilitiesReportGenerator.java
+6
-3
OptionHelp.java
.../springframework/boot/cli/command/options/OptionHelp.java
+3
-1
SpringApplicationRunnerConfiguration.java
...cli/command/run/SpringApplicationRunnerConfiguration.java
+3
-1
ShellPrompts.java
.../springframework/boot/cli/command/shell/ShellPrompts.java
+2
-1
AstUtils.java
.../java/org/springframework/boot/cli/compiler/AstUtils.java
+19
-2
CompilerAutoConfiguration.java
...ramework/boot/cli/compiler/CompilerAutoConfiguration.java
+16
-3
DependencyCustomizer.java
...ringframework/boot/cli/compiler/DependencyCustomizer.java
+7
-3
GroovyCompiler.java
...org/springframework/boot/cli/compiler/GroovyCompiler.java
+2
-1
GroovyCompilerConfiguration.java
...mework/boot/cli/compiler/GroovyCompilerConfiguration.java
+10
-3
ManagedDependenciesFactory.java
...k/boot/cli/compiler/grape/ManagedDependenciesFactory.java
+2
-1
RepositorySystemSessionAutoConfiguration.java
...piler/grape/RepositorySystemSessionAutoConfiguration.java
+3
-1
No files found.
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/Command.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -33,11 +33,13 @@ public interface Command {
...
@@ -33,11 +33,13 @@ public interface Command {
/**
/**
* Returns the name of the command.
* Returns the name of the command.
* @return the command's name
*/
*/
String
getName
();
String
getName
();
/**
/**
* Returns a description of the command.
* Returns a description of the command.
* @return the command's description
*/
*/
String
getDescription
();
String
getDescription
();
...
@@ -45,29 +47,34 @@ public interface Command {
...
@@ -45,29 +47,34 @@ public interface Command {
* Returns usage help for the command. This should be a simple one-line string
* 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
* describing basic usage. e.g. '[options] <file>'. Do not include the name of
* the command in this string.
* the command in this string.
* @return the command's usage help
*/
*/
String
getUsageHelp
();
String
getUsageHelp
();
/**
/**
* Gets full help text for the command, e.g. a longer description and one line per
* Gets full help text for the command, e.g. a longer description and one line per
* option.
* option.
* @return the command's help text
*/
*/
String
getHelp
();
String
getHelp
();
/**
/**
* Returns help for each supported option.
* Returns help for each supported option.
* @return help for each of the command's options
*/
*/
Collection
<
OptionHelp
>
getOptionsHelp
();
Collection
<
OptionHelp
>
getOptionsHelp
();
/**
/**
* Return some examples for the command.
* Return some examples for the command.
* @return the command's examples
*/
*/
Collection
<
HelpExample
>
getExamples
();
Collection
<
HelpExample
>
getExamples
();
/**
/**
* Run the command.
* Run the command.
* @param args command arguments (this will not include the command itself)
* @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
;
ExitStatus
run
(
String
...
args
)
throws
Exception
;
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandException.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -80,7 +80,8 @@ public class CommandException extends RuntimeException {
...
@@ -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
()
{
public
Set
<
Option
>
getOptions
()
{
return
Collections
.
unmodifiableSet
(
this
.
options
);
return
Collections
.
unmodifiableSet
(
this
.
options
);
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -61,6 +61,7 @@ public class CommandRunner implements Iterable<Command> {
...
@@ -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
* 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.
* trailing space character so that they can be used as a prefix.
* @return the name of the runner
*/
*/
public
String
getName
()
{
public
String
getName
()
{
return
this
.
name
;
return
this
.
name
;
...
@@ -179,7 +180,7 @@ public class CommandRunner implements Iterable<Command> {
...
@@ -179,7 +180,7 @@ public class CommandRunner implements Iterable<Command> {
showUsage
();
showUsage
();
return
1
;
return
1
;
}
}
catch
(
TestFailedException
e
)
{
catch
(
TestFailedException
e
)
{
return
1
;
return
1
;
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
...
@@ -204,7 +205,8 @@ public class CommandRunner implements Iterable<Command> {
...
@@ -204,7 +205,8 @@ public class CommandRunner implements Iterable<Command> {
/**
/**
* Parse the arguments and run a suitable command.
* Parse the arguments and run a suitable command.
* @param args the arguments
* @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
{
protected
ExitStatus
run
(
String
...
args
)
throws
Exception
{
if
(
args
.
length
==
0
)
{
if
(
args
.
length
==
0
)
{
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -69,7 +69,9 @@ class InitializrService {
...
@@ -69,7 +69,9 @@ class InitializrService {
/**
/**
* Generate a project based on the specified {@link ProjectGenerationRequest}
* Generate a project based on the specified {@link ProjectGenerationRequest}
* @param request the generation request
* @return an entity defining the project
* @return an entity defining the project
* @throws IOException if generation fails
*/
*/
public
ProjectGenerationResponse
generate
(
ProjectGenerationRequest
request
)
public
ProjectGenerationResponse
generate
(
ProjectGenerationRequest
request
)
throws
IOException
{
throws
IOException
{
...
@@ -89,6 +91,9 @@ class InitializrService {
...
@@ -89,6 +91,9 @@ class InitializrService {
/**
/**
* Load the {@link InitializrServiceMetadata} at the specified url.
* 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
{
public
InitializrServiceMetadata
loadMetadata
(
String
serviceUrl
)
throws
IOException
{
CloseableHttpResponse
httpResponse
=
executeInitializrMetadataRetrieval
(
serviceUrl
);
CloseableHttpResponse
httpResponse
=
executeInitializrMetadataRetrieval
(
serviceUrl
);
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -57,6 +57,7 @@ class InitializrServiceMetadata {
...
@@ -57,6 +57,7 @@ class InitializrServiceMetadata {
/**
/**
* Creates a new instance using the specified root {@link JSONObject}.
* Creates a new instance using the specified root {@link JSONObject}.
* @param root the root JSONObject
*/
*/
public
InitializrServiceMetadata
(
JSONObject
root
)
{
public
InitializrServiceMetadata
(
JSONObject
root
)
{
this
.
dependencies
=
parseDependencies
(
root
);
this
.
dependencies
=
parseDependencies
(
root
);
...
@@ -75,6 +76,7 @@ class InitializrServiceMetadata {
...
@@ -75,6 +76,7 @@ class InitializrServiceMetadata {
/**
/**
* Return the dependencies supported by the service.
* Return the dependencies supported by the service.
* @return the supported dependencies
*/
*/
public
Collection
<
Dependency
>
getDependencies
()
{
public
Collection
<
Dependency
>
getDependencies
()
{
return
this
.
dependencies
.
values
();
return
this
.
dependencies
.
values
();
...
@@ -83,6 +85,8 @@ class InitializrServiceMetadata {
...
@@ -83,6 +85,8 @@ class InitializrServiceMetadata {
/**
/**
* Return the dependency with the specified id or {@code null} if no such dependency
* Return the dependency with the specified id or {@code null} if no such dependency
* exists.
* exists.
* @param id the id
* @return the dependency or {@code null}
*/
*/
public
Dependency
getDependency
(
String
id
)
{
public
Dependency
getDependency
(
String
id
)
{
return
this
.
dependencies
.
get
(
id
);
return
this
.
dependencies
.
get
(
id
);
...
@@ -90,14 +94,16 @@ class InitializrServiceMetadata {
...
@@ -90,14 +94,16 @@ class InitializrServiceMetadata {
/**
/**
* Return the project types supported by the service.
* Return the project types supported by the service.
* @return the supported project types
*/
*/
public
Map
<
String
,
ProjectType
>
getProjectTypes
()
{
public
Map
<
String
,
ProjectType
>
getProjectTypes
()
{
return
this
.
projectTypes
.
getContent
();
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.
* default.
* @return the default project type or {@code null}
*/
*/
public
ProjectType
getDefaultType
()
{
public
ProjectType
getDefaultType
()
{
if
(
this
.
projectTypes
.
getDefaultItem
()
!=
null
)
{
if
(
this
.
projectTypes
.
getDefaultItem
()
!=
null
)
{
...
@@ -112,6 +118,7 @@ class InitializrServiceMetadata {
...
@@ -112,6 +118,7 @@ class InitializrServiceMetadata {
/**
/**
* Returns the defaults applicable to the service.
* Returns the defaults applicable to the service.
* @return the defaults of the service
*/
*/
public
Map
<
String
,
String
>
getDefaults
()
{
public
Map
<
String
,
String
>
getDefaults
()
{
return
this
.
defaults
;
return
this
.
defaults
;
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -60,8 +60,9 @@ class ProjectGenerationRequest {
...
@@ -60,8 +60,9 @@ class ProjectGenerationRequest {
private
String
type
;
private
String
type
;
/**
/**
* The
url
of the service to use.
* The
URL
of the service to use.
* @see #DEFAULT_SERVICE_URL
* @see #DEFAULT_SERVICE_URL
* @return the service URL
*/
*/
public
String
getServiceUrl
()
{
public
String
getServiceUrl
()
{
return
this
.
serviceUrl
;
return
this
.
serviceUrl
;
...
@@ -73,6 +74,7 @@ class ProjectGenerationRequest {
...
@@ -73,6 +74,7 @@ class ProjectGenerationRequest {
/**
/**
* The location of the generated project.
* The location of the generated project.
* @return the location of the generated project
*/
*/
public
String
getOutput
()
{
public
String
getOutput
()
{
return
this
.
output
;
return
this
.
output
;
...
@@ -89,8 +91,10 @@ class ProjectGenerationRequest {
...
@@ -89,8 +91,10 @@ class ProjectGenerationRequest {
}
}
/**
/**
* Specify if the project archive should be extract in the output location. If the
* Whether or not the project archive should be extracted in the output location. If
* {@link #getOutput() output} ends with "/", the project is extracted automatically.
* 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
()
{
public
boolean
isExtract
()
{
return
this
.
extract
;
return
this
.
extract
;
...
@@ -102,6 +106,7 @@ class ProjectGenerationRequest {
...
@@ -102,6 +106,7 @@ class ProjectGenerationRequest {
/**
/**
* The Spring Boot version to use or {@code null} if it should not be customized.
* 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
()
{
public
String
getBootVersion
()
{
return
this
.
bootVersion
;
return
this
.
bootVersion
;
...
@@ -113,6 +118,7 @@ class ProjectGenerationRequest {
...
@@ -113,6 +118,7 @@ class ProjectGenerationRequest {
/**
/**
* The identifiers of the dependencies to include in the project.
* The identifiers of the dependencies to include in the project.
* @return the dependency identifiers
*/
*/
public
List
<
String
>
getDependencies
()
{
public
List
<
String
>
getDependencies
()
{
return
this
.
dependencies
;
return
this
.
dependencies
;
...
@@ -120,6 +126,7 @@ class ProjectGenerationRequest {
...
@@ -120,6 +126,7 @@ class ProjectGenerationRequest {
/**
/**
* The Java version to use or {@code null} if it should not be customized.
* The Java version to use or {@code null} if it should not be customized.
* @return the Java version or {@code null}
*/
*/
public
String
getJavaVersion
()
{
public
String
getJavaVersion
()
{
return
this
.
javaVersion
;
return
this
.
javaVersion
;
...
@@ -131,6 +138,7 @@ class ProjectGenerationRequest {
...
@@ -131,6 +138,7 @@ class ProjectGenerationRequest {
/**
/**
* The packaging type or {@code null} if it should not be customized.
* The packaging type or {@code null} if it should not be customized.
* @return the packaging type or {@code null}
*/
*/
public
String
getPackaging
()
{
public
String
getPackaging
()
{
return
this
.
packaging
;
return
this
.
packaging
;
...
@@ -143,6 +151,7 @@ class ProjectGenerationRequest {
...
@@ -143,6 +151,7 @@ class ProjectGenerationRequest {
/**
/**
* The build type to use. Ignored if a type is set. Can be used alongside the
* 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.
* {@link #getFormat() format} to identify the type to use.
* @return the build type
*/
*/
public
String
getBuild
()
{
public
String
getBuild
()
{
return
this
.
build
;
return
this
.
build
;
...
@@ -155,6 +164,7 @@ class ProjectGenerationRequest {
...
@@ -155,6 +164,7 @@ class ProjectGenerationRequest {
/**
/**
* The project format to use. Ignored if a type is set. Can be used alongside the
* 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.
* {@link #getBuild() build} to identify the type to use.
* @return the project format
*/
*/
public
String
getFormat
()
{
public
String
getFormat
()
{
return
this
.
format
;
return
this
.
format
;
...
@@ -165,7 +175,8 @@ class ProjectGenerationRequest {
...
@@ -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
()
{
public
boolean
isDetectType
()
{
return
this
.
detectType
;
return
this
.
detectType
;
...
@@ -178,6 +189,7 @@ class ProjectGenerationRequest {
...
@@ -178,6 +189,7 @@ class ProjectGenerationRequest {
/**
/**
* The type of project to generate. Should match one of the advertized type that the
* 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.
* service supports. If not set, the default is retrieved from the service metadata.
* @return the project type
*/
*/
public
String
getType
()
{
public
String
getType
()
{
return
this
.
type
;
return
this
.
type
;
...
@@ -188,7 +200,9 @@ class ProjectGenerationRequest {
...
@@ -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
)
{
URI
generateUrl
(
InitializrServiceMetadata
metadata
)
{
try
{
try
{
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationResponse.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -38,6 +38,7 @@ class ProjectGenerationResponse {
...
@@ -38,6 +38,7 @@ class ProjectGenerationResponse {
/**
/**
* Return the {@link ContentType} of this instance
* Return the {@link ContentType} of this instance
* @return the content type
*/
*/
public
ContentType
getContentType
()
{
public
ContentType
getContentType
()
{
return
this
.
contentType
;
return
this
.
contentType
;
...
@@ -45,6 +46,7 @@ class ProjectGenerationResponse {
...
@@ -45,6 +46,7 @@ class ProjectGenerationResponse {
/**
/**
* The generated project archive or file.
* The generated project archive or file.
* @return the content
*/
*/
public
byte
[]
getContent
()
{
public
byte
[]
getContent
()
{
return
this
.
content
;
return
this
.
content
;
...
@@ -57,6 +59,7 @@ class ProjectGenerationResponse {
...
@@ -57,6 +59,7 @@ class ProjectGenerationResponse {
/**
/**
* The preferred file name to use to store the entity on disk or {@code null} if no
* The preferred file name to use to store the entity on disk or {@code null} if no
* preferred value has been set.
* preferred value has been set.
* @return the file name, or {@code null}
*/
*/
public
String
getFileName
()
{
public
String
getFileName
()
{
return
this
.
fileName
;
return
this
.
fileName
;
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -24,7 +24,6 @@ import java.util.Iterator;
...
@@ -24,7 +24,6 @@ import java.util.Iterator;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.codehaus.plexus.util.StringUtils
;
import
org.codehaus.plexus.util.StringUtils
;
/**
/**
...
@@ -40,7 +39,8 @@ class ServiceCapabilitiesReportGenerator {
...
@@ -40,7 +39,8 @@ class ServiceCapabilitiesReportGenerator {
private
final
InitializrService
initializrService
;
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
)
{
ServiceCapabilitiesReportGenerator
(
InitializrService
initializrService
)
{
this
.
initializrService
=
initializrService
;
this
.
initializrService
=
initializrService
;
...
@@ -49,6 +49,9 @@ class ServiceCapabilitiesReportGenerator {
...
@@ -49,6 +49,9 @@ class ServiceCapabilitiesReportGenerator {
/**
/**
* Generate a report for the specified service. The report contains the available
* Generate a report for the specified service. The report contains the available
* capabilities as advertized by the root endpoint.
* 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
{
public
String
generate
(
String
url
)
throws
IOException
{
InitializrServiceMetadata
metadata
=
this
.
initializrService
.
loadMetadata
(
url
);
InitializrServiceMetadata
metadata
=
this
.
initializrService
.
loadMetadata
(
url
);
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHelp.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -27,11 +27,13 @@ public interface OptionHelp {
...
@@ -27,11 +27,13 @@ public interface OptionHelp {
/**
/**
* Returns the set of options that are mutually synonymous.
* Returns the set of options that are mutually synonymous.
* @return the options
*/
*/
Set
<
String
>
getOptions
();
Set
<
String
>
getOptions
();
/**
/**
* Returns usage help for the option.
* Returns usage help for the option.
* @return the usage help
*/
*/
String
getUsageHelp
();
String
getUsageHelp
();
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunnerConfiguration.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -30,11 +30,13 @@ public interface SpringApplicationRunnerConfiguration extends GroovyCompilerConf
...
@@ -30,11 +30,13 @@ public interface SpringApplicationRunnerConfiguration extends GroovyCompilerConf
/**
/**
* Returns {@code true} if the source file should be monitored for changes and
* Returns {@code true} if the source file should be monitored for changes and
* automatically recompiled.
* automatically recompiled.
* @return {@code true} if file watching should be performed, otherwise {@code false}
*/
*/
boolean
isWatchForFileChanges
();
boolean
isWatchForFileChanges
();
/**
/**
* Returns the logging level to use.
* Returns the logging level to use.
* @return the logging level
*/
*/
Level
getLogLevel
();
Level
getLogLevel
();
}
}
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/ShellPrompts.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -50,6 +50,7 @@ public class ShellPrompts {
...
@@ -50,6 +50,7 @@ public class ShellPrompts {
/**
/**
* Returns the current prompt.
* Returns the current prompt.
* @return the current prompt
*/
*/
public
String
getPrompt
()
{
public
String
getPrompt
()
{
return
this
.
prompts
.
isEmpty
()
?
DEFAULT_PROMPT
:
this
.
prompts
.
peek
();
return
this
.
prompts
.
isEmpty
()
?
DEFAULT_PROMPT
:
this
.
prompts
.
peek
();
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -49,6 +49,10 @@ public abstract class AstUtils {
...
@@ -49,6 +49,10 @@ public abstract class AstUtils {
* Determine if a {@link ClassNode} has one or more of the specified annotations on
* 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
* the class or any of its methods. N.B. the type names are not normally fully
* qualified.
* 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
)
{
public
static
boolean
hasAtLeastOneAnnotation
(
ClassNode
node
,
String
...
annotations
)
{
if
(
hasAtLeastOneAnnotation
((
AnnotatedNode
)
node
,
annotations
))
{
if
(
hasAtLeastOneAnnotation
((
AnnotatedNode
)
node
,
annotations
))
{
...
@@ -65,6 +69,10 @@ public abstract class AstUtils {
...
@@ -65,6 +69,10 @@ public abstract class AstUtils {
/**
/**
* Determine if an {@link AnnotatedNode} has one or more of the specified annotations.
* Determine if an {@link AnnotatedNode} has one or more of the specified annotations.
* N.B. the annotation type names are not normally fully qualified.
* 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
,
public
static
boolean
hasAtLeastOneAnnotation
(
AnnotatedNode
node
,
String
...
annotations
)
{
String
...
annotations
)
{
...
@@ -83,6 +91,9 @@ public abstract class AstUtils {
...
@@ -83,6 +91,9 @@ public abstract class AstUtils {
* Determine if a {@link ClassNode} has one or more fields of the specified types or
* 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
* method returning one or more of the specified types. N.B. the type names are not
* normally fully qualified.
* 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
)
{
public
static
boolean
hasAtLeastOneFieldOrMethod
(
ClassNode
node
,
String
...
types
)
{
Set
<
String
>
typesSet
=
new
HashSet
<
String
>(
Arrays
.
asList
(
types
));
Set
<
String
>
typesSet
=
new
HashSet
<
String
>(
Arrays
.
asList
(
types
));
...
@@ -102,6 +113,10 @@ public abstract class AstUtils {
...
@@ -102,6 +113,10 @@ public abstract class AstUtils {
/**
/**
* Determine if a {@link ClassNode} subclasses any of the specified types N.B. the
* Determine if a {@link ClassNode} subclasses any of the specified types N.B. the
* type names are not normally fully qualified.
* 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
)
{
public
static
boolean
subclasses
(
ClassNode
node
,
String
...
types
)
{
for
(
String
type
:
types
)
{
for
(
String
type
:
types
)
{
...
@@ -124,8 +139,10 @@ public abstract class AstUtils {
...
@@ -124,8 +139,10 @@ public abstract class AstUtils {
/**
/**
* Extract a top-level <code>name</code> closure from inside this block if there is
* 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 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
* @return a beans Closure if one can be found, null otherwise
*/
*/
public
static
ClosureExpression
getClosure
(
BlockStatement
block
,
String
name
,
public
static
ClosureExpression
getClosure
(
BlockStatement
block
,
String
name
,
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -48,7 +48,7 @@ public abstract class CompilerAutoConfiguration {
...
@@ -48,7 +48,7 @@ public abstract class CompilerAutoConfiguration {
* Apply any dependency customizations. This method will only be called if
* Apply any dependency customizations. This method will only be called if
* {@link #matches} returns {@code true}.
* {@link #matches} returns {@code true}.
* @param dependencies dependency customizer
* @param dependencies dependency customizer
* @throws CompilationFailedException
* @throws CompilationFailedException
if the dependencies cannot be applied
*/
*/
public
void
applyDependencies
(
DependencyCustomizer
dependencies
)
public
void
applyDependencies
(
DependencyCustomizer
dependencies
)
throws
CompilationFailedException
{
throws
CompilationFailedException
{
...
@@ -58,7 +58,7 @@ public abstract class CompilerAutoConfiguration {
...
@@ -58,7 +58,7 @@ public abstract class CompilerAutoConfiguration {
* Apply any import customizations. This method will only be called if
* Apply any import customizations. This method will only be called if
* {@link #matches} returns {@code true}.
* {@link #matches} returns {@code true}.
* @param imports import customizer
* @param imports import customizer
* @throws CompilationFailedException
* @throws CompilationFailedException
if the imports cannot be applied
*/
*/
public
void
applyImports
(
ImportCustomizer
imports
)
throws
CompilationFailedException
{
public
void
applyImports
(
ImportCustomizer
imports
)
throws
CompilationFailedException
{
}
}
...
@@ -67,6 +67,12 @@ public abstract class CompilerAutoConfiguration {
...
@@ -67,6 +67,12 @@ public abstract class CompilerAutoConfiguration {
* Apply any customizations to the main class. This method will only be called if
* 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
* {@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.
* 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
,
public
void
applyToMainClass
(
GroovyClassLoader
loader
,
GroovyCompilerConfiguration
configuration
,
GeneratorContext
generatorContext
,
GroovyCompilerConfiguration
configuration
,
GeneratorContext
generatorContext
,
...
@@ -75,6 +81,13 @@ public abstract class CompilerAutoConfiguration {
...
@@ -75,6 +81,13 @@ public abstract class CompilerAutoConfiguration {
/**
/**
* Apply any additional configuration.
* 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
,
public
void
apply
(
GroovyClassLoader
loader
,
GroovyCompilerConfiguration
configuration
,
GeneratorContext
generatorContext
,
GroovyCompilerConfiguration
configuration
,
GeneratorContext
generatorContext
,
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -47,7 +47,9 @@ public class DependencyCustomizer {
...
@@ -47,7 +47,9 @@ public class DependencyCustomizer {
/**
/**
* Create a new {@link DependencyCustomizer} instance.
* 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
,
public
DependencyCustomizer
(
GroovyClassLoader
loader
,
ModuleNode
moduleNode
,
DependencyResolutionContext
dependencyResolutionContext
)
{
DependencyResolutionContext
dependencyResolutionContext
)
{
...
@@ -250,7 +252,9 @@ public class DependencyCustomizer {
...
@@ -250,7 +252,9 @@ public class DependencyCustomizer {
/**
/**
* Strategy called to test if dependencies can be added. Subclasses override as
* 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
()
{
protected
boolean
canAdd
()
{
return
true
;
return
true
;
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -123,6 +123,7 @@ public class GroovyCompiler {
...
@@ -123,6 +123,7 @@ public class GroovyCompiler {
/**
/**
* Return a mutable list of the {@link ASTTransformation}s to be applied during
* Return a mutable list of the {@link ASTTransformation}s to be applied during
* {@link #compile(String...)}.
* {@link #compile(String...)}.
* @return the AST transformations to apply
*/
*/
public
List
<
ASTTransformation
>
getAstTransformations
()
{
public
List
<
ASTTransformation
>
getAstTransformations
()
{
return
this
.
transformations
;
return
this
.
transformations
;
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompilerConfiguration.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -35,32 +35,39 @@ public interface GroovyCompilerConfiguration {
...
@@ -35,32 +35,39 @@ public interface GroovyCompilerConfiguration {
/**
/**
* Returns the scope in which the compiler operates.
* Returns the scope in which the compiler operates.
* @return the scope of the compiler
*/
*/
GroovyCompilerScope
getScope
();
GroovyCompilerScope
getScope
();
/**
/**
* Returns if import declarations should be guessed.
* Returns if import declarations should be guessed.
* @return {@code true} if imports should be guessed, otherwise {@code false}
*/
*/
boolean
isGuessImports
();
boolean
isGuessImports
();
/**
/**
* Returns if jar dependencies should be guessed.
* Returns if jar dependencies should be guessed.
* @return {@code true} if dependencies should be guessed, otherwise {@code false}
*/
*/
boolean
isGuessDependencies
();
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
();
boolean
isAutoconfigure
();
/**
/**
* Returns the classpath for local resources
* @return a path for local resources
* @return a path for local resources
*/
*/
String
[]
getClasspath
();
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.
* resolve dependencies.
* @return the repository configurations
*/
*/
List
<
RepositoryConfiguration
>
getRepositoryConfiguration
();
List
<
RepositoryConfiguration
>
getRepositoryConfiguration
();
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/ManagedDependenciesFactory.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -45,6 +45,7 @@ public class ManagedDependenciesFactory {
...
@@ -45,6 +45,7 @@ public class ManagedDependenciesFactory {
/**
/**
* Return a list of the managed dependencies.
* Return a list of the managed dependencies.
* @return the managed dependencies
*/
*/
public
List
<
Dependency
>
getManagedDependencies
()
{
public
List
<
Dependency
>
getManagedDependencies
()
{
List
<
Dependency
>
result
=
new
ArrayList
<
Dependency
>();
List
<
Dependency
>
result
=
new
ArrayList
<
Dependency
>();
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/RepositorySystemSessionAutoConfiguration.java
View file @
54e90c03
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -29,6 +29,8 @@ public interface RepositorySystemSessionAutoConfiguration {
...
@@ -29,6 +29,8 @@ public interface RepositorySystemSessionAutoConfiguration {
/**
/**
* Apply the configuration
* Apply the configuration
* @param session the repository system session
* @param repositorySystem the repository system
*/
*/
void
apply
(
DefaultRepositorySystemSession
session
,
RepositorySystem
repositorySystem
);
void
apply
(
DefaultRepositorySystemSession
session
,
RepositorySystem
repositorySystem
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment