Giter Club home page Giter Club logo

feather's Introduction

Feather

Latest release version badge Latest snapshot version badge CI release build status CI snapshot build status

A library for common data objects and parsing, used across ParchmentMC's projects.

There are five subprojects within the repository:

  • core - the main data interfaces and implementations (immutables and builders).
  • io-gson - JSON adapters for the Gson library
  • io-moshi - JSON adapters for the Moshi library.
  • io-proguard - parsing for ProGuard mapping files
  • utils - miscellaneous utilities not fit for inclusion in the core library

Installing Feather

Add this to your Gradle buildscript (replacing ${feather_version} with the actual version of Feather):

repositories {
    maven {
        name 'ParchmentMC'
        url 'https://maven.parchmentmc.org/'
    }
}

dependencies {
    implementation "org.parchmentmc:feather:${feather_version}"
    implementation "org.parchmentmc.feather:io-gson:${feather_version}" // For the Gson adapters
    implementation "org.parchmentmc.feather:io-moshi:${feather_version}" // For the Moshi adapters
    implementation "org.parchmentmc.feather:io-proguard:${feather_version}" // For the ProGuard parser
    implementation "org.parchmentmc.feather:utils:${feather_version}" // For the misc. utilities
}

The IO Libraries

Feather offers JSON adapters for two JSON parsing libraries: Gson and Moshi.

class UsingGson {
    final Gson gson = new GsonBuilder()
            // Required for `MappingDataContainer` and inner data classes
            .registerTypeAdapterFactory(new MDCGsonAdapterFactory())
            // Required for `MappingDataContainer`s and `SourceMetadata`
            .registerTypeAdapter(SimpleVersion.class, new SimpleVersionAdapter())
            // Required for the metadata classes (`SourceMetadata`, `MethodReference`, etc.) and `Named`
            .registerTypeAdapterFactory(new MetadataAdapterFactory())
            // Alternatively, if you only need to serialize `Named` objects
            .registerTypeAdapter(Named.class, new NamedAdapter())
            // Required for parsing manifests: `LauncherManifest`, `VersionManifest`, and their inner data classes
            .registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeAdapter())
            .create();
} 

class UsingMoshi {
    final Moshi moshi = new Moshi.Builder()
            // Required for `MappingDataContainer` and inner data classes
            .add(new MDCMoshiAdapter())
            // Required for `MappingDataContainer`s and `SourceMetadata`
            .add(new SimpleVersionAdapter())
            // Required for the metadata classes (`SourceMetadata`, `MethodReference`, etc.) and `Named`
            .add(new MetadataMoshiAdapter()).add(LinkedHashSetMoshiAdapter.FACTORY)
            // Required for parsing manifests: `LauncherManifest`, `VersionManifest`, and their inner data classes
            .add(new OffsetDateTimeAdapter())
            .create();
}

License

Copyright (c) 2021 ParchmentMC. This project is licensed under the MIT License (see LICENSE.txt).

feather's People

Contributors

sciwhiz12 avatar marchermans avatar ateranimavis avatar sizableshrimp avatar hydos 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.