Java 类javax.el.FunctionMapper 实例源码

项目:querybuilder    文件:ELUtils.java   
public static EvaluationContext buildEvaluationContext(
        Map<String, Method> functionMethodMap,
        Map<String, Object> attributeMap) {

    VariableMapper vMapper = buildVariableMapper(attributeMap);
    FunctionMapper fMapper = buildFunctionMapper(functionMethodMap);

    EsfingeELContext context = new EsfingeELContext(fMapper, vMapper,
            new ArrayELResolver(), new ListELResolver(), new MapELResolver(), new BeanELResolver());

    return new EvaluationContext(context, fMapper, vMapper);
}
项目:metrics-cdi    文件:ElMetricName.java   
private ELContext createELContext(final ELResolver resolver, final FunctionMapper functionMapper, final VariableMapper variableMapper) {

        return new ELContext() {
            @Override
            public ELResolver getELResolver() {
                return resolver;
            }

            @Override
            public FunctionMapper getFunctionMapper() {
                return functionMapper;
            }

            @Override
            public VariableMapper getVariableMapper() {
                return variableMapper;
            }
        };
    }
项目:tomcat7    文件:AstFunction.java   
@Override
public Class<?> getType(EvaluationContext ctx)
        throws ELException {

    FunctionMapper fnMapper = ctx.getFunctionMapper();

    // quickly validate again for this request
    if (fnMapper == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.null"));
    }
    Method m = fnMapper.resolveFunction(this.prefix, this.localName);
    if (m == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.method",
                this.getOutputName()));
    }
    return m.getReturnType();
}
项目:lams    文件:AstFunction.java   
public Class getType(EvaluationContext ctx)
        throws ELException {

    FunctionMapper fnMapper = ctx.getFunctionMapper();

    // quickly validate again for this request
    if (fnMapper == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.null"));
    }
    Method m = fnMapper.resolveFunction(this.prefix, this.localName);
    if (m == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.method",
                this.getOutputName()));
    }
    return m.getReturnType();
}
项目:lams    文件:ValueExpressionImpl.java   
/**
 * 
 */
public ValueExpressionImpl(String expr, Node node, FunctionMapper fnMapper,
        VariableMapper varMapper, Class expectedType) {
    this.expr = expr;
    this.node = node;
    this.fnMapper = fnMapper;
    this.varMapper = varMapper;
    this.expectedType = expectedType;
}
项目:lams    文件:JspUtil.java   
/**
     * Validates the syntax of all ${} expressions within the given string.
     * @param where the approximate location of the expressions in the JSP page
     * @param expressions a string containing zero or more "${}" expressions
     * @param err an error dispatcher to use
     * @deprecated now delegated to the org.apache.el Package
     */
    public static void validateExpressions(Mark where,
                                           String expressions,
                                           Class expectedType,
                                           FunctionMapper functionMapper,
                                           ErrorDispatcher err)
            throws JasperException {

//        try {
//            
//            JspUtil.expressionEvaluator.parseExpression( expressions, 
//                expectedType, functionMapper );
//        }
//        catch( ELParseException e ) {
//            err.jspError(where, "jsp.error.invalid.expression", expressions,
//                e.toString() );
//        }
//        catch( ELException e ) {
//            err.jspError(where, "jsp.error.invalid.expression", expressions,
//                e.toString() );
//        }
    }
项目:apache-tomcat-7.0.73-with-comment    文件:AstFunction.java   
@Override
public Class<?> getType(EvaluationContext ctx)
        throws ELException {

    FunctionMapper fnMapper = ctx.getFunctionMapper();

    // quickly validate again for this request
    if (fnMapper == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.null"));
    }
    Method m = fnMapper.resolveFunction(this.prefix, this.localName);
    if (m == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.method",
                this.getOutputName()));
    }
    return m.getReturnType();
}
项目:apache-tomcat-7.0.73-with-comment    文件:ExpressionBuilder.java   
/**
 *
 */
public ExpressionBuilder(String expression, ELContext ctx)
        throws ELException {
    this.expression = expression;

    FunctionMapper ctxFn = ctx.getFunctionMapper();
    VariableMapper ctxVar = ctx.getVariableMapper();

    if (ctxFn != null) {
        this.fnMapper = new FunctionMapperFactory(ctxFn);
    }
    if (ctxVar != null) {
        this.varMapper = new VariableMapperFactory(ctxVar);
    }
}
项目:flowable-engine    文件:CdiResolver.java   
public CdiResolver() {
    context = new javax.el.ELContext() {

        @Override
        public VariableMapper getVariableMapper() {
            return null;
        }

        @Override
        public FunctionMapper getFunctionMapper() {
            return null;
        }

        @Override
        public javax.el.ELResolver getELResolver() {
            return getWrappedResolver();
        }
    };
}
项目:packagedrone    文件:PageContextImpl.java   
public static MethodExpression getMethodExpression(
                                           String expression,
                                           PageContext pageContext,
                                           FunctionMapper functionMap,
                                           Class expectedType,
                                           Class[] paramTypes) {

    ELContextImpl elctxt = (ELContextImpl)pageContext.getELContext();
    elctxt.setFunctionMapper(functionMap);
    ExpressionFactory expFactory = getExpressionFactory(pageContext);
    return expFactory.createMethodExpression(
                                elctxt,
                                expression,
                                expectedType,
                                paramTypes);
}
项目:packagedrone    文件:JspUtil.java   
/**
 * Validates the syntax of all EL expressions within the given string.
 * @param where the approximate location of the expressions in the JSP page
 * @param expressions a string containing an EL expressions
 * @param err an error dispatcher to use
 */
public static void validateExpressions(Mark where,
                                       String expressions,
                                       FunctionMapper functionMapper,
                                       ErrorDispatcher err)
        throws JasperException {

    try {
        ELContextImpl elContext = new ELContextImpl(null);
        elContext.setFunctionMapper(functionMapper);
        getExpressionFactory().createValueExpression(
            elContext, 
            expressions, Object.class);
    }
    catch( ELException e ) {
        err.jspError(where, "jsp.error.invalid.expression", expressions,
            e.toString() );
    }
}
项目:SecureBPMN    文件:CdiResolver.java   
public CdiResolver() {
  context = new javax.el.ELContext() {

    @Override
    public VariableMapper getVariableMapper() {
      return null;
    }

    @Override
    public FunctionMapper getFunctionMapper() {
      return null;
    }

    @Override
    public javax.el.ELResolver getELResolver() {
      return getWrappedResolver();
    }
  };
}
项目:class-guard    文件:AstFunction.java   
@Override
public Class<?> getType(EvaluationContext ctx)
        throws ELException {

    FunctionMapper fnMapper = ctx.getFunctionMapper();

    // quickly validate again for this request
    if (fnMapper == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.null"));
    }
    Method m = fnMapper.resolveFunction(this.prefix, this.localName);
    if (m == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.method",
                this.getOutputName()));
    }
    return m.getReturnType();
}
项目:class-guard    文件:ValueExpressionImpl.java   
/**
 * 
 */
public ValueExpressionImpl(String expr, Node node, FunctionMapper fnMapper,
        VariableMapper varMapper, Class<?> expectedType) {
    this.expr = expr;
    this.node = node;
    this.fnMapper = fnMapper;
    this.varMapper = varMapper;
    this.expectedType = expectedType;
}
项目:package-drone    文件:PageContextImpl.java   
public static MethodExpression getMethodExpression(
                                           String expression,
                                           PageContext pageContext,
                                           FunctionMapper functionMap,
                                           Class expectedType,
                                           Class[] paramTypes) {

    ELContextImpl elctxt = (ELContextImpl)pageContext.getELContext();
    elctxt.setFunctionMapper(functionMap);
    ExpressionFactory expFactory = getExpressionFactory(pageContext);
    return expFactory.createMethodExpression(
                                elctxt,
                                expression,
                                expectedType,
                                paramTypes);
}
项目:package-drone    文件:JspUtil.java   
/**
 * Validates the syntax of all EL expressions within the given string.
 * @param where the approximate location of the expressions in the JSP page
 * @param expressions a string containing an EL expressions
 * @param err an error dispatcher to use
 */
public static void validateExpressions(Mark where,
                                       String expressions,
                                       FunctionMapper functionMapper,
                                       ErrorDispatcher err)
        throws JasperException {

    try {
        ELContextImpl elContext = new ELContextImpl(null);
        elContext.setFunctionMapper(functionMapper);
        getExpressionFactory().createValueExpression(
            elContext, 
            expressions, Object.class);
    }
    catch( ELException e ) {
        err.jspError(where, "jsp.error.invalid.expression", expressions,
            e.toString() );
    }
}
项目:apache-tomcat-7.0.57    文件:AstFunction.java   
@Override
public Class<?> getType(EvaluationContext ctx)
        throws ELException {

    FunctionMapper fnMapper = ctx.getFunctionMapper();

    // quickly validate again for this request
    if (fnMapper == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.null"));
    }
    Method m = fnMapper.resolveFunction(this.prefix, this.localName);
    if (m == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.method",
                this.getOutputName()));
    }
    return m.getReturnType();
}
项目:apache-tomcat-7.0.57    文件:AstFunction.java   
@Override
public Class<?> getType(EvaluationContext ctx)
        throws ELException {

    FunctionMapper fnMapper = ctx.getFunctionMapper();

    // quickly validate again for this request
    if (fnMapper == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.null"));
    }
    Method m = fnMapper.resolveFunction(this.prefix, this.localName);
    if (m == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.method",
                this.getOutputName()));
    }
    return m.getReturnType();
}
项目:oxCore    文件:ContextProducer.java   
private ExtendedELContext createELContext(final ELResolver resolver, final FunctionMapper functionMapper,
        final VariableMapper variableMapper, final ConstantResolver constantResolver) {
    return new ExtendedELContext() {
        @Override
        public ELResolver getELResolver() {
            return resolver;
        }

        @Override
        public FunctionMapper getFunctionMapper() {
            return functionMapper;
        }

        @Override
        public VariableMapper getVariableMapper() {
            return variableMapper;
        }

        @Override
        public ConstantResolver getConstantResolver() {
            return constantResolver;
        }
    };
}
项目:FiWare-Template-Handler    文件:CdiResolver.java   
public CdiResolver() {
  context = new javax.el.ELContext() {

    @Override
    public VariableMapper getVariableMapper() {
      return null;
    }

    @Override
    public FunctionMapper getFunctionMapper() {
      return null;
    }

    @Override
    public javax.el.ELResolver getELResolver() {
      return getWrappedResolver();
    }
  };
}
项目:jboss-el    文件:AstFunction.java   
public Class getType(EvaluationContext ctx)
throws ELException {

    FunctionMapper fnMapper = ctx.getFunctionMapper();

    // quickly validate again for this request
    if (fnMapper == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.null"));
    }
    Method m = fnMapper.resolveFunction(this.prefix, this.localName);
    if (m == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.method",
                this.getOutputName()));
    }
    return m.getReturnType();
}
项目:jboss-el    文件:AstFunction.java   
public Object getValue(EvaluationContext ctx)
throws ELException {

    FunctionMapper fnMapper = ctx.getFunctionMapper();

    // quickly validate again for this request
    if (fnMapper == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.null"));
    }
    Method m = fnMapper.resolveFunction(this.prefix, this.localName);
    if (m == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.method",
                this.getOutputName()));
    }

    // If no params, there are no children, jjtGetNumChildren returns 0 if no children, not NPE
    Object[] params = new Object[this.jjtGetNumChildren()];
    for (int i = 0; i < this.jjtGetNumChildren(); i++) {
        params[i] = this.children[i].getValue(ctx);
    }

    return ReflectionUtil.invokeMethod(null, m, params);
}
项目:proctor    文件:ProctorUtils.java   
public static ProctorLoadResult verifyAndConsolidate(@Nonnull final TestMatrixArtifact testMatrix, final String matrixSource, @Nonnull final Map<String, TestSpecification> requiredTests, @Nonnull final FunctionMapper functionMapper, final ProvidedContext providedContext) {
    final ProctorLoadResult result = verify(testMatrix, matrixSource, requiredTests, functionMapper, providedContext);

    final Map<String, ConsumableTestDefinition> definedTests = testMatrix.getTests();
    // Remove any invalid tests so that any required ones will be replaced with default values during the
    // consolidation below (just like missing tests). Any non-required tests can safely be ignored.
    for (final String invalidTest: result.getTestsWithErrors()) {
        // TODO - mjs - gross that this depends on the mutability of the returned map, but then so does the
        //  consolidate method below.
        definedTests.remove(invalidTest);
    }

    consolidate(testMatrix, requiredTests);

    return result;
}
项目:proctor    文件:Proctor.java   
/**
 * Factory method to do the setup and transformation of inputs
 *
 * @param matrix a {@link TestMatrixArtifact} loaded by ProctorLoader
 * @param loadResult a {@link ProctorLoadResult} which contains result of validation of test definition
 * @param functionMapper a given el {@link FunctionMapper}
 * @return constructed Proctor object
 */
@Nonnull
public static Proctor construct(@Nonnull final TestMatrixArtifact matrix, ProctorLoadResult loadResult, FunctionMapper functionMapper) {
    final ExpressionFactory expressionFactory = RuleEvaluator.EXPRESSION_FACTORY;

    final Map<String, TestChooser<?>> testChoosers = Maps.newLinkedHashMap();
    final Map<String, String> versions = Maps.newLinkedHashMap();

    for (final Entry<String, ConsumableTestDefinition> entry : matrix.getTests().entrySet()) {
        final String testName = entry.getKey();
        final ConsumableTestDefinition testDefinition = entry.getValue();
        final TestType testType = testDefinition.getTestType();
        final TestChooser<?> testChooser;
        if (TestType.RANDOM.equals(testType)) {
            testChooser = new RandomTestChooser(expressionFactory, functionMapper, testName, testDefinition);
        } else {
            testChooser = new StandardTestChooser(expressionFactory, functionMapper, testName, testDefinition);
        }
        testChoosers.put(testName, testChooser);
        versions.put(testName, testDefinition.getVersion());
    }

    return new Proctor(matrix, loadResult, testChoosers);
}
项目:proctor    文件:RuleEvaluator.java   
@Nonnull
ELContext createELContext(@Nonnull final VariableMapper variableMapper) {
    return new ELContext() {
        @Nonnull
        @Override
        public ELResolver getELResolver() {
            return elResolver;
        }

        @Nonnull
        @Override
        public FunctionMapper getFunctionMapper() {
            return functionMapper;
        }

        @Nonnull
        @Override
        public VariableMapper getVariableMapper() {
            return variableMapper;
        }
    };
}
项目:proctor    文件:TestRandomTestChooser.java   
static RandomTestChooser initializeRandomTestChooser(final List<Range> ranges, final List<TestBucket> buckets) {
    final ExpressionFactory expressionFactory = new ExpressionFactoryImpl();

    final FunctionMapper functionMapper = RuleEvaluator.FUNCTION_MAPPER;

    final ConsumableTestDefinition testDefinition = new ConsumableTestDefinition();
    testDefinition.setConstants(Collections.<String, Object>emptyMap());

    testDefinition.setBuckets(buckets);

    final List<Allocation> allocations = Lists.newArrayList();
    allocations.add(new Allocation("${}", ranges));
    testDefinition.setAllocations(allocations);

    final RandomTestChooser rtc = new RandomTestChooser(expressionFactory, functionMapper, "testName", testDefinition);
    return rtc;
}
项目:WBSAirback    文件:AstFunction.java   
@Override
public Class<?> getType(EvaluationContext ctx)
        throws ELException {

    FunctionMapper fnMapper = ctx.getFunctionMapper();

    // quickly validate again for this request
    if (fnMapper == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.null"));
    }
    Method m = fnMapper.resolveFunction(this.prefix, this.localName);
    if (m == null) {
        throw new ELException(MessageFactory.get("error.fnMapper.method",
                this.getOutputName()));
    }
    return m.getReturnType();
}
项目:sonar-web    文件:UnifiedExpressionCheck.java   
@Override
public FunctionMapper getFunctionMapper() {
  if (functions.isEmpty()) {
    return null;
  } else {
    return new FunctionMapper() {

      @Override
      public Method resolveFunction(String prefix, String localName) {
        if (!ArrayUtils.contains(JSTL_FUNCTIONS, localName) && !ArrayUtils.contains(functionsArray, localName)) {
          createViolation(element.getStartLinePosition(), "Fix this expression: Unknown function \"" + localName + "\".");
        }

        // we only care about the check.
        return null;
      }

    };
  }
}
项目:tomcat7    文件:MethodExpressionImpl.java   
/**
 * @param expr
 * @param node
 * @param fnMapper
 * @param expectedType
 * @param paramTypes
 */
public MethodExpressionImpl(String expr, Node node,
        FunctionMapper fnMapper, VariableMapper varMapper,
        Class<?> expectedType, Class<?>[] paramTypes) {
    super();
    this.expr = expr;
    this.node = node;
    this.fnMapper = fnMapper;
    this.varMapper = varMapper;
    this.expectedType = expectedType;
    this.paramTypes = paramTypes;
}
项目:tomcat7    文件:MethodExpressionImpl.java   
@Override
public void readExternal(ObjectInput in) throws IOException,
        ClassNotFoundException {
    this.expr = in.readUTF();
    String type = in.readUTF();
    if (!"".equals(type)) {
        this.expectedType = ReflectionUtil.forName(type);
    }
    this.paramTypes = ReflectionUtil.toTypeArray(((String[]) in
            .readObject()));
    this.fnMapper = (FunctionMapper) in.readObject();
    this.varMapper = (VariableMapper) in.readObject();
}
项目:tomcat7    文件:ExpressionBuilder.java   
/**
 *
 */
public ExpressionBuilder(String expression, ELContext ctx)
        throws ELException {
    this.expression = expression;

    FunctionMapper ctxFn = ctx.getFunctionMapper();
    VariableMapper ctxVar = ctx.getVariableMapper();

    if (ctxFn != null) {
        this.fnMapper = new FunctionMapperFactory(ctxFn);
    }
    if (ctxVar != null) {
        this.varMapper = new VariableMapperFactory(ctxVar);
    }
}
项目:tomcat7    文件:ValueExpressionImpl.java   
/**
 * 
 */
public ValueExpressionImpl(String expr, Node node, FunctionMapper fnMapper,
        VariableMapper varMapper, Class<?> expectedType) {
    this.expr = expr;
    this.node = node;
    this.fnMapper = fnMapper;
    this.varMapper = varMapper;
    this.expectedType = expectedType;
}
项目:tomcat7    文件:ValueExpressionImpl.java   
@Override
public void readExternal(ObjectInput in) throws IOException,
        ClassNotFoundException {
    this.expr = in.readUTF();
    String type = in.readUTF();
    if (!"".equals(type)) {
        this.expectedType = ReflectionUtil.forName(type);
    }
    this.fnMapper = (FunctionMapper) in.readObject();
    this.varMapper = (VariableMapper) in.readObject();
}
项目:myfaces-trinidad    文件:SortableModel.java   
@Override
public FunctionMapper getFunctionMapper()
{
  // Because we're only really being used to pass
  // to an ELResolver, no FunctionMapper is needed
  return null;
}
项目:lams    文件:MethodExpressionImpl.java   
/**
 * @param expr
 * @param node
 * @param fnMapper
 * @param expectedType
 * @param paramTypes
 */
public MethodExpressionImpl(String expr, Node node,
        FunctionMapper fnMapper, VariableMapper varMapper,
        Class expectedType, Class[] paramTypes) {
    super();
    this.expr = expr;
    this.node = node;
    this.fnMapper = fnMapper;
    this.varMapper = varMapper;
    this.expectedType = expectedType;
    this.paramTypes = paramTypes;
}
项目:lams    文件:MethodExpressionImpl.java   
public void readExternal(ObjectInput in) throws IOException,
        ClassNotFoundException {
    this.expr = in.readUTF();
    String type = in.readUTF();
    if (!"".equals(type)) {
        this.expectedType = ReflectionUtil.forName(type);
    }
    this.paramTypes = ReflectionUtil.toTypeArray(((String[]) in
            .readObject()));
    this.fnMapper = (FunctionMapper) in.readObject();
    this.varMapper = (VariableMapper) in.readObject();
}
项目:lams    文件:ExpressionBuilder.java   
/**
 * 
 */
public ExpressionBuilder(String expression, ELContext ctx)
        throws ELException {
    this.expression = expression;

    FunctionMapper ctxFn = ctx.getFunctionMapper();
    VariableMapper ctxVar = ctx.getVariableMapper();

    if (ctxFn != null) {
        this.fnMapper = new FunctionMapperFactory(ctxFn);
    }
    if (ctxVar != null) {
        this.varMapper = new VariableMapperFactory(ctxVar);
    }
}
项目:lams    文件:ValueExpressionImpl.java   
public void readExternal(ObjectInput in) throws IOException,
        ClassNotFoundException {
    this.expr = in.readUTF();
    String type = in.readUTF();
    if (!"".equals(type)) {
        this.expectedType = ReflectionUtil.forName(type);
    }
    this.fnMapper = (FunctionMapper) in.readObject();
    this.varMapper = (VariableMapper) in.readObject();
}
项目:lams    文件:ELContextImpl.java   
public ELContextImpl() {
    this(ELResolverImpl.getDefaultResolver());
    if (Globals.IS_SECURITY_ENABLED) {
        functionMapper = new FunctionMapper() {
            public Method resolveFunction(String prefix, String localName) {
                return null;
            }
        };
    } else {
        functionMapper = NullFunctionMapper;
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:MethodExpressionImpl.java   
/**
 * @param expr
 * @param node
 * @param fnMapper
 * @param expectedType
 * @param paramTypes
 */
public MethodExpressionImpl(String expr, Node node,
        FunctionMapper fnMapper, VariableMapper varMapper,
        Class<?> expectedType, Class<?>[] paramTypes) {
    super();
    this.expr = expr;
    this.node = node;
    this.fnMapper = fnMapper;
    this.varMapper = varMapper;
    this.expectedType = expectedType;
    this.paramTypes = paramTypes;
}