Fix codestyle in model code snippets (#1203)

This commit is contained in:
Guillaume Nodet 2023-08-22 08:10:39 +02:00 committed by GitHub
parent eff2fbf2a9
commit e7feeb6ff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 48 deletions

View File

@ -2476,9 +2476,8 @@
<version>4.0.0+</version>
<code>
<![CDATA[
public boolean isExtensions()
{
return ( getExtensions() != null ) ? Boolean.parseBoolean( getExtensions() ) : false;
public boolean isExtensions() {
return (getExtensions() != null) ? Boolean.parseBoolean(getExtensions()) : false;
}
]]>
</code>
@ -2487,9 +2486,8 @@
<version>4.0.0/4.1.0</version>
<code>
<![CDATA[
public void setExtensions( boolean extensions )
{
setExtensions( String.valueOf( extensions ) );
public void setExtensions(boolean extensions) {
setExtensions(String.valueOf(extensions));
}
]]>
</code>
@ -2498,32 +2496,28 @@
<version>4.0.0+</version>
<code>
<![CDATA[
private java.util.Map<String, PluginExecution> executionMap = null;
private Map<String, PluginExecution> executionMap = null;
/**
* Reset the {@code executionMap} field to {@code null}
*/
public void flushExecutionMap()
{
public void flushExecutionMap() {
this.executionMap = null;
}
/**
* @return a Map of executions field with {@code PluginExecution#getId()} as key
* @see PluginExecution#getId()
*/
public java.util.Map<String, PluginExecution> getExecutionsAsMap()
{
if ( executionMap == null )
{
public Map<String, PluginExecution> getExecutionsAsMap() {
if (executionMap == null) {
executionMap = new java.util.LinkedHashMap<String, PluginExecution>();
for ( java.util.Iterator<PluginExecution> i = getExecutions().iterator(); i.hasNext(); )
{
for (java.util.Iterator<PluginExecution> i = getExecutions().iterator(); i.hasNext();) {
PluginExecution exec = (PluginExecution) i.next();
if ( executionMap.containsKey( exec.getId() ) )
{
throw new IllegalStateException( "You cannot have two plugin executions with the same (or missing) <id/> elements.\nOffending execution\n\nId: \'" + exec.getId() + "\'\nPlugin:\'" + getKey() + "\'\n\n" );
if (executionMap.containsKey(exec.getId())) {
throw new IllegalStateException("You cannot have two plugin executions with the same (or missing) <id/> elements.\nOffending execution\n\nId: \'" + exec.getId() + "\'\nPlugin:\'" + getKey() + "\'\n\n");
}
executionMap.put( exec.getId(), exec );
executionMap.put(exec.getId(), exec);
}
}
return executionMap;
@ -2534,34 +2528,29 @@
*
* @return the plugin id in the form {@code <groupId>:<artifactId>:<version>}, never {@code null}
*/
public String getId()
{
StringBuilder id = new StringBuilder( 128 );
id.append( ( getGroupId() == null ) ? "[unknown-group-id]" : getGroupId() );
id.append( ":" );
id.append( ( getArtifactId() == null ) ? "[unknown-artifact-id]" : getArtifactId() );
id.append( ":" );
id.append( ( getVersion() == null ) ? "[unknown-version]" : getVersion() );
return id.toString();
public String getId() {
return new StringBuilder(128)
.append((getGroupId() == null) ? "[unknown-group-id]" : getGroupId())
.append(":")
.append((getArtifactId() == null) ? "[unknown-artifact-id]" : getArtifactId())
.append(":")
.append((getVersion() == null) ? "[unknown-version]" : getVersion())
.toString();
}
/**
* @return the key of the plugin, ie {@code groupId:artifactId}
*/
public String getKey()
{
return constructKey( getGroupId(), getArtifactId() );
public String getKey() {
return constructKey(getGroupId(), getArtifactId());
}
/**
* @param groupId The group ID of the plugin in the repository
* @param artifactId The artifact ID of the reporting plugin in the repository
* @param groupId the group ID of the plugin in the repository
* @param artifactId the artifact ID of the reporting plugin in the repository
* @return the key of the plugin, ie {@code groupId:artifactId}
*/
public static String constructKey( String groupId, String artifactId )
{
public static String constructKey(String groupId, String artifactId) {
return groupId + ":" + artifactId;
}
@ -2575,31 +2564,25 @@
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals( Object other )
{
if ( other instanceof Plugin )
{
public boolean equals(Object other) {
if (other instanceof Plugin) {
Plugin otherPlugin = (Plugin) other;
return getKey().equals( otherPlugin.getKey() );
return getKey().equals(otherPlugin.getKey());
}
return false;
}
/**
* @see java.lang.Object#hashCode()
*/
public int hashCode()
{
public int hashCode() {
return getKey().hashCode();
}
/**
* @see java.lang.Object#toString()
*/
public String toString()
{
public String toString() {
return "Plugin [" + getKey() + "]";
}
]]>