Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kikuchy/genum

Generate Java Enum class from YAML
https://github.com/kikuchy/genum

Last synced: 1 day ago
JSON representation

Generate Java Enum class from YAML

Awesome Lists containing this project

README

        

# Genum - Generate Enum from YAML

[![Build Status](https://travis-ci.org/kikuchy/genum.svg)](https://travis-ci.org/kikuchy/genum)

Genum is the code generator that generate Java enum class file from YAML array.

You can share the definition between server side and client application!

For example, here is a array written in YAML format.

```yaml
- Tokyo
- NewYork
- London
- Beijing
- Paris
- Roma
```

Genum turns it into Enum java file.

```java
package com.example;

public enum City {
TOKYO,

NEW_YORK,

LONDON,

BEIJING,

PARIS,

ROMA
}
```

## Usage

### CLI tool

Download [latest cli tool](https://github.com/kikuchy/genum/releases) and unzip it.

```
$ ./bin/genus-cli -c City -p com.example -s cities.yml -o your/project/src/main/java
```
Run without any option to show command line option discription.

```
-c (--class-name) VAL : Class name of Enum class.
-o (--output) FILE : Destination directory. Package directory will make
automatically.
-p (--package-name) VAL : Package name that used for 'package' statement.
-s (--source) FILE : Source YAML file.
```

### Library

Download [latest library](https://github.com/kikuchy/genum/releases) and unzip it.

_Maybe, Genum will be registed to Maven Central._

## It's inspired from...

- [jsonschema2pojo](http://www.jsonschema2pojo.org)

## License

```
Copyright 2015 kikuchy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```