001/* 002 * Licensed under the Apache License, Version 2.0 (the "License"); 003 * you may not use this file except in compliance with the License. 004 * You may obtain a copy of the License at 005 * 006 * http://www.apache.org/licenses/LICENSE-2.0 007 * 008 * Unless required by applicable law or agreed to in writing, software 009 * distributed under the License is distributed on an "AS IS" BASIS, 010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 011 * See the License for the specific language governing permissions and 012 * limitations under the License. 013 */ 014package org.gbif.common.parsers; 015 016import org.gbif.api.vocabulary.LifeStage; 017import org.gbif.common.parsers.core.EnumParser; 018 019/** 020 * Singleton implementation of the dictionary that uses the file /dictionaries/parse/life_stage.txt. 021 * 022 * @deprecated replaced by the vocabulary server <a href="https://github.com/gbif/vocabulary">https://github.com/gbif/vocabulary</a>. 023 */ 024@Deprecated 025public class LifeStageParser extends EnumParser<LifeStage> { 026 027 private static LifeStageParser singletonObject = null; 028 029 private LifeStageParser() { 030 super(LifeStage.class, false); 031 // make sure we have all life_stage from the enum 032 for (LifeStage c : LifeStage.values()) { 033 add(c.name(), c); 034 } 035 // use dict file last 036 init(LifeStageParser.class.getResourceAsStream("/dictionaries/parse/life_stage.tsv")); 037 } 038 039 public static LifeStageParser getInstance() { 040 synchronized (LifeStageParser.class) { 041 if (singletonObject == null) { 042 singletonObject = new LifeStageParser(); 043 } 044 } 045 return singletonObject; 046 } 047 048}