001// Generated by delombok at Fri Mar 03 18:26:02 UTC 2023
002package de.cuioss.test.generator.impl;
003
004import de.cuioss.test.generator.TypedGenerator;
005import lombok.NonNull;
006
007/**
008 * Wrapper for decorating an already existing {@link TypedGenerator}. This is usually used for
009 * modeling corner cases.
010 *
011 * @author Oliver Wolff
012 * @param <T> identifying the type of elements to be generated
013 */
014public class DecoratorGenerator<T> implements TypedGenerator<T> {
015    @NonNull
016    private final Class<T> type;
017    @NonNull
018    private final TypedGenerator<T> decorator;
019
020    @Override
021    public T next() {
022        return decorator.next();
023    }
024
025    @java.lang.SuppressWarnings("all")
026    @lombok.Generated
027    public DecoratorGenerator(@NonNull final Class<T> type, @NonNull final TypedGenerator<T> decorator) {
028        if (type == null) {
029            throw new java.lang.NullPointerException("type is marked non-null but is null");
030        }
031        if (decorator == null) {
032            throw new java.lang.NullPointerException("decorator is marked non-null but is null");
033        }
034        this.type = type;
035        this.decorator = decorator;
036    }
037
038    @java.lang.Override
039    @java.lang.SuppressWarnings("all")
040    @lombok.Generated
041    public java.lang.String toString() {
042        return "DecoratorGenerator(type=" + this.getType() + ")";
043    }
044
045    @NonNull
046    @java.lang.SuppressWarnings("all")
047    @lombok.Generated
048    public Class<T> getType() {
049        return this.type;
050    }
051
052    @NonNull
053    @java.lang.SuppressWarnings("all")
054    @lombok.Generated
055    public TypedGenerator<T> getDecorator() {
056        return this.decorator;
057    }
058}