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

com.cloudimpl.outstack.spring.service.ServiceDescriptorManager Maven / Gradle / Ivy

There is a newer version: 4.0.551
Show newest version
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cloudimpl.outstack.spring.service;

import com.cloudimpl.outstack.spring.component.SpringServiceDescriptor;
import java.util.Collection;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;

/**
 *
 * @author nuwan
 */
public class ServiceDescriptorManager {
    private final Map map = new ConcurrentHashMap<>();
    
    protected void putByPlural(SpringServiceDescriptor serviceDescriptor)
    {
        this.map.put(serviceDescriptor.getPlural().toLowerCase(), serviceDescriptor);
    }
    
    public Optional getServiceDescriptorByPlural(String rootTypePlural)
    {
        return Optional.ofNullable(map.get(rootTypePlural.toLowerCase()));
    }
    
    public Collection getDescriptors()
    {
        return map.values();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy