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.expression;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    
019    /**
020     * @author Marcellus Tavares
021     */
022    public class ExpressionFactoryUtil {
023    
024            public static Expression<Boolean> createBooleanExpression(
025                    String expressionString) {
026    
027                    return getExpressionFactory().createBooleanExpression(expressionString);
028            }
029    
030            public static Expression<Double> createDoubleExpression(
031                    String expressionString) {
032    
033                    return getExpressionFactory().createDoubleExpression(expressionString);
034            }
035    
036            public static <T> Expression<T> createExpression(
037                    String expressionString, Class<T> expressionType) {
038    
039                    return getExpressionFactory().createExpression(
040                            expressionString, expressionType);
041            }
042    
043            public static Expression<Float> createFloatExpression(
044                    String expressionString) {
045    
046                    return getExpressionFactory().createFloatExpression(expressionString);
047            }
048    
049            public static Expression<Integer> createIntegerExpression(
050                    String expressionString) {
051    
052                    return getExpressionFactory().createIntegerExpression(expressionString);
053            }
054    
055            public static Expression<Long> createLongExpression(
056                    String expressionString) {
057    
058                    return getExpressionFactory().createLongExpression(expressionString);
059            }
060    
061            public static Expression<String> createStringExpression(
062                    String expressionString) {
063    
064                    return getExpressionFactory().createStringExpression(expressionString);
065            }
066    
067            public static ExpressionFactory getExpressionFactory() {
068                    PortalRuntimePermission.checkGetBeanProperty(
069                            ExpressionFactoryUtil.class);
070    
071                    return _expressionFactory;
072            }
073    
074            public void setExpressionFactory(ExpressionFactory expressionFactory) {
075                    PortalRuntimePermission.checkSetBeanProperty(getClass());
076    
077                    _expressionFactory = expressionFactory;
078            }
079    
080            private static ExpressionFactory _expressionFactory;
081    
082    }