public class EvidenceBuilder extends Object
You can also interact with the builder object directly, e.g.// Create evidence based on a given user agent EvidenceBuilder.withUserAgent("my-user-agent");
// Create evidence based on a various pieces of evidence new EvidenceBuilder() // call with 1 argument sets the user agent argument .with("my-user-agent") // call with 2 arguments allows you control which evidence item you are adding .with("cookie", "my-cookie") // call with 3 arguments allows you to set the origin, e.g. define preset context property .with("device.displayWidth", "400", "context") // ... and finally build the evidence .build()
Constructor and Description |
---|
EvidenceBuilder()
Create new EvidenceBuilder.
|
Modifier and Type | Method and Description |
---|---|
Evidence |
build()
Build the evidence.
|
protected EvidenceItem |
get(String key)
Get the evidence value for the given key.
|
EvidenceBuilder |
with(Evidence evidence)
State evidence that the evidence that you are building inherits from.
|
EvidenceBuilder |
with(Map<String,Object> evidenceMap)
Create evidence based on a map of evidence key / value pairs.
|
EvidenceBuilder |
with(Object value)
Add evidence item for given user-agent HTTP header.
|
EvidenceBuilder |
with(String key,
Object value)
Add evidence for the given key / value pair, e.g.
|
EvidenceBuilder |
with(String key,
Object value,
String origin)
Add evidence for the given key / value pair and origin, e.g.
|
static Evidence |
withEvidence(Map<String,Object> evidenceMap)
Create evidence based on a map of evidence key / value pairs.
|
EvidenceBuilder |
withPublicationId(Integer publicationId)
Add evidence item for given publication id related to target group.
|
static Evidence |
withUserAgent(String userAgent)
Create evidence based on just a single user agent HTTP header.
|
public static Evidence withUserAgent(String userAgent)
userAgent
- user agent HTTP headerpublic static Evidence withEvidence(Map<String,Object> evidenceMap)
evidenceMap
- map of evidence key / value pairspublic EvidenceBuilder with(Object value)
value
- user agent HTTP header valuepublic EvidenceBuilder withPublicationId(Integer publicationId)
publicationId
- publication idpublic EvidenceBuilder with(String key, Object value)
key
- evidence keyvalue
- evidence valuepublic EvidenceBuilder with(String key, Object value, String origin)
key
- evidence keyvalue
- evidence valueorigin
- evidence originpublic EvidenceBuilder with(Map<String,Object> evidenceMap)
evidenceMap
- evidence map of key / value pairspublic EvidenceBuilder with(Evidence evidence)
evidence
- evidence the evidence you are building on should inherit fromprotected EvidenceItem get(String key)
key
- evidence key namepublic Evidence build()
Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries