com.perforce.p4java.impl.mapbased.server
Class Parameters

java.lang.Object
  extended by com.perforce.p4java.impl.mapbased.server.Parameters

public class Parameters
extends Object

Internal helper class for Server parameter processing using the Options class and other typical server command parameters. Methods here are usually aimed at producing the string arrays passed to the various IServer / Server execMapCmd, etc., methods.

This class is not intended for general use by developers or users, but is documented anyway as it's a public class due to package constraints. Using this class is not supported by anything other than the P4Java implementation itself internally.


Constructor Summary
Parameters()
           
 
Method Summary
protected static String[] addFileSpec(List<String> args, IFileSpec fileSpec)
           
protected static String[] addFileSpecs(List<String> args, List<IFileSpec> fileSpecs)
           
protected static void addOpts(List<String> args, Options opts, IServer server)
           
protected static String[] addUnannotatedFileSpecs(List<String> args, List<IFileSpec> fileSpecs)
           
static String[] processParameters(Options opts, IFileSpec fromFile, IFileSpec toFile, String branchSpec, IServer server)
          Specialized parameter processing method for the Client.integrateFiles and IOptionsServer.getFileDiffs methods.
static String[] processParameters(Options opts, IFileSpec fromFileSpec, List<IFileSpec> toFileSpecs, String[] stringParams, IServer server)
          Specialized parameter processing method for commands with 'fromFile' and 'toFiles' parameters.
static String[] processParameters(Options opts, IServer server)
          Version of processParameters for those rare methods that have no non-Options arguments.
static String[] processParameters(Options opts, List<IFileSpec> fileSpecs, IServer server)
          Process options and filespecs arguments for common methods that use a single file spec list and an options object.
static String[] processParameters(Options opts, List<IFileSpec> fromFiles, List<IFileSpec> toFiles, String branchSpec, IServer server)
          Specialized parameter processing method for the IOptionsServer.getInterchanges method.
static String[] processParameters(Options opts, List<IFileSpec> fileSpecs, String[] stringParams, boolean annotateFiles, IServer server)
          Omnibus processParameters method.
static String[] processParameters(Options opts, List<IFileSpec> fileSpecs, String[] stringParams, IServer server)
          Process options, filespecs arguments, and string arguments for common methods.
static String[] processParameters(Options opts, List<IFileSpec> fileSpecs, String stringParam, IServer server)
          Process options, filespecs arguments, and a single string argument for common methods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parameters

public Parameters()
Method Detail

processParameters

public static String[] processParameters(Options opts,
                                         List<IFileSpec> fileSpecs,
                                         IServer server)
                                  throws P4JavaException
Process options and filespecs arguments for common methods that use a single file spec list and an options object. Will use file annotation on the passed-in file specs (if they exist).

Parameters:
opts - possibly-null Options object; if null, no options are set.
fileSpecs - possibly-null list of file specs; if null, no file specs are added; any non-valid file specs in the list are silently ignored.
server - possibly-null server object; default behaviour when this is null is to ignore it, and no parameter validation will be done.
Returns:
non-null but possibly empty array of strings suitable for using as-is with the IServer.execMapCmd etc. methods.
Throws:
P4JavaException - thrown if any error is detected.

processParameters

public static String[] processParameters(Options opts,
                                         IServer server)
                                  throws P4JavaException
Version of processParameters for those rare methods that have no non-Options arguments.

Parameters:
opts - possibly-null Options object; if null, no options are set.
server - possibly-null server object; default behaviour when this is null is to ignore it, and no parameter validation will be done.
Returns:
non-null but possibly empty array of strings suitable for using as-is with the IServer.execMapCmd etc. methods.
Throws:
P4JavaException - thrown if any error is detected.

processParameters

public static String[] processParameters(Options opts,
                                         List<IFileSpec> fileSpecs,
                                         String[] stringParams,
                                         IServer server)
                                  throws P4JavaException
Process options, filespecs arguments, and string arguments for common methods. Will use file annotation on the passed-in file specs (if they exist).

Parameters:
opts - possibly-null Options object; if null, no options are set.
fileSpecs - possibly-null list of file specs; if null, no file specs are added; any non-valid file specs in the list are silently ignored.
stringParams - possibly-null string arrays to be added element by element.
server - possibly-null server object; default behaviour when this is null is to ignore it, and no parameter validation will be done.
Returns:
non-null but possibly empty array of strings suitable for using as-is with the IServer.execMapCmd etc. methods.
Throws:
P4JavaException - thrown if any error is detected.

processParameters

public static String[] processParameters(Options opts,
                                         List<IFileSpec> fileSpecs,
                                         String stringParam,
                                         IServer server)
                                  throws P4JavaException
Process options, filespecs arguments, and a single string argument for common methods. Will use file annotation on the passed-in file specs (if they exist).

Parameters:
opts - possibly-null Options object; if null, no options are set.
fileSpecs - possibly-null list of file specs; if null, no file specs are added; any non-valid file specs in the list are silently ignored.
stringParam - possibly-null string parameter to be added.
server - possibly-null server object; default behaviour when this is null is to ignore it, and no parameter validation will be done.
Returns:
non-null but possibly empty array of strings suitable for using as-is with the IServer.execMapCmd etc. methods.
Throws:
P4JavaException - thrown if any error is detected.

processParameters

public static String[] processParameters(Options opts,
                                         List<IFileSpec> fileSpecs,
                                         String[] stringParams,
                                         boolean annotateFiles,
                                         IServer server)
                                  throws P4JavaException
Omnibus processParameters method.

Parameters:
opts - possibly-null Options object; if null, no options are set.
fileSpecs - possibly-null list of file specs; if null, no file specs are added; any non-valid file specs in the list are silently ignored.
stringParams - possibly-null string array whose contents are to be added element by element in the array index order.
annotateFiles - if true, use the fileSpec's getAnnotatedPreferredPathString method rather than its getPreferredPathString.
server - possibly-null server object; default behaviour when this is null is to ignore it, and no parameter validation will be done.
Returns:
non-null but possibly empty array of strings suitable for using as-is with the IServer.execMapCmd etc. methods.
Throws:
P4JavaException

processParameters

public static String[] processParameters(Options opts,
                                         IFileSpec fromFileSpec,
                                         List<IFileSpec> toFileSpecs,
                                         String[] stringParams,
                                         IServer server)
                                  throws P4JavaException
Specialized parameter processing method for commands with 'fromFile' and 'toFiles' parameters.

Throws:
P4JavaException

processParameters

public static String[] processParameters(Options opts,
                                         IFileSpec fromFile,
                                         IFileSpec toFile,
                                         String branchSpec,
                                         IServer server)
                                  throws P4JavaException
Specialized parameter processing method for the Client.integrateFiles and IOptionsServer.getFileDiffs methods.

Used due to the need to preserve parameter order in the resulting array; don't use or change this method unless you really know what you're doing...

Throws:
P4JavaException

processParameters

public static String[] processParameters(Options opts,
                                         List<IFileSpec> fromFiles,
                                         List<IFileSpec> toFiles,
                                         String branchSpec,
                                         IServer server)
                                  throws P4JavaException
Specialized parameter processing method for the IOptionsServer.getInterchanges method. Used due to the need to preserve parameter order in the resulting array; don't use or change this method unless you really know what you're doing...

Throws:
P4JavaException

addFileSpecs

protected static String[] addFileSpecs(List<String> args,
                                       List<IFileSpec> fileSpecs)

addFileSpec

protected static String[] addFileSpec(List<String> args,
                                      IFileSpec fileSpec)

addUnannotatedFileSpecs

protected static String[] addUnannotatedFileSpecs(List<String> args,
                                                  List<IFileSpec> fileSpecs)

addOpts

protected static void addOpts(List<String> args,
                              Options opts,
                              IServer server)
                       throws P4JavaException
Throws:
P4JavaException


Copyright © 2015 Perforce Software. All Rights Reserved.