001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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    }