Giter Site home page Giter Site logo

prototype's Introduction

Prototype

Prototype provides a concise syntax to define data (and value) types. It saves developers the need to write repetitive boilerplate code and writes it instead of them.

Prototype based classes are immutable and disallow null as field values by default. This behavior can be overriden using the provided annotations.

Prototype is required only in compile time and requires JDK 1.6 or later.

Getting started

Prototype is only required in compile time. The generated classes do not need the Prototype library.

Using maven

Just add dependency to the library:

<dependency>
    <groupId>io.kimia</groupId>
    <artifactId>prototype</artifactId>
    <version>0.1</version>
    <scope>provided</scope>
</dependency>

Manually

Since Prototype has no dependencies, just add our jar to your classpath while running javac.

Simple Usage

Here's an example of a prototype of a point's prototype. This prototype:

import io.kimia.prototype.Prototype;
@Prototype class _Point { int x, y; }

Will produce:

public final class Point {
    private final int x;
    private final int y;
    public Point(int x, int y) {...}
    public int getX() {...}
    public int getY() {...}
    @Override public int hashCode() {...}
    @Override public boolean equals(Object o) {...}
    @Override public String toString() {...}
}

Advanced Usage

The prototype library includes variations to the default @Prototype annotation:

  • @Mutable - generates mutability for all the fields or for selected fields.
  • @Nullable - allows a field to hold null as a value.

For more in depth explanation, see the API documentation.

License

Prototype is licesnsed under MIT. Full license here.

prototype's People

Contributors

ikimia avatar

Watchers

 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.