blueflood-core/src/main/java/com/rackspacecloud/blueflood/types/Token.java
public static List<Token> getTokens(Locator locator) {

        if (StringUtils.isEmpty(locator.getMetricName()) || StringUtils.isEmpty(locator.getTenantId()))
            return new ArrayList<>();

        String[] tokens = locator.getMetricName().split(Locator.METRIC_TOKEN_SEPARATOR_REGEX);

        return IntStream.range(0, tokens.length)
                        .mapToObj(index -> new Token(locator, tokens, index))
                        .collect(toList());
    }
public static List<Token> getTokens(Locator locator) {

        if (StringUtils.isEmpty(locator.getMetricName()) || StringUtils.isEmpty(locator.getTenantId()))
            return new ArrayList<>();

        String[] tokens = locator.getMetricName().split(Locator.METRIC_TOKEN_SEPARATOR_REGEX);

        return IntStream.range(0, tokens.length)
                        .mapToObj(index -> new Token(locator, tokens, index))
                        .collect(toList());
    }
public static List < Token > getTokens ( Locator locator ) { if ( StringUtils . isEmpty ( locator . getMetricName ( ) ) || StringUtils . isEmpty ( locator . getTenantId ( ) ) ) return new ArrayList <> ( ) ; String [ ] tokens = locator . getMetricName ( ) . split ( Locator . METRIC_TOKEN_SEPARATOR_REGEX ) ; return IntStream . range ( 0 , tokens . length ) . mapToObj ( index -> new Token ( locator , tokens , index ) ) . collect ( toList ( ) ) ; }
This method return list of tokens with their parents for a current Discovery object.

For example: A locator of 1111:a.b.c.d would generate the following tokens

Token{token='a', parent='', isLeaf=false, id='111111:a', locator=111111.a.b.c.d}
Token{token='b', parent='a', isLeaf=false, id='111111:a.b', locator=111111.a.b.c.d}
Token{token='c', parent='a.b', isLeaf=false, id='111111:a.b.c', locator=111111.a.b.c.d}
Token{token='d', parent='a.b.c', isLeaf=true, id='111111:a.b.c.d:$', locator=111111.a.b.c.d}

@return
This method return list of tokens with their parents for a current Discovery object .