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

com.signalfx.shaded.fasterxml.jackson.databind.introspect.PotentialCreators Maven / Gradle / Ivy

Go to download

Bare minimum core library needed to sending metrics to SignalFx from Java clients

The newest version!
package com.signalfx.shaded.fasterxml.jackson.databind.introspect;

import java.util.*;

import com.signalfx.shaded.fasterxml.jackson.databind.cfg.MapperConfig;

public class PotentialCreators
{
    /**
     * Property-based Creator found, if any
     */
    public PotentialCreator propertiesBased;

    private List explicitDelegating;

    private List implicitDelegatingConstructors;
    private List implicitDelegatingFactories;

    public PotentialCreators() { }

    /*
    /**********************************************************************
    /* Accumulating candidates
    /**********************************************************************
     */
    
    // desc -> "explicit", "implicit" etc
    public void setPropertiesBased(MapperConfig config, PotentialCreator ctor, String mode)
    {
        if (propertiesBased != null) {
            throw new IllegalArgumentException(String.format(
                    "Conflicting property-based creators: already had %s creator %s, encountered another: %s",
                    mode, propertiesBased.creator(), ctor.creator()));
        }
        propertiesBased = ctor.introspectParamNames(config);
    }

    public void addExplicitDelegating(PotentialCreator ctor)
    {
        if (explicitDelegating == null) {
            explicitDelegating = new ArrayList<>();
        }
        explicitDelegating.add(ctor);
    }

    public void setImplicitDelegating(List implicitConstructors,
            List implicitFactories)
    {
        implicitDelegatingConstructors = implicitConstructors;
        implicitDelegatingFactories = implicitFactories;
    }

    /*
    /**********************************************************************
    /* Accessors
    /**********************************************************************
     */

    public boolean hasPropertiesBased() {
        return (propertiesBased != null);
    }

    public boolean hasPropertiesBasedOrDelegating() {
        return (propertiesBased != null) || (explicitDelegating != null && !explicitDelegating.isEmpty());
    }

    public List getExplicitDelegating() {
        return (explicitDelegating == null) ? Collections.emptyList() : explicitDelegating;
    }

    public List getImplicitDelegatingFactories() {
        return (implicitDelegatingFactories == null) ? Collections.emptyList() : implicitDelegatingFactories;
    }
    
    public List getImplicitDelegatingConstructors() {
        return (implicitDelegatingConstructors == null) ? Collections.emptyList() : implicitDelegatingConstructors;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy