1 /* 2 * Copyright 2013 smartics, Kronseder & Reiner GmbH 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package de.smartics.resteasy.hypermedia.renderer.i18n; 17 18 import java.util.Locale; 19 20 import javax.enterprise.inject.Alternative; 21 22 import de.smartics.resteasy.hypermedia.renderer.I18nProvider; 23 import de.smartics.resteasy.hypermedia.renderer.LinkMetadata; 24 import de.smartics.resteasy.hypermedia.renderer.LocalizationProvider; 25 26 /** 27 * Provides no localization information. 28 */ 29 @Alternative 30 public class DummyI18nProvider implements I18nProvider 31 { 32 // ********************************* Fields ********************************* 33 34 // --- constants ------------------------------------------------------------ 35 36 // --- members -------------------------------------------------------------- 37 38 // ****************************** Initializer ******************************* 39 40 // ****************************** Constructors ****************************** 41 42 // ****************************** Inner Classes ***************************** 43 44 // ********************************* Methods ******************************** 45 46 // --- init ----------------------------------------------------------------- 47 48 // --- get&set -------------------------------------------------------------- 49 50 /** 51 * {@inheritDoc} 52 * <p> 53 * Every value in the returned provider instance is unset, with the exception 54 * of the locale which matches the values passed in. 55 * </p> 56 */ 57 @Override 58 public LocalizationProvider getProvider(final Locale locale) 59 { 60 return new LocalizationProvider() 61 { 62 @Override 63 public Locale getLocale() 64 { 65 return locale; 66 } 67 68 @Override 69 public LinkMetadata getLinkMetadata(final String id) 70 { 71 return new LinkMetadata(); 72 } 73 }; 74 } 75 76 // --- business ------------------------------------------------------------- 77 78 // --- object basics -------------------------------------------------------- 79 80 }