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;
 
 
 
 import java.util.Map;
 
 public class ServiceUrlBean extends ProducerBean<String> {
 
     private static final String SUFFIX = "-url";
     private static final Map<KeyServiceUrlBeanBEANS = new HashMap<>();
 
     public static ServiceUrlBean getBean(String nameString protocolString aliasBoolean external) {
         String serviceAlias = alias != null ? alias :
                 (external ? "external-" : "") + name + "-" + protocol + ;
         Key key = new Key(nameprotocolserviceAliasexternal);
         if (.containsKey(key)) {
             return .get(key);
         }
         ServiceUrlBean bean = new ServiceUrlBean(nameprotocolserviceAliasexternal);
         .put(keybean);
         return bean;
     }
 
     public static ServiceUrlBean anyBean(String idString protocolBoolean external) {
         for (Map.Entry<KeyServiceUrlBeanentry : .entrySet()) {
            Key key = entry.getKey();
            if (key.serviceName.equals(id) && key.serviceProtocol.equals(protocol)) {
                return entry.getValue();
            }
         }
         return getBean(idprotocolnullexternal);
     }
 
     public static Collection<ServiceUrlBeangetBeans() {
         return .values();
     }
     private final String serviceName;
     private final String serviceProtocol;
     private final String serviceAlias;
     private final Boolean serviceExternal;
 
     private ServiceUrlBean(String serviceNameString serviceProtocolString serviceAliasBoolean serviceExternal) {
         super(serviceAliasString.classnew ServiceUrlProducer(serviceNameserviceProtocolserviceExternal), Qualifiers.create(serviceNameserviceProtocolfalseserviceExternal));
         this. = serviceName;
         this. = serviceProtocol;
         this. = serviceAlias;
         this. = serviceExternal;
     }
 
     public String getServiceName() {
         return ;
     }
 
     public String getServiceProtocol() {
         return ;
     }
 
     public String getServiceAlias() {
         return ;
     }
 
     @Override
     public String toString() {
         return "ServiceUrlBean[" +
                 "serviceName='" +  + '\'' +
                 ", serviceProtocol='" +  + '\'' +
                 ']';
     }
 
     private static final class Key {
         private final String serviceName;
         private final String serviceProtocol;
         private final String serviceAlias;
         private final Boolean serviceExternal;
 
         private Key(String serviceNameString serviceProtocolString serviceAliasBoolean serviceExternal) {
             this. = serviceName;
             this. = serviceProtocol;
             this. = serviceAlias;
             this. = serviceExternal;
        }
        @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.serviceName) : key.serviceName != nullreturn false;
            if ( != null ? !.equals(key.serviceProtocol) : key.serviceProtocol != nullreturn false;
            if ( != null ? !.equals(key.serviceAlias) : key.serviceAlias != nullreturn false;
            if ( != null ? !.equals(key.serviceExternal) : key.serviceExternal != nullreturn false;
            return true;
        }
        @Override
        public int hashCode() {
            int result =  != null ? .hashCode() : 0;
            result = 31 * result + ( != null ? .hashCode() : 0);
            result = 31 * result + ( != null ? .hashCode() : 0);
            result = 31 * result + ( != null ? .hashCode() : 0);
            return result;
        }
    }
New to GrepCode? Check out our FAQ X