001    /**
002     * Copyright (c) 2000-present 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.kernel.words;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.jazzy.InvalidWord;
020    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
021    
022    import java.util.List;
023    import java.util.Set;
024    
025    /**
026     * @author Shinn Lok
027     */
028    @ProviderType
029    public class WordsUtil {
030    
031            public static List<InvalidWord> checkSpelling(String text) {
032                    return getWords().checkSpelling(text);
033            }
034    
035            public static List<String> getDictionaryList() {
036                    return getWords().getDictionaryList();
037            }
038    
039            public static Set<String> getDictionarySet() {
040                    return getWords().getDictionarySet();
041            }
042    
043            public static String getRandomWord() {
044                    return getWords().getRandomWord();
045            }
046    
047            public static Words getWords() {
048                    PortalRuntimePermission.checkGetBeanProperty(WordsUtil.class);
049    
050                    return _words;
051            }
052    
053            public static boolean isDictionaryWord(String word) {
054                    return getWords().isDictionaryWord(word);
055            }
056    
057            public void setWords(Words words) {
058                    PortalRuntimePermission.checkSetBeanProperty(getClass());
059    
060                    _words = words;
061            }
062    
063            private static Words _words;
064    
065    }