ListenerUtil.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:athena 作者:
/**
 * Validates boolean value.
 *
 * @param booleanValue value to be validated
 * @param yangConstruct yang construct for creating error message
 * @param ctx context object of the grammar rule
 * @return boolean value either true or false
 */
public static boolean getValidBooleanValue(String booleanValue, YangConstructType yangConstruct,
        ParserRuleContext ctx) {

    String value = removeQuotesAndHandleConcat(booleanValue);
    if (value.equals(TRUE)) {
        return true;
    } else if (value.equals(FALSE)) {
        return false;
    } else {
        ParserException parserException = new ParserException("YANG file error : " +
                YangConstructType.getYangConstructType(yangConstruct) + " value " + value + " is not " +
                "valid.");
        parserException.setLine(ctx.getStart().getLine());
        parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
        throw parserException;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号