The Java implementation for looking up Chinese administrative divisions.
The latest GB/T 2260 codes. Read the GB2260 Specification.
Install with maven:
$ git submodule update --init
$ mvn clean package
$ mvn install:install-file -Dfile=target/GB2260-0.1.1.jar -DgroupId=cn.gb2260 -DartifactId=GB2260 -Dversion=0.1.1 -Dpackaging=jar
Update the pom.xml file in project
<dependencies>
...
<dependency>
<groupId>cn.gb2260</groupId>
<artifactId>GB2260</artifactId>
<version>0.1.1</version>
</dependency>
...
</dependencies>
GB2260 gb = new GB2260(); // with default revision 2014
GB2260 gb = new GB2260(Revision.V2002); // specify the revision
Interface for GB2260.
Get division for the given code.
Division division = gb.getDivision("110105")
// 北京市 市辖区 朝阳区
division.getName()
// 朝阳区
division.getCode()
// 110105
division.getRevision()
// 2014
division.getProvince()
// 北京市
division.getPrefecture()
// 市辖区
division.toString()
// 北京市 市辖区 朝阳区
Return a list of provinces in Division data structure.
gb.getProvinces()
Return a list of prefecture level cities in Division data structure.
gb.getPrefectures("110000")
Return a list of counties in Division data structure.
gb.getCounties("110100")
Revision
contains a list of available revisions.
Revision.V2014.getCode() // return 2014
MIT.