xapi.gwt.collect.CollectionServiceGwt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xapi-dev Show documentation
Show all versions of xapi-dev Show documentation
Everything needed to run a comprehensive dev environment.
Just type X_ and pick a service from autocomplete;
new dev modules will be added as they are built.
The only dev service not included in the uber jar is xapi-dev-maven,
as it includes all runtime dependencies of maven, adding ~4 seconds to build time,
and 6 megabytes to the final output jar size (without xapi-dev-maven, it's ~1MB).
The newest version!
package xapi.gwt.collect;
import xapi.annotation.inject.SingletonOverride;
import xapi.collect.api.ClassTo;
import xapi.collect.api.CollectionOptions;
import xapi.collect.api.Fifo;
import xapi.collect.api.IntTo;
import xapi.collect.api.ObjectTo;
import xapi.collect.api.ObjectTo.Many;
import xapi.collect.api.StringDictionary;
import xapi.collect.api.StringTo;
import xapi.collect.service.CollectionService;
import xapi.except.NotYetImplemented;
import xapi.platform.GwtPlatform;
@GwtPlatform
@SingletonOverride(implFor=CollectionService.class)
public class CollectionServiceGwt implements CollectionService{
@Override
public IntTo newList(Class cls, CollectionOptions opts) {
return IntToListGwt.newInstance();
}
@Override
public IntTo newSet(Class cls, CollectionOptions opts) {
throw new NotYetImplemented("IntTo not yet implemented");
}
@Override
public ObjectTo newMap(Class key, Class cls, CollectionOptions opts) {
return new xapi.collect.proxy.MapOf(new java.util.HashMap(), key, cls);
}
@Override
public ClassTo newClassMap(Class cls, CollectionOptions opts) {
return new xapi.collect.impl.ClassToDefault(new java.util.HashMap, V>(), cls);
}
@Override
public StringTo newStringMap(Class cls, CollectionOptions opts) {
// we ignore options because js maps are, for now, all the same
// all maps are insertion ordered an mutable;
// there's nothing we can do to stop you from changing a jso value ;)
return StringToGwt.create(cls);
}
@Override
public StringDictionary newDictionary() {
return JsStringDictionary.create();
}
@Override
public Many newMultiMap(Class key, Class cls, CollectionOptions opts) {
throw new NotYetImplemented("MultiMap not yet implemented");
}
@Override
public xapi.collect.api.ClassTo.Many newClassMultiMap(Class cls, CollectionOptions opts) {
throw new NotYetImplemented("MultiMap not yet implemented");
}
@Override
public xapi.collect.api.StringTo.Many newStringMultiMap(Class cls,
CollectionOptions opts) {
throw new NotYetImplemented("MultiMap not yet implemented");
}
@Override
public Fifo newFifo() {
return JsFifo.newFifo();
}
}