001    /**
002     * Copyright (c) 2000-2010 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.portal.model;
016    
017    import com.liferay.portal.kernel.util.Tuple;
018    import com.liferay.portal.kernel.xml.Element;
019    
020    import java.util.List;
021    import java.util.Map;
022    
023    /**
024     * @author Brian Wing Shun Chan
025     */
026    public class ModelHintsUtil {
027    
028            public static Map<String, String> getDefaultHints(String model) {
029                    return getModelHints().getDefaultHints(model);
030            }
031    
032            public static Element getFieldsEl(String model, String field) {
033                    return getModelHints().getFieldsEl(model, field);
034            }
035    
036            public static Map<String, String> getHints(String model, String field) {
037                    return getModelHints().getHints(model, field);
038            }
039    
040            public static ModelHints getModelHints() {
041                    return _modelHints;
042            }
043    
044            public static List<String> getModels() {
045                    return getModelHints().getModels();
046            }
047    
048            public static Tuple getSanitizeTuple(String model, String field) {
049                    return getModelHints().getSanitizeTuple(model, field);
050            }
051    
052            public static List<Tuple> getSanitizeTuples(String model) {
053                    return getModelHints().getSanitizeTuples(model);
054            }
055    
056            public static String getType(String model, String field) {
057                    return getModelHints().getType(model, field);
058            }
059    
060            public static boolean isLocalized(String model, String field) {
061                    return getModelHints().isLocalized(model, field);
062            }
063    
064            public static void read(ClassLoader classLoader, String source)
065                    throws Exception {
066    
067                    getModelHints().read(classLoader, source);
068            }
069    
070            public static String trimString(String model, String field, String value) {
071                    return getModelHints().trimString(model, field, value);
072            }
073    
074            public void setModelHints(ModelHints modelHints) {
075                    _modelHints = modelHints;
076            }
077    
078            private static ModelHints _modelHints;
079    
080    }