Class ByteBufferBackedVendorConsent
- java.lang.Object
-
- com.iab.gdpr.consent.implementation.v1.ByteBufferBackedVendorConsent
-
- All Implemented Interfaces:
VendorConsent
public class ByteBufferBackedVendorConsent extends Object implements VendorConsent
Implementation ofVendorConsent. This implementation uses byte buffer (wrapped withBits) as a storage of consent string values and parses individual fields on demand. This should work well in environment where vendor consent string is decoded, couple of isPurposeAllowed()/isVendorAllowed() calls are made and then value of the consent is discarded. In the environment where decoded consent string is kept for longer time with numerous isPurposeAllowed()/isVendorAllowed() calls a different implementation may be needed that would cache results of those calls.
-
-
Constructor Summary
Constructors Constructor Description ByteBufferBackedVendorConsent(Bits bits)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)Set<Integer>getAllowedPurposeIds()Set<Purpose>getAllowedPurposes()intgetAllowedPurposesBits()Set<Integer>getAllowedVendorIds()intgetCmpId()intgetCmpVersion()StringgetConsentLanguage()InstantgetConsentRecordCreated()InstantgetConsentRecordLastUpdated()intgetConsentScreen()intgetMaxVendorId()intgetVendorListVersion()intgetVersion()inthashCode()booleanisPurposeAllowed(int purposeId)Check whether purpose with specified ID is allowedbooleanisPurposeAllowed(Purpose purpose)Check whether specified purpose is allowedbooleanisVendorAllowed(int vendorId)Check whether vendor with specified ID is allowdbyte[]toByteArray()StringtoString()
-
-
-
Constructor Detail
-
ByteBufferBackedVendorConsent
public ByteBufferBackedVendorConsent(Bits bits)
-
-
Method Detail
-
getVersion
public int getVersion()
- Specified by:
getVersionin interfaceVendorConsent- Returns:
- the version of consent string format
-
getConsentRecordCreated
public Instant getConsentRecordCreated()
- Specified by:
getConsentRecordCreatedin interfaceVendorConsent- Returns:
- the
Instantat which the consent string was created
-
getConsentRecordLastUpdated
public Instant getConsentRecordLastUpdated()
- Specified by:
getConsentRecordLastUpdatedin interfaceVendorConsent- Returns:
- the
Instantat which consent string was last updated
-
getCmpId
public int getCmpId()
- Specified by:
getCmpIdin interfaceVendorConsent- Returns:
- the Consent Manager Provider ID that last updated the consent string
-
getCmpVersion
public int getCmpVersion()
- Specified by:
getCmpVersionin interfaceVendorConsent- Returns:
- the Consent Manager Provider version
-
getConsentScreen
public int getConsentScreen()
- Specified by:
getConsentScreenin interfaceVendorConsent- Returns:
- the screen number in the CMP where consent was given
-
getConsentLanguage
public String getConsentLanguage()
- Specified by:
getConsentLanguagein interfaceVendorConsent- Returns:
- the two-letter ISO639-1 language code that CMP asked for consent in
-
getVendorListVersion
public int getVendorListVersion()
- Specified by:
getVendorListVersionin interfaceVendorConsent- Returns:
- version of vendor list used in most recent consent string update.
-
getAllowedPurposeIds
public Set<Integer> getAllowedPurposeIds()
- Specified by:
getAllowedPurposeIdsin interfaceVendorConsent- Returns:
- the set of purpose id's which are permitted according to this consent string
-
getAllowedPurposes
public Set<Purpose> getAllowedPurposes()
- Specified by:
getAllowedPurposesin interfaceVendorConsent- Returns:
- the set of allowed purposes which are permitted according to this consent string
-
getAllowedPurposesBits
public int getAllowedPurposesBits()
- Specified by:
getAllowedPurposesBitsin interfaceVendorConsent- Returns:
- an integer equivalent of allowed purpose id bits according to this consent string
-
getAllowedVendorIds
public Set<Integer> getAllowedVendorIds()
- Specified by:
getAllowedVendorIdsin interfaceVendorConsent- Returns:
- the set of allowed vendor id's which are permitted according to this consent string
-
getMaxVendorId
public int getMaxVendorId()
- Specified by:
getMaxVendorIdin interfaceVendorConsent- Returns:
- the maximum VendorId for which consent values are given.
-
isPurposeAllowed
public boolean isPurposeAllowed(int purposeId)
Description copied from interface:VendorConsentCheck whether purpose with specified ID is allowed- Specified by:
isPurposeAllowedin interfaceVendorConsent- Parameters:
purposeId- purpose ID- Returns:
- true if purpose is allowed in this consent, false otherwise
-
isPurposeAllowed
public boolean isPurposeAllowed(Purpose purpose)
Description copied from interface:VendorConsentCheck whether specified purpose is allowed- Specified by:
isPurposeAllowedin interfaceVendorConsent- Parameters:
purpose- purpose to check- Returns:
- true if purpose is allowed in this consent, false otherwise
-
isVendorAllowed
public boolean isVendorAllowed(int vendorId)
Description copied from interface:VendorConsentCheck whether vendor with specified ID is allowd- Specified by:
isVendorAllowedin interfaceVendorConsent- Parameters:
vendorId- vendor ID- Returns:
- a boolean describing if a user has consented to a particular vendor
-
toByteArray
public byte[] toByteArray()
- Specified by:
toByteArrayin interfaceVendorConsent- Returns:
- the value of this consent as byte array
-
-