Package com.suse.salt.netapi.datatypes
Class Batch
- java.lang.Object
-
- com.suse.salt.netapi.datatypes.Batch
-
public class Batch extends java.lang.Object
A class representing the batch parameter. Salt uses a string for the batch parameter, but it accept strings representing both exact numerals and percents, so this class encapsulates the creation and usage of the batch strings, adding safety.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Batch.BatchBuilder
Helper class for building a Batch.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
batch
private java.util.Optional<java.lang.Double>
delay
private java.util.Optional<java.lang.Integer>
presencePingGatherJobTimeout
private java.util.Optional<java.lang.Integer>
presencePingTimeout
-
Constructor Summary
Constructors Modifier Constructor Description private
Batch(Batch.BatchBuilder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Batch
asAmount(int value)
Construct a Batch from a value representing an exact amount of itemsstatic Batch
asPercent(int value)
Construct a Batch from a value representing a percentstatic Batch.BatchBuilder
custom()
Returns a BatchBuilder for instantiating a custom Batch.java.lang.String
getBatch()
java.util.Optional<java.lang.Double>
getDelay()
java.util.Map<java.lang.String,java.lang.Object>
getParams()
java.util.Optional<java.lang.Integer>
getPresencePingGatherJobTimeout()
java.util.Optional<java.lang.Integer>
getPresencePingTimeout()
java.lang.String
toString()
-
-
-
Constructor Detail
-
Batch
private Batch(Batch.BatchBuilder builder)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getBatch
public java.lang.String getBatch()
-
getDelay
public java.util.Optional<java.lang.Double> getDelay()
-
getPresencePingTimeout
public java.util.Optional<java.lang.Integer> getPresencePingTimeout()
-
getPresencePingGatherJobTimeout
public java.util.Optional<java.lang.Integer> getPresencePingGatherJobTimeout()
-
getParams
public java.util.Map<java.lang.String,java.lang.Object> getParams()
-
asPercent
public static Batch asPercent(int value)
Construct a Batch from a value representing a percent- Parameters:
value
- the percent, which must be greater than 0 and less than or equal to 100- Returns:
- the Batch
-
asAmount
public static Batch asAmount(int value)
Construct a Batch from a value representing an exact amount of items- Parameters:
value
- the exact amount of items, which must be greater than 0- Returns:
- the Batch
-
custom
public static Batch.BatchBuilder custom()
Returns a BatchBuilder for instantiating a custom Batch.- Returns:
- a BatchBuilder instance.
-
-