Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2005-2015 Red Hat, Inc. Red Hat licenses this file to you under the Apache License, version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package io.fabric8.cdi.bean;
public class ConfigurationBean<T> extends ProducerBean<T> {
    private static final String SUFFIX = "-config-bean";
    private static final Map<KeyConfigurationBeanBEANS = new HashMap<>();
    private final String configurationId;
    public static ConfigurationBean getBean(String configurationIdClass type) {
        Key key = new Key(configurationIdtype);
        if (.containsKey(key)) {
            return .get(key);
        }
        ConfigurationBean bean = new ConfigurationBean(configurationIdtype);
        .put(keybean);
        return bean;
    }
    public static Collection<ConfigurationBeangetBeans() {
        return .values();
    }
    private ConfigurationBean(String configurationIdClass<T> type) {
        super(configurationId + ,
                type,
                new ConfigurationProducer<T>(configurationIdtype),
                new ConfigurationQualifier(configurationId));
        this. = configurationId;
    }
    public String getConfigurationId() {
        return ;
    }
    private static class Key<T> {
        private final String configurationId;
        private final Class<T> type;
        private Key(String configurationIdClass<T> type) {
            this. = configurationId;
            this. = type;
        }
        @Override
        public boolean equals(Object o) {
            if (this == oreturn true;
            if (o == null || getClass() != o.getClass()) return false;
            Key key = (Keyo;
            if ( != null ? !.equals(key.configurationId) : key.configurationId != null)
                return false;
            if ( != null ? !.equals(key.type) : key.type != nullreturn false;
            return true;
        }
        @Override
        public int hashCode() {
            int result =  != null ? .hashCode() : 0;
            result = 31 * result + ( != null ? .hashCode() : 0);
            return result;
        }
    }
New to GrepCode? Check out our FAQ X