public class MetadataBuilder
public MetadataBuilder(@NotNull
java.util.Map<java.lang.String,java.lang.Object> values,
@NotNull
au.com.dius.pact.core.model.matchingrules.Category matchers,
@NotNull
java.util.Map<java.lang.String,au.com.dius.pact.core.model.generators.Generator> generators)
public MetadataBuilder()
@NotNull public MetadataBuilder add(@NotNull java.lang.String key, @Nullable java.lang.Object value)
Add an entry to the metadata
@NotNull public MetadataBuilder like(@NotNull java.lang.String name, @NotNull java.lang.Object example)
Attribute that must be the same type as the example
name - attribute name@NotNull public MetadataBuilder numberType(@NotNull java.lang.String name, @NotNull java.lang.Number number)
Attribute that can be any number
name - attribute namenumber - example number to use for generated messages@NotNull public MetadataBuilder integerType(@NotNull java.lang.String name, long number)
Attribute that must be an integer
name - attribute namenumber - example integer value to use for generated messages@NotNull public MetadataBuilder integerType(@NotNull java.lang.String name, int number)
Attribute that must be an integer
name - attribute namenumber - example integer value to use for generated messages@NotNull public MetadataBuilder decimalType(@NotNull java.lang.String name, @NotNull java.math.BigDecimal number)
Attribute that must be a decimalType value
name - attribute namenumber - example decimalType value@NotNull public MetadataBuilder decimalType(@NotNull java.lang.String name, double number)
Attribute that must be a decimalType value
name - attribute namenumber - example decimalType value@NotNull public MetadataBuilder booleanType(@NotNull java.lang.String name, boolean example)
Attribute that must be a boolean
name - attribute nameexample - example boolean to use for generated bodies@NotNull public MetadataBuilder matchRegex(@NotNull java.lang.String name, @NotNull java.lang.String regex, @NotNull java.lang.String value)
Attribute that must match the regular expression
name - attribute nameregex - regular expressionvalue - example value to use for generated bodies@NotNull public MetadataBuilder datetime(@NotNull java.lang.String name)
Attribute that must be an ISO formatted datetime
name - @NotNull public MetadataBuilder datetime(@NotNull java.lang.String name, @NotNull java.lang.String format)
Attribute that must match the given datetime format
name - attribute nameformat - datetime format@NotNull public MetadataBuilder datetime(@NotNull java.lang.String name, @NotNull java.lang.String format, @NotNull java.util.Date example)
Attribute that must match the given datetime format
name - attribute nameformat - datetime formatexample - example date and time to use for generated bodies@NotNull public MetadataBuilder datetime(@NotNull java.lang.String name, @NotNull java.lang.String format, @NotNull java.util.Date example, @NotNull java.util.TimeZone timeZone)
Attribute that must match the given datetime format
name - attribute nameformat - datetime formatexample - example date and time to use for generated bodiestimeZone - time zone used for formatting of example date and time@NotNull public MetadataBuilder datetime(@NotNull java.lang.String name, @NotNull java.lang.String format, @NotNull java.time.Instant example)
Attribute that must match the given datetime format
name - attribute nameformat - datetime formatexample - example date and time to use for generated bodies@NotNull public MetadataBuilder datetime(@NotNull java.lang.String name, @NotNull java.lang.String format, @NotNull java.time.Instant example, @NotNull java.util.TimeZone timeZone)
Attribute that must match the given datetime format
name - attribute nameformat - timestamp formatexample - example date and time to use for generated bodiestimeZone - time zone used for formatting of example date and time@NotNull public MetadataBuilder date(@NotNull java.lang.String name)
Attribute that must be formatted as an ISO date
name - attribute name@NotNull public MetadataBuilder date(@NotNull java.lang.String name, @NotNull java.lang.String format)
Attribute that must match the provided date format
name - attribute dateformat - date format to match@NotNull public MetadataBuilder date(@NotNull java.lang.String name, @NotNull java.lang.String format, @NotNull java.util.Date example)
Attribute that must match the provided date format
name - attribute dateformat - date format to matchexample - example date to use for generated values@NotNull public MetadataBuilder date(@NotNull java.lang.String name, @NotNull java.lang.String format, @NotNull java.util.Date example, @NotNull java.util.TimeZone timeZone)
Attribute that must match the provided date format
name - attribute dateformat - date format to matchexample - example date to use for generated valuestimeZone - time zone used for formatting of example date@NotNull public MetadataBuilder time(@NotNull java.lang.String name)
Attribute that must be an ISO formatted time
name - attribute name@NotNull public MetadataBuilder time(@NotNull java.lang.String name, @NotNull java.lang.String format)
Attribute that must match the given time format
name - attribute nameformat - time format to match@NotNull public MetadataBuilder time(@NotNull java.lang.String name, @NotNull java.lang.String format, @NotNull java.util.Date example)
Attribute that must match the given time format
name - attribute nameformat - time format to matchexample - example time to use for generated bodies@NotNull public MetadataBuilder time(@NotNull java.lang.String name, @NotNull java.lang.String format, @NotNull java.util.Date example, @NotNull java.util.TimeZone timeZone)
Attribute that must match the given time format
name - attribute nameformat - time format to matchexample - example time to use for generated bodiestimeZone - time zone used for formatting of example time@NotNull public MetadataBuilder ipAddress(@NotNull java.lang.String name)
Attribute that must be an IP4 address
name - attribute name@NotNull public MetadataBuilder hexValue(@NotNull java.lang.String name)
Attribute that must be encoded as a hexadecimal value
name - attribute name@NotNull public MetadataBuilder hexValue(@NotNull java.lang.String name, @NotNull java.lang.String hexValue)
Attribute that must be encoded as a hexadecimal value
name - attribute namehexValue - example value to use for generated bodies@NotNull public MetadataBuilder uuid(@NotNull java.lang.String name)
Attribute that must be encoded as an UUID
name - attribute name@NotNull public MetadataBuilder uuid(@NotNull java.lang.String name, @NotNull java.util.UUID uuid)
Attribute that must be encoded as an UUID
name - attribute nameuuid - example UUID to use for generated bodies@NotNull public MetadataBuilder uuid(@NotNull java.lang.String name, @NotNull java.lang.String uuid)
Attribute that must be encoded as an UUID
name - attribute nameuuid - example UUID to use for generated bodies@NotNull public MetadataBuilder includesStr(@NotNull java.lang.String name, @NotNull java.lang.String value)
Attribute that must include the provided string value
name - attribute namevalue - Value that must be included@NotNull public MetadataBuilder matchUrl(@NotNull java.lang.String name, @NotNull java.lang.String basePath, @NotNull java.lang.Object... pathFragments)
Matches a URL that is composed of a base path and a sequence of path expressions
name - Attribute namebasePath - The base path for the URL (like "http://localhost:8080/") which will be excluded from the matchingpathFragments - Series of path fragments to match on. These can be strings or regular expressions.@NotNull public MetadataBuilder valueFromProviderState(@NotNull java.lang.String name, @NotNull java.lang.String expression, @NotNull java.lang.Object example)
Adds an attribute that will have it's value injected from the provider state
name - Attribute nameexpression - Expression to be evaluated from the provider stateexample - Example value to be used in the consumer test@NotNull public MetadataBuilder dateExpression(@NotNull java.lang.String name, @NotNull java.lang.String expression)
Adds a date attribute formatted as an ISO date with the value generated by the date expression
name - Attribute nameexpression - Date expression to use to generate the values@NotNull public MetadataBuilder dateExpression(@NotNull java.lang.String name, @NotNull java.lang.String expression, @NotNull java.lang.String format)
Adds a date attribute with the value generated by the date expression
name - Attribute nameexpression - Date expression to use to generate the valuesformat - Date format to use@NotNull public MetadataBuilder timeExpression(@NotNull java.lang.String name, @NotNull java.lang.String expression)
Adds a time attribute formatted as an ISO time with the value generated by the time expression
name - Attribute nameexpression - Time expression to use to generate the values@NotNull public MetadataBuilder timeExpression(@NotNull java.lang.String name, @NotNull java.lang.String expression, @NotNull java.lang.String format)
Adds a time attribute with the value generated by the time expression
name - Attribute nameexpression - Time expression to use to generate the valuesformat - Time format to use@NotNull public MetadataBuilder datetimeExpression(@NotNull java.lang.String name, @NotNull java.lang.String expression)
Adds a datetime attribute formatted as an ISO datetime with the value generated by the expression
name - Attribute nameexpression - Datetime expression to use to generate the values@NotNull public MetadataBuilder datetimeExpression(@NotNull java.lang.String name, @NotNull java.lang.String expression, @NotNull java.lang.String format)
Adds a datetime attribute with the value generated by the expression
name - Attribute nameexpression - Datetime expression to use to generate the valuesformat - Datetime format to use@NotNull public java.util.Map<java.lang.String,java.lang.Object> getValues()
@NotNull public au.com.dius.pact.core.model.matchingrules.Category getMatchers()
@NotNull public java.util.Map<java.lang.String,au.com.dius.pact.core.model.generators.Generator> getGenerators()