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

org.eclipse.aether.util.artifact.SimpleArtifactTypeRegistry Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
/*******************************************************************************
 * Copyright (c) 2010, 2011 Sonatype, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Sonatype, Inc. - initial API and implementation
 *******************************************************************************/
package org.eclipse.aether.util.artifact;

import java.util.HashMap;
import java.util.Map;

import org.eclipse.aether.artifact.ArtifactType;
import org.eclipse.aether.artifact.ArtifactTypeRegistry;

/**
 * A simple map-based artifact type registry.
 */
class SimpleArtifactTypeRegistry
    implements ArtifactTypeRegistry
{

    private final Map types;

    /**
     * Creates a new artifact type registry with initally no registered artifact types. Use {@link #add(ArtifactType)}
     * to populate the registry.
     */
    public SimpleArtifactTypeRegistry()
    {
        types = new HashMap();
    }

    /**
     * Adds the specified artifact type to the registry.
     * 
     * @param type The artifact type to add, must not be {@code null}.
     * @return This registry for chaining, never {@code null}.
     */
    public SimpleArtifactTypeRegistry add( ArtifactType type )
    {
        types.put( type.getId(), type );
        return this;
    }

    public ArtifactType get( String typeId )
    {
        ArtifactType type = types.get( typeId );

        return type;
    }

    @Override
    public String toString()
    {
        return types.toString();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy