com.perforce.p4java.option.server
Class CounterOptions

java.lang.Object
  extended by com.perforce.p4java.option.Options
      extended by com.perforce.p4java.option.server.CounterOptions

public class CounterOptions
extends Options

Options class for Perforce counter methods.


Field Summary
protected  boolean delete
          If true, delete the counter.
protected  boolean incrementCounter
          If true, increment the counter and return the new value (if using the standard IOptionsServer.setCounter method).
static String OPTIONS_SPECS
          Recognized p4 counter options; these include -f, -d, and -i.
protected  boolean perforceCounter
          If true, set or delete counters used by Perforce, as listed in 'p4 help counters'.
 
Fields inherited from class com.perforce.p4java.option.Options
immutable, optionList, OPTPFX
 
Constructor Summary
CounterOptions()
          Default constructor -- sets all fields to false.
CounterOptions(boolean perforceCounter, boolean delete, boolean incrementCounter)
          Explicit value constructor.
CounterOptions(String... options)
          String-based constructor; possible values include: -f, -d, and -i.
 
Method Summary
 boolean isDelete()
           
 boolean isIncrementCounter()
           
 boolean isPerforceCounter()
           
 List<String> processOptions(IServer server)
          Turn this (specific) options object into a list of strings to be sent to the Perforce server as options for a specific command.
 CounterOptions setDelete(boolean delete)
           
 CounterOptions setIncrementCounter(boolean incrementCounter)
           
 CounterOptions setPerforceCounter(boolean perforceCounter)
           
 
Methods inherited from class com.perforce.p4java.option.Options
applyRule, applyRule, applyRule, getOptions, isImmutable, processFields, setImmutable, setOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTIONS_SPECS

public static final String OPTIONS_SPECS
Recognized p4 counter options; these include -f, -d, and -i.

See Also:
Constant Field Values

perforceCounter

protected boolean perforceCounter
If true, set or delete counters used by Perforce, as listed in 'p4 help counters'. Corresponds to the -f flag.


delete

protected boolean delete
If true, delete the counter. Corresponds to the -d flag.


incrementCounter

protected boolean incrementCounter
If true, increment the counter and return the new value (if using the standard IOptionsServer.setCounter method). Corresponds to the -i flag.

Note: will work only with 10.1 or later servers.

Constructor Detail

CounterOptions

public CounterOptions()
Default constructor -- sets all fields to false.


CounterOptions

public CounterOptions(String... options)
String-based constructor; possible values include: -f, -d, and -i.

Parameters:
options - string options

CounterOptions

public CounterOptions(boolean perforceCounter,
                      boolean delete,
                      boolean incrementCounter)
Explicit value constructor.

Method Detail

processOptions

public List<String> processOptions(IServer server)
                            throws OptionsException
Description copied from class: Options
Turn this (specific) options object into a list of strings to be sent to the Perforce server as options for a specific command. As a side effect, set the option list associated with this Option to the result.

The method is used by the server object to generate the string-based arguments expected by the Perforce server corresponding to the state of this method-specific options object. Will return an empty list if there are no "interesting" options set or available. May simply return the superclass options string list if is non-null, but that behaviour is neither guaranteed nor required.

Note that this method is not intended to be called directly by users but by the underlying P4Java plumbing; odd results may occur if this method is called in other contexts.

Specified by:
processOptions in class Options
Parameters:
server - possibly-null IServer representing the Perforce server the options are to be used against. If this parameter is null, it is acceptable to throw an OptionsException, but it is also possible to ignore it and do the best you can with what you've got...
Returns:
non-null (but possibly empty) string list representing the normalized Perforce server arguments corresponding to the state of this specific options object.
Throws:
OptionsException - if an error occurs in options processing that is not some species of ConnectionException, RequestException, AccessException, etc.
See Also:
Options.processOptions(com.perforce.p4java.server.IServer)

isPerforceCounter

public boolean isPerforceCounter()

setPerforceCounter

public CounterOptions setPerforceCounter(boolean perforceCounter)

isDelete

public boolean isDelete()

setDelete

public CounterOptions setDelete(boolean delete)

isIncrementCounter

public boolean isIncrementCounter()

setIncrementCounter

public CounterOptions setIncrementCounter(boolean incrementCounter)


Copyright © 2011 Perforce Software. All Rights Reserved.