xapi.model.impl.PrimitiveReaders Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xapi-gwt Show documentation
Show all versions of xapi-gwt Show documentation
This module exists solely to package all other gwt modules into a single
uber jar. This makes deploying to non-mavenized targets much easier.
Of course, you would be wise to inherit your dependencies individually;
the uber jar is intended for projects like collide,
which have complex configuration, and adding many jars would be a pain.
The newest version!
/**
*
*/
package xapi.model.impl;
import xapi.model.api.PrimitiveReader;
import xapi.model.api.PrimitiveSerializer;
import xapi.source.api.CharIterator;
/**
* @author James X. Nelson ([email protected], @james)
*
*/
public final class PrimitiveReaders {
private PrimitiveReaders() {}
public static PrimitiveReader forBoolean() {
return new PrimitiveReader() {
@Override
public Object readPrimitive(final Class> cls, final CharIterator src, final PrimitiveSerializer primitives) {
return primitives.deserializeBoolean(src);
}
};
}
public static PrimitiveReader forByte() {
return new PrimitiveReader() {
@Override
public Object readPrimitive(final Class> cls, final CharIterator src, final PrimitiveSerializer primitives) {
return primitives.deserializeByte(src);
}
};
}
public static PrimitiveReader forShort() {
return new PrimitiveReader() {
@Override
public Object readPrimitive(final Class> cls, final CharIterator src, final PrimitiveSerializer primitives) {
return primitives.deserializeShort(src);
}
};
}
public static PrimitiveReader forChar() {
return new PrimitiveReader() {
@Override
public Object readPrimitive(final Class> cls, final CharIterator src, final PrimitiveSerializer primitives) {
return primitives.deserializeChar(src);
}
};
}
public static PrimitiveReader forInt() {
return new PrimitiveReader() {
@Override
public Object readPrimitive(final Class> cls, final CharIterator src, final PrimitiveSerializer primitives) {
return primitives.deserializeInt(src);
}
};
}
public static PrimitiveReader forLong() {
return new PrimitiveReader() {
@Override
public Object readPrimitive(final Class> cls, final CharIterator src, final PrimitiveSerializer primitives) {
return primitives.deserializeLong(src);
}
};
}
public static PrimitiveReader forFloat() {
return new PrimitiveReader() {
@Override
public Object readPrimitive(final Class> cls, final CharIterator src, final PrimitiveSerializer primitives) {
return primitives.deserializeFloat(src);
}
};
}
public static PrimitiveReader forDouble() {
return new PrimitiveReader() {
@Override
public Object readPrimitive(final Class> cls, final CharIterator src, final PrimitiveSerializer primitives) {
return primitives.deserializeDouble(src);
}
};
}
}