[ 
https://issues.apache.org/jira/browse/NIFI-2950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15637253#comment-15637253
 ] 

ASF GitHub Bot commented on NIFI-2950:
--------------------------------------

Github user JPercivall commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1161#discussion_r86605783
  
    --- Diff: 
nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/FromRadixEvaluator.java
 ---
    @@ -0,0 +1,58 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.nifi.attribute.expression.language.evaluation.functions;
    +
    +import org.apache.nifi.attribute.expression.language.evaluation.Evaluator;
    +import 
org.apache.nifi.attribute.expression.language.evaluation.QueryResult;
    +import 
org.apache.nifi.attribute.expression.language.evaluation.WholeNumberEvaluator;
    +import 
org.apache.nifi.attribute.expression.language.evaluation.WholeNumberQueryResult;
    +
    +import java.util.Map;
    +
    +public class FromRadixEvaluator extends WholeNumberEvaluator {
    +
    +    private final Evaluator<String> numberEvaluator;
    +    private final Evaluator<Long> radixEvaluator;
    +
    +    public FromRadixEvaluator(final Evaluator<String> subject, final 
Evaluator<Long> radixEvaluator) {
    +        this.numberEvaluator = subject;
    +        this.radixEvaluator = radixEvaluator;
    +    }
    +
    +    @Override
    +    public QueryResult<Long> evaluate(final Map<String, String> 
attributes) {
    +        final String result = 
numberEvaluator.evaluate(attributes).getValue();
    --- End diff --
    
    I highly doubt this is considered part of the Public API. 
    
    Also passing null to the evaluate() methods is expected but since I never 
explicitly use attributes (other than passing it to the next evaluator), it is 
safe from NPE.


> Allow literal interpretation of hex numbers as whole numbers in EL
> ------------------------------------------------------------------
>
>                 Key: NIFI-2950
>                 URL: https://issues.apache.org/jira/browse/NIFI-2950
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Joseph Percivall
>            Assignee: Joseph Percivall
>            Priority: Minor
>
> Currently in EL you cannot pass hex numbers as a whole number and instead 
> only decimals support them. Whole numbers should support being passed in as 
> hex too.
> This was brought up by this SO[1] question.
> [1] 
> http://stackoverflow.com/questions/40265791/applying-string-manipulations-mathematical-operations-to-the-contents-of-a-flow/40267507#40267507



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to