public class OptionsHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
OPTPFX
String used to prefix options for the server.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
applyRule(java.lang.String ruleName,
java.lang.String serverOptStr,
boolean value)
Apply an optional rule to a boolean option value.
|
static java.lang.String |
applyRule(java.lang.String ruleName,
java.lang.String serverOptStr,
int value)
Apply an optional rule to an integer option value.
|
static java.lang.String |
applyRule(java.lang.String ruleName,
java.lang.String serverOptStr,
long value)
Apply an optional rule to a long option value.
|
static java.lang.String |
applyRule(java.lang.String ruleName,
java.lang.String serverOptStr,
java.lang.String value)
Apply an optional rule to a string option value.
|
static boolean |
objectToBoolean(java.lang.Object optValue) |
public static final java.lang.String OPTPFX
public static java.lang.String applyRule(java.lang.String ruleName, java.lang.String serverOptStr, boolean value) throws OptionsException
There are currently no rules recognised or implemented in this method.
ruleName
- rule name string from the options spec string. If null, no rule was
specified.serverOptStr
- the flag string to be sent to the Perforce server prefixing this valuevalue
- the boolean value itself.OptionsException
- if any errors occurred during options processing.public static java.lang.String applyRule(java.lang.String ruleName, java.lang.String serverOptStr, int value) throws OptionsException
This version of applyRules implements the rules specified below:
"gtz": don't return anything unless the value is > 0; typically used for things like maxUsers or maxRows. "cl": ignore negative values; convert 0 to the string "default". Typically used for changelists. "clz": ignore non-positive values; typically used for changelists where we let the server infer "default" for IChangelist.DEFAULT rather than spelling it out. "dcn": implements the -dc[n] rule for diff contexts, i.e. if the int value is zero, emit the flag alone; if it's positive, emit the flag with the int value attached; if it's negative, don't emit anything.If the passed-in ruleName is non-null and not recognized, the behaviour is the same as if a null rule name was passed in.
ruleName
- rule name string from the options spec string. If null, no rule was
specified.serverOptStr
- the flag string to be sent to the Perforce server prefixing this value
If the flag start with "-" it will be passed as "--flag=value". Eg: The flag "-offset" will
be passed as "--offset=value"value
- the integer value itself.OptionsException
- if any errors occurred during options processing.public static java.lang.String applyRule(java.lang.String ruleName, java.lang.String serverOptStr, long value) throws OptionsException
This version of applyRules implements the rules specified below:
"gtz": don't return anything unless the value is > 0. "gez": don't return anything unless the value is >= 0.If the passed-in ruleName is non-null and not recognized, the behaviour is the same as if a null rule name was passed in.
ruleName
- rule name string from the options spec string. If null, no rule was
specified.serverOptStr
- the flag string to be sent to the Perforce server prefixing this value
If the flag start with "-" it will be passed as "--flag=value". Eg: The flag "-offset" will
be passed as "--offset=value"value
- the long value itself.OptionsException
- if any errors occurred during options processing.public static java.lang.String applyRule(java.lang.String ruleName, java.lang.String serverOptStr, java.lang.String value) throws OptionsException
There are currently no rules recognised or implemented in this method.
ruleName
- rule name string from the options spec string. If null, no rule was
specified.serverOptStr
- the flag string to be sent to the Perforce server prefixing this value
If the flag start with "-" it will be passed as "--flag=value". Eg: The flag "-offset" will
be passed as "--offset=value"value
- the string value itself; may be null.OptionsException
- if any errors occurred during options processing.public static boolean objectToBoolean(java.lang.Object optValue) throws OptionsException
OptionsException