001/* 002 * Copyright 2010, 2011 Christopher Pheby 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.jadira.bindings.core.loader; 017 018import java.util.ArrayList; 019import java.util.Collections; 020import java.util.List; 021 022/** 023 * Represents the contents of a bindings.xml configuration file. The 024 * configuration contains providers which represent implementations of a 025 * facility capable of resolving converters at runtime and binding configuration 026 * entries which specifically register converters for a given class 027 */ 028public class BindingConfiguration { 029 030 private List<Provider> providers = new ArrayList<Provider>(); 031 032 private List<Extension<?>> extensions = new ArrayList<Extension<?>>(); 033 034 private List<BindingConfigurationEntry> bindingEntries = new ArrayList<BindingConfigurationEntry>(); 035 036 /** 037 * Return the registered providers 038 * @return List of {@link Provider} 039 */ 040 public List<Provider> getProviders() { 041 return Collections.unmodifiableList(providers); 042 } 043 044 /** 045 * Registers a new provider 046 * @param provider The new {@link Provider} 047 */ 048 public void addProvider(Provider provider) { 049 providers.add(provider); 050 } 051 052 /** 053 * Return the registered extensions 054 * @return List of {@link Extension} 055 */ 056 public List<Extension<?>> getExtensions() { 057 return Collections.unmodifiableList(extensions); 058 } 059 060 /** 061 * Registers a new extension 062 * @param extension The new {@link Extension} 063 */ 064 public void addExtension(Extension<?> extension) { 065 extensions.add(extension); 066 } 067 068 /** 069 * Return the registered {@link BindingConfigurationEntry} instances 070 * @return List of {@link BindingConfigurationEntry} 071 */ 072 public List<BindingConfigurationEntry> getBindingEntries() { 073 return Collections.unmodifiableList(bindingEntries); 074 } 075 076 /** 077 * Registers a new binding entry 078 * @param bindingEntry The new {@link BindingConfigurationEntry} 079 */ 080 public void addBindingEntry(BindingConfigurationEntry bindingEntry) { 081 bindingEntries.add(bindingEntry); 082 } 083}