Class CounterDelegator

    • Constructor Detail

      • CounterDelegator

        public CounterDelegator​(IOptionsServer server)
        Instantiates a new change delegator.
        Parameters:
        server - the server
    • Method Detail

      • getCounter

        public java.lang.String getCounter​(java.lang.String counterName,
                                           CounterOptions opts)
                                    throws P4JavaException
        Description copied from interface: ICounterDelegator
        Get the value of a named Perforce counter from the Perforce server. Note that this method will return a zero string (i.e. "0") if the named counter doesn't exist (rather than throw an exception); use getCounters to see if a counter actually exists before you use it.

        Note that despite their name, counters can be any value, not just a number; hence the string return value here.

        Specified by:
        getCounter in interface ICounterDelegator
        Parameters:
        counterName - non-null counter name.
        opts - CounterOptions object describing optional parameters; if null, no options are set.
        Returns:
        non-null (but possibly empty or useless) counter value associated with counterName.
        Throws:
        P4JavaException - if an error occurs processing this method and its parameters.
      • setCounter

        public java.lang.String setCounter​(java.lang.String counterName,
                                           java.lang.String value,
                                           CounterOptions opts)
                                    throws P4JavaException
        Description copied from interface: ICounterDelegator
        Create, set or delete a counter on a Perforce server. This method can be used to create, set, increment, or delete a counter according to the specific options set in the associated options object. Note that the increment operation does not work on servers earlier than 10.1, and that the return value is never guaranteed to be non-null -- use with caution.
        Specified by:
        setCounter in interface ICounterDelegator
        Parameters:
        counterName - non-null counter name.
        value - value the counter should be set to; can be null if the set operation is an increment.
        opts - CounterOptions object describing optional parameters; if null, no options are set.
        Returns:
        possibly-null current (post-set, post-increment) value; may be zero if the operation was a delete; may not be reliable for pre 10.1 servers.
        Throws:
        P4JavaException - if an error occurs processing this method and its parameters.