001    /**
002     * Copyright (c) 2000-2012 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 String buildCustomValidatorName(String validatorName) {
029                    return getModelHints().buildCustomValidatorName(validatorName);
030            }
031    
032            public static Map<String, String> getDefaultHints(String model) {
033                    return getModelHints().getDefaultHints(model);
034            }
035    
036            public static Element getFieldsEl(String model, String field) {
037                    return getModelHints().getFieldsEl(model, field);
038            }
039    
040            public static Map<String, String> getHints(String model, String field) {
041                    return getModelHints().getHints(model, field);
042            }
043    
044            public static ModelHints getModelHints() {
045                    return _modelHints;
046            }
047    
048            public static List<String> getModels() {
049                    return getModelHints().getModels();
050            }
051    
052            public static Tuple getSanitizeTuple(String model, String field) {
053                    return getModelHints().getSanitizeTuple(model, field);
054            }
055    
056            public static List<Tuple> getSanitizeTuples(String model) {
057                    return getModelHints().getSanitizeTuples(model);
058            }
059    
060            public static String getType(String model, String field) {
061                    return getModelHints().getType(model, field);
062            }
063    
064            public static List<Tuple> getValidators(String model, String field) {
065                    return getModelHints().getValidators(model, field);
066            }
067    
068            public static boolean isCustomValidator(String validatorName) {
069                    return getModelHints().isCustomValidator(validatorName);
070            }
071    
072            public static boolean isLocalized(String model, String field) {
073                    return getModelHints().isLocalized(model, field);
074            }
075    
076            public static void read(ClassLoader classLoader, String source)
077                    throws Exception {
078    
079                    getModelHints().read(classLoader, source);
080            }
081    
082            public static String trimString(String model, String field, String value) {
083                    return getModelHints().trimString(model, field, value);
084            }
085    
086            public void setModelHints(ModelHints modelHints) {
087                    _modelHints = modelHints;
088            }
089    
090            private static ModelHints _modelHints;
091    
092    }