Example usage for org.apache.ibatis.parsing XNode getIntAttribute

List of usage examples for org.apache.ibatis.parsing XNode getIntAttribute

Introduction

In this page you can find the example usage for org.apache.ibatis.parsing XNode getIntAttribute.

Prototype

public Integer getIntAttribute(String name, Integer def) 

Source Link

Usage

From source file:com.ibatis.sqlmap.engine.builder.XmlSqlMapParser.java

License:Apache License

@NodeEvent("/sqlMap/cacheModel/flushInterval")
public void sqlMapcacheModelflushInterval(XNode context) throws Exception {
    if (cacheBuilder != null) {
        long clearInterval = 0L;
        clearInterval += context.getIntAttribute("milliseconds", 0);
        clearInterval += context.getIntAttribute("seconds", 0) * 1000L;
        clearInterval += context.getIntAttribute("minutes", 0) * 60L * 1000L;
        clearInterval += context.getIntAttribute("hours", 0) * 60L * 60L * 1000L;
        if (clearInterval < 1L) {
            throw new RuntimeException(
                    "A flush interval must specify one or more of milliseconds, seconds, minutes or hours.");
        }//from  ww w . j  ava  2s  . c  o m
        cacheBuilder.clearInterval(clearInterval);
    }
}