001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.dynamicdatamapping.storage;
016    
017    /**
018     * @author Marcellus Tavares
019     * @author Eduardo Lundgren
020     */
021    public enum StorageType {
022    
023            EXPANDO("expando"), XML("xml");
024    
025            public static StorageType parse(String value) {
026                    if (EXPANDO.getValue().equals(value)) {
027                            return EXPANDO;
028                    }
029                    else if (XML.getValue().equals(value)) {
030                            return XML;
031                    }
032                    else {
033                            throw new IllegalArgumentException("Invalid value " + value);
034                    }
035            }
036    
037            public String getValue() {
038                    return _value;
039            }
040    
041            @Override
042            public String toString() {
043                    return _value;
044            }
045    
046            private StorageType(String value) {
047                    _value = value;
048            }
049    
050            private String _value;
051    
052    }