Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2014-2019 Netflix, Inc.
*
* Licensed 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 com.netflix.spectator.atlas.impl;
import com.netflix.spectator.impl.matcher.PatternUtils;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
/**
* Parses an Atlas data or query expression.
*
* Classes in this package are only intended for use internally within spectator. They may
* change at any time and without notice.
*/
public final class Parser {
private Parser() {
}
/**
* Parse an Atlas data
* expression.
*/
public static DataExpr parseDataExpr(String expr) {
try {
return (DataExpr) parse(expr);
} catch (ClassCastException e) {
throw new IllegalArgumentException("invalid data expression: " + expr, e);
}
}
/**
* Parse an Atlas query
* expression.
*/
public static Query parseQuery(String expr) {
try {
return (Query) parse(expr);
} catch (ClassCastException e) {
throw new IllegalArgumentException("invalid query expression: " + expr, e);
}
}
@SuppressWarnings({"unchecked", "checkstyle:MethodLength", "PMD"})
private static Object parse(String expr) {
DataExpr.AggregateFunction af;
Query q, q1, q2;
String k, v;
int depth = 0;
List tmp;
List vs = null;
String[] parts = expr.split(",");
Deque