Skip to content

Commit

Permalink
add some generics (#6)
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Lamy <[email protected]>
  • Loading branch information
olamy authored Sep 23, 2021
1 parent 836ee67 commit 631f0aa
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ public abstract class AbstractInputHandler
extends AbstractLogEnabled
implements InputHandler
{
public List readMultipleLines()
public List<String> readMultipleLines()
throws IOException
{
List lines = new ArrayList();
List<String> lines = new ArrayList<>();
String line = readLine();
while ( line != null && line.length() > 0 )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* SOFTWARE.
*/

import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public String prompt( String message, String defaultReply )
}
}

public String prompt( String message, List possibleValues, String defaultReply )
public String prompt( String message, List<String> possibleValues, String defaultReply )
throws PrompterException
{
String formattedMessage = formatMessage( message, possibleValues, defaultReply );
Expand Down Expand Up @@ -152,7 +152,7 @@ public String prompt( String message, List possibleValues, String defaultReply )
return line;
}

public String prompt( String message, List possibleValues )
public String prompt( String message, List<String> possibleValues )
throws PrompterException
{
return prompt( message, possibleValues, null );
Expand Down Expand Up @@ -180,19 +180,19 @@ public String promptForPassword( String message )
}
}

private String formatMessage( String message, List possibleValues, String defaultReply )
private String formatMessage( String message, List<String> possibleValues, String defaultReply )
{
StringBuffer formatted = new StringBuffer( message.length() * 2 );
StringBuilder formatted = new StringBuilder( message.length() * 2 );

formatted.append( message );

if ( possibleValues != null && !possibleValues.isEmpty() )
{
formatted.append( " (" );

for ( Iterator it = possibleValues.iterator(); it.hasNext(); )
for ( Iterator<String> it = possibleValues.iterator(); it.hasNext(); )
{
String possibleValue = (String) it.next();
String possibleValue = it.next();

formatted.append( possibleValue );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ String readPassword()
* Ends when an empty line is encountered.
* @return a list of lines read
*/
List readMultipleLines()
List<String> readMultipleLines()
throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ String prompt( String message )
String prompt( String message, String defaultReply )
throws PrompterException;

String prompt( String message, List possibleValues )
String prompt( String message, List<String> possibleValues )
throws PrompterException;

String prompt( String message, List possibleValues, String defaultReply )
String prompt( String message, List<String> possibleValues, String defaultReply )
throws PrompterException;

String promptForPassword( String message )
Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>plexus-components</artifactId>
<groupId>org.codehaus.plexus</groupId>
<version>6.5</version>
<version>6.6</version>
</parent>

<artifactId>plexus-interactivity</artifactId>
Expand All @@ -17,7 +17,6 @@
<connection>${scm.url}</connection>
<developerConnection>${scm.url}</developerConnection>
<url>https://github.com/codehaus-plexus/plexus-interactivity</url>
<tag>plexus-interactivity-1.1</tag>
</scm>
<issueManagement>
<system>github</system>
Expand Down

0 comments on commit 631f0aa

Please sign in to comment.