655 lines · 24.6 KB · Java
RawDownload
         return new BinaryOpValueExp(PLUS, value1, value2);     }      /**      * Returns a binary expression representing the product of two numeric values.      *      *      * @param value1 The first '*' operand.      * @param value2 The second '*' operand.      *      * @return A ValueExp representing the product.  The returned      * object will be serialized as an instance of the non-public      * class {@link <a      * href="../../serialized-form.html#javax.management.BinaryOpValueExp">      * javax.management.BinaryOpValueExp</a>} with an {@code op} equal to      * {@link #TIMES}.      */     public static ValueExp times(ValueExp value1,ValueExp value2) {         return new BinaryOpValueExp(TIMES, value1, value2);     }      /**      * Returns a binary expression representing the difference between two numeric      * values.      *      * @param value1 The first '-' operand.      * @param value2 The second '-' operand.      *      * @return A ValueExp representing the difference between two      * arguments.  The returned object will be serialized as an      * instance of the non-public class {@link <a      * href="../../serialized-form.html#javax.management.BinaryOpValueExp">      * javax.management.BinaryOpValueExp</a>} with an {@code op} equal to      * {@link #MINUS}.      */     public static ValueExp minus(ValueExp value1, ValueExp value2) {         return new BinaryOpValueExp(MINUS, value1, value2);     }      /**      * Returns a binary expression representing the quotient of two numeric      * values.      *      * @param value1 The first '/' operand.      * @param value2 The second '/' operand.      *      * @return A ValueExp representing the quotient of two arguments.      * The returned object will be serialized as an instance of the      * non-public class {@link <a      * href="../../serialized-form.html#javax.management.BinaryOpValueExp">      * javax.management.BinaryOpValueExp</a>} with an {@code op} equal to      * {@link #DIV}.      */     public static ValueExp div(ValueExp value1, ValueExp value2) {         return new BinaryOpValueExp(DIV, value1, value2);     }      /**      * Returns a query expression that represents a matching constraint on      * a string argument. The value must start with the given literal string      * value.      *      * @param a An attribute expression.      * @param s A string value expression representing the beginning of the      * string value.      *      * @return The constraint that a matches s.  The returned object      * will be serialized as an instance of the non-public class      * {@link <a      * href="../../serialized-form.html#javax.management.MatchQueryExp">      * javax.management.MatchQueryExp</a>}.      */     public static QueryExp initialSubString(AttributeValueExp a, StringValueExp s)  {         return new MatchQueryExp(a,             new StringValueExp(escapeString(s.getValue()) + "*"));     }      /**      * Returns a query expression that represents a matching constraint on      * a string argument. The value must contain the given literal string      * value.      *      * @param a An attribute expression.      * @param s A string value expression representing the substring.      *      * @return The constraint that a matches s.  The returned object      * will be serialized as an instance of the non-public class      * {@link <a      * href="../../serialized-form.html#javax.management.MatchQueryExp">      * javax.management.MatchQueryExp</a>}.      */     public static QueryExp anySubString(AttributeValueExp a, StringValueExp s) {         return new MatchQueryExp(a,             new StringValueExp("*" + escapeString(s.getValue()) + "*"));     }      /**      * Returns a query expression that represents a matching constraint on      * a string argument. The value must end with the given literal string      * value.      *      * @param a An attribute expression.      * @param s A string value expression representing the end of the string      * value.      *      * @return The constraint that a matches s.  The returned object      * will be serialized as an instance of the non-public class      * {@link <a      * href="../../serialized-form.html#javax.management.MatchQueryExp">      * javax.management.MatchQueryExp</a>}.      */     public static QueryExp finalSubString(AttributeValueExp a, StringValueExp s) {         return new MatchQueryExp(a,             new StringValueExp("*" + escapeString(s.getValue())));     }      /**      * Returns a query expression that represents an inheritance constraint      * on an MBean class.      * <p>Example: to find MBeans that are instances of      * {@link NotificationBroadcaster}, use      * {@code Query.isInstanceOf(Query.value(NotificationBroadcaster.class.getName()))}.      * </p>      * <p>Evaluating this expression for a given      * <code>objectName</code> includes performing {@link      * MBeanServer#isInstanceOf MBeanServer.isInstanceOf(objectName,      * ((StringValueExp)classNameValue.apply(objectName)).getValue()}.</p>      *      * @param classNameValue The {@link StringValueExp} returning the name      *        of the class of which selected MBeans should be instances.      * @return a query expression that represents an inheritance      * constraint on an MBean class.  The returned object will be      * serialized as an instance of the non-public class {@link <a      * href="../../serialized-form.html#javax.management.InstanceOfQueryExp">      * javax.management.InstanceOfQueryExp</a>}.      * @since 1.6      */     public static QueryExp isInstanceOf(StringValueExp classNameValue) {        return new InstanceOfQueryExp(classNameValue);     }      /**      * Utility method to escape strings used with      * Query.{initial|any|final}SubString() methods.      */     private static String escapeString(String s) {         if (s == null)             return null;         s = s.replace("\\", "\\\\");         s = s.replace("*", "\\*");         s = s.replace("?", "\\?");         s = s.replace("[", "\\[");         return s;     } }

Lines 501–655 of 655. Previous lines