将字符串解析为复杂类

时间:2017-02-01 09:29:41

标签: java regex string class parsing

我有一个由{2}其他类扩展的Filters

public class Filters {
}

public class SimpleFilter extends Filters {
    FilterAttribute A;
    FilterOperator  op;
    String value;
}

public class ComplexFilter extends Filters {
    Filters filterA;
    Filters filterB;
    Conjunction c;
}

我有一个字符串:

String filters = "(((CreationT>1234)and(LastM<567))or(LastM<=8910))";

我需要将此字符串解析为ComplexFilter。其中ComplexFilter"((creationT>1234)and(LastM<567))/*This complex filter has 2 simple filters and conjunction 'and'*/""(LastM<=8910)"为简单过滤,or

这样做的最佳方法是什么?从几个小时就坚持了下来。

0 个答案:

没有答案