Class MetricFunction

  • All Implemented Interfaces:
    org.jaxen.Function

    public class MetricFunction
    extends java.lang.Object
    implements org.jaxen.Function
    Implements the metric() XPath function. Takes the string name of a metric and the context node and returns the result if the metric can be computed, otherwise returns Double.NaN.
    Since:
    6.0.0
    Author:
    Clément Fournier
    • Constructor Detail

      • MetricFunction

        public MetricFunction()
    • Method Detail

      • call

        public java.lang.Object call​(org.jaxen.Context context,
                                     java.util.List args)
                              throws org.jaxen.FunctionCallException
        Specified by:
        call in interface org.jaxen.Function
        Throws:
        org.jaxen.FunctionCallException
      • badOperationMetricKeyMessage

        public static java.lang.String badOperationMetricKeyMessage()
      • badClassMetricKeyMessage

        public static java.lang.String badClassMetricKeyMessage()
      • genericBadNodeMessage

        public static java.lang.String genericBadNodeMessage()
      • badMetricKeyArgMessage

        public static java.lang.String badMetricKeyArgMessage()
      • getMetric

        public static double getMetric​(net.sourceforge.pmd.lang.ast.Node n,
                                       java.lang.String metricKeyName)
      • registerSelfInSimpleContext

        public static void registerSelfInSimpleContext()