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.List;
 import java.util.Map;
 
 public class ServiceUrlCollectionBean extends ProducerBean<List<String>> {
 
     private static final String SUFFIX = "-urls";
     private static final String ENDPOINT_SUFFIX = "-endpoint-urls";
     private static final Map<KeyServiceUrlCollectionBeanBEANS = new HashMap<>();
 
     public static ServiceUrlCollectionBean getBean(String nameString protocolString aliasBoolean endpointType collectionType) {
         String serviceAlias = alias != null ? alias : name + "-" + protocol + (endpoint ?  : );
         Key key = new Key(nameprotocolserviceAliasendpointcollectionType);
         if (.containsKey(key)) {
             return .get(key);
         }
         ServiceUrlCollectionBean bean = new ServiceUrlCollectionBean(nameprotocolserviceAliasendpointcollectionType);
         .put(keybean);
         return bean;
     }
 
     public static ServiceUrlCollectionBean anyBean(String idString protocolBoolean endpointType collectionType) {
         for (Map.Entry<KeyServiceUrlCollectionBeanentry : .entrySet()) {
            Key key = entry.getKey();
            if (key.serviceId.equals(id) && key.serviceProtocol.equals(protocol)) {
                return entry.getValue();
            }
         }
         return getBean(idprotocolnullendpointcollectionType);
     }
 
     public static Collection<ServiceUrlCollectionBeangetBeans() {
         return .values();
     }
     
     private final String serviceName;
     private final String serviceProtocol;
     private final String serviceAlias;
     private final Boolean serviceEndpoint;
     private final Type serviceCollectionType;
 
     private ServiceUrlCollectionBean(String serviceNameString serviceProtocolString serviceAliasBoolean serviceEndpointType serviceCollectionType) {
         super(serviceAliasserviceCollectionTypenew ServiceEndpointsProducer(serviceNameserviceProtocol), Qualifiers.create(serviceNameserviceProtocolserviceEndpointfalse));
         this. = serviceName;
         this. = serviceProtocol;
         this. = serviceAlias;
         this. = serviceEndpoint;
         this. = serviceCollectionType;
     }
 
     public String getServiceName() {
         return ;
     }
 
     public String getServiceProtocol() {
         return ;
     }
 
     public String getServiceAlias() {
         return ;
     }
 
     public Boolean isServiceEndpoint() {
         return ;
     }
 
     public Type getServiceCollectionType() {
         return ;
     }
 
     @Override
     public String toString() {
         return "ServiceUrlBean[" +
                 "serviceName='" +  + '\'' +
                 ", serviceProtocol='" +  + '\'' +
                 ']';
    }
    private static final class Key {
        private final String serviceId;
        private final String serviceProtocol;
        private final String serviceAlias;
        private final Boolean serviceEndpoint;
        private final Type serviceCollectionType;
        private Key(String serviceIdString serviceProtocolString serviceAliasBoolean serviceEndpointType serviceCollectionType) {
            this. = serviceId;
            this. = serviceProtocol;
            this. = serviceAlias;
            this. = serviceEndpoint;
            this. = serviceCollectionType;
        }
        @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.serviceId) : key.serviceId != nullreturn false;
            if ( != null ? !.equals(key.serviceProtocol) : key.serviceProtocol != nullreturn false;
            if ( != null ? !.equals(key.serviceProtocol) : key.serviceAlias != nullreturn false;
            if ( != null ? !.equals(key.serviceEndpoint) : key.serviceEndpoint != nullreturn false;
            if ( != null ? !.equals(key.serviceCollectionType) : key.serviceCollectionType != 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);
            result = 31 * result + ( != null ? .hashCode() : 0);
            return result;
        }
    }
New to GrepCode? Check out our FAQ X