A library for reading and writing luxem
in Java.
<dependency>
<groupId>com.zarbosoft</groupId>
<artifactId>luxem</artifactId>
<version>0.0.1</version>
</dependency>
System.out.format(
"%s\n",
((Map)Luxem.parse("[a, {b: c}]").get(1)).get("b")
);
@Configuration
public class MyType {
@Configuration
public int a;
}
System.out.format(
"%s\n",
Luxem.parse(new Reflections(), new TypeInfo(MyType.class), "{a: 4},").get(0).a
);
Output
4
@Configuration
public class MyType {
@Configuration
public int a;
}
MyType x = new MyType();
x.a = 4;
Luxem.write(x, System.out);
Output
{a:4,},
If you have multiple root elements, use TypeWriter
and call write
for each element.
RawWriter writer = new RawWriter(System.out);
writer.recordBegin();
writer.key("a");
writer.primitive("4");
writer.recordEnd();
Output
{a:4,},
- Deserialize to an event stream for use with pidgoon
- Pretty print (indent)
- Write a tree of
Map
,List
,Typed
, andtoString
able objects (reverse of example 1) withTreeWriter
- Tokenize luxem
RawReader
See the Javadoc (not hosted currently) for details.