SpongePowered/SpongeAPI — pull request #253 by gratimax (2014-12-01 05:44:35+00:00)
Title: Nbt API

This is, in large part, a continuation of #49.

Currently doing some cleanup on the previous commits as well as adding an annotation-based serialization API.

Example usage for annotations:
```java
public interface BannerData extends NbtStored {

@NbtGetter String getId();

// The attributes of this compound tag are collapsed into this NBT data
@Nbt.Collapse Vec3i position();

// Could be replaced with a TextColor, I'm not sure
// 'Base' is set as the name
@NbtGetter(name = "base") String getColor();

// Nested data as a list
@NbtGetter List getPatterns();

// As an example, simple compound NBT data
@NbtGetter BannerPattern getPattern();

interface BannerPattern extends NbtStored {

// Could be replaced with a TextColor, I'm not sure
@NbtGetter String getColor();

// Almost certain this is a string internally
@NbtGetter String getPattern();

}

// Maybe setters are specified too?
@NbtSetter(for="position") void setPosition(Vec3i pos);
@NbtSetter(for="color") void setColor(String color);
@NbtSetter(for="patterns") void setPatterns(List patterns());
@NbtSetter(for="pattern") void setPattern(BannerPattern pattern);

}

public class Vec3i extends NbtStored {

@NbtField int x;
@NbtField int y;
@NbtField int z;

}
```