Redid jcommander code
This commit is contained in:
parent
7ea1f88238
commit
1c86d5a944
@ -2,17 +2,22 @@ package com.belkast.soap;
|
||||
|
||||
import com.beust.jcommander.Parameter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class jCommanderArgs {
|
||||
@Parameter
|
||||
private List<String> parameters = new ArrayList<>();
|
||||
|
||||
@Parameter(names = "--props" , description = "Location of the properties file", validateWith = jCommanderVerifyFile.class)
|
||||
public String props;
|
||||
public String props = "props.conf";
|
||||
|
||||
@Parameter(names = "--key", description = "Encryption Key (must be 16 characters in length)", required = true, password = true, validateWith = jCommanderVerifyKey.class)
|
||||
@Parameter(names = "--key", description = "Encryption key (must be 16 characters)", required = true, password = true, validateWith = jCommanderVerifyKey.class)
|
||||
public String key;
|
||||
|
||||
@Parameter(names = "--encrypt", description = "Value to encrypt using the Encryption Key")
|
||||
@Parameter(names = "--encrypt", description = "Value to encrypt using the encryption key")
|
||||
public String encrypt;
|
||||
|
||||
@Parameter(names = "--debug", description = "Display debug information on the screen (true/false)")
|
||||
public String debug;
|
||||
@Parameter(names = "--debug", description = "Display debug information on the screen (no value required)")
|
||||
public boolean debug = false;
|
||||
}
|
||||
|
@ -15,13 +15,13 @@ public class jCommanderVerifyFile implements IParameterValidator
|
||||
boolean success = file.exists();
|
||||
if (!success)
|
||||
{
|
||||
throw new ParameterException("Parameter value " + name + " points to a file that does not exist : " + value);
|
||||
throw new ParameterException("Parameter value for " + name + " specifies a file that does not exist : " + value);
|
||||
}
|
||||
}
|
||||
catch (ParameterException ex)
|
||||
{
|
||||
System.out.println();
|
||||
System.out.println(ex.toString());
|
||||
System.out.println();
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
@ -10,13 +10,13 @@ public class jCommanderVerifyKey implements IParameterValidator {
|
||||
try {
|
||||
int n = value.length();
|
||||
if (n != 16) {
|
||||
throw new ParameterException("Parameter value " + name + " must have a length of 16 characters!");
|
||||
throw new ParameterException("Parameter value for " + name + " must have a length of 16 characters!");
|
||||
}
|
||||
}
|
||||
catch (ParameterException ex)
|
||||
{
|
||||
System.out.println();
|
||||
System.out.println(ex.toString());
|
||||
System.out.println();
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user