Move our GWT stuff around.

This avoids having it look like normal Java source and then confusing tools
because there are two copies of DefaultCollector.
This commit is contained in:
Michael Bayne
2014-12-01 16:46:51 -08:00
parent 614bb82b17
commit 692adc47f4
7 changed files with 6 additions and 8 deletions
@@ -1,5 +0,0 @@
<!-- defines our GWT module -->
<module>
<source path="mustache"/>
<super-source path="gwt"/>
</module>
@@ -1,33 +0,0 @@
//
// $Id$
package com.samskivert.mustache;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* A collector used when running in GWT.
*/
public class DefaultCollector extends BasicCollector
{
@Override
public Iterator<?> toIterator (final Object value) {
Iterator<?> iter = super.toIterator(value);
if (iter != null) return iter;
if (value.getClass().isArray()) {
return Arrays.asList((Object[])value).iterator();
}
return null;
}
@Override
public <K,V> Map<K,V> createFetcherCache () {
return new HashMap<K,V>();
}
// TODO: override createFetcher and do some magic for JavaScript/JSON objects
}
@@ -1,12 +0,0 @@
//
// $Id$
package java.io;
/**
* A minimal version of {@code Reader} to satisfy GWT.
*/
public abstract class Reader
{
public abstract int read () throws IOException;
}
@@ -1,21 +0,0 @@
//
// $Id$
package java.io;
/**
* A basic implementation of {@code StringReader} for use in GWT.
*/
public class StringReader extends Reader
{
public StringReader (String data) {
_data = data;
}
public int read () throws IOException {
return (_pos >= _data.length()) ? -1 : _data.charAt(_pos++);
}
protected final String _data;
protected int _pos;
}
@@ -1,20 +0,0 @@
//
// $Id$
package java.io;
/**
* A basic implementation of {@code StringReader} for use in GWT.
*/
public class StringWriter extends Writer
{
public void write (String text) throws IOException {
_buf.append(text);
}
@Override public String toString () {
return _buf.toString();
}
protected final StringBuilder _buf = new StringBuilder();
}
@@ -1,12 +0,0 @@
//
// $Id$
package java.io;
/**
* A minimal version of {@code Writer} to satisfy GWT.
*/
public abstract class Writer
{
public abstract void write (String text) throws IOException;
}