Package net.shibboleth.idp.consent.storage.impl

# Class ConsentSerializer

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.consent.storage.impl.ConsentSerializer

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `InitializableComponent`, `StorageSerializer<Map<String,Consent>>`

public class ConsentSerializer extends AbstractInitializableComponent implements StorageSerializer<Map<String,Consent>>
Serializes `Consent`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final JsonGeneratorFactory`
`generatorFactory`
JSON generator factory.
`private static final String`
`ID_FIELD`
Field name of consent identifier.
`private static final String`
`IS_APPROVED_FIELD`
Field name of whether consent is approved.
`private final org.slf4j.Logger`
`log`
Class logger.
`private final JsonReaderFactory`
`readerFactory`
JSON reader factory.
`private BiMap<String,Integer>`
`symbolics`
Shrink consent IDs into symbolic numbers.
`private static final String`
`VALUE_FIELD`
Field name of consent value.

## Constructor Summary

Constructors
Constructor
Description
`ConsentSerializer()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`Map<String,Consent>`
`deserialize(long version, String context, String key, String value, Long expiration)`
`protected String`
`desymbolize(JsonValue field)`
Map a field value to a string, either directly or via the symbolic map.
`String`
`serialize(Map<String,Consent> consents)`
`void`
`setSymbolics(Map<String,Integer> mappings)`
Set mappings of string constants to symbolic constants.

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, doInitialize, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

`initialize, isInitialized`

## Field Details

### ID_FIELD

@Nonnull @NotEmpty private static final String ID_FIELD
Field name of consent identifier.

See Also:
  - Constant Field Values

### VALUE_FIELD

@Nonnull @NotEmpty private static final String VALUE_FIELD
Field name of consent value.

See Also:
  - Constant Field Values

### IS_APPROVED_FIELD

@Nonnull @NotEmpty private static final String IS_APPROVED_FIELD
Field name of whether consent is approved.

See Also:
  - Constant Field Values

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### generatorFactory

@Nonnull private final JsonGeneratorFactory generatorFactory
JSON generator factory.

### readerFactory

@Nonnull private final JsonReaderFactory readerFactory
JSON reader factory.

### symbolics

@Nonnull private BiMap<String,Integer> symbolics
Shrink consent IDs into symbolic numbers.

## Constructor Details

### ConsentSerializer

public ConsentSerializer()
Constructor.

## Method Details

### setSymbolics

public void setSymbolics(@Nonnull Map<String,Integer> mappings)
Set mappings of string constants to symbolic constants.

Parameters:
  `mappings` - string to symbolic mappings

### desymbolize

@Nullable protected String desymbolize(@Nonnull JsonValue field)
Map a field value to a string, either directly or via the symbolic map.

Parameters:
  `field` - the object field to examine
Returns:
  the resulting string, or null if invalid

### deserialize

@Nonnull public Map<String,Consent> deserialize(long version, @Nonnull @NotEmpty String context, @Nonnull @NotEmpty String key, @Nonnull @NotEmpty String value, @Nullable Long expiration) throws IOException

Specified by:
  `deserialize` in interface `StorageSerializer<Map<String,Consent>>`
Throws:
  `IOException`

### serialize

@Nonnull @NotEmpty public String serialize(@Nonnull Map<String,Consent> consents) throws IOException

Specified by:
  `serialize` in interface `StorageSerializer<Map<String,Consent>>`
Throws:
  `IOException`