Class ControlNumberGenerator.AbstractBuilder<T extends ControlNumberGenerator>
- java.lang.Object
-
- de.pseudonymisierung.controlnumbers.ControlNumberGenerator.AbstractBuilder<T>
-
- Type Parameters:
T- The type of objects built by an implementation of this class.
- Direct Known Subclasses:
ControlNumberGenerator.Builder,EncryptedControlNumberGenerator.Builder
- Enclosing class:
- ControlNumberGenerator
public abstract static class ControlNumberGenerator.AbstractBuilder<T extends ControlNumberGenerator> extends Object
Abstraction of a builder class. This is needed to implement builders forControlNumberGeneratorandEncryptedControlNumberGenerator, which generate instances of the respective classes, while keeping common code in one place. (see https://stackoverflow.com/questions/21086417/builder-pattern-and-inheritance). Implementations should set T to a fixed class.
-
-
Field Summary
Fields Modifier and Type Field Description protected Charsetencodingprotected inthashLengthprotected intnGramLengthprotected intnHashFunctions
-
Constructor Summary
Constructors Constructor Description AbstractBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Tbuild()Generate a control number generator based on the configuration of this builder.ControlNumberGenerator.AbstractBuilder<T>encoding(String encoding)Set the encoding used for transforming strings into byte sequences before applying hash functions of encryption.ControlNumberGenerator.AbstractBuilder<T>encoding(Charset encoding)Set the encoding used for transforming strings into byte sequences before applying hash functions of encryption.ControlNumberGenerator.AbstractBuilder<T>hashLength(int hashLength)Set the bit length of control numbers.ControlNumberGenerator.AbstractBuilder<T>nGramLength(int nGramLength)Set the length of n grams.ControlNumberGenerator.AbstractBuilder<T>nHashFunctions(int nHashFunctions)Set the number of hash functions.
-
-
-
Field Detail
-
hashLength
protected int hashLength
-
nGramLength
protected int nGramLength
-
nHashFunctions
protected int nHashFunctions
-
encoding
protected Charset encoding
-
-
Method Detail
-
hashLength
public ControlNumberGenerator.AbstractBuilder<T> hashLength(int hashLength)
Set the bit length of control numbers.
-
nGramLength
public ControlNumberGenerator.AbstractBuilder<T> nGramLength(int nGramLength)
Set the length of n grams.
-
nHashFunctions
public ControlNumberGenerator.AbstractBuilder<T> nHashFunctions(int nHashFunctions)
Set the number of hash functions.
-
encoding
public ControlNumberGenerator.AbstractBuilder<T> encoding(String encoding)
Set the encoding used for transforming strings into byte sequences before applying hash functions of encryption.
-
encoding
public ControlNumberGenerator.AbstractBuilder<T> encoding(Charset encoding)
Set the encoding used for transforming strings into byte sequences before applying hash functions of encryption.
-
build
public abstract T build()
Generate a control number generator based on the configuration of this builder.
-
-