cognitect / cognitect/transit-java

Marshaling Annotations

Open
#9 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
65
Forks
23
PR merge metrics
No merged PRs in 30d

Description

It would be helpful to have annotations to mark up POJOs for Transit, and an the associated Reader/Writer implementations, in the style of Jackson Annotations.

I've been reading and writing POJOs with Transit with runtime reflection on the getters and setters (using commons beanutils), but that solution isn't as flexible when it comes to things overriding the introspected name of a field, and overriding the class's Transit tag.

This is the kind of construct I am thinking of:

@TransitTagged("com.example.SamplePojo")
public class SamplePojo {

    private String name = "John";
    private int age = 21;
    private String nonExposedField = "...";

    @TransitField("person-name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    // no annotation, default to reflection
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }

    @TransitIgnore
    public String getNonExposedField() {
      return this.nonExposedField;
    }
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing POJO reflection approach using commons beanutils and the Transit Reader/Writer implementations. Define how the proposed TransitTagged, TransitField, and TransitIgnore annotations should affect class tags, field names, and exposed properties; done means the annotation API and associated Reader/Writer behavior are implemented and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.