All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.fortuna.ical4j.vcard.VCardBuilderContext Maven / Gradle / Ivy

package net.fortuna.ical4j.vcard;

import net.fortuna.ical4j.model.Parameter;
import net.fortuna.ical4j.model.ParameterFactory;
import net.fortuna.ical4j.model.Property;
import net.fortuna.ical4j.model.PropertyFactory;

import java.util.Collections;
import java.util.List;
import java.util.function.Supplier;

/**
 * Customize behaviour of {@link VCardBuilder} implementations.
 */
public class VCardBuilderContext {

    private Supplier>> parameterFactorySupplier = new VCardParameterFactorySupplier();

    private Supplier>> propertyFactorySupplier = new VCardPropertyFactorySupplier();

    private List ignoredPropertyNames = Collections.emptyList();

    public VCardBuilderContext withParameterFactorySupplier(Supplier>> parameterFactorySupplier) {
        var context = new VCardBuilderContext();
        context.parameterFactorySupplier = parameterFactorySupplier;
        context.propertyFactorySupplier = this.propertyFactorySupplier;
        context.ignoredPropertyNames = this.ignoredPropertyNames;
        return context;
    }

    public VCardBuilderContext withPropertyFactorySupplier(Supplier>> propertyFactorySupplier) {
        var context = new VCardBuilderContext();
        context.parameterFactorySupplier = this.parameterFactorySupplier;
        context.propertyFactorySupplier = propertyFactorySupplier;
        context.ignoredPropertyNames = this.ignoredPropertyNames;
        return context;
    }

    public VCardBuilderContext withIgnoredPropertyNames(List ignoredPropertyNames) {
        var context = new VCardBuilderContext();
        context.parameterFactorySupplier = this.parameterFactorySupplier;
        context.propertyFactorySupplier = this.propertyFactorySupplier;
        context.ignoredPropertyNames = ignoredPropertyNames;
        return context;
    }

    public Supplier>> getParameterFactorySupplier() {
        return parameterFactorySupplier;
    }

    public Supplier>> getPropertyFactorySupplier() {
        return propertyFactorySupplier;
    }

    public List getIgnoredPropertyNames() {
        return ignoredPropertyNames;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy