public class OptionsHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
OPTPFX
String used to prefix options for the server.
|
Modifier and Type | Method and Description |
---|---|
static String |
applyRule(String ruleName,
String serverOptStr,
boolean value)
Apply an optional rule to a boolean option value.
|
static String |
applyRule(String ruleName,
String serverOptStr,
int value)
Apply an optional rule to an integer option value.
|
static String |
applyRule(String ruleName,
String serverOptStr,
long value)
Apply an optional rule to a long option value.
|
static String |
applyRule(String ruleName,
String serverOptStr,
String value)
Apply an optional rule to a string option value.
|
static boolean |
objectToBoolean(Object optValue) |
public static final String OPTPFX
public static String applyRule(String ruleName, 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 String applyRule(String ruleName, 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 valuevalue
- the integer value itself.OptionsException
- if any errors occurred during options processing.public static String applyRule(String ruleName, 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 valuevalue
- the long value itself.OptionsException
- if any errors occurred during options processing.public static String applyRule(String ruleName, String serverOptStr, 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 valuevalue
- the string value itself; may be null.OptionsException
- if any errors occurred during options processing.public static boolean objectToBoolean(Object optValue) throws OptionsException
OptionsException
Copyright © 2017 Perforce Software. All Rights Reserved.