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

net.java.truecommons.key.spec.spi.KeyManagerMapFactory Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (C) 2005-2015 Schlichtherle IT Services.
 * All rights reserved. Use is subject to license terms.
 */
package net.java.truecommons.key.spec.spi;

import java.util.HashMap;
import java.util.Map;
import javax.annotation.concurrent.Immutable;
import net.java.truecommons.annotations.ServiceImplementation;
import net.java.truecommons.annotations.ServiceSpecification;
import net.java.truecommons.key.spec.KeyManager;
import net.java.truecommons.key.spec.sl.KeyManagerMapLocator;
import net.java.truecommons.services.LocatableFactory;

/**
 * A service for creating maps of classes to nullable key managers.
 * Note that this class solely exists in order to support the
 * {@link KeyManagerMapLocator#SINGLETON}, which will use it to create the
 * manager map and subsequently modify it by the
 * {@link KeyManagerMapModifier} implementations found on the class path.
 *
 * @since  TrueCommons 2.2
 * @author Christian Schlichtherle
 */
@Immutable
@ServiceSpecification
@ServiceImplementation
public class KeyManagerMapFactory
extends LocatableFactory, KeyManager>> {

    /**
     * Returns a new empty map for subsequent modification.
     *
     * @return A new empty map for subsequent modification.
     */
    @Override
    public Map, KeyManager> get() {
        return new HashMap<>(32);
    }

    /**
     * {@inheritDoc}
     * 

* If the {@linkplain #getClass() runtime class} of this object is * {@link KeyManagerMapFactory}, then {@code -100} gets returned. * Otherwise, zero gets returned. */ @Override public int getPriority() { return KeyManagerMapFactory.class.equals(getClass()) ? -100 : 0; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy