Giter Site home page Giter Site logo

gb2260.java's Introduction

GB2260.java

The Java implementation for looking up Chinese administrative divisions.

GB/T 2260

GB/T 2260 Build Status Coverage

The latest GB/T 2260 codes. Read the GB2260 Specification.

Build

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>

Usage

GB2260

GB2260 gb = new GB2260(); // with default revision 2020
GB2260 gb = new GB2260(Revision.V2002); // specify the revision

Interface for GB2260.

.getDivision(code)

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()
// 北京市 市辖区 朝阳区

.getProvinces()

Return a list of provinces in Division data structure.

gb.getProvinces()

.getPrefectures(code)

Return a list of prefecture level cities in Division data structure.

gb.getPrefectures("110000")

.getCounties(code)

Return a list of counties in Division data structure.

gb.getCounties("110100")

revisions

Revision contains a list of available revisions.

Revision.V2014.getCode() // return 2014

License

MIT.

gb2260.java's People

Contributors

rjyo avatar lepture avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.