repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
loomchild/segment
segment/src/main/java/net/loomchild/segment/util/Bind.java
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static XMLReader getXmlReader(Schema schema) { // try { // SAXParserFactory parserFactory = SAXParserFactory.newInstance(); // parserFactory.setValidating(false); // parserFactory.setNamespaceAware(true); // if (schema != null) { // parserFactory.setSchema(schema); // } // SAXParser saxParser = parserFactory.newSAXParser(); // XMLReader xmlReader = saxParser.getXMLReader(); // xmlReader.setEntityResolver(new IgnoreDTDEntityResolver()); // return xmlReader; // } catch (ParserConfigurationException e) { // throw new XmlException("SAX Parser configuration error.", e); // } catch (SAXException e) { // throw new XmlException("Error creating XMLReader.", e); // } // }
import static net.loomchild.segment.util.Util.getXmlReader; import java.io.IOException; import java.io.Reader; import java.io.Writer; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.transform.Source; import javax.xml.transform.sax.SAXSource; import javax.xml.validation.Schema; import org.xml.sax.InputSource;
public void marshal(Writer writer, Object object) { try { marshaller.marshal(object, writer); } catch (JAXBException e) { throw new XmlException("JAXB marshalling error", e); } } /** * Writes given object to a file with given name validating it. * @param fileName * @param object */ public void marshal(String fileName, Object object) { try { Writer writer = Util.getWriter(Util.getFileOutputStream(fileName)); marshal(writer, object); writer.close(); } catch (IOException e) { throw new IORuntimeException(e); } } /** * Retrieves object from given reader validation the input. * @param reader * @return object */ public Object unmarshal(Reader reader) { try {
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static XMLReader getXmlReader(Schema schema) { // try { // SAXParserFactory parserFactory = SAXParserFactory.newInstance(); // parserFactory.setValidating(false); // parserFactory.setNamespaceAware(true); // if (schema != null) { // parserFactory.setSchema(schema); // } // SAXParser saxParser = parserFactory.newSAXParser(); // XMLReader xmlReader = saxParser.getXMLReader(); // xmlReader.setEntityResolver(new IgnoreDTDEntityResolver()); // return xmlReader; // } catch (ParserConfigurationException e) { // throw new XmlException("SAX Parser configuration error.", e); // } catch (SAXException e) { // throw new XmlException("Error creating XMLReader.", e); // } // } // Path: segment/src/main/java/net/loomchild/segment/util/Bind.java import static net.loomchild.segment.util.Util.getXmlReader; import java.io.IOException; import java.io.Reader; import java.io.Writer; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.transform.Source; import javax.xml.transform.sax.SAXSource; import javax.xml.validation.Schema; import org.xml.sax.InputSource; public void marshal(Writer writer, Object object) { try { marshaller.marshal(object, writer); } catch (JAXBException e) { throw new XmlException("JAXB marshalling error", e); } } /** * Writes given object to a file with given name validating it. * @param fileName * @param object */ public void marshal(String fileName, Object object) { try { Writer writer = Util.getWriter(Util.getFileOutputStream(fileName)); marshal(writer, object); writer.close(); } catch (IOException e) { throw new IORuntimeException(e); } } /** * Retrieves object from given reader validation the input. * @param reader * @return object */ public Object unmarshal(Reader reader) { try {
Source source = new SAXSource(Util.getXmlReader(), new InputSource(
loomchild/segment
segment/src/main/java/net/loomchild/segment/srx/io/SrxAnyParser.java
// Path: segment/src/main/java/net/loomchild/segment/srx/SrxDocument.java // public class SrxDocument { // // /** // * Default cascade value. // */ // public static final boolean DEFAULT_CASCADE = true; // // private boolean cascade; // // private List<LanguageMap> languageMapList; // // private SrxDocumentCache cache; // // /** // * Creates empty document. // * // * @param cascade true if document is cascading // */ // public SrxDocument(boolean cascade) { // this.cascade = cascade; // this.languageMapList = new ArrayList<LanguageMap>(); // this.cache = new SrxDocumentCache(); // } // // /** // * Creates empty document with default cascade. See {@link #DEFAULT_CASCADE}. // */ // public SrxDocument() { // this(DEFAULT_CASCADE); // } // // /** // * Sets if document is cascading or not. // * // * @param cascade true f document is cascading // */ // public void setCascade(boolean cascade) { // this.cascade = cascade; // } // // /** // * @return true if document is cascading // */ // public boolean getCascade() { // return cascade; // } // // /** // * Add language map to this document. // * // * @param pattern language code pattern // * @param languageRule // */ // public void addLanguageMap(String pattern, LanguageRule languageRule) { // LanguageMap languageMap = new LanguageMap(pattern, languageRule); // languageMapList.add(languageMap); // } // // public List<LanguageMap> getLanguageMapList() { // return languageMapList; // } // // /** // * If cascade is true then returns all language rules matching given // * language code. If cascade is false returns first language rule matching // * given language code. If no matching language rules are found returns // * empty list. // * // * @param languageCode language code, for example en_US // * @return matching language rules // */ // public List<LanguageRule> getLanguageRuleList(String languageCode) { // List<LanguageRule> matchingLanguageRuleList = new ArrayList<LanguageRule>(); // for (LanguageMap languageMap : languageMapList) { // if (languageMap.matches(languageCode)) { // matchingLanguageRuleList.add(languageMap.getLanguageRule()); // if (!cascade) { // break; // } // } // } // return matchingLanguageRuleList; // } // // public SrxDocumentCache getCache() { // return cache; // } // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxParser.java // public interface SrxParser { // // /** // * Parses SRX document. // * // * @param reader reader from which read the document // * @return initialized SRX document // */ // public SrxDocument parse(Reader reader); // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // }
import java.io.BufferedReader; import java.io.Reader; import java.util.Collections; import java.util.Map; import net.loomchild.segment.srx.SrxDocument; import net.loomchild.segment.srx.SrxParser; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.XmlException;
package net.loomchild.segment.srx.io; /** * Represents any version intelligent SRX document parser. Responsible for * creating appropriate SRX parser to given SRX document version. * * @author loomchild */ public class SrxAnyParser implements SrxParser { private SrxParser parser; /** * Creates SRX any parser using given SRX 2.0 parser. * @param parser */ public SrxAnyParser(SrxParser parser) { this.parser = parser; } /** * Creates SRX any parser using default SRX 2.0 parser. */ public SrxAnyParser() { this(new Srx2Parser()); } /** * Parses SRX document from reader. Selects appropriate SRX parser for * document version. * * @param reader * @return Return initialized document */
// Path: segment/src/main/java/net/loomchild/segment/srx/SrxDocument.java // public class SrxDocument { // // /** // * Default cascade value. // */ // public static final boolean DEFAULT_CASCADE = true; // // private boolean cascade; // // private List<LanguageMap> languageMapList; // // private SrxDocumentCache cache; // // /** // * Creates empty document. // * // * @param cascade true if document is cascading // */ // public SrxDocument(boolean cascade) { // this.cascade = cascade; // this.languageMapList = new ArrayList<LanguageMap>(); // this.cache = new SrxDocumentCache(); // } // // /** // * Creates empty document with default cascade. See {@link #DEFAULT_CASCADE}. // */ // public SrxDocument() { // this(DEFAULT_CASCADE); // } // // /** // * Sets if document is cascading or not. // * // * @param cascade true f document is cascading // */ // public void setCascade(boolean cascade) { // this.cascade = cascade; // } // // /** // * @return true if document is cascading // */ // public boolean getCascade() { // return cascade; // } // // /** // * Add language map to this document. // * // * @param pattern language code pattern // * @param languageRule // */ // public void addLanguageMap(String pattern, LanguageRule languageRule) { // LanguageMap languageMap = new LanguageMap(pattern, languageRule); // languageMapList.add(languageMap); // } // // public List<LanguageMap> getLanguageMapList() { // return languageMapList; // } // // /** // * If cascade is true then returns all language rules matching given // * language code. If cascade is false returns first language rule matching // * given language code. If no matching language rules are found returns // * empty list. // * // * @param languageCode language code, for example en_US // * @return matching language rules // */ // public List<LanguageRule> getLanguageRuleList(String languageCode) { // List<LanguageRule> matchingLanguageRuleList = new ArrayList<LanguageRule>(); // for (LanguageMap languageMap : languageMapList) { // if (languageMap.matches(languageCode)) { // matchingLanguageRuleList.add(languageMap.getLanguageRule()); // if (!cascade) { // break; // } // } // } // return matchingLanguageRuleList; // } // // public SrxDocumentCache getCache() { // return cache; // } // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxParser.java // public interface SrxParser { // // /** // * Parses SRX document. // * // * @param reader reader from which read the document // * @return initialized SRX document // */ // public SrxDocument parse(Reader reader); // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // } // Path: segment/src/main/java/net/loomchild/segment/srx/io/SrxAnyParser.java import java.io.BufferedReader; import java.io.Reader; import java.util.Collections; import java.util.Map; import net.loomchild.segment.srx.SrxDocument; import net.loomchild.segment.srx.SrxParser; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.XmlException; package net.loomchild.segment.srx.io; /** * Represents any version intelligent SRX document parser. Responsible for * creating appropriate SRX parser to given SRX document version. * * @author loomchild */ public class SrxAnyParser implements SrxParser { private SrxParser parser; /** * Creates SRX any parser using given SRX 2.0 parser. * @param parser */ public SrxAnyParser(SrxParser parser) { this.parser = parser; } /** * Creates SRX any parser using default SRX 2.0 parser. */ public SrxAnyParser() { this(new Srx2Parser()); } /** * Parses SRX document from reader. Selects appropriate SRX parser for * document version. * * @param reader * @return Return initialized document */
public SrxDocument parse(Reader reader) {
loomchild/segment
segment/src/main/java/net/loomchild/segment/srx/io/SrxAnyParser.java
// Path: segment/src/main/java/net/loomchild/segment/srx/SrxDocument.java // public class SrxDocument { // // /** // * Default cascade value. // */ // public static final boolean DEFAULT_CASCADE = true; // // private boolean cascade; // // private List<LanguageMap> languageMapList; // // private SrxDocumentCache cache; // // /** // * Creates empty document. // * // * @param cascade true if document is cascading // */ // public SrxDocument(boolean cascade) { // this.cascade = cascade; // this.languageMapList = new ArrayList<LanguageMap>(); // this.cache = new SrxDocumentCache(); // } // // /** // * Creates empty document with default cascade. See {@link #DEFAULT_CASCADE}. // */ // public SrxDocument() { // this(DEFAULT_CASCADE); // } // // /** // * Sets if document is cascading or not. // * // * @param cascade true f document is cascading // */ // public void setCascade(boolean cascade) { // this.cascade = cascade; // } // // /** // * @return true if document is cascading // */ // public boolean getCascade() { // return cascade; // } // // /** // * Add language map to this document. // * // * @param pattern language code pattern // * @param languageRule // */ // public void addLanguageMap(String pattern, LanguageRule languageRule) { // LanguageMap languageMap = new LanguageMap(pattern, languageRule); // languageMapList.add(languageMap); // } // // public List<LanguageMap> getLanguageMapList() { // return languageMapList; // } // // /** // * If cascade is true then returns all language rules matching given // * language code. If cascade is false returns first language rule matching // * given language code. If no matching language rules are found returns // * empty list. // * // * @param languageCode language code, for example en_US // * @return matching language rules // */ // public List<LanguageRule> getLanguageRuleList(String languageCode) { // List<LanguageRule> matchingLanguageRuleList = new ArrayList<LanguageRule>(); // for (LanguageMap languageMap : languageMapList) { // if (languageMap.matches(languageCode)) { // matchingLanguageRuleList.add(languageMap.getLanguageRule()); // if (!cascade) { // break; // } // } // } // return matchingLanguageRuleList; // } // // public SrxDocumentCache getCache() { // return cache; // } // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxParser.java // public interface SrxParser { // // /** // * Parses SRX document. // * // * @param reader reader from which read the document // * @return initialized SRX document // */ // public SrxDocument parse(Reader reader); // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // }
import java.io.BufferedReader; import java.io.Reader; import java.util.Collections; import java.util.Map; import net.loomchild.segment.srx.SrxDocument; import net.loomchild.segment.srx.SrxParser; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.XmlException;
package net.loomchild.segment.srx.io; /** * Represents any version intelligent SRX document parser. Responsible for * creating appropriate SRX parser to given SRX document version. * * @author loomchild */ public class SrxAnyParser implements SrxParser { private SrxParser parser; /** * Creates SRX any parser using given SRX 2.0 parser. * @param parser */ public SrxAnyParser(SrxParser parser) { this.parser = parser; } /** * Creates SRX any parser using default SRX 2.0 parser. */ public SrxAnyParser() { this(new Srx2Parser()); } /** * Parses SRX document from reader. Selects appropriate SRX parser for * document version. * * @param reader * @return Return initialized document */ public SrxDocument parse(Reader reader) { BufferedReader bufferedReader = new BufferedReader(reader); reader = bufferedReader; SrxVersion version = SrxVersion.parse(bufferedReader); if (version == SrxVersion.VERSION_1_0) {
// Path: segment/src/main/java/net/loomchild/segment/srx/SrxDocument.java // public class SrxDocument { // // /** // * Default cascade value. // */ // public static final boolean DEFAULT_CASCADE = true; // // private boolean cascade; // // private List<LanguageMap> languageMapList; // // private SrxDocumentCache cache; // // /** // * Creates empty document. // * // * @param cascade true if document is cascading // */ // public SrxDocument(boolean cascade) { // this.cascade = cascade; // this.languageMapList = new ArrayList<LanguageMap>(); // this.cache = new SrxDocumentCache(); // } // // /** // * Creates empty document with default cascade. See {@link #DEFAULT_CASCADE}. // */ // public SrxDocument() { // this(DEFAULT_CASCADE); // } // // /** // * Sets if document is cascading or not. // * // * @param cascade true f document is cascading // */ // public void setCascade(boolean cascade) { // this.cascade = cascade; // } // // /** // * @return true if document is cascading // */ // public boolean getCascade() { // return cascade; // } // // /** // * Add language map to this document. // * // * @param pattern language code pattern // * @param languageRule // */ // public void addLanguageMap(String pattern, LanguageRule languageRule) { // LanguageMap languageMap = new LanguageMap(pattern, languageRule); // languageMapList.add(languageMap); // } // // public List<LanguageMap> getLanguageMapList() { // return languageMapList; // } // // /** // * If cascade is true then returns all language rules matching given // * language code. If cascade is false returns first language rule matching // * given language code. If no matching language rules are found returns // * empty list. // * // * @param languageCode language code, for example en_US // * @return matching language rules // */ // public List<LanguageRule> getLanguageRuleList(String languageCode) { // List<LanguageRule> matchingLanguageRuleList = new ArrayList<LanguageRule>(); // for (LanguageMap languageMap : languageMapList) { // if (languageMap.matches(languageCode)) { // matchingLanguageRuleList.add(languageMap.getLanguageRule()); // if (!cascade) { // break; // } // } // } // return matchingLanguageRuleList; // } // // public SrxDocumentCache getCache() { // return cache; // } // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxParser.java // public interface SrxParser { // // /** // * Parses SRX document. // * // * @param reader reader from which read the document // * @return initialized SRX document // */ // public SrxDocument parse(Reader reader); // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // } // Path: segment/src/main/java/net/loomchild/segment/srx/io/SrxAnyParser.java import java.io.BufferedReader; import java.io.Reader; import java.util.Collections; import java.util.Map; import net.loomchild.segment.srx.SrxDocument; import net.loomchild.segment.srx.SrxParser; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.XmlException; package net.loomchild.segment.srx.io; /** * Represents any version intelligent SRX document parser. Responsible for * creating appropriate SRX parser to given SRX document version. * * @author loomchild */ public class SrxAnyParser implements SrxParser { private SrxParser parser; /** * Creates SRX any parser using given SRX 2.0 parser. * @param parser */ public SrxAnyParser(SrxParser parser) { this.parser = parser; } /** * Creates SRX any parser using default SRX 2.0 parser. */ public SrxAnyParser() { this(new Srx2Parser()); } /** * Parses SRX document from reader. Selects appropriate SRX parser for * document version. * * @param reader * @return Return initialized document */ public SrxDocument parse(Reader reader) { BufferedReader bufferedReader = new BufferedReader(reader); reader = bufferedReader; SrxVersion version = SrxVersion.parse(bufferedReader); if (version == SrxVersion.VERSION_1_0) {
SrxTransformer transformer = new Srx1Transformer();
loomchild/segment
segment/src/main/java/net/loomchild/segment/srx/io/SrxAnyParser.java
// Path: segment/src/main/java/net/loomchild/segment/srx/SrxDocument.java // public class SrxDocument { // // /** // * Default cascade value. // */ // public static final boolean DEFAULT_CASCADE = true; // // private boolean cascade; // // private List<LanguageMap> languageMapList; // // private SrxDocumentCache cache; // // /** // * Creates empty document. // * // * @param cascade true if document is cascading // */ // public SrxDocument(boolean cascade) { // this.cascade = cascade; // this.languageMapList = new ArrayList<LanguageMap>(); // this.cache = new SrxDocumentCache(); // } // // /** // * Creates empty document with default cascade. See {@link #DEFAULT_CASCADE}. // */ // public SrxDocument() { // this(DEFAULT_CASCADE); // } // // /** // * Sets if document is cascading or not. // * // * @param cascade true f document is cascading // */ // public void setCascade(boolean cascade) { // this.cascade = cascade; // } // // /** // * @return true if document is cascading // */ // public boolean getCascade() { // return cascade; // } // // /** // * Add language map to this document. // * // * @param pattern language code pattern // * @param languageRule // */ // public void addLanguageMap(String pattern, LanguageRule languageRule) { // LanguageMap languageMap = new LanguageMap(pattern, languageRule); // languageMapList.add(languageMap); // } // // public List<LanguageMap> getLanguageMapList() { // return languageMapList; // } // // /** // * If cascade is true then returns all language rules matching given // * language code. If cascade is false returns first language rule matching // * given language code. If no matching language rules are found returns // * empty list. // * // * @param languageCode language code, for example en_US // * @return matching language rules // */ // public List<LanguageRule> getLanguageRuleList(String languageCode) { // List<LanguageRule> matchingLanguageRuleList = new ArrayList<LanguageRule>(); // for (LanguageMap languageMap : languageMapList) { // if (languageMap.matches(languageCode)) { // matchingLanguageRuleList.add(languageMap.getLanguageRule()); // if (!cascade) { // break; // } // } // } // return matchingLanguageRuleList; // } // // public SrxDocumentCache getCache() { // return cache; // } // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxParser.java // public interface SrxParser { // // /** // * Parses SRX document. // * // * @param reader reader from which read the document // * @return initialized SRX document // */ // public SrxDocument parse(Reader reader); // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // }
import java.io.BufferedReader; import java.io.Reader; import java.util.Collections; import java.util.Map; import net.loomchild.segment.srx.SrxDocument; import net.loomchild.segment.srx.SrxParser; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.XmlException;
package net.loomchild.segment.srx.io; /** * Represents any version intelligent SRX document parser. Responsible for * creating appropriate SRX parser to given SRX document version. * * @author loomchild */ public class SrxAnyParser implements SrxParser { private SrxParser parser; /** * Creates SRX any parser using given SRX 2.0 parser. * @param parser */ public SrxAnyParser(SrxParser parser) { this.parser = parser; } /** * Creates SRX any parser using default SRX 2.0 parser. */ public SrxAnyParser() { this(new Srx2Parser()); } /** * Parses SRX document from reader. Selects appropriate SRX parser for * document version. * * @param reader * @return Return initialized document */ public SrxDocument parse(Reader reader) { BufferedReader bufferedReader = new BufferedReader(reader); reader = bufferedReader; SrxVersion version = SrxVersion.parse(bufferedReader); if (version == SrxVersion.VERSION_1_0) { SrxTransformer transformer = new Srx1Transformer(); Map<String, Object> parameterMap = Collections.emptyMap(); reader = transformer.transform(bufferedReader, parameterMap); } else if (version != SrxVersion.VERSION_2_0) {
// Path: segment/src/main/java/net/loomchild/segment/srx/SrxDocument.java // public class SrxDocument { // // /** // * Default cascade value. // */ // public static final boolean DEFAULT_CASCADE = true; // // private boolean cascade; // // private List<LanguageMap> languageMapList; // // private SrxDocumentCache cache; // // /** // * Creates empty document. // * // * @param cascade true if document is cascading // */ // public SrxDocument(boolean cascade) { // this.cascade = cascade; // this.languageMapList = new ArrayList<LanguageMap>(); // this.cache = new SrxDocumentCache(); // } // // /** // * Creates empty document with default cascade. See {@link #DEFAULT_CASCADE}. // */ // public SrxDocument() { // this(DEFAULT_CASCADE); // } // // /** // * Sets if document is cascading or not. // * // * @param cascade true f document is cascading // */ // public void setCascade(boolean cascade) { // this.cascade = cascade; // } // // /** // * @return true if document is cascading // */ // public boolean getCascade() { // return cascade; // } // // /** // * Add language map to this document. // * // * @param pattern language code pattern // * @param languageRule // */ // public void addLanguageMap(String pattern, LanguageRule languageRule) { // LanguageMap languageMap = new LanguageMap(pattern, languageRule); // languageMapList.add(languageMap); // } // // public List<LanguageMap> getLanguageMapList() { // return languageMapList; // } // // /** // * If cascade is true then returns all language rules matching given // * language code. If cascade is false returns first language rule matching // * given language code. If no matching language rules are found returns // * empty list. // * // * @param languageCode language code, for example en_US // * @return matching language rules // */ // public List<LanguageRule> getLanguageRuleList(String languageCode) { // List<LanguageRule> matchingLanguageRuleList = new ArrayList<LanguageRule>(); // for (LanguageMap languageMap : languageMapList) { // if (languageMap.matches(languageCode)) { // matchingLanguageRuleList.add(languageMap.getLanguageRule()); // if (!cascade) { // break; // } // } // } // return matchingLanguageRuleList; // } // // public SrxDocumentCache getCache() { // return cache; // } // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxParser.java // public interface SrxParser { // // /** // * Parses SRX document. // * // * @param reader reader from which read the document // * @return initialized SRX document // */ // public SrxDocument parse(Reader reader); // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // } // Path: segment/src/main/java/net/loomchild/segment/srx/io/SrxAnyParser.java import java.io.BufferedReader; import java.io.Reader; import java.util.Collections; import java.util.Map; import net.loomchild.segment.srx.SrxDocument; import net.loomchild.segment.srx.SrxParser; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.XmlException; package net.loomchild.segment.srx.io; /** * Represents any version intelligent SRX document parser. Responsible for * creating appropriate SRX parser to given SRX document version. * * @author loomchild */ public class SrxAnyParser implements SrxParser { private SrxParser parser; /** * Creates SRX any parser using given SRX 2.0 parser. * @param parser */ public SrxAnyParser(SrxParser parser) { this.parser = parser; } /** * Creates SRX any parser using default SRX 2.0 parser. */ public SrxAnyParser() { this(new Srx2Parser()); } /** * Parses SRX document from reader. Selects appropriate SRX parser for * document version. * * @param reader * @return Return initialized document */ public SrxDocument parse(Reader reader) { BufferedReader bufferedReader = new BufferedReader(reader); reader = bufferedReader; SrxVersion version = SrxVersion.parse(bufferedReader); if (version == SrxVersion.VERSION_1_0) { SrxTransformer transformer = new Srx1Transformer(); Map<String, Object> parameterMap = Collections.emptyMap(); reader = transformer.transform(bufferedReader, parameterMap); } else if (version != SrxVersion.VERSION_2_0) {
throw new XmlException("Unsupported SRX version: \"" + version
loomchild/segment
segment/src/main/java/net/loomchild/segment/srx/io/Srx1Parser.java
// Path: segment/src/main/java/net/loomchild/segment/srx/SrxDocument.java // public class SrxDocument { // // /** // * Default cascade value. // */ // public static final boolean DEFAULT_CASCADE = true; // // private boolean cascade; // // private List<LanguageMap> languageMapList; // // private SrxDocumentCache cache; // // /** // * Creates empty document. // * // * @param cascade true if document is cascading // */ // public SrxDocument(boolean cascade) { // this.cascade = cascade; // this.languageMapList = new ArrayList<LanguageMap>(); // this.cache = new SrxDocumentCache(); // } // // /** // * Creates empty document with default cascade. See {@link #DEFAULT_CASCADE}. // */ // public SrxDocument() { // this(DEFAULT_CASCADE); // } // // /** // * Sets if document is cascading or not. // * // * @param cascade true f document is cascading // */ // public void setCascade(boolean cascade) { // this.cascade = cascade; // } // // /** // * @return true if document is cascading // */ // public boolean getCascade() { // return cascade; // } // // /** // * Add language map to this document. // * // * @param pattern language code pattern // * @param languageRule // */ // public void addLanguageMap(String pattern, LanguageRule languageRule) { // LanguageMap languageMap = new LanguageMap(pattern, languageRule); // languageMapList.add(languageMap); // } // // public List<LanguageMap> getLanguageMapList() { // return languageMapList; // } // // /** // * If cascade is true then returns all language rules matching given // * language code. If cascade is false returns first language rule matching // * given language code. If no matching language rules are found returns // * empty list. // * // * @param languageCode language code, for example en_US // * @return matching language rules // */ // public List<LanguageRule> getLanguageRuleList(String languageCode) { // List<LanguageRule> matchingLanguageRuleList = new ArrayList<LanguageRule>(); // for (LanguageMap languageMap : languageMapList) { // if (languageMap.matches(languageCode)) { // matchingLanguageRuleList.add(languageMap.getLanguageRule()); // if (!cascade) { // break; // } // } // } // return matchingLanguageRuleList; // } // // public SrxDocumentCache getCache() { // return cache; // } // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxParser.java // public interface SrxParser { // // /** // * Parses SRX document. // * // * @param reader reader from which read the document // * @return initialized SRX document // */ // public SrxDocument parse(Reader reader); // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // }
import java.io.Reader; import java.util.Collections; import java.util.Map; import net.loomchild.segment.srx.SrxDocument; import net.loomchild.segment.srx.SrxParser; import net.loomchild.segment.srx.SrxTransformer;
package net.loomchild.segment.srx.io; /** * Represents SRX 1.0 parser. Transforms document to SRX 2.0 using * {@link Srx1Transformer} and then parses it using {@link Srx2Parser}. * * @author loomchild */ public class Srx1Parser implements SrxParser { /** * Transforms document to SRX 2.0 using {@link Srx1Transformer} and default * transformation parameters and parses it using {@link Srx2Parser}. * * @param reader reader from which read the document * @return initialized SRX document */ public SrxDocument parse(Reader reader) {
// Path: segment/src/main/java/net/loomchild/segment/srx/SrxDocument.java // public class SrxDocument { // // /** // * Default cascade value. // */ // public static final boolean DEFAULT_CASCADE = true; // // private boolean cascade; // // private List<LanguageMap> languageMapList; // // private SrxDocumentCache cache; // // /** // * Creates empty document. // * // * @param cascade true if document is cascading // */ // public SrxDocument(boolean cascade) { // this.cascade = cascade; // this.languageMapList = new ArrayList<LanguageMap>(); // this.cache = new SrxDocumentCache(); // } // // /** // * Creates empty document with default cascade. See {@link #DEFAULT_CASCADE}. // */ // public SrxDocument() { // this(DEFAULT_CASCADE); // } // // /** // * Sets if document is cascading or not. // * // * @param cascade true f document is cascading // */ // public void setCascade(boolean cascade) { // this.cascade = cascade; // } // // /** // * @return true if document is cascading // */ // public boolean getCascade() { // return cascade; // } // // /** // * Add language map to this document. // * // * @param pattern language code pattern // * @param languageRule // */ // public void addLanguageMap(String pattern, LanguageRule languageRule) { // LanguageMap languageMap = new LanguageMap(pattern, languageRule); // languageMapList.add(languageMap); // } // // public List<LanguageMap> getLanguageMapList() { // return languageMapList; // } // // /** // * If cascade is true then returns all language rules matching given // * language code. If cascade is false returns first language rule matching // * given language code. If no matching language rules are found returns // * empty list. // * // * @param languageCode language code, for example en_US // * @return matching language rules // */ // public List<LanguageRule> getLanguageRuleList(String languageCode) { // List<LanguageRule> matchingLanguageRuleList = new ArrayList<LanguageRule>(); // for (LanguageMap languageMap : languageMapList) { // if (languageMap.matches(languageCode)) { // matchingLanguageRuleList.add(languageMap.getLanguageRule()); // if (!cascade) { // break; // } // } // } // return matchingLanguageRuleList; // } // // public SrxDocumentCache getCache() { // return cache; // } // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxParser.java // public interface SrxParser { // // /** // * Parses SRX document. // * // * @param reader reader from which read the document // * @return initialized SRX document // */ // public SrxDocument parse(Reader reader); // // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // Path: segment/src/main/java/net/loomchild/segment/srx/io/Srx1Parser.java import java.io.Reader; import java.util.Collections; import java.util.Map; import net.loomchild.segment.srx.SrxDocument; import net.loomchild.segment.srx.SrxParser; import net.loomchild.segment.srx.SrxTransformer; package net.loomchild.segment.srx.io; /** * Represents SRX 1.0 parser. Transforms document to SRX 2.0 using * {@link Srx1Transformer} and then parses it using {@link Srx2Parser}. * * @author loomchild */ public class Srx1Parser implements SrxParser { /** * Transforms document to SRX 2.0 using {@link Srx1Transformer} and default * transformation parameters and parses it using {@link Srx2Parser}. * * @param reader reader from which read the document * @return initialized SRX document */ public SrxDocument parse(Reader reader) {
SrxTransformer transformer = new Srx1Transformer();
loomchild/segment
segment/src/main/java/net/loomchild/segment/AbstractTextIterator.java
// Path: segment/src/main/java/net/loomchild/segment/srx/LanguageRule.java // public class LanguageRule { // // private List<Rule> ruleList; // // private String name; // // /** // * Creates language rule. // * // * @param name language rule name // * @param ruleList rule list (it will be shallow copied) // */ // public LanguageRule(String name, List<Rule> ruleList) { // this.ruleList = new ArrayList<Rule>(ruleList); // this.name = name; // } // // /** // * Creates empty language rule. // * // * @param name language rule name // */ // public LanguageRule(String name) { // this(name, new ArrayList<Rule>()); // } // // /** // * @return unmodifiable rules list // */ // public List<Rule> getRuleList() { // return Collections.unmodifiableList(ruleList); // } // // /** // * Adds rule to the end of rule list. // * @param rule // */ // public void addRule(Rule rule) { // ruleList.add(rule); // } // // /** // * @return language rule name // */ // public String getName() { // return name; // } // // }
import java.util.Iterator; import java.util.List; import net.loomchild.segment.srx.LanguageRule;
package net.loomchild.segment; /** * Represents abstract text iterator. Responsible for implementing remove * operation. * * @author loomchild * */ public abstract class AbstractTextIterator implements TextIterator { /** * {@inheritDoc} */ public void remove() { throw new UnsupportedOperationException( "Remove is not supported by TextIterator."); }
// Path: segment/src/main/java/net/loomchild/segment/srx/LanguageRule.java // public class LanguageRule { // // private List<Rule> ruleList; // // private String name; // // /** // * Creates language rule. // * // * @param name language rule name // * @param ruleList rule list (it will be shallow copied) // */ // public LanguageRule(String name, List<Rule> ruleList) { // this.ruleList = new ArrayList<Rule>(ruleList); // this.name = name; // } // // /** // * Creates empty language rule. // * // * @param name language rule name // */ // public LanguageRule(String name) { // this(name, new ArrayList<Rule>()); // } // // /** // * @return unmodifiable rules list // */ // public List<Rule> getRuleList() { // return Collections.unmodifiableList(ruleList); // } // // /** // * Adds rule to the end of rule list. // * @param rule // */ // public void addRule(Rule rule) { // ruleList.add(rule); // } // // /** // * @return language rule name // */ // public String getName() { // return name; // } // // } // Path: segment/src/main/java/net/loomchild/segment/AbstractTextIterator.java import java.util.Iterator; import java.util.List; import net.loomchild.segment.srx.LanguageRule; package net.loomchild.segment; /** * Represents abstract text iterator. Responsible for implementing remove * operation. * * @author loomchild * */ public abstract class AbstractTextIterator implements TextIterator { /** * {@inheritDoc} */ public void remove() { throw new UnsupportedOperationException( "Remove is not supported by TextIterator."); }
public String toString(List<LanguageRule> languageRuleList) {
loomchild/segment
segment/src/main/java/net/loomchild/segment/srx/legacy/ReaderCharSequence.java
// Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // }
import java.io.IOException; import java.io.Reader; import net.loomchild.segment.util.IORuntimeException;
* buffer |-|-|-|-|-| * 0 1 2 3 4 * * relative index = 2 * </pre> * * @param index sequence index * @return buffer relative index */ private int getRelativeIndex(int index) { return index - (position - buffer.length()); } private int getMinIndex() { return position - buffer.length(); } private void fillBuffer(int index) { // Index can be MAX_INT so all arithmetic operations should be // on the left side of equation to avoid integer overflow. while (index >= position - lookahead && position < length) { readCharacter(); } } private void readCharacter() { int readResult; try { readResult = reader.read(); } catch (IOException e) {
// Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // } // Path: segment/src/main/java/net/loomchild/segment/srx/legacy/ReaderCharSequence.java import java.io.IOException; import java.io.Reader; import net.loomchild.segment.util.IORuntimeException; * buffer |-|-|-|-|-| * 0 1 2 3 4 * * relative index = 2 * </pre> * * @param index sequence index * @return buffer relative index */ private int getRelativeIndex(int index) { return index - (position - buffer.length()); } private int getMinIndex() { return position - buffer.length(); } private void fillBuffer(int index) { // Index can be MAX_INT so all arithmetic operations should be // on the left side of equation to avoid integer overflow. while (index >= position - lookahead && position < length) { readCharacter(); } } private void readCharacter() { int readResult; try { readResult = reader.read(); } catch (IOException e) {
throw new IORuntimeException(e);
loomchild/segment
segment/src/main/java/net/loomchild/segment/srx/io/SrxAnyTransformer.java
// Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // }
import java.io.BufferedReader; import java.io.Reader; import java.io.Writer; import java.util.Map; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.XmlException;
package net.loomchild.segment.srx.io; /** * Represents any version intelligent SRX document transformer to newest * supported version. * * @author loomchild * @see SrxVersion */ public class SrxAnyTransformer implements SrxTransformer { /** * Transform given SRX document to newest supported version and write it to * given writer. Recognizes version by using * {@link SrxVersion#parse(BufferedReader)}, which does not always work * perfectly. * * @param reader reader containing SRX document * @param writer writer to write transformed SRX document * @param parameterMap map containing transformation parameters */ public void transform(Reader reader, Writer writer, Map<String, Object> parameterMap) { BufferedReader bufferedReader = new BufferedReader(reader); SrxTransformer transformer = getTransformer(bufferedReader); transformer.transform(bufferedReader, writer, parameterMap); } /** * Transform given SRX document and return Reader containing newest * supported version. Recognizes version by using * {@link SrxVersion#parse(BufferedReader)}, which does not always work * perfectly. * * @param reader reader containing SRX document * @param parameterMap map containing transformation parameters * @return reader containing SRX document in newest supported version */ public Reader transform(Reader reader, Map<String, Object> parameterMap) { BufferedReader bufferedReader = new BufferedReader(reader); SrxTransformer transformer = getTransformer(bufferedReader); return transformer.transform(bufferedReader, parameterMap); } private SrxTransformer getTransformer(BufferedReader reader) { SrxTransformer transformer; SrxVersion version = SrxVersion.parse(reader); if (version == SrxVersion.VERSION_1_0) { transformer = new Srx1Transformer(); } else if (version == SrxVersion.VERSION_2_0) { transformer = new Srx2Transformer(); } else {
// Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // } // Path: segment/src/main/java/net/loomchild/segment/srx/io/SrxAnyTransformer.java import java.io.BufferedReader; import java.io.Reader; import java.io.Writer; import java.util.Map; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.XmlException; package net.loomchild.segment.srx.io; /** * Represents any version intelligent SRX document transformer to newest * supported version. * * @author loomchild * @see SrxVersion */ public class SrxAnyTransformer implements SrxTransformer { /** * Transform given SRX document to newest supported version and write it to * given writer. Recognizes version by using * {@link SrxVersion#parse(BufferedReader)}, which does not always work * perfectly. * * @param reader reader containing SRX document * @param writer writer to write transformed SRX document * @param parameterMap map containing transformation parameters */ public void transform(Reader reader, Writer writer, Map<String, Object> parameterMap) { BufferedReader bufferedReader = new BufferedReader(reader); SrxTransformer transformer = getTransformer(bufferedReader); transformer.transform(bufferedReader, writer, parameterMap); } /** * Transform given SRX document and return Reader containing newest * supported version. Recognizes version by using * {@link SrxVersion#parse(BufferedReader)}, which does not always work * perfectly. * * @param reader reader containing SRX document * @param parameterMap map containing transformation parameters * @return reader containing SRX document in newest supported version */ public Reader transform(Reader reader, Map<String, Object> parameterMap) { BufferedReader bufferedReader = new BufferedReader(reader); SrxTransformer transformer = getTransformer(bufferedReader); return transformer.transform(bufferedReader, parameterMap); } private SrxTransformer getTransformer(BufferedReader reader) { SrxTransformer transformer; SrxVersion version = SrxVersion.parse(reader); if (version == SrxVersion.VERSION_1_0) { transformer = new Srx1Transformer(); } else if (version == SrxVersion.VERSION_2_0) { transformer = new Srx2Transformer(); } else {
throw new XmlException("Unsupported SRX version: \"" + version
loomchild/segment
segment/src/test/java/net/loomchild/segment/srx/io/SrxTransformersTest.java
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Templates getTemplates(Reader reader) { // try { // TransformerFactory factory = TransformerFactory.newInstance(); // Source source = new StreamSource(reader); // Templates templates; // templates = factory.newTemplates(source); // return templates; // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT templates.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static void transform(Templates templates, Schema schema, // Reader reader, Writer writer, Map<String, Object> parameterMap) { // try { // Source source = getSource(reader, schema); // Result result = new StreamResult(writer); // Transformer transformer = templates.newTransformer(); // transformer.setErrorListener(new TransformationErrorListener()); // for (Map.Entry<String, Object> entry : parameterMap.entrySet()) { // transformer.setParameter(entry.getKey(), entry.getValue()); // } // transformer.transform(source, result); // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT transformer.", e); // } catch (TransformerException e) { // throw new XmlException("XSLT transformer error.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // }
import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import static net.loomchild.segment.util.Util.getTemplates; import static net.loomchild.segment.util.Util.transform; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import javax.xml.transform.Templates; import junit.framework.TestCase; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.IORuntimeException;
package net.loomchild.segment.srx.io; public class SrxTransformersTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String STYLESHEET = "net/loomchild/segment/res/xml/strip-space.xsl";
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Templates getTemplates(Reader reader) { // try { // TransformerFactory factory = TransformerFactory.newInstance(); // Source source = new StreamSource(reader); // Templates templates; // templates = factory.newTemplates(source); // return templates; // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT templates.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static void transform(Templates templates, Schema schema, // Reader reader, Writer writer, Map<String, Object> parameterMap) { // try { // Source source = getSource(reader, schema); // Result result = new StreamResult(writer); // Transformer transformer = templates.newTransformer(); // transformer.setErrorListener(new TransformationErrorListener()); // for (Map.Entry<String, Object> entry : parameterMap.entrySet()) { // transformer.setParameter(entry.getKey(), entry.getValue()); // } // transformer.transform(source, result); // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT transformer.", e); // } catch (TransformerException e) { // throw new XmlException("XSLT transformer error.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // } // Path: segment/src/test/java/net/loomchild/segment/srx/io/SrxTransformersTest.java import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import static net.loomchild.segment.util.Util.getTemplates; import static net.loomchild.segment.util.Util.transform; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import javax.xml.transform.Templates; import junit.framework.TestCase; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.IORuntimeException; package net.loomchild.segment.srx.io; public class SrxTransformersTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String STYLESHEET = "net/loomchild/segment/res/xml/strip-space.xsl";
private static final Templates templates = getTemplates(getReader(getResourceStream(STYLESHEET)));
loomchild/segment
segment/src/test/java/net/loomchild/segment/srx/io/SrxTransformersTest.java
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Templates getTemplates(Reader reader) { // try { // TransformerFactory factory = TransformerFactory.newInstance(); // Source source = new StreamSource(reader); // Templates templates; // templates = factory.newTemplates(source); // return templates; // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT templates.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static void transform(Templates templates, Schema schema, // Reader reader, Writer writer, Map<String, Object> parameterMap) { // try { // Source source = getSource(reader, schema); // Result result = new StreamResult(writer); // Transformer transformer = templates.newTransformer(); // transformer.setErrorListener(new TransformationErrorListener()); // for (Map.Entry<String, Object> entry : parameterMap.entrySet()) { // transformer.setParameter(entry.getKey(), entry.getValue()); // } // transformer.transform(source, result); // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT transformer.", e); // } catch (TransformerException e) { // throw new XmlException("XSLT transformer error.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // }
import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import static net.loomchild.segment.util.Util.getTemplates; import static net.loomchild.segment.util.Util.transform; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import javax.xml.transform.Templates; import junit.framework.TestCase; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.IORuntimeException;
package net.loomchild.segment.srx.io; public class SrxTransformersTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String STYLESHEET = "net/loomchild/segment/res/xml/strip-space.xsl";
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Templates getTemplates(Reader reader) { // try { // TransformerFactory factory = TransformerFactory.newInstance(); // Source source = new StreamSource(reader); // Templates templates; // templates = factory.newTemplates(source); // return templates; // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT templates.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static void transform(Templates templates, Schema schema, // Reader reader, Writer writer, Map<String, Object> parameterMap) { // try { // Source source = getSource(reader, schema); // Result result = new StreamResult(writer); // Transformer transformer = templates.newTransformer(); // transformer.setErrorListener(new TransformationErrorListener()); // for (Map.Entry<String, Object> entry : parameterMap.entrySet()) { // transformer.setParameter(entry.getKey(), entry.getValue()); // } // transformer.transform(source, result); // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT transformer.", e); // } catch (TransformerException e) { // throw new XmlException("XSLT transformer error.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // } // Path: segment/src/test/java/net/loomchild/segment/srx/io/SrxTransformersTest.java import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import static net.loomchild.segment.util.Util.getTemplates; import static net.loomchild.segment.util.Util.transform; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import javax.xml.transform.Templates; import junit.framework.TestCase; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.IORuntimeException; package net.loomchild.segment.srx.io; public class SrxTransformersTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String STYLESHEET = "net/loomchild/segment/res/xml/strip-space.xsl";
private static final Templates templates = getTemplates(getReader(getResourceStream(STYLESHEET)));
loomchild/segment
segment/src/test/java/net/loomchild/segment/srx/io/SrxTransformersTest.java
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Templates getTemplates(Reader reader) { // try { // TransformerFactory factory = TransformerFactory.newInstance(); // Source source = new StreamSource(reader); // Templates templates; // templates = factory.newTemplates(source); // return templates; // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT templates.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static void transform(Templates templates, Schema schema, // Reader reader, Writer writer, Map<String, Object> parameterMap) { // try { // Source source = getSource(reader, schema); // Result result = new StreamResult(writer); // Transformer transformer = templates.newTransformer(); // transformer.setErrorListener(new TransformationErrorListener()); // for (Map.Entry<String, Object> entry : parameterMap.entrySet()) { // transformer.setParameter(entry.getKey(), entry.getValue()); // } // transformer.transform(source, result); // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT transformer.", e); // } catch (TransformerException e) { // throw new XmlException("XSLT transformer error.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // }
import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import static net.loomchild.segment.util.Util.getTemplates; import static net.loomchild.segment.util.Util.transform; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import javax.xml.transform.Templates; import junit.framework.TestCase; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.IORuntimeException;
package net.loomchild.segment.srx.io; public class SrxTransformersTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String STYLESHEET = "net/loomchild/segment/res/xml/strip-space.xsl";
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Templates getTemplates(Reader reader) { // try { // TransformerFactory factory = TransformerFactory.newInstance(); // Source source = new StreamSource(reader); // Templates templates; // templates = factory.newTemplates(source); // return templates; // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT templates.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static void transform(Templates templates, Schema schema, // Reader reader, Writer writer, Map<String, Object> parameterMap) { // try { // Source source = getSource(reader, schema); // Result result = new StreamResult(writer); // Transformer transformer = templates.newTransformer(); // transformer.setErrorListener(new TransformationErrorListener()); // for (Map.Entry<String, Object> entry : parameterMap.entrySet()) { // transformer.setParameter(entry.getKey(), entry.getValue()); // } // transformer.transform(source, result); // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT transformer.", e); // } catch (TransformerException e) { // throw new XmlException("XSLT transformer error.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // } // Path: segment/src/test/java/net/loomchild/segment/srx/io/SrxTransformersTest.java import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import static net.loomchild.segment.util.Util.getTemplates; import static net.loomchild.segment.util.Util.transform; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import javax.xml.transform.Templates; import junit.framework.TestCase; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.IORuntimeException; package net.loomchild.segment.srx.io; public class SrxTransformersTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String STYLESHEET = "net/loomchild/segment/res/xml/strip-space.xsl";
private static final Templates templates = getTemplates(getReader(getResourceStream(STYLESHEET)));
loomchild/segment
segment/src/test/java/net/loomchild/segment/srx/io/SrxTransformersTest.java
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Templates getTemplates(Reader reader) { // try { // TransformerFactory factory = TransformerFactory.newInstance(); // Source source = new StreamSource(reader); // Templates templates; // templates = factory.newTemplates(source); // return templates; // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT templates.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static void transform(Templates templates, Schema schema, // Reader reader, Writer writer, Map<String, Object> parameterMap) { // try { // Source source = getSource(reader, schema); // Result result = new StreamResult(writer); // Transformer transformer = templates.newTransformer(); // transformer.setErrorListener(new TransformationErrorListener()); // for (Map.Entry<String, Object> entry : parameterMap.entrySet()) { // transformer.setParameter(entry.getKey(), entry.getValue()); // } // transformer.transform(source, result); // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT transformer.", e); // } catch (TransformerException e) { // throw new XmlException("XSLT transformer error.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // }
import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import static net.loomchild.segment.util.Util.getTemplates; import static net.loomchild.segment.util.Util.transform; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import javax.xml.transform.Templates; import junit.framework.TestCase; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.IORuntimeException;
package net.loomchild.segment.srx.io; public class SrxTransformersTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String STYLESHEET = "net/loomchild/segment/res/xml/strip-space.xsl"; private static final Templates templates = getTemplates(getReader(getResourceStream(STYLESHEET))); public void testSrx1Transformer() {
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Templates getTemplates(Reader reader) { // try { // TransformerFactory factory = TransformerFactory.newInstance(); // Source source = new StreamSource(reader); // Templates templates; // templates = factory.newTemplates(source); // return templates; // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT templates.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static void transform(Templates templates, Schema schema, // Reader reader, Writer writer, Map<String, Object> parameterMap) { // try { // Source source = getSource(reader, schema); // Result result = new StreamResult(writer); // Transformer transformer = templates.newTransformer(); // transformer.setErrorListener(new TransformationErrorListener()); // for (Map.Entry<String, Object> entry : parameterMap.entrySet()) { // transformer.setParameter(entry.getKey(), entry.getValue()); // } // transformer.transform(source, result); // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT transformer.", e); // } catch (TransformerException e) { // throw new XmlException("XSLT transformer error.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // } // Path: segment/src/test/java/net/loomchild/segment/srx/io/SrxTransformersTest.java import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import static net.loomchild.segment.util.Util.getTemplates; import static net.loomchild.segment.util.Util.transform; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import javax.xml.transform.Templates; import junit.framework.TestCase; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.IORuntimeException; package net.loomchild.segment.srx.io; public class SrxTransformersTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String STYLESHEET = "net/loomchild/segment/res/xml/strip-space.xsl"; private static final Templates templates = getTemplates(getReader(getResourceStream(STYLESHEET))); public void testSrx1Transformer() {
SrxTransformer transformer = new Srx1Transformer();
loomchild/segment
segment/src/test/java/net/loomchild/segment/srx/io/SrxTransformersTest.java
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Templates getTemplates(Reader reader) { // try { // TransformerFactory factory = TransformerFactory.newInstance(); // Source source = new StreamSource(reader); // Templates templates; // templates = factory.newTemplates(source); // return templates; // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT templates.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static void transform(Templates templates, Schema schema, // Reader reader, Writer writer, Map<String, Object> parameterMap) { // try { // Source source = getSource(reader, schema); // Result result = new StreamResult(writer); // Transformer transformer = templates.newTransformer(); // transformer.setErrorListener(new TransformationErrorListener()); // for (Map.Entry<String, Object> entry : parameterMap.entrySet()) { // transformer.setParameter(entry.getKey(), entry.getValue()); // } // transformer.transform(source, result); // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT transformer.", e); // } catch (TransformerException e) { // throw new XmlException("XSLT transformer error.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // }
import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import static net.loomchild.segment.util.Util.getTemplates; import static net.loomchild.segment.util.Util.transform; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import javax.xml.transform.Templates; import junit.framework.TestCase; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.IORuntimeException;
package net.loomchild.segment.srx.io; public class SrxTransformersTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String STYLESHEET = "net/loomchild/segment/res/xml/strip-space.xsl"; private static final Templates templates = getTemplates(getReader(getResourceStream(STYLESHEET))); public void testSrx1Transformer() { SrxTransformer transformer = new Srx1Transformer(); Map<String, Object> parameterMap = new HashMap<String, Object>(); testTransformer(SRX_2_DOCUMENT_NAME, SRX_1_DOCUMENT_NAME, transformer, parameterMap); parameterMap.put(Srx1Transformer.MAP_RULE_NAME, (Object) "Default"); testTransformer(SRX_2_DOCUMENT_NAME, SRX_1_DOCUMENT_NAME, transformer, parameterMap); } public void testSrx2Transformer() { SrxTransformer transformer = new Srx2Transformer(); Map<String, Object> parameterMap = new HashMap<String, Object>(); testTransformer(SRX_2_DOCUMENT_NAME, SRX_2_DOCUMENT_NAME, transformer, parameterMap); } private void testTransformer(String expectedDocumentName, String sourceDocumentName, SrxTransformer transformer, Map<String, Object> parameterMap) { Reader reader = getReader(getResourceStream(expectedDocumentName)); String expectedDocument = removeWhitespaces(reader); reader = getReader(getResourceStream(sourceDocumentName));
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Templates getTemplates(Reader reader) { // try { // TransformerFactory factory = TransformerFactory.newInstance(); // Source source = new StreamSource(reader); // Templates templates; // templates = factory.newTemplates(source); // return templates; // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT templates.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static void transform(Templates templates, Schema schema, // Reader reader, Writer writer, Map<String, Object> parameterMap) { // try { // Source source = getSource(reader, schema); // Result result = new StreamResult(writer); // Transformer transformer = templates.newTransformer(); // transformer.setErrorListener(new TransformationErrorListener()); // for (Map.Entry<String, Object> entry : parameterMap.entrySet()) { // transformer.setParameter(entry.getKey(), entry.getValue()); // } // transformer.transform(source, result); // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT transformer.", e); // } catch (TransformerException e) { // throw new XmlException("XSLT transformer error.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // } // Path: segment/src/test/java/net/loomchild/segment/srx/io/SrxTransformersTest.java import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import static net.loomchild.segment.util.Util.getTemplates; import static net.loomchild.segment.util.Util.transform; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import javax.xml.transform.Templates; import junit.framework.TestCase; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.IORuntimeException; package net.loomchild.segment.srx.io; public class SrxTransformersTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String STYLESHEET = "net/loomchild/segment/res/xml/strip-space.xsl"; private static final Templates templates = getTemplates(getReader(getResourceStream(STYLESHEET))); public void testSrx1Transformer() { SrxTransformer transformer = new Srx1Transformer(); Map<String, Object> parameterMap = new HashMap<String, Object>(); testTransformer(SRX_2_DOCUMENT_NAME, SRX_1_DOCUMENT_NAME, transformer, parameterMap); parameterMap.put(Srx1Transformer.MAP_RULE_NAME, (Object) "Default"); testTransformer(SRX_2_DOCUMENT_NAME, SRX_1_DOCUMENT_NAME, transformer, parameterMap); } public void testSrx2Transformer() { SrxTransformer transformer = new Srx2Transformer(); Map<String, Object> parameterMap = new HashMap<String, Object>(); testTransformer(SRX_2_DOCUMENT_NAME, SRX_2_DOCUMENT_NAME, transformer, parameterMap); } private void testTransformer(String expectedDocumentName, String sourceDocumentName, SrxTransformer transformer, Map<String, Object> parameterMap) { Reader reader = getReader(getResourceStream(expectedDocumentName)); String expectedDocument = removeWhitespaces(reader); reader = getReader(getResourceStream(sourceDocumentName));
reader = transformer.transform(reader, parameterMap);
loomchild/segment
segment/src/test/java/net/loomchild/segment/srx/io/SrxTransformersTest.java
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Templates getTemplates(Reader reader) { // try { // TransformerFactory factory = TransformerFactory.newInstance(); // Source source = new StreamSource(reader); // Templates templates; // templates = factory.newTemplates(source); // return templates; // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT templates.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static void transform(Templates templates, Schema schema, // Reader reader, Writer writer, Map<String, Object> parameterMap) { // try { // Source source = getSource(reader, schema); // Result result = new StreamResult(writer); // Transformer transformer = templates.newTransformer(); // transformer.setErrorListener(new TransformationErrorListener()); // for (Map.Entry<String, Object> entry : parameterMap.entrySet()) { // transformer.setParameter(entry.getKey(), entry.getValue()); // } // transformer.transform(source, result); // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT transformer.", e); // } catch (TransformerException e) { // throw new XmlException("XSLT transformer error.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // }
import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import static net.loomchild.segment.util.Util.getTemplates; import static net.loomchild.segment.util.Util.transform; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import javax.xml.transform.Templates; import junit.framework.TestCase; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.IORuntimeException;
reader = transformer.transform(reader, parameterMap); String actualDocument = removeWhitespaces(reader); assertEquals(expectedDocument, actualDocument); reader = getReader(getResourceStream(sourceDocumentName)); Writer writer = new StringWriter(); transformer.transform(reader, writer, parameterMap); reader = new StringReader(writer.toString()); actualDocument = removeWhitespaces(reader); assertEquals(expectedDocument, actualDocument); } private String removeWhitespaces(Reader reader) { StringWriter writer = new StringWriter(); transform(templates, reader, writer); // Java 1.5 requires this because transformation does not work properly. StringReader stringReader = new StringReader(writer.toString()); StringBuilder builder = new StringBuilder(); try { int i; while ((i = stringReader.read()) != -1) { char c = (char)i; if ((c != ' ' && c != '\t' && c != '\r' && c != '\n' && c != '\f')) { builder.append((char)c); } } } catch (IOException e) {
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Templates getTemplates(Reader reader) { // try { // TransformerFactory factory = TransformerFactory.newInstance(); // Source source = new StreamSource(reader); // Templates templates; // templates = factory.newTemplates(source); // return templates; // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT templates.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static void transform(Templates templates, Schema schema, // Reader reader, Writer writer, Map<String, Object> parameterMap) { // try { // Source source = getSource(reader, schema); // Result result = new StreamResult(writer); // Transformer transformer = templates.newTransformer(); // transformer.setErrorListener(new TransformationErrorListener()); // for (Map.Entry<String, Object> entry : parameterMap.entrySet()) { // transformer.setParameter(entry.getKey(), entry.getValue()); // } // transformer.transform(source, result); // } catch (TransformerConfigurationException e) { // throw new XmlException("Error creating XSLT transformer.", e); // } catch (TransformerException e) { // throw new XmlException("XSLT transformer error.", e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // // Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // } // Path: segment/src/test/java/net/loomchild/segment/srx/io/SrxTransformersTest.java import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import static net.loomchild.segment.util.Util.getTemplates; import static net.loomchild.segment.util.Util.transform; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import javax.xml.transform.Templates; import junit.framework.TestCase; import net.loomchild.segment.srx.SrxTransformer; import net.loomchild.segment.util.IORuntimeException; reader = transformer.transform(reader, parameterMap); String actualDocument = removeWhitespaces(reader); assertEquals(expectedDocument, actualDocument); reader = getReader(getResourceStream(sourceDocumentName)); Writer writer = new StringWriter(); transformer.transform(reader, writer, parameterMap); reader = new StringReader(writer.toString()); actualDocument = removeWhitespaces(reader); assertEquals(expectedDocument, actualDocument); } private String removeWhitespaces(Reader reader) { StringWriter writer = new StringWriter(); transform(templates, reader, writer); // Java 1.5 requires this because transformation does not work properly. StringReader stringReader = new StringReader(writer.toString()); StringBuilder builder = new StringBuilder(); try { int i; while ((i = stringReader.read()) != -1) { char c = (char)i; if ((c != ' ' && c != '\t' && c != '\r' && c != '\n' && c != '\f')) { builder.append((char)c); } } } catch (IOException e) {
throw new IORuntimeException(e);
loomchild/segment
segment/src/main/java/net/loomchild/segment/util/Util.java
// Path: segment/src/main/java/net/loomchild/segment/srx/SrxDocument.java // public class SrxDocument { // // /** // * Default cascade value. // */ // public static final boolean DEFAULT_CASCADE = true; // // private boolean cascade; // // private List<LanguageMap> languageMapList; // // private SrxDocumentCache cache; // // /** // * Creates empty document. // * // * @param cascade true if document is cascading // */ // public SrxDocument(boolean cascade) { // this.cascade = cascade; // this.languageMapList = new ArrayList<LanguageMap>(); // this.cache = new SrxDocumentCache(); // } // // /** // * Creates empty document with default cascade. See {@link #DEFAULT_CASCADE}. // */ // public SrxDocument() { // this(DEFAULT_CASCADE); // } // // /** // * Sets if document is cascading or not. // * // * @param cascade true f document is cascading // */ // public void setCascade(boolean cascade) { // this.cascade = cascade; // } // // /** // * @return true if document is cascading // */ // public boolean getCascade() { // return cascade; // } // // /** // * Add language map to this document. // * // * @param pattern language code pattern // * @param languageRule // */ // public void addLanguageMap(String pattern, LanguageRule languageRule) { // LanguageMap languageMap = new LanguageMap(pattern, languageRule); // languageMapList.add(languageMap); // } // // public List<LanguageMap> getLanguageMapList() { // return languageMapList; // } // // /** // * If cascade is true then returns all language rules matching given // * language code. If cascade is false returns first language rule matching // * given language code. If no matching language rules are found returns // * empty list. // * // * @param languageCode language code, for example en_US // * @return matching language rules // */ // public List<LanguageRule> getLanguageRuleList(String languageCode) { // List<LanguageRule> matchingLanguageRuleList = new ArrayList<LanguageRule>(); // for (LanguageMap languageMap : languageMapList) { // if (languageMap.matches(languageCode)) { // matchingLanguageRuleList.add(languageMap.getLanguageRule()); // if (!cascade) { // break; // } // } // } // return matchingLanguageRuleList; // } // // public SrxDocumentCache getCache() { // return cache; // } // // }
import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Reader; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.net.URL; import java.util.Collections; import java.util.Map; import java.util.jar.Manifest; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.xml.XMLConstants; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import net.loomchild.segment.srx.SrxDocument; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader;
return patternBuilder.toString(); } /** * Changes unlimited length pattern to limited length pattern. It is done by * replacing constructs with "*" and "+" symbols with their finite * counterparts - "{0,n}" and {1,n}. * As a side effect block quotes are replaced with normal quotes * by using {@link #removeBlockQuotes(String)}. * * @param pattern pattern to be finitized * @param infinity "n" number * @return limited length pattern */ public static String finitize(String pattern, int infinity) { String finitePattern = removeBlockQuotes(pattern); Matcher starMatcher = STAR_PATTERN.matcher(finitePattern); finitePattern = starMatcher.replaceAll("{0," + infinity + "}"); Matcher plusMatcher = PLUS_PATTERN.matcher(finitePattern); finitePattern = plusMatcher.replaceAll("{1," + infinity + "}"); Matcher rangeMatcher = RANGE_PATTERN.matcher(finitePattern); finitePattern = rangeMatcher.replaceAll("{$1," + infinity + "}"); return finitePattern; }
// Path: segment/src/main/java/net/loomchild/segment/srx/SrxDocument.java // public class SrxDocument { // // /** // * Default cascade value. // */ // public static final boolean DEFAULT_CASCADE = true; // // private boolean cascade; // // private List<LanguageMap> languageMapList; // // private SrxDocumentCache cache; // // /** // * Creates empty document. // * // * @param cascade true if document is cascading // */ // public SrxDocument(boolean cascade) { // this.cascade = cascade; // this.languageMapList = new ArrayList<LanguageMap>(); // this.cache = new SrxDocumentCache(); // } // // /** // * Creates empty document with default cascade. See {@link #DEFAULT_CASCADE}. // */ // public SrxDocument() { // this(DEFAULT_CASCADE); // } // // /** // * Sets if document is cascading or not. // * // * @param cascade true f document is cascading // */ // public void setCascade(boolean cascade) { // this.cascade = cascade; // } // // /** // * @return true if document is cascading // */ // public boolean getCascade() { // return cascade; // } // // /** // * Add language map to this document. // * // * @param pattern language code pattern // * @param languageRule // */ // public void addLanguageMap(String pattern, LanguageRule languageRule) { // LanguageMap languageMap = new LanguageMap(pattern, languageRule); // languageMapList.add(languageMap); // } // // public List<LanguageMap> getLanguageMapList() { // return languageMapList; // } // // /** // * If cascade is true then returns all language rules matching given // * language code. If cascade is false returns first language rule matching // * given language code. If no matching language rules are found returns // * empty list. // * // * @param languageCode language code, for example en_US // * @return matching language rules // */ // public List<LanguageRule> getLanguageRuleList(String languageCode) { // List<LanguageRule> matchingLanguageRuleList = new ArrayList<LanguageRule>(); // for (LanguageMap languageMap : languageMapList) { // if (languageMap.matches(languageCode)) { // matchingLanguageRuleList.add(languageMap.getLanguageRule()); // if (!cascade) { // break; // } // } // } // return matchingLanguageRuleList; // } // // public SrxDocumentCache getCache() { // return cache; // } // // } // Path: segment/src/main/java/net/loomchild/segment/util/Util.java import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Reader; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.net.URL; import java.util.Collections; import java.util.Map; import java.util.jar.Manifest; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.xml.XMLConstants; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import net.loomchild.segment.srx.SrxDocument; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; return patternBuilder.toString(); } /** * Changes unlimited length pattern to limited length pattern. It is done by * replacing constructs with "*" and "+" symbols with their finite * counterparts - "{0,n}" and {1,n}. * As a side effect block quotes are replaced with normal quotes * by using {@link #removeBlockQuotes(String)}. * * @param pattern pattern to be finitized * @param infinity "n" number * @return limited length pattern */ public static String finitize(String pattern, int infinity) { String finitePattern = removeBlockQuotes(pattern); Matcher starMatcher = STAR_PATTERN.matcher(finitePattern); finitePattern = starMatcher.replaceAll("{0," + infinity + "}"); Matcher plusMatcher = PLUS_PATTERN.matcher(finitePattern); finitePattern = plusMatcher.replaceAll("{1," + infinity + "}"); Matcher rangeMatcher = RANGE_PATTERN.matcher(finitePattern); finitePattern = rangeMatcher.replaceAll("{$1," + infinity + "}"); return finitePattern; }
public static Pattern compile(SrxDocument document, String regex) {
loomchild/segment
segment/src/main/java/net/loomchild/segment/srx/TextManager.java
// Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // }
import java.io.IOException; import java.io.Reader; import net.loomchild.segment.util.IORuntimeException;
nextCharacter = charBuffer[count - 1]; } else if (count > 0 && count < amount) { result = new String(charBuffer, 0, count); nextCharacter = -1; } else { result = ""; nextCharacter = -1; } return result; } /** * Reads specified amount of characters. It is needed because when * reading from console {@link Reader#read(char[])} it returns * after first end of line (probably it checks if characters are available). * @param reader input * @param buffer buffer where read characters will be stored * @return number of read characters */ private int read(Reader reader, char[] buffer) { try { int start = 0; int count; while (((count = reader.read(buffer, start, buffer.length - start)) != -1) && start < buffer.length) { start += count; } return start; } catch (IOException e) {
// Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // } // Path: segment/src/main/java/net/loomchild/segment/srx/TextManager.java import java.io.IOException; import java.io.Reader; import net.loomchild.segment.util.IORuntimeException; nextCharacter = charBuffer[count - 1]; } else if (count > 0 && count < amount) { result = new String(charBuffer, 0, count); nextCharacter = -1; } else { result = ""; nextCharacter = -1; } return result; } /** * Reads specified amount of characters. It is needed because when * reading from console {@link Reader#read(char[])} it returns * after first end of line (probably it checks if characters are available). * @param reader input * @param buffer buffer where read characters will be stored * @return number of read characters */ private int read(Reader reader, char[] buffer) { try { int start = 0; int count; while (((count = reader.read(buffer, start, buffer.length - start)) != -1) && start < buffer.length) { start += count; } return start; } catch (IOException e) {
throw new IORuntimeException(e);
loomchild/segment
segment/src/main/java/net/loomchild/segment/srx/io/Srx2Transformer.java
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static void copyAll(Reader reader, Writer writer) { // try { // char[] readBuffer = new char[READ_BUFFER_SIZE]; // int count; // while ((count = reader.read(readBuffer)) != -1) { // writer.write(readBuffer, 0, count); // } // } catch (IOException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // }
import static net.loomchild.segment.util.Util.copyAll; import java.io.Reader; import java.io.Writer; import java.util.Map; import net.loomchild.segment.srx.SrxTransformer;
package net.loomchild.segment.srx.io; /** * Represents SRX document transformer between SRX 2.0 and newest supported * version. As newest supported version is 2.0 so does no transformation. * * @author loomchild */ public class Srx2Transformer implements SrxTransformer { /** * Copies SRX document from reader to writer without transformation. * * @param reader reader containing SRX document * @param writer writer to write SRX document * @param parameterMap map containing transformation parameters, ignored */ public void transform(Reader reader, Writer writer, Map<String, Object> parameterMap) {
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static void copyAll(Reader reader, Writer writer) { // try { // char[] readBuffer = new char[READ_BUFFER_SIZE]; // int count; // while ((count = reader.read(readBuffer)) != -1) { // writer.write(readBuffer, 0, count); // } // } catch (IOException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/srx/SrxTransformer.java // public interface SrxTransformer { // // /** // * Transform given SRX document to newest supported version and write it to // * given writer. // * // * @param reader reader containing SRX document // * @param writer writer to write transformed SRX document // * @param parameterMap map containing transformation parameters // */ // public void transform(Reader reader, Writer writer, // Map<String, Object> parameterMap); // // /** // * Transform given SRX document and return Reader containing newest // * supported version. // * // * @param reader reader containing SRX document // * @param parameterMap map containing transformation parameters // * @return reader containing SRX document in newest supported version // */ // public Reader transform(Reader reader, Map<String, Object> parameterMap); // // } // Path: segment/src/main/java/net/loomchild/segment/srx/io/Srx2Transformer.java import static net.loomchild.segment.util.Util.copyAll; import java.io.Reader; import java.io.Writer; import java.util.Map; import net.loomchild.segment.srx.SrxTransformer; package net.loomchild.segment.srx.io; /** * Represents SRX document transformer between SRX 2.0 and newest supported * version. As newest supported version is 2.0 so does no transformation. * * @author loomchild */ public class Srx2Transformer implements SrxTransformer { /** * Copies SRX document from reader to writer without transformation. * * @param reader reader containing SRX document * @param writer writer to write SRX document * @param parameterMap map containing transformation parameters, ignored */ public void transform(Reader reader, Writer writer, Map<String, Object> parameterMap) {
copyAll(reader, writer);
loomchild/segment
segment/src/test/java/net/loomchild/segment/srx/io/SrxVersionTest.java
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // }
import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import java.io.BufferedReader; import junit.framework.TestCase; import net.loomchild.segment.util.XmlException;
package net.loomchild.segment.srx.io; public class SrxVersionTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String NO_SRX_DOCUMENT_NAME = "net/loomchild/segment/res/test/some.xml"; public static final String SRX_NOVERSION_DOCUMENT_NAME = "net/loomchild/segment/res/test/invalid.srx"; public void testGetSrxVersion() { BufferedReader reader = new BufferedReader(
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // } // Path: segment/src/test/java/net/loomchild/segment/srx/io/SrxVersionTest.java import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import java.io.BufferedReader; import junit.framework.TestCase; import net.loomchild.segment.util.XmlException; package net.loomchild.segment.srx.io; public class SrxVersionTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String NO_SRX_DOCUMENT_NAME = "net/loomchild/segment/res/test/some.xml"; public static final String SRX_NOVERSION_DOCUMENT_NAME = "net/loomchild/segment/res/test/invalid.srx"; public void testGetSrxVersion() { BufferedReader reader = new BufferedReader(
getReader(getResourceStream(SRX_1_DOCUMENT_NAME)));
loomchild/segment
segment/src/test/java/net/loomchild/segment/srx/io/SrxVersionTest.java
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // }
import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import java.io.BufferedReader; import junit.framework.TestCase; import net.loomchild.segment.util.XmlException;
package net.loomchild.segment.srx.io; public class SrxVersionTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String NO_SRX_DOCUMENT_NAME = "net/loomchild/segment/res/test/some.xml"; public static final String SRX_NOVERSION_DOCUMENT_NAME = "net/loomchild/segment/res/test/invalid.srx"; public void testGetSrxVersion() { BufferedReader reader = new BufferedReader(
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // } // Path: segment/src/test/java/net/loomchild/segment/srx/io/SrxVersionTest.java import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import java.io.BufferedReader; import junit.framework.TestCase; import net.loomchild.segment.util.XmlException; package net.loomchild.segment.srx.io; public class SrxVersionTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String NO_SRX_DOCUMENT_NAME = "net/loomchild/segment/res/test/some.xml"; public static final String SRX_NOVERSION_DOCUMENT_NAME = "net/loomchild/segment/res/test/invalid.srx"; public void testGetSrxVersion() { BufferedReader reader = new BufferedReader(
getReader(getResourceStream(SRX_1_DOCUMENT_NAME)));
loomchild/segment
segment/src/test/java/net/loomchild/segment/srx/io/SrxVersionTest.java
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // }
import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import java.io.BufferedReader; import junit.framework.TestCase; import net.loomchild.segment.util.XmlException;
package net.loomchild.segment.srx.io; public class SrxVersionTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String NO_SRX_DOCUMENT_NAME = "net/loomchild/segment/res/test/some.xml"; public static final String SRX_NOVERSION_DOCUMENT_NAME = "net/loomchild/segment/res/test/invalid.srx"; public void testGetSrxVersion() { BufferedReader reader = new BufferedReader( getReader(getResourceStream(SRX_1_DOCUMENT_NAME))); SrxVersion version = SrxVersion.parse(reader); assertEquals(SrxVersion.VERSION_1_0, version); reader = new BufferedReader( getReader(getResourceStream(SRX_2_DOCUMENT_NAME))); version = SrxVersion.parse(reader); assertEquals(SrxVersion.VERSION_2_0, version); try { reader = new BufferedReader( getReader(getResourceStream(NO_SRX_DOCUMENT_NAME))); SrxVersion.parse(reader); fail("Recognized version of non SRX document.");
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Reader getReader(InputStream inputStream) { // try { // Reader reader = new InputStreamReader(inputStream, "utf-8"); // return reader; // } catch (UnsupportedEncodingException e) { // throw new IORuntimeException(e); // } // } // // Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static InputStream getResourceStream(String name) { // InputStream inputStream = Util.class.getClassLoader() // .getResourceAsStream(name); // if (inputStream == null) { // throw new ResourceNotFoundException(name); // } // return inputStream; // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // } // Path: segment/src/test/java/net/loomchild/segment/srx/io/SrxVersionTest.java import static net.loomchild.segment.util.Util.getReader; import static net.loomchild.segment.util.Util.getResourceStream; import java.io.BufferedReader; import junit.framework.TestCase; import net.loomchild.segment.util.XmlException; package net.loomchild.segment.srx.io; public class SrxVersionTest extends TestCase { public static final String SRX_1_DOCUMENT_NAME = "net/loomchild/segment/res/test/example1.srx"; public static final String SRX_2_DOCUMENT_NAME = "net/loomchild/segment/res/test/example2.srx"; public static final String NO_SRX_DOCUMENT_NAME = "net/loomchild/segment/res/test/some.xml"; public static final String SRX_NOVERSION_DOCUMENT_NAME = "net/loomchild/segment/res/test/invalid.srx"; public void testGetSrxVersion() { BufferedReader reader = new BufferedReader( getReader(getResourceStream(SRX_1_DOCUMENT_NAME))); SrxVersion version = SrxVersion.parse(reader); assertEquals(SrxVersion.VERSION_1_0, version); reader = new BufferedReader( getReader(getResourceStream(SRX_2_DOCUMENT_NAME))); version = SrxVersion.parse(reader); assertEquals(SrxVersion.VERSION_2_0, version); try { reader = new BufferedReader( getReader(getResourceStream(NO_SRX_DOCUMENT_NAME))); SrxVersion.parse(reader); fail("Recognized version of non SRX document.");
} catch (XmlException e) {
loomchild/segment
segment/src/test/java/net/loomchild/segment/srx/SrxTextIteratorReaderTest.java
// Path: segment/src/main/java/net/loomchild/segment/TextIterator.java // public interface TextIterator extends Iterator<String> { // // /** // * @return next segment in text, or null if end of text has been // * reached. // */ // public String next(); // // /** // * @return true if there are more segments // */ // public boolean hasNext(); // // /** // * Unsupported operation. // * // * @throws UnsupportedOperationException // */ // public void remove(); // // }
import java.io.StringReader; import java.util.HashMap; import java.util.Map; import net.loomchild.segment.TextIterator;
package net.loomchild.segment.srx; public class SrxTextIteratorReaderTest extends AbstractSrxTextIteratorTest { private static final int BUFFER_SIZE = 60; private static final int MARGIN = 10;
// Path: segment/src/main/java/net/loomchild/segment/TextIterator.java // public interface TextIterator extends Iterator<String> { // // /** // * @return next segment in text, or null if end of text has been // * reached. // */ // public String next(); // // /** // * @return true if there are more segments // */ // public boolean hasNext(); // // /** // * Unsupported operation. // * // * @throws UnsupportedOperationException // */ // public void remove(); // // } // Path: segment/src/test/java/net/loomchild/segment/srx/SrxTextIteratorReaderTest.java import java.io.StringReader; import java.util.HashMap; import java.util.Map; import net.loomchild.segment.TextIterator; package net.loomchild.segment.srx; public class SrxTextIteratorReaderTest extends AbstractSrxTextIteratorTest { private static final int BUFFER_SIZE = 60; private static final int MARGIN = 10;
protected TextIterator getTextIterator(SrxDocument document,
loomchild/segment
segment/src/main/java/net/loomchild/segment/util/Version.java
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Manifest getJarManifest(Class<?> klass) { // URL classUrl = klass.getResource(klass.getSimpleName() + ".class"); // if (classUrl == null) { // throw new IllegalArgumentException("Class not found: " + // klass.getName() + "."); // } // String classPath = classUrl.toString(); // int jarIndex = classPath.indexOf('!'); // if (jarIndex != -1) { // String manifestPath = // classPath.substring(0, jarIndex + 1) + MANIFEST_PATH; // try { // URL manifestUrl = new URL(manifestPath); // InputStream manifestStream = manifestUrl.openStream(); // Manifest manifest = new Manifest(manifestStream); // return manifest; // } // catch (IOException e) { // throw new ResourceNotFoundException( // "IO Error retrieving manifest.", e); // } // } // else { // throw new ResourceNotFoundException( // "Class is not in a JAR archive " + klass.getName() + "."); // } // }
import static net.loomchild.segment.util.Util.getJarManifest; import java.util.jar.Manifest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
package net.loomchild.segment.util; /** * Retrieves segment version. Singleton. * @author loomchild */ public class Version { private static final Log log = LogFactory.getLog(Version.class); public static final String VERSION_ATTRIBUTE = "Implementation-Version"; public static final String DATE_ATTRIBUTE = "Build-Date"; private static Version instance = new Version(); private String version; private String date; public static Version getInstance() { return instance; } private Version() { try {
// Path: segment/src/main/java/net/loomchild/segment/util/Util.java // public static Manifest getJarManifest(Class<?> klass) { // URL classUrl = klass.getResource(klass.getSimpleName() + ".class"); // if (classUrl == null) { // throw new IllegalArgumentException("Class not found: " + // klass.getName() + "."); // } // String classPath = classUrl.toString(); // int jarIndex = classPath.indexOf('!'); // if (jarIndex != -1) { // String manifestPath = // classPath.substring(0, jarIndex + 1) + MANIFEST_PATH; // try { // URL manifestUrl = new URL(manifestPath); // InputStream manifestStream = manifestUrl.openStream(); // Manifest manifest = new Manifest(manifestStream); // return manifest; // } // catch (IOException e) { // throw new ResourceNotFoundException( // "IO Error retrieving manifest.", e); // } // } // else { // throw new ResourceNotFoundException( // "Class is not in a JAR archive " + klass.getName() + "."); // } // } // Path: segment/src/main/java/net/loomchild/segment/util/Version.java import static net.loomchild.segment.util.Util.getJarManifest; import java.util.jar.Manifest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; package net.loomchild.segment.util; /** * Retrieves segment version. Singleton. * @author loomchild */ public class Version { private static final Log log = LogFactory.getLog(Version.class); public static final String VERSION_ATTRIBUTE = "Implementation-Version"; public static final String DATE_ATTRIBUTE = "Build-Date"; private static Version instance = new Version(); private String version; private String date; public static Version getInstance() { return instance; } private Version() { try {
Manifest manifest = getJarManifest(Version.class);
loomchild/segment
segment/src/main/java/net/loomchild/segment/srx/io/SrxVersion.java
// Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // }
import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.loomchild.segment.util.IORuntimeException; import net.loomchild.segment.util.XmlException;
package net.loomchild.segment.srx.io; /** * Represents SRX version. * Responsible for retrieving SRX version from a reader without modifying it. * @author loomchild */ public enum SrxVersion { VERSION_1_0("1.0"), VERSION_2_0("2.0"); private final static int HEADER_BUFFER_LENGHT = 1024; private final static Pattern VERSION_PATTERN = Pattern .compile("<srx[^>]+version=\"([^\"]+)\""); private String versionString; private SrxVersion(String versionString) { this.versionString = versionString; } public String toString() { return versionString; } public static SrxVersion parse(String versionString) { for (SrxVersion version : SrxVersion.values()) { if (version.versionString.equals(versionString)) { return version; } }
// Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // } // Path: segment/src/main/java/net/loomchild/segment/srx/io/SrxVersion.java import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.loomchild.segment.util.IORuntimeException; import net.loomchild.segment.util.XmlException; package net.loomchild.segment.srx.io; /** * Represents SRX version. * Responsible for retrieving SRX version from a reader without modifying it. * @author loomchild */ public enum SrxVersion { VERSION_1_0("1.0"), VERSION_2_0("2.0"); private final static int HEADER_BUFFER_LENGHT = 1024; private final static Pattern VERSION_PATTERN = Pattern .compile("<srx[^>]+version=\"([^\"]+)\""); private String versionString; private SrxVersion(String versionString) { this.versionString = versionString; } public String toString() { return versionString; } public static SrxVersion parse(String versionString) { for (SrxVersion version : SrxVersion.values()) { if (version.versionString.equals(versionString)) { return version; } }
throw new XmlException("Unrecognized SRX version: "
loomchild/segment
segment/src/main/java/net/loomchild/segment/srx/io/SrxVersion.java
// Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // }
import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.loomchild.segment.util.IORuntimeException; import net.loomchild.segment.util.XmlException;
} /** * Returns SRX document version. Works simply by looking in document header * of length {@link #HEADER_BUFFER_LENGHT} * and trying to match version regular expression, so it is imperfect. * It must be possible to mark the given reader ({@link Reader#mark(int)}). * * @param reader buffered reader containing SRX document with unknown version * @return version string * @throws IORuntimeException if IO error occurs * @throws IllegalArgumentException if reader does not support marking */ public static SrxVersion parse(BufferedReader reader) { try { if (!reader.markSupported()) { throw new IllegalArgumentException("Mark not supported for reader."); } reader.mark(HEADER_BUFFER_LENGHT); char[] headerBuffer = new char[HEADER_BUFFER_LENGHT]; int count = reader.read(headerBuffer); String header = new String(headerBuffer, 0, count); reader.reset(); Matcher matcher = VERSION_PATTERN.matcher(header); String versionString = null; if (matcher.find()) { versionString = matcher.group(1); } return parse(versionString); } catch (IOException e) {
// Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java // public class IORuntimeException extends RuntimeException { // // private static final long serialVersionUID = -6587044052300876023L; // // public IORuntimeException(IOException exception) { // super(exception); // } // // public void rethrow() throws IOException { // throw (IOException) getCause(); // } // // } // // Path: segment/src/main/java/net/loomchild/segment/util/XmlException.java // public class XmlException extends RuntimeException { // // private static final long serialVersionUID = -143693366659133245L; // // public XmlException(String message) { // super(message); // } // // public XmlException(String message, Throwable cause) { // super(message, cause); // } // // public XmlException(Throwable cause) { // super(cause); // } // // } // Path: segment/src/main/java/net/loomchild/segment/srx/io/SrxVersion.java import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.loomchild.segment.util.IORuntimeException; import net.loomchild.segment.util.XmlException; } /** * Returns SRX document version. Works simply by looking in document header * of length {@link #HEADER_BUFFER_LENGHT} * and trying to match version regular expression, so it is imperfect. * It must be possible to mark the given reader ({@link Reader#mark(int)}). * * @param reader buffered reader containing SRX document with unknown version * @return version string * @throws IORuntimeException if IO error occurs * @throws IllegalArgumentException if reader does not support marking */ public static SrxVersion parse(BufferedReader reader) { try { if (!reader.markSupported()) { throw new IllegalArgumentException("Mark not supported for reader."); } reader.mark(HEADER_BUFFER_LENGHT); char[] headerBuffer = new char[HEADER_BUFFER_LENGHT]; int count = reader.read(headerBuffer); String header = new String(headerBuffer, 0, count); reader.reset(); Matcher matcher = VERSION_PATTERN.matcher(header); String versionString = null; if (matcher.find()) { versionString = matcher.group(1); } return parse(versionString); } catch (IOException e) {
throw new IORuntimeException(e);
mmonkey/Destinations
src/main/java/com/github/mmonkey/destinations/entities/SpawnEntity.java
// Path: src/main/java/com/github/mmonkey/destinations/persistence/repositories/WorldRepository.java // public class WorldRepository extends EntityRepository<WorldEntity> { // // public static final WorldRepository instance = new WorldRepository(); // // /** // * Get a PlayerEntity by identifier // * // * @param identifier String // * @return PlayerEntity // */ // public Optional<WorldEntity> get(String identifier) { // Preconditions.checkNotNull(identifier); // // Session session = this.sessionFactory.openSession(); // session.beginTransaction(); // Query query = session.createNamedQuery("getWorldByIdentifier", WorldEntity.class); // query.setParameter("identifier", identifier); // // try { // WorldEntity result = (WorldEntity) query.getSingleResult(); // session.close(); // return Optional.of(result); // } catch (Exception e) { // session.close(); // return Optional.empty(); // } // } // // }
import com.flowpowered.math.vector.Vector3d; import com.github.mmonkey.destinations.persistence.repositories.WorldRepository; import com.google.common.base.Preconditions; import org.hibernate.annotations.DynamicUpdate; import javax.persistence.*; import java.io.Serializable; import java.util.Optional;
private Double yaw; @Column(name = "pitch") private Double pitch; @Column(name = "roll") private Double roll; @ManyToOne(cascade = CascadeType.MERGE, optional = false) @JoinColumn(name = "world_id", nullable = false) private WorldEntity world; /** * SpawnEntity default constructor */ public SpawnEntity() { } /** * SpawnEntity Constructor * * @param entity Entity */ public SpawnEntity(org.spongepowered.api.entity.Entity entity) { Preconditions.checkNotNull(entity); this.yaw = entity.getRotation().getX(); this.pitch = entity.getRotation().getY(); this.roll = entity.getRotation().getZ();
// Path: src/main/java/com/github/mmonkey/destinations/persistence/repositories/WorldRepository.java // public class WorldRepository extends EntityRepository<WorldEntity> { // // public static final WorldRepository instance = new WorldRepository(); // // /** // * Get a PlayerEntity by identifier // * // * @param identifier String // * @return PlayerEntity // */ // public Optional<WorldEntity> get(String identifier) { // Preconditions.checkNotNull(identifier); // // Session session = this.sessionFactory.openSession(); // session.beginTransaction(); // Query query = session.createNamedQuery("getWorldByIdentifier", WorldEntity.class); // query.setParameter("identifier", identifier); // // try { // WorldEntity result = (WorldEntity) query.getSingleResult(); // session.close(); // return Optional.of(result); // } catch (Exception e) { // session.close(); // return Optional.empty(); // } // } // // } // Path: src/main/java/com/github/mmonkey/destinations/entities/SpawnEntity.java import com.flowpowered.math.vector.Vector3d; import com.github.mmonkey.destinations.persistence.repositories.WorldRepository; import com.google.common.base.Preconditions; import org.hibernate.annotations.DynamicUpdate; import javax.persistence.*; import java.io.Serializable; import java.util.Optional; private Double yaw; @Column(name = "pitch") private Double pitch; @Column(name = "roll") private Double roll; @ManyToOne(cascade = CascadeType.MERGE, optional = false) @JoinColumn(name = "world_id", nullable = false) private WorldEntity world; /** * SpawnEntity default constructor */ public SpawnEntity() { } /** * SpawnEntity Constructor * * @param entity Entity */ public SpawnEntity(org.spongepowered.api.entity.Entity entity) { Preconditions.checkNotNull(entity); this.yaw = entity.getRotation().getX(); this.pitch = entity.getRotation().getY(); this.roll = entity.getRotation().getZ();
Optional<WorldEntity> optional = WorldRepository.instance.get(entity.getWorld().getUniqueId().toString());
mmonkey/Destinations
src/main/java/com/github/mmonkey/destinations/commands/elements/HomeCommandElement.java
// Path: src/main/java/com/github/mmonkey/destinations/persistence/cache/PlayerCache.java // public class PlayerCache { // // public static final PlayerCache instance = new PlayerCache(); // // private final Map<Player, PlayerEntity> cache = new ConcurrentHashMap<>(); // private final Map<Player, ResourceBundle> resourceCache = new ConcurrentHashMap<>(); // // /** // * Get the PlayerEntity for this Player from the cache // * // * @param player Player // * @return PlayerEntity // */ // public PlayerEntity get(Player player) { // if (!cache.containsKey(player)) { // PlayerEntity playerEntity = PlayerUtil.getPlayerEntity(player); // cache.put(player, playerEntity); // } // return cache.get(player); // } // // /** // * Set the PlayerEntity for this Player in the cache // * // * @param player Player // * @param playerEntity PlayerEntity // */ // public void set(Player player, PlayerEntity playerEntity) { // cache.put(player, playerEntity); // } // // /** // * Get the ResourceBundle for this player from the cache // * // * @param player Player // * @return ResourceBundle // */ // public ResourceBundle getResourceCache(Player player) { // if (!resourceCache.containsKey(player)) { // ResourceBundle resourceBundle = ResourceBundle.getBundle("lang/messages", player.getLocale()); // resourceCache.put(player, resourceBundle); // } // return resourceCache.get(player); // } // // }
import com.github.mmonkey.destinations.persistence.cache.PlayerCache; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.ArgumentParseException; import org.spongepowered.api.command.args.CommandArgs; import org.spongepowered.api.command.args.SelectorCommandElement; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.text.Text; import javax.annotation.Nullable; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList;
package com.github.mmonkey.destinations.commands.elements; public class HomeCommandElement extends SelectorCommandElement { /** * HomeCommandElement constructor * * @param key Text */ public HomeCommandElement(@Nullable Text key) { super(key); } @Override protected Iterable<String> getChoices(CommandSource source) { if (!(source instanceof Player)) { return null; } Player player = (Player) source; List<String> list = new CopyOnWriteArrayList<>();
// Path: src/main/java/com/github/mmonkey/destinations/persistence/cache/PlayerCache.java // public class PlayerCache { // // public static final PlayerCache instance = new PlayerCache(); // // private final Map<Player, PlayerEntity> cache = new ConcurrentHashMap<>(); // private final Map<Player, ResourceBundle> resourceCache = new ConcurrentHashMap<>(); // // /** // * Get the PlayerEntity for this Player from the cache // * // * @param player Player // * @return PlayerEntity // */ // public PlayerEntity get(Player player) { // if (!cache.containsKey(player)) { // PlayerEntity playerEntity = PlayerUtil.getPlayerEntity(player); // cache.put(player, playerEntity); // } // return cache.get(player); // } // // /** // * Set the PlayerEntity for this Player in the cache // * // * @param player Player // * @param playerEntity PlayerEntity // */ // public void set(Player player, PlayerEntity playerEntity) { // cache.put(player, playerEntity); // } // // /** // * Get the ResourceBundle for this player from the cache // * // * @param player Player // * @return ResourceBundle // */ // public ResourceBundle getResourceCache(Player player) { // if (!resourceCache.containsKey(player)) { // ResourceBundle resourceBundle = ResourceBundle.getBundle("lang/messages", player.getLocale()); // resourceCache.put(player, resourceBundle); // } // return resourceCache.get(player); // } // // } // Path: src/main/java/com/github/mmonkey/destinations/commands/elements/HomeCommandElement.java import com.github.mmonkey.destinations.persistence.cache.PlayerCache; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.ArgumentParseException; import org.spongepowered.api.command.args.CommandArgs; import org.spongepowered.api.command.args.SelectorCommandElement; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.text.Text; import javax.annotation.Nullable; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; package com.github.mmonkey.destinations.commands.elements; public class HomeCommandElement extends SelectorCommandElement { /** * HomeCommandElement constructor * * @param key Text */ public HomeCommandElement(@Nullable Text key) { super(key); } @Override protected Iterable<String> getChoices(CommandSource source) { if (!(source instanceof Player)) { return null; } Player player = (Player) source; List<String> list = new CopyOnWriteArrayList<>();
PlayerCache.instance.get(player).getHomes().forEach(home -> list.add(home.getName()));
mmonkey/Destinations
src/main/java/com/github/mmonkey/destinations/persistence/cache/SpawnCache.java
// Path: src/main/java/com/github/mmonkey/destinations/entities/SpawnEntity.java // @Entity // @DynamicUpdate // @Table(name = "spawns", uniqueConstraints = { // @UniqueConstraint(columnNames = "spawn_id") // }) // @NamedQueries({ // @NamedQuery(name = "getSpawns", query = "from SpawnEntity") // }) // public class SpawnEntity implements Serializable { // // private static final long serialVersionUID = -396101307042415790L; // // @Id // @Column(name = "spawn_id", unique = true, nullable = false) // @GeneratedValue(strategy = GenerationType.IDENTITY) // private long id; // // @Column(name = "yaw") // private Double yaw; // // @Column(name = "pitch") // private Double pitch; // // @Column(name = "roll") // private Double roll; // // @ManyToOne(cascade = CascadeType.MERGE, optional = false) // @JoinColumn(name = "world_id", nullable = false) // private WorldEntity world; // // /** // * SpawnEntity default constructor // */ // public SpawnEntity() { // } // // /** // * SpawnEntity Constructor // * // * @param entity Entity // */ // public SpawnEntity(org.spongepowered.api.entity.Entity entity) { // Preconditions.checkNotNull(entity); // // this.yaw = entity.getRotation().getX(); // this.pitch = entity.getRotation().getY(); // this.roll = entity.getRotation().getZ(); // // Optional<WorldEntity> optional = WorldRepository.instance.get(entity.getWorld().getUniqueId().toString()); // this.world = optional.orElseGet(() -> WorldRepository.instance.save(new WorldEntity(entity.getWorld()))); // } // // /** // * @return long // */ // public long getId() { // return id; // } // // /** // * @param id long // */ // public void setId(long id) { // Preconditions.checkNotNull(id); // // this.id = id; // } // // /** // * @return Double // */ // public Double getYaw() { // return yaw; // } // // /** // * @param yaw Double // */ // public void setYaw(Double yaw) { // Preconditions.checkNotNull(yaw); // // this.yaw = yaw; // } // // /** // * @return Double // */ // public Double getPitch() { // return pitch; // } // // /** // * @param pitch Double // */ // public void setPitch(Double pitch) { // Preconditions.checkNotNull(pitch); // // this.pitch = pitch; // } // // /** // * @return Double // */ // public Double getRoll() { // return roll; // } // // /** // * @param roll Double // */ // public void setRoll(Double roll) { // Preconditions.checkNotNull(roll); // // this.roll = roll; // } // // /** // * @return WorldEntity // */ // public WorldEntity getWorld() { // return world; // } // // /** // * Get this Rotation // * // * @return Vector3d // */ // public Vector3d getRotation() { // return (this.yaw == null || this.pitch == null || this.roll == null) ? new Vector3d(0, 0, 0) : new Vector3d(this.yaw, this.pitch, this.roll); // } // // }
import com.github.mmonkey.destinations.entities.SpawnEntity; import java.util.HashSet; import java.util.Set;
package com.github.mmonkey.destinations.persistence.cache; public class SpawnCache { public static final SpawnCache instance = new SpawnCache();
// Path: src/main/java/com/github/mmonkey/destinations/entities/SpawnEntity.java // @Entity // @DynamicUpdate // @Table(name = "spawns", uniqueConstraints = { // @UniqueConstraint(columnNames = "spawn_id") // }) // @NamedQueries({ // @NamedQuery(name = "getSpawns", query = "from SpawnEntity") // }) // public class SpawnEntity implements Serializable { // // private static final long serialVersionUID = -396101307042415790L; // // @Id // @Column(name = "spawn_id", unique = true, nullable = false) // @GeneratedValue(strategy = GenerationType.IDENTITY) // private long id; // // @Column(name = "yaw") // private Double yaw; // // @Column(name = "pitch") // private Double pitch; // // @Column(name = "roll") // private Double roll; // // @ManyToOne(cascade = CascadeType.MERGE, optional = false) // @JoinColumn(name = "world_id", nullable = false) // private WorldEntity world; // // /** // * SpawnEntity default constructor // */ // public SpawnEntity() { // } // // /** // * SpawnEntity Constructor // * // * @param entity Entity // */ // public SpawnEntity(org.spongepowered.api.entity.Entity entity) { // Preconditions.checkNotNull(entity); // // this.yaw = entity.getRotation().getX(); // this.pitch = entity.getRotation().getY(); // this.roll = entity.getRotation().getZ(); // // Optional<WorldEntity> optional = WorldRepository.instance.get(entity.getWorld().getUniqueId().toString()); // this.world = optional.orElseGet(() -> WorldRepository.instance.save(new WorldEntity(entity.getWorld()))); // } // // /** // * @return long // */ // public long getId() { // return id; // } // // /** // * @param id long // */ // public void setId(long id) { // Preconditions.checkNotNull(id); // // this.id = id; // } // // /** // * @return Double // */ // public Double getYaw() { // return yaw; // } // // /** // * @param yaw Double // */ // public void setYaw(Double yaw) { // Preconditions.checkNotNull(yaw); // // this.yaw = yaw; // } // // /** // * @return Double // */ // public Double getPitch() { // return pitch; // } // // /** // * @param pitch Double // */ // public void setPitch(Double pitch) { // Preconditions.checkNotNull(pitch); // // this.pitch = pitch; // } // // /** // * @return Double // */ // public Double getRoll() { // return roll; // } // // /** // * @param roll Double // */ // public void setRoll(Double roll) { // Preconditions.checkNotNull(roll); // // this.roll = roll; // } // // /** // * @return WorldEntity // */ // public WorldEntity getWorld() { // return world; // } // // /** // * Get this Rotation // * // * @return Vector3d // */ // public Vector3d getRotation() { // return (this.yaw == null || this.pitch == null || this.roll == null) ? new Vector3d(0, 0, 0) : new Vector3d(this.yaw, this.pitch, this.roll); // } // // } // Path: src/main/java/com/github/mmonkey/destinations/persistence/cache/SpawnCache.java import com.github.mmonkey.destinations.entities.SpawnEntity; import java.util.HashSet; import java.util.Set; package com.github.mmonkey.destinations.persistence.cache; public class SpawnCache { public static final SpawnCache instance = new SpawnCache();
private final Set<SpawnEntity> cache = new HashSet<>();
mmonkey/Destinations
src/main/java/com/github/mmonkey/destinations/commands/GrabCommand.java
// Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportGrabEvent.java // public class PlayerTeleportGrabEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Grab { // // /** // * PlayerTeleportGrabEvent constructor // * // * @param player Player // * @param location Location // * @param rotation Vector3d // */ // public PlayerTeleportGrabEvent(Player player, Location<World> location, Vector3d rotation) { // super(player, location, rotation); // } // } // // Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportPreEvent.java // public class PlayerTeleportPreEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Pre { // // /** // * PlayerTeleportPreEvent constructor // * // * @param player Player // * @param location Location // * @param rotation Vector3d // */ // public PlayerTeleportPreEvent(Player player, Location<World> location, Vector3d rotation) { // super(player, location, rotation); // } // // } // // Path: src/main/java/com/github/mmonkey/destinations/utilities/MessagesUtil.java // public class MessagesUtil { // // /** // * Get the message associated with this key, for this player's locale // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text get(Player player, String key, Object... args) { // ResourceBundle messages = PlayerCache.instance.getResourceCache(player); // return messages.containsKey(key) ? Text.of(String.format(messages.getString(key), args)) : Text.EMPTY; // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as a success (green). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text success(Player player, String key, Object... args) { // return Text.of(TextColors.GREEN, get(player, key, args)); // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as a warning (gold). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text warning(Player player, String key, Object... args) { // return Text.of(TextColors.GOLD, get(player, key, args)); // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as an error (red). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text error(Player player, String key, Object... args) { // return Text.of(TextColors.RED, get(player, key, args)); // } // // }
import com.github.mmonkey.destinations.events.PlayerTeleportGrabEvent; import com.github.mmonkey.destinations.events.PlayerTeleportPreEvent; import com.github.mmonkey.destinations.utilities.MessagesUtil; import org.spongepowered.api.Sponge; import org.spongepowered.api.command.CommandException; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.CommandContext; import org.spongepowered.api.command.args.GenericArguments; import org.spongepowered.api.command.spec.CommandExecutor; import org.spongepowered.api.command.spec.CommandSpec; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.text.Text;
package com.github.mmonkey.destinations.commands; public class GrabCommand implements CommandExecutor { public static final String[] ALIASES = {"grab", "tphere"}; /** * Get the Command Specifications for this command * * @return CommandSpec */ public static CommandSpec getCommandSpec() { return CommandSpec.builder() .permission("destinations.tphere") .description(Text.of("/grab <player> or /tphere <player>")) .extendedDescription(Text.of("Teleports a player to your current location.")) .executor(new GrabCommand()) .arguments(GenericArguments.player(Text.of("player"))) .build(); } @Override public CommandResult execute(CommandSource src, CommandContext args) throws CommandException { if (!(src instanceof Player)) { return CommandResult.empty(); } Player requester = (Player) src; Player target = (Player) args.getOne("player").orElse(null); if (target == null) {
// Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportGrabEvent.java // public class PlayerTeleportGrabEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Grab { // // /** // * PlayerTeleportGrabEvent constructor // * // * @param player Player // * @param location Location // * @param rotation Vector3d // */ // public PlayerTeleportGrabEvent(Player player, Location<World> location, Vector3d rotation) { // super(player, location, rotation); // } // } // // Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportPreEvent.java // public class PlayerTeleportPreEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Pre { // // /** // * PlayerTeleportPreEvent constructor // * // * @param player Player // * @param location Location // * @param rotation Vector3d // */ // public PlayerTeleportPreEvent(Player player, Location<World> location, Vector3d rotation) { // super(player, location, rotation); // } // // } // // Path: src/main/java/com/github/mmonkey/destinations/utilities/MessagesUtil.java // public class MessagesUtil { // // /** // * Get the message associated with this key, for this player's locale // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text get(Player player, String key, Object... args) { // ResourceBundle messages = PlayerCache.instance.getResourceCache(player); // return messages.containsKey(key) ? Text.of(String.format(messages.getString(key), args)) : Text.EMPTY; // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as a success (green). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text success(Player player, String key, Object... args) { // return Text.of(TextColors.GREEN, get(player, key, args)); // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as a warning (gold). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text warning(Player player, String key, Object... args) { // return Text.of(TextColors.GOLD, get(player, key, args)); // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as an error (red). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text error(Player player, String key, Object... args) { // return Text.of(TextColors.RED, get(player, key, args)); // } // // } // Path: src/main/java/com/github/mmonkey/destinations/commands/GrabCommand.java import com.github.mmonkey.destinations.events.PlayerTeleportGrabEvent; import com.github.mmonkey.destinations.events.PlayerTeleportPreEvent; import com.github.mmonkey.destinations.utilities.MessagesUtil; import org.spongepowered.api.Sponge; import org.spongepowered.api.command.CommandException; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.CommandContext; import org.spongepowered.api.command.args.GenericArguments; import org.spongepowered.api.command.spec.CommandExecutor; import org.spongepowered.api.command.spec.CommandSpec; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.text.Text; package com.github.mmonkey.destinations.commands; public class GrabCommand implements CommandExecutor { public static final String[] ALIASES = {"grab", "tphere"}; /** * Get the Command Specifications for this command * * @return CommandSpec */ public static CommandSpec getCommandSpec() { return CommandSpec.builder() .permission("destinations.tphere") .description(Text.of("/grab <player> or /tphere <player>")) .extendedDescription(Text.of("Teleports a player to your current location.")) .executor(new GrabCommand()) .arguments(GenericArguments.player(Text.of("player"))) .build(); } @Override public CommandResult execute(CommandSource src, CommandContext args) throws CommandException { if (!(src instanceof Player)) { return CommandResult.empty(); } Player requester = (Player) src; Player target = (Player) args.getOne("player").orElse(null); if (target == null) {
requester.sendMessage(MessagesUtil.error(requester, "grab.invalid_player"));
mmonkey/Destinations
src/main/java/com/github/mmonkey/destinations/commands/GrabCommand.java
// Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportGrabEvent.java // public class PlayerTeleportGrabEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Grab { // // /** // * PlayerTeleportGrabEvent constructor // * // * @param player Player // * @param location Location // * @param rotation Vector3d // */ // public PlayerTeleportGrabEvent(Player player, Location<World> location, Vector3d rotation) { // super(player, location, rotation); // } // } // // Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportPreEvent.java // public class PlayerTeleportPreEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Pre { // // /** // * PlayerTeleportPreEvent constructor // * // * @param player Player // * @param location Location // * @param rotation Vector3d // */ // public PlayerTeleportPreEvent(Player player, Location<World> location, Vector3d rotation) { // super(player, location, rotation); // } // // } // // Path: src/main/java/com/github/mmonkey/destinations/utilities/MessagesUtil.java // public class MessagesUtil { // // /** // * Get the message associated with this key, for this player's locale // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text get(Player player, String key, Object... args) { // ResourceBundle messages = PlayerCache.instance.getResourceCache(player); // return messages.containsKey(key) ? Text.of(String.format(messages.getString(key), args)) : Text.EMPTY; // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as a success (green). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text success(Player player, String key, Object... args) { // return Text.of(TextColors.GREEN, get(player, key, args)); // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as a warning (gold). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text warning(Player player, String key, Object... args) { // return Text.of(TextColors.GOLD, get(player, key, args)); // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as an error (red). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text error(Player player, String key, Object... args) { // return Text.of(TextColors.RED, get(player, key, args)); // } // // }
import com.github.mmonkey.destinations.events.PlayerTeleportGrabEvent; import com.github.mmonkey.destinations.events.PlayerTeleportPreEvent; import com.github.mmonkey.destinations.utilities.MessagesUtil; import org.spongepowered.api.Sponge; import org.spongepowered.api.command.CommandException; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.CommandContext; import org.spongepowered.api.command.args.GenericArguments; import org.spongepowered.api.command.spec.CommandExecutor; import org.spongepowered.api.command.spec.CommandSpec; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.text.Text;
package com.github.mmonkey.destinations.commands; public class GrabCommand implements CommandExecutor { public static final String[] ALIASES = {"grab", "tphere"}; /** * Get the Command Specifications for this command * * @return CommandSpec */ public static CommandSpec getCommandSpec() { return CommandSpec.builder() .permission("destinations.tphere") .description(Text.of("/grab <player> or /tphere <player>")) .extendedDescription(Text.of("Teleports a player to your current location.")) .executor(new GrabCommand()) .arguments(GenericArguments.player(Text.of("player"))) .build(); } @Override public CommandResult execute(CommandSource src, CommandContext args) throws CommandException { if (!(src instanceof Player)) { return CommandResult.empty(); } Player requester = (Player) src; Player target = (Player) args.getOne("player").orElse(null); if (target == null) { requester.sendMessage(MessagesUtil.error(requester, "grab.invalid_player")); return CommandResult.success(); }
// Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportGrabEvent.java // public class PlayerTeleportGrabEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Grab { // // /** // * PlayerTeleportGrabEvent constructor // * // * @param player Player // * @param location Location // * @param rotation Vector3d // */ // public PlayerTeleportGrabEvent(Player player, Location<World> location, Vector3d rotation) { // super(player, location, rotation); // } // } // // Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportPreEvent.java // public class PlayerTeleportPreEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Pre { // // /** // * PlayerTeleportPreEvent constructor // * // * @param player Player // * @param location Location // * @param rotation Vector3d // */ // public PlayerTeleportPreEvent(Player player, Location<World> location, Vector3d rotation) { // super(player, location, rotation); // } // // } // // Path: src/main/java/com/github/mmonkey/destinations/utilities/MessagesUtil.java // public class MessagesUtil { // // /** // * Get the message associated with this key, for this player's locale // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text get(Player player, String key, Object... args) { // ResourceBundle messages = PlayerCache.instance.getResourceCache(player); // return messages.containsKey(key) ? Text.of(String.format(messages.getString(key), args)) : Text.EMPTY; // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as a success (green). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text success(Player player, String key, Object... args) { // return Text.of(TextColors.GREEN, get(player, key, args)); // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as a warning (gold). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text warning(Player player, String key, Object... args) { // return Text.of(TextColors.GOLD, get(player, key, args)); // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as an error (red). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text error(Player player, String key, Object... args) { // return Text.of(TextColors.RED, get(player, key, args)); // } // // } // Path: src/main/java/com/github/mmonkey/destinations/commands/GrabCommand.java import com.github.mmonkey.destinations.events.PlayerTeleportGrabEvent; import com.github.mmonkey.destinations.events.PlayerTeleportPreEvent; import com.github.mmonkey.destinations.utilities.MessagesUtil; import org.spongepowered.api.Sponge; import org.spongepowered.api.command.CommandException; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.CommandContext; import org.spongepowered.api.command.args.GenericArguments; import org.spongepowered.api.command.spec.CommandExecutor; import org.spongepowered.api.command.spec.CommandSpec; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.text.Text; package com.github.mmonkey.destinations.commands; public class GrabCommand implements CommandExecutor { public static final String[] ALIASES = {"grab", "tphere"}; /** * Get the Command Specifications for this command * * @return CommandSpec */ public static CommandSpec getCommandSpec() { return CommandSpec.builder() .permission("destinations.tphere") .description(Text.of("/grab <player> or /tphere <player>")) .extendedDescription(Text.of("Teleports a player to your current location.")) .executor(new GrabCommand()) .arguments(GenericArguments.player(Text.of("player"))) .build(); } @Override public CommandResult execute(CommandSource src, CommandContext args) throws CommandException { if (!(src instanceof Player)) { return CommandResult.empty(); } Player requester = (Player) src; Player target = (Player) args.getOne("player").orElse(null); if (target == null) { requester.sendMessage(MessagesUtil.error(requester, "grab.invalid_player")); return CommandResult.success(); }
Sponge.getGame().getEventManager().post(new PlayerTeleportPreEvent(target, target.getLocation(), target.getRotation()));
mmonkey/Destinations
src/main/java/com/github/mmonkey/destinations/commands/GrabCommand.java
// Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportGrabEvent.java // public class PlayerTeleportGrabEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Grab { // // /** // * PlayerTeleportGrabEvent constructor // * // * @param player Player // * @param location Location // * @param rotation Vector3d // */ // public PlayerTeleportGrabEvent(Player player, Location<World> location, Vector3d rotation) { // super(player, location, rotation); // } // } // // Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportPreEvent.java // public class PlayerTeleportPreEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Pre { // // /** // * PlayerTeleportPreEvent constructor // * // * @param player Player // * @param location Location // * @param rotation Vector3d // */ // public PlayerTeleportPreEvent(Player player, Location<World> location, Vector3d rotation) { // super(player, location, rotation); // } // // } // // Path: src/main/java/com/github/mmonkey/destinations/utilities/MessagesUtil.java // public class MessagesUtil { // // /** // * Get the message associated with this key, for this player's locale // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text get(Player player, String key, Object... args) { // ResourceBundle messages = PlayerCache.instance.getResourceCache(player); // return messages.containsKey(key) ? Text.of(String.format(messages.getString(key), args)) : Text.EMPTY; // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as a success (green). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text success(Player player, String key, Object... args) { // return Text.of(TextColors.GREEN, get(player, key, args)); // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as a warning (gold). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text warning(Player player, String key, Object... args) { // return Text.of(TextColors.GOLD, get(player, key, args)); // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as an error (red). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text error(Player player, String key, Object... args) { // return Text.of(TextColors.RED, get(player, key, args)); // } // // }
import com.github.mmonkey.destinations.events.PlayerTeleportGrabEvent; import com.github.mmonkey.destinations.events.PlayerTeleportPreEvent; import com.github.mmonkey.destinations.utilities.MessagesUtil; import org.spongepowered.api.Sponge; import org.spongepowered.api.command.CommandException; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.CommandContext; import org.spongepowered.api.command.args.GenericArguments; import org.spongepowered.api.command.spec.CommandExecutor; import org.spongepowered.api.command.spec.CommandSpec; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.text.Text;
package com.github.mmonkey.destinations.commands; public class GrabCommand implements CommandExecutor { public static final String[] ALIASES = {"grab", "tphere"}; /** * Get the Command Specifications for this command * * @return CommandSpec */ public static CommandSpec getCommandSpec() { return CommandSpec.builder() .permission("destinations.tphere") .description(Text.of("/grab <player> or /tphere <player>")) .extendedDescription(Text.of("Teleports a player to your current location.")) .executor(new GrabCommand()) .arguments(GenericArguments.player(Text.of("player"))) .build(); } @Override public CommandResult execute(CommandSource src, CommandContext args) throws CommandException { if (!(src instanceof Player)) { return CommandResult.empty(); } Player requester = (Player) src; Player target = (Player) args.getOne("player").orElse(null); if (target == null) { requester.sendMessage(MessagesUtil.error(requester, "grab.invalid_player")); return CommandResult.success(); } Sponge.getGame().getEventManager().post(new PlayerTeleportPreEvent(target, target.getLocation(), target.getRotation()));
// Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportGrabEvent.java // public class PlayerTeleportGrabEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Grab { // // /** // * PlayerTeleportGrabEvent constructor // * // * @param player Player // * @param location Location // * @param rotation Vector3d // */ // public PlayerTeleportGrabEvent(Player player, Location<World> location, Vector3d rotation) { // super(player, location, rotation); // } // } // // Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportPreEvent.java // public class PlayerTeleportPreEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Pre { // // /** // * PlayerTeleportPreEvent constructor // * // * @param player Player // * @param location Location // * @param rotation Vector3d // */ // public PlayerTeleportPreEvent(Player player, Location<World> location, Vector3d rotation) { // super(player, location, rotation); // } // // } // // Path: src/main/java/com/github/mmonkey/destinations/utilities/MessagesUtil.java // public class MessagesUtil { // // /** // * Get the message associated with this key, for this player's locale // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text get(Player player, String key, Object... args) { // ResourceBundle messages = PlayerCache.instance.getResourceCache(player); // return messages.containsKey(key) ? Text.of(String.format(messages.getString(key), args)) : Text.EMPTY; // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as a success (green). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text success(Player player, String key, Object... args) { // return Text.of(TextColors.GREEN, get(player, key, args)); // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as a warning (gold). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text warning(Player player, String key, Object... args) { // return Text.of(TextColors.GOLD, get(player, key, args)); // } // // /** // * Get the message associated with this key, for this player's locale. // * Message colored as an error (red). // * // * @param player Player // * @param key String // * @param args String.format args // * @return Text formatting of message // */ // public static Text error(Player player, String key, Object... args) { // return Text.of(TextColors.RED, get(player, key, args)); // } // // } // Path: src/main/java/com/github/mmonkey/destinations/commands/GrabCommand.java import com.github.mmonkey.destinations.events.PlayerTeleportGrabEvent; import com.github.mmonkey.destinations.events.PlayerTeleportPreEvent; import com.github.mmonkey.destinations.utilities.MessagesUtil; import org.spongepowered.api.Sponge; import org.spongepowered.api.command.CommandException; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.CommandContext; import org.spongepowered.api.command.args.GenericArguments; import org.spongepowered.api.command.spec.CommandExecutor; import org.spongepowered.api.command.spec.CommandSpec; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.text.Text; package com.github.mmonkey.destinations.commands; public class GrabCommand implements CommandExecutor { public static final String[] ALIASES = {"grab", "tphere"}; /** * Get the Command Specifications for this command * * @return CommandSpec */ public static CommandSpec getCommandSpec() { return CommandSpec.builder() .permission("destinations.tphere") .description(Text.of("/grab <player> or /tphere <player>")) .extendedDescription(Text.of("Teleports a player to your current location.")) .executor(new GrabCommand()) .arguments(GenericArguments.player(Text.of("player"))) .build(); } @Override public CommandResult execute(CommandSource src, CommandContext args) throws CommandException { if (!(src instanceof Player)) { return CommandResult.empty(); } Player requester = (Player) src; Player target = (Player) args.getOne("player").orElse(null); if (target == null) { requester.sendMessage(MessagesUtil.error(requester, "grab.invalid_player")); return CommandResult.success(); } Sponge.getGame().getEventManager().post(new PlayerTeleportPreEvent(target, target.getLocation(), target.getRotation()));
Sponge.getGame().getEventManager().post(new PlayerTeleportGrabEvent(target, requester.getLocation(), requester.getRotation()));
mmonkey/Destinations
src/main/java/com/github/mmonkey/destinations/persistence/cache/WarpCache.java
// Path: src/main/java/com/github/mmonkey/destinations/entities/WarpEntity.java // @Entity // @DynamicUpdate // @Table(name = "warps", uniqueConstraints = { // @UniqueConstraint(columnNames = "warp_id"), @UniqueConstraint(columnNames = "name") // }) // @NamedQueries({ // @NamedQuery(name = "getWarps", query = "from WarpEntity") // }) // public class WarpEntity implements Serializable { // // private static final long serialVersionUID = 8469390755174027818L; // // @Id // @Column(name = "warp_id", unique = true, nullable = false) // @GeneratedValue(strategy = GenerationType.IDENTITY) // private long id; // // @Column(name = "name", unique = true, nullable = false) // private String name; // // @Column(name = "is_private") // private boolean isPrivate; // // @OneToOne(cascade = CascadeType.ALL) // @JoinColumn(name = "location_id", nullable = false) // private LocationEntity location; // // @ManyToOne // @JoinColumn(name = "owner_id", nullable = false) // private PlayerEntity owner; // // @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true) // private Set<AccessEntity> access; // // /** // * WarpEntity default constructor // */ // public WarpEntity() { // } // // /** // * WarpEntity constructor // * // * @param name String // * @param isPrivate boolean // * @param location LocationEntity // * @param owner PlayerEntity // */ // public WarpEntity(String name, boolean isPrivate, LocationEntity location, PlayerEntity owner) { // Preconditions.checkNotNull(name); // Preconditions.checkNotNull(location); // Preconditions.checkNotNull(owner); // // this.name = name; // this.isPrivate = isPrivate; // this.location = location; // this.owner = owner; // } // // /** // * @return long // */ // public long getId() { // return id; // } // // /** // * @param id long // */ // public void setId(long id) { // Preconditions.checkNotNull(id); // // this.id = id; // } // // /** // * @return String // */ // public String getName() { // return name; // } // // /** // * @param name String // */ // public void setName(String name) { // Preconditions.checkNotNull(name); // // this.name = name; // } // // /** // * @return boolean // */ // public boolean isPrivate() { // return isPrivate; // } // // /** // * @param isPrivate boolean // */ // public void setPrivate(boolean isPrivate) { // isPrivate = isPrivate; // } // // /** // * @return LocationEntity // */ // public LocationEntity getLocation() { // return location; // } // // /** // * @param location LocationEntity // */ // public void setLocation(LocationEntity location) { // Preconditions.checkNotNull(location); // // this.location = location; // } // // /** // * @return PlayerEntity // */ // public PlayerEntity getOwner() { // return owner; // } // // /** // * @param owner PlayerEntity // */ // public void setOwner(PlayerEntity owner) { // Preconditions.checkNotNull(owner); // // this.owner = owner; // } // // /** // * @return Set<AccessEntity> // */ // public Set<AccessEntity> getAccess() { // return access; // } // // /** // * @param access Set<AccessEntity> // */ // public void setAccess(Set<AccessEntity> access) { // Preconditions.checkNotNull(access); // // this.access = access; // } // // }
import com.github.mmonkey.destinations.entities.WarpEntity; import java.util.HashSet; import java.util.Set;
package com.github.mmonkey.destinations.persistence.cache; public class WarpCache { public static final WarpCache instance = new WarpCache();
// Path: src/main/java/com/github/mmonkey/destinations/entities/WarpEntity.java // @Entity // @DynamicUpdate // @Table(name = "warps", uniqueConstraints = { // @UniqueConstraint(columnNames = "warp_id"), @UniqueConstraint(columnNames = "name") // }) // @NamedQueries({ // @NamedQuery(name = "getWarps", query = "from WarpEntity") // }) // public class WarpEntity implements Serializable { // // private static final long serialVersionUID = 8469390755174027818L; // // @Id // @Column(name = "warp_id", unique = true, nullable = false) // @GeneratedValue(strategy = GenerationType.IDENTITY) // private long id; // // @Column(name = "name", unique = true, nullable = false) // private String name; // // @Column(name = "is_private") // private boolean isPrivate; // // @OneToOne(cascade = CascadeType.ALL) // @JoinColumn(name = "location_id", nullable = false) // private LocationEntity location; // // @ManyToOne // @JoinColumn(name = "owner_id", nullable = false) // private PlayerEntity owner; // // @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true) // private Set<AccessEntity> access; // // /** // * WarpEntity default constructor // */ // public WarpEntity() { // } // // /** // * WarpEntity constructor // * // * @param name String // * @param isPrivate boolean // * @param location LocationEntity // * @param owner PlayerEntity // */ // public WarpEntity(String name, boolean isPrivate, LocationEntity location, PlayerEntity owner) { // Preconditions.checkNotNull(name); // Preconditions.checkNotNull(location); // Preconditions.checkNotNull(owner); // // this.name = name; // this.isPrivate = isPrivate; // this.location = location; // this.owner = owner; // } // // /** // * @return long // */ // public long getId() { // return id; // } // // /** // * @param id long // */ // public void setId(long id) { // Preconditions.checkNotNull(id); // // this.id = id; // } // // /** // * @return String // */ // public String getName() { // return name; // } // // /** // * @param name String // */ // public void setName(String name) { // Preconditions.checkNotNull(name); // // this.name = name; // } // // /** // * @return boolean // */ // public boolean isPrivate() { // return isPrivate; // } // // /** // * @param isPrivate boolean // */ // public void setPrivate(boolean isPrivate) { // isPrivate = isPrivate; // } // // /** // * @return LocationEntity // */ // public LocationEntity getLocation() { // return location; // } // // /** // * @param location LocationEntity // */ // public void setLocation(LocationEntity location) { // Preconditions.checkNotNull(location); // // this.location = location; // } // // /** // * @return PlayerEntity // */ // public PlayerEntity getOwner() { // return owner; // } // // /** // * @param owner PlayerEntity // */ // public void setOwner(PlayerEntity owner) { // Preconditions.checkNotNull(owner); // // this.owner = owner; // } // // /** // * @return Set<AccessEntity> // */ // public Set<AccessEntity> getAccess() { // return access; // } // // /** // * @param access Set<AccessEntity> // */ // public void setAccess(Set<AccessEntity> access) { // Preconditions.checkNotNull(access); // // this.access = access; // } // // } // Path: src/main/java/com/github/mmonkey/destinations/persistence/cache/WarpCache.java import com.github.mmonkey.destinations.entities.WarpEntity; import java.util.HashSet; import java.util.Set; package com.github.mmonkey.destinations.persistence.cache; public class WarpCache { public static final WarpCache instance = new WarpCache();
private final Set<WarpEntity> cache = new HashSet<>();
mmonkey/Destinations
src/main/java/com/github/mmonkey/destinations/utilities/MessagesUtil.java
// Path: src/main/java/com/github/mmonkey/destinations/persistence/cache/PlayerCache.java // public class PlayerCache { // // public static final PlayerCache instance = new PlayerCache(); // // private final Map<Player, PlayerEntity> cache = new ConcurrentHashMap<>(); // private final Map<Player, ResourceBundle> resourceCache = new ConcurrentHashMap<>(); // // /** // * Get the PlayerEntity for this Player from the cache // * // * @param player Player // * @return PlayerEntity // */ // public PlayerEntity get(Player player) { // if (!cache.containsKey(player)) { // PlayerEntity playerEntity = PlayerUtil.getPlayerEntity(player); // cache.put(player, playerEntity); // } // return cache.get(player); // } // // /** // * Set the PlayerEntity for this Player in the cache // * // * @param player Player // * @param playerEntity PlayerEntity // */ // public void set(Player player, PlayerEntity playerEntity) { // cache.put(player, playerEntity); // } // // /** // * Get the ResourceBundle for this player from the cache // * // * @param player Player // * @return ResourceBundle // */ // public ResourceBundle getResourceCache(Player player) { // if (!resourceCache.containsKey(player)) { // ResourceBundle resourceBundle = ResourceBundle.getBundle("lang/messages", player.getLocale()); // resourceCache.put(player, resourceBundle); // } // return resourceCache.get(player); // } // // }
import com.github.mmonkey.destinations.persistence.cache.PlayerCache; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.text.Text; import org.spongepowered.api.text.format.TextColors; import java.util.ResourceBundle;
package com.github.mmonkey.destinations.utilities; public class MessagesUtil { /** * Get the message associated with this key, for this player's locale * * @param player Player * @param key String * @param args String.format args * @return Text formatting of message */ public static Text get(Player player, String key, Object... args) {
// Path: src/main/java/com/github/mmonkey/destinations/persistence/cache/PlayerCache.java // public class PlayerCache { // // public static final PlayerCache instance = new PlayerCache(); // // private final Map<Player, PlayerEntity> cache = new ConcurrentHashMap<>(); // private final Map<Player, ResourceBundle> resourceCache = new ConcurrentHashMap<>(); // // /** // * Get the PlayerEntity for this Player from the cache // * // * @param player Player // * @return PlayerEntity // */ // public PlayerEntity get(Player player) { // if (!cache.containsKey(player)) { // PlayerEntity playerEntity = PlayerUtil.getPlayerEntity(player); // cache.put(player, playerEntity); // } // return cache.get(player); // } // // /** // * Set the PlayerEntity for this Player in the cache // * // * @param player Player // * @param playerEntity PlayerEntity // */ // public void set(Player player, PlayerEntity playerEntity) { // cache.put(player, playerEntity); // } // // /** // * Get the ResourceBundle for this player from the cache // * // * @param player Player // * @return ResourceBundle // */ // public ResourceBundle getResourceCache(Player player) { // if (!resourceCache.containsKey(player)) { // ResourceBundle resourceBundle = ResourceBundle.getBundle("lang/messages", player.getLocale()); // resourceCache.put(player, resourceBundle); // } // return resourceCache.get(player); // } // // } // Path: src/main/java/com/github/mmonkey/destinations/utilities/MessagesUtil.java import com.github.mmonkey.destinations.persistence.cache.PlayerCache; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.text.Text; import org.spongepowered.api.text.format.TextColors; import java.util.ResourceBundle; package com.github.mmonkey.destinations.utilities; public class MessagesUtil { /** * Get the message associated with this key, for this player's locale * * @param player Player * @param key String * @param args String.format args * @return Text formatting of message */ public static Text get(Player player, String key, Object... args) {
ResourceBundle messages = PlayerCache.instance.getResourceCache(player);
mmonkey/Destinations
src/main/java/com/github/mmonkey/destinations/entities/LocationEntity.java
// Path: src/main/java/com/github/mmonkey/destinations/persistence/repositories/WorldRepository.java // public class WorldRepository extends EntityRepository<WorldEntity> { // // public static final WorldRepository instance = new WorldRepository(); // // /** // * Get a PlayerEntity by identifier // * // * @param identifier String // * @return PlayerEntity // */ // public Optional<WorldEntity> get(String identifier) { // Preconditions.checkNotNull(identifier); // // Session session = this.sessionFactory.openSession(); // session.beginTransaction(); // Query query = session.createNamedQuery("getWorldByIdentifier", WorldEntity.class); // query.setParameter("identifier", identifier); // // try { // WorldEntity result = (WorldEntity) query.getSingleResult(); // session.close(); // return Optional.of(result); // } catch (Exception e) { // session.close(); // return Optional.empty(); // } // } // // }
import com.flowpowered.math.vector.Vector3d; import com.github.mmonkey.destinations.persistence.repositories.WorldRepository; import com.google.common.base.Preconditions; import org.hibernate.annotations.DynamicUpdate; import org.spongepowered.api.Sponge; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.persistence.*; import java.io.Serializable; import java.util.Optional; import java.util.UUID;
private Double pitch; @Column(name = "roll") private Double roll; @ManyToOne(cascade = CascadeType.MERGE, optional = false) @JoinColumn(name = "world_id", nullable = false) private WorldEntity world; /** * LocationEntity default constructor */ public LocationEntity() { } /** * LocationEntity constructor * * @param entity WorldEntity */ public LocationEntity(org.spongepowered.api.entity.Entity entity) { Preconditions.checkNotNull(entity); this.x = entity.getLocation().getX(); this.y = entity.getLocation().getY(); this.z = entity.getLocation().getZ(); this.yaw = entity.getRotation().getX(); this.pitch = entity.getRotation().getY(); this.roll = entity.getRotation().getZ();
// Path: src/main/java/com/github/mmonkey/destinations/persistence/repositories/WorldRepository.java // public class WorldRepository extends EntityRepository<WorldEntity> { // // public static final WorldRepository instance = new WorldRepository(); // // /** // * Get a PlayerEntity by identifier // * // * @param identifier String // * @return PlayerEntity // */ // public Optional<WorldEntity> get(String identifier) { // Preconditions.checkNotNull(identifier); // // Session session = this.sessionFactory.openSession(); // session.beginTransaction(); // Query query = session.createNamedQuery("getWorldByIdentifier", WorldEntity.class); // query.setParameter("identifier", identifier); // // try { // WorldEntity result = (WorldEntity) query.getSingleResult(); // session.close(); // return Optional.of(result); // } catch (Exception e) { // session.close(); // return Optional.empty(); // } // } // // } // Path: src/main/java/com/github/mmonkey/destinations/entities/LocationEntity.java import com.flowpowered.math.vector.Vector3d; import com.github.mmonkey.destinations.persistence.repositories.WorldRepository; import com.google.common.base.Preconditions; import org.hibernate.annotations.DynamicUpdate; import org.spongepowered.api.Sponge; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.persistence.*; import java.io.Serializable; import java.util.Optional; import java.util.UUID; private Double pitch; @Column(name = "roll") private Double roll; @ManyToOne(cascade = CascadeType.MERGE, optional = false) @JoinColumn(name = "world_id", nullable = false) private WorldEntity world; /** * LocationEntity default constructor */ public LocationEntity() { } /** * LocationEntity constructor * * @param entity WorldEntity */ public LocationEntity(org.spongepowered.api.entity.Entity entity) { Preconditions.checkNotNull(entity); this.x = entity.getLocation().getX(); this.y = entity.getLocation().getY(); this.z = entity.getLocation().getZ(); this.yaw = entity.getRotation().getX(); this.pitch = entity.getRotation().getY(); this.roll = entity.getRotation().getZ();
Optional<WorldEntity> optional = WorldRepository.instance.get(entity.getWorld().getUniqueId().toString());
mmonkey/Destinations
src/main/java/com/github/mmonkey/destinations/persistence/repositories/EntityRepository.java
// Path: src/main/java/com/github/mmonkey/destinations/persistence/PersistenceService.java // public class PersistenceService { // // private static PersistenceService instance; // private final Configuration configuration; // private final String type; // private final String url; // private final String database; // private final String username; // private final String password; // // private SessionFactory sessionFactory; // // /** // * PersistenceService constructor // */ // public PersistenceService(Configuration configuration, String type, String url, String database, String username, String password) // throws IOException, ClassNotFoundException { // Preconditions.checkNotNull(configuration); // Preconditions.checkArgument(!type.isEmpty()); // Preconditions.checkArgument(!url.isEmpty()); // Preconditions.checkArgument(!database.isEmpty()); // Preconditions.checkArgument(!username.isEmpty()); // Preconditions.checkArgument(!password.isEmpty()); // // instance = this; // this.configuration = configuration; // this.type = type; // this.url = url; // this.database = database; // this.username = username; // this.password = password; // this.initialize(); // } // // /** // * @return PersistenceService // */ // public static PersistenceService getInstance() { // return instance; // } // // /** // * @return SessionFactory // */ // public SessionFactory getSessionFactory() { // return this.sessionFactory; // } // // /** // * Initialize the database connection // */ // private void initialize() throws IOException, ClassNotFoundException { // Properties properties = new Properties(); // // // Dynamically load the database properties based on type // InputStream databaseProperties = getClass().getClassLoader().getResourceAsStream(this.type.toLowerCase() + ".properties"); // properties.load(databaseProperties); // databaseProperties.close(); // // // Load HikariCP properties // InputStream connectionPoolProperties = getClass().getClassLoader().getResourceAsStream("hikari.properties"); // properties.load(connectionPoolProperties); // connectionPoolProperties.close(); // // // Updated database connection properties // properties.setProperty("hibernate.connection.url", url + database); // properties.setProperty("hibernate.connection.username", username); // properties.setProperty("hibernate.connection.password", password); // this.configuration.addProperties(properties); // // // Load the driver class for this database type // Class.forName(properties.getProperty("hibernate.connection.driver_class")); // // // Create the session factory // ServiceRegistry registry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build(); // this.sessionFactory = configuration.buildSessionFactory(registry); // } // // }
import com.github.mmonkey.destinations.persistence.PersistenceService; import com.google.common.base.Preconditions; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction;
package com.github.mmonkey.destinations.persistence.repositories; public abstract class EntityRepository<Entity> { final SessionFactory sessionFactory; /** * EntityRepository constructor */ EntityRepository() {
// Path: src/main/java/com/github/mmonkey/destinations/persistence/PersistenceService.java // public class PersistenceService { // // private static PersistenceService instance; // private final Configuration configuration; // private final String type; // private final String url; // private final String database; // private final String username; // private final String password; // // private SessionFactory sessionFactory; // // /** // * PersistenceService constructor // */ // public PersistenceService(Configuration configuration, String type, String url, String database, String username, String password) // throws IOException, ClassNotFoundException { // Preconditions.checkNotNull(configuration); // Preconditions.checkArgument(!type.isEmpty()); // Preconditions.checkArgument(!url.isEmpty()); // Preconditions.checkArgument(!database.isEmpty()); // Preconditions.checkArgument(!username.isEmpty()); // Preconditions.checkArgument(!password.isEmpty()); // // instance = this; // this.configuration = configuration; // this.type = type; // this.url = url; // this.database = database; // this.username = username; // this.password = password; // this.initialize(); // } // // /** // * @return PersistenceService // */ // public static PersistenceService getInstance() { // return instance; // } // // /** // * @return SessionFactory // */ // public SessionFactory getSessionFactory() { // return this.sessionFactory; // } // // /** // * Initialize the database connection // */ // private void initialize() throws IOException, ClassNotFoundException { // Properties properties = new Properties(); // // // Dynamically load the database properties based on type // InputStream databaseProperties = getClass().getClassLoader().getResourceAsStream(this.type.toLowerCase() + ".properties"); // properties.load(databaseProperties); // databaseProperties.close(); // // // Load HikariCP properties // InputStream connectionPoolProperties = getClass().getClassLoader().getResourceAsStream("hikari.properties"); // properties.load(connectionPoolProperties); // connectionPoolProperties.close(); // // // Updated database connection properties // properties.setProperty("hibernate.connection.url", url + database); // properties.setProperty("hibernate.connection.username", username); // properties.setProperty("hibernate.connection.password", password); // this.configuration.addProperties(properties); // // // Load the driver class for this database type // Class.forName(properties.getProperty("hibernate.connection.driver_class")); // // // Create the session factory // ServiceRegistry registry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build(); // this.sessionFactory = configuration.buildSessionFactory(registry); // } // // } // Path: src/main/java/com/github/mmonkey/destinations/persistence/repositories/EntityRepository.java import com.github.mmonkey.destinations.persistence.PersistenceService; import com.google.common.base.Preconditions; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; package com.github.mmonkey.destinations.persistence.repositories; public abstract class EntityRepository<Entity> { final SessionFactory sessionFactory; /** * EntityRepository constructor */ EntityRepository() {
this.sessionFactory = PersistenceService.getInstance().getSessionFactory();
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxSuccessHandler<T extends JSObject> extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxSuccessHandler<T extends JSObject> extends JSObject {
void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/types/JQueryAjaxTransportHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryAjaxTransportHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryAjaxTransportHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryAjaxTransportHandler extends JSObject {
JQueryTransport onTransport(JQueryAjaxSettingsObject options, JQueryAjaxSettingsObject originalOptions, JQueryXHR jqXHR);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/types/JQueryAjaxTransportHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryAjaxTransportHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryAjaxTransportHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryAjaxTransportHandler extends JSObject {
JQueryTransport onTransport(JQueryAjaxSettingsObject options, JQueryAjaxSettingsObject originalOptions, JQueryXHR jqXHR);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxDoneHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxDoneHandler<T extends JSObject> extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxDoneHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxDoneHandler<T extends JSObject> extends JSObject {
void onDone(T data, JSString textStatus, JQueryXHR jqXHR);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFailHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxFailHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFailHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxFailHandler extends JSObject {
void onFail(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxAlwaysHandler.java // @JSFunctor // public interface AjaxAlwaysHandler extends JSObject { // // void onAlways(JSObject dataOrJqXHR, JSString textStatus, JSObject jqXHROrErrorThrown); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxDoneHandler.java // @JSFunctor // public interface AjaxDoneHandler<T extends JSObject> extends JSObject { // // void onDone(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFailHandler.java // @JSFunctor // public interface AjaxFailHandler extends JSObject { // // void onFail(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryPromise.java // public interface JQueryPromise extends JSObject { // // String state(); // // JQueryPromise always(JQueryPromiseCallback1<?> alwaysCallback); // // JQueryPromise done(JQueryPromiseCallback1<?> doneCallback); // // JQueryPromise fail(JQueryPromiseCallback1<?> failCallback); // // JQueryPromise progress(JQueryPromiseCallback1<?> progressCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback, JQueryPromiseCallback1<?> failCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback, JQueryPromiseCallback1<?> failCallback, // JQueryPromiseCallback1<?> progressCallback); // // }
import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.ajax.XMLHttpRequest; import de.iterable.teavm.jquery.ajax.handler.AjaxAlwaysHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxDoneHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFailHandler; import de.iterable.teavm.jquery.types.JQueryPromise;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax; /** * * This object provides a subset of the methods of the Deferred object * (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred. * * @author Jan-Felix Wittmann */ public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { @Override public abstract void overrideMimeType(String mimeType); public abstract void abort(); public abstract void abort(String statusText);
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxAlwaysHandler.java // @JSFunctor // public interface AjaxAlwaysHandler extends JSObject { // // void onAlways(JSObject dataOrJqXHR, JSString textStatus, JSObject jqXHROrErrorThrown); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxDoneHandler.java // @JSFunctor // public interface AjaxDoneHandler<T extends JSObject> extends JSObject { // // void onDone(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFailHandler.java // @JSFunctor // public interface AjaxFailHandler extends JSObject { // // void onFail(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryPromise.java // public interface JQueryPromise extends JSObject { // // String state(); // // JQueryPromise always(JQueryPromiseCallback1<?> alwaysCallback); // // JQueryPromise done(JQueryPromiseCallback1<?> doneCallback); // // JQueryPromise fail(JQueryPromiseCallback1<?> failCallback); // // JQueryPromise progress(JQueryPromiseCallback1<?> progressCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback, JQueryPromiseCallback1<?> failCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback, JQueryPromiseCallback1<?> failCallback, // JQueryPromiseCallback1<?> progressCallback); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.ajax.XMLHttpRequest; import de.iterable.teavm.jquery.ajax.handler.AjaxAlwaysHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxDoneHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFailHandler; import de.iterable.teavm.jquery.types.JQueryPromise; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax; /** * * This object provides a subset of the methods of the Deferred object * (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred. * * @author Jan-Felix Wittmann */ public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { @Override public abstract void overrideMimeType(String mimeType); public abstract void abort(); public abstract void abort(String statusText);
public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxAlwaysHandler.java // @JSFunctor // public interface AjaxAlwaysHandler extends JSObject { // // void onAlways(JSObject dataOrJqXHR, JSString textStatus, JSObject jqXHROrErrorThrown); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxDoneHandler.java // @JSFunctor // public interface AjaxDoneHandler<T extends JSObject> extends JSObject { // // void onDone(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFailHandler.java // @JSFunctor // public interface AjaxFailHandler extends JSObject { // // void onFail(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryPromise.java // public interface JQueryPromise extends JSObject { // // String state(); // // JQueryPromise always(JQueryPromiseCallback1<?> alwaysCallback); // // JQueryPromise done(JQueryPromiseCallback1<?> doneCallback); // // JQueryPromise fail(JQueryPromiseCallback1<?> failCallback); // // JQueryPromise progress(JQueryPromiseCallback1<?> progressCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback, JQueryPromiseCallback1<?> failCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback, JQueryPromiseCallback1<?> failCallback, // JQueryPromiseCallback1<?> progressCallback); // // }
import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.ajax.XMLHttpRequest; import de.iterable.teavm.jquery.ajax.handler.AjaxAlwaysHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxDoneHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFailHandler; import de.iterable.teavm.jquery.types.JQueryPromise;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax; /** * * This object provides a subset of the methods of the Deferred object * (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred. * * @author Jan-Felix Wittmann */ public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { @Override public abstract void overrideMimeType(String mimeType); public abstract void abort(); public abstract void abort(String statusText); public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback);
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxAlwaysHandler.java // @JSFunctor // public interface AjaxAlwaysHandler extends JSObject { // // void onAlways(JSObject dataOrJqXHR, JSString textStatus, JSObject jqXHROrErrorThrown); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxDoneHandler.java // @JSFunctor // public interface AjaxDoneHandler<T extends JSObject> extends JSObject { // // void onDone(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFailHandler.java // @JSFunctor // public interface AjaxFailHandler extends JSObject { // // void onFail(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryPromise.java // public interface JQueryPromise extends JSObject { // // String state(); // // JQueryPromise always(JQueryPromiseCallback1<?> alwaysCallback); // // JQueryPromise done(JQueryPromiseCallback1<?> doneCallback); // // JQueryPromise fail(JQueryPromiseCallback1<?> failCallback); // // JQueryPromise progress(JQueryPromiseCallback1<?> progressCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback, JQueryPromiseCallback1<?> failCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback, JQueryPromiseCallback1<?> failCallback, // JQueryPromiseCallback1<?> progressCallback); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.ajax.XMLHttpRequest; import de.iterable.teavm.jquery.ajax.handler.AjaxAlwaysHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxDoneHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFailHandler; import de.iterable.teavm.jquery.types.JQueryPromise; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax; /** * * This object provides a subset of the methods of the Deferred object * (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred. * * @author Jan-Felix Wittmann */ public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { @Override public abstract void overrideMimeType(String mimeType); public abstract void abort(); public abstract void abort(String statusText); public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback);
public abstract JQueryXHR fail(AjaxFailHandler failCallback);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxAlwaysHandler.java // @JSFunctor // public interface AjaxAlwaysHandler extends JSObject { // // void onAlways(JSObject dataOrJqXHR, JSString textStatus, JSObject jqXHROrErrorThrown); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxDoneHandler.java // @JSFunctor // public interface AjaxDoneHandler<T extends JSObject> extends JSObject { // // void onDone(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFailHandler.java // @JSFunctor // public interface AjaxFailHandler extends JSObject { // // void onFail(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryPromise.java // public interface JQueryPromise extends JSObject { // // String state(); // // JQueryPromise always(JQueryPromiseCallback1<?> alwaysCallback); // // JQueryPromise done(JQueryPromiseCallback1<?> doneCallback); // // JQueryPromise fail(JQueryPromiseCallback1<?> failCallback); // // JQueryPromise progress(JQueryPromiseCallback1<?> progressCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback, JQueryPromiseCallback1<?> failCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback, JQueryPromiseCallback1<?> failCallback, // JQueryPromiseCallback1<?> progressCallback); // // }
import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.ajax.XMLHttpRequest; import de.iterable.teavm.jquery.ajax.handler.AjaxAlwaysHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxDoneHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFailHandler; import de.iterable.teavm.jquery.types.JQueryPromise;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax; /** * * This object provides a subset of the methods of the Deferred object * (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred. * * @author Jan-Felix Wittmann */ public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { @Override public abstract void overrideMimeType(String mimeType); public abstract void abort(); public abstract void abort(String statusText); public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); public abstract JQueryXHR fail(AjaxFailHandler failCallback);
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxAlwaysHandler.java // @JSFunctor // public interface AjaxAlwaysHandler extends JSObject { // // void onAlways(JSObject dataOrJqXHR, JSString textStatus, JSObject jqXHROrErrorThrown); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxDoneHandler.java // @JSFunctor // public interface AjaxDoneHandler<T extends JSObject> extends JSObject { // // void onDone(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFailHandler.java // @JSFunctor // public interface AjaxFailHandler extends JSObject { // // void onFail(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryPromise.java // public interface JQueryPromise extends JSObject { // // String state(); // // JQueryPromise always(JQueryPromiseCallback1<?> alwaysCallback); // // JQueryPromise done(JQueryPromiseCallback1<?> doneCallback); // // JQueryPromise fail(JQueryPromiseCallback1<?> failCallback); // // JQueryPromise progress(JQueryPromiseCallback1<?> progressCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback, JQueryPromiseCallback1<?> failCallback); // // JQueryPromise then(JQueryPromiseCallback1<?> doneCallback, JQueryPromiseCallback1<?> failCallback, // JQueryPromiseCallback1<?> progressCallback); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.ajax.XMLHttpRequest; import de.iterable.teavm.jquery.ajax.handler.AjaxAlwaysHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxDoneHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFailHandler; import de.iterable.teavm.jquery.types.JQueryPromise; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax; /** * * This object provides a subset of the methods of the Deferred object * (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred. * * @author Jan-Felix Wittmann */ public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { @Override public abstract void overrideMimeType(String mimeType); public abstract void abort(); public abstract void abort(String statusText); public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); public abstract JQueryXHR fail(AjaxFailHandler failCallback);
public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/types/JQueryFxObject.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // }
import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import de.iterable.teavm.utils.functor.JSVoidFunctor0;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryFxObject implements JSObject { @JSBody(params = {}, script = "return {}") public static native final JQueryFxObject create(); @JSProperty
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryFxObject.java import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import de.iterable.teavm.utils.functor.JSVoidFunctor0; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryFxObject implements JSObject { @JSBody(params = {}, script = "return {}") public static native final JQueryFxObject create(); @JSProperty
public abstract JSVoidFunctor0 getTick();
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/types/JQueryTransport.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // }
import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor2;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryTransport implements JSObject { @JSBody(params = {}, script = "return {}") public static native final JQueryTransport create(); @JSProperty
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryTransport.java import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor2; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryTransport implements JSObject { @JSBody(params = {}, script = "return {}") public static native final JQueryTransport create(); @JSProperty
public abstract void setAbort(JSVoidFunctor0 abortFunct);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/types/JQueryTransport.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // }
import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor2;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryTransport implements JSObject { @JSBody(params = {}, script = "return {}") public static native final JQueryTransport create(); @JSProperty public abstract void setAbort(JSVoidFunctor0 abortFunct); @JSProperty
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryTransport.java import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor2; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryTransport implements JSObject { @JSBody(params = {}, script = "return {}") public static native final JQueryTransport create(); @JSProperty public abstract void setAbort(JSVoidFunctor0 abortFunct); @JSProperty
public abstract void setSend(JSVoidFunctor2<JSObject, JQueryTansportSendCompleteHandler> sendFunct);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxStatusCodeBuilder.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java // public final class JSFunctorUtils { // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor0 functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor1<?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor2<?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor3<?, ?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor0<?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor1<?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor2<?, ?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor3<?, ?, ?, ?> functor); // // }
import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.jso.JSDictonary; import de.iterable.teavm.utils.jso.JSFunctorUtils;
package de.iterable.teavm.jquery.ajax; public class JQueryAjaxStatusCodeBuilder { private JSDictonary dict = JSDictonary.create(); private JQueryAjaxStatusCodeBuilder() { } public static JQueryAjaxStatusCodeBuilder create() { return new JQueryAjaxStatusCodeBuilder(); }
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java // public final class JSFunctorUtils { // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor0 functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor1<?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor2<?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor3<?, ?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor0<?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor1<?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor2<?, ?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor3<?, ?, ?, ?> functor); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxStatusCodeBuilder.java import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.jso.JSDictonary; import de.iterable.teavm.utils.jso.JSFunctorUtils; package de.iterable.teavm.jquery.ajax; public class JQueryAjaxStatusCodeBuilder { private JSDictonary dict = JSDictonary.create(); private JQueryAjaxStatusCodeBuilder() { } public static JQueryAjaxStatusCodeBuilder create() { return new JQueryAjaxStatusCodeBuilder(); }
public JQueryAjaxStatusCodeBuilder handler(int code, JSVoidFunctor0 handler) {
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxStatusCodeBuilder.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java // public final class JSFunctorUtils { // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor0 functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor1<?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor2<?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor3<?, ?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor0<?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor1<?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor2<?, ?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor3<?, ?, ?, ?> functor); // // }
import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.jso.JSDictonary; import de.iterable.teavm.utils.jso.JSFunctorUtils;
package de.iterable.teavm.jquery.ajax; public class JQueryAjaxStatusCodeBuilder { private JSDictonary dict = JSDictonary.create(); private JQueryAjaxStatusCodeBuilder() { } public static JQueryAjaxStatusCodeBuilder create() { return new JQueryAjaxStatusCodeBuilder(); } public JQueryAjaxStatusCodeBuilder handler(int code, JSVoidFunctor0 handler) {
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java // public final class JSFunctorUtils { // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor0 functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor1<?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor2<?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSVoidFunctor3<?, ?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor0<?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor1<?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor2<?, ?, ?> functor); // // @JSBody(params = "functor", script = "return functor;") // public static native JSFunction of(JSFunctor3<?, ?, ?, ?> functor); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxStatusCodeBuilder.java import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.jso.JSDictonary; import de.iterable.teavm.utils.jso.JSFunctorUtils; package de.iterable.teavm.jquery.ajax; public class JQueryAjaxStatusCodeBuilder { private JSDictonary dict = JSDictonary.create(); private JQueryAjaxStatusCodeBuilder() { } public static JQueryAjaxStatusCodeBuilder create() { return new JQueryAjaxStatusCodeBuilder(); } public JQueryAjaxStatusCodeBuilder handler(int code, JSVoidFunctor0 handler) {
dict.with(String.valueOf(code), JSFunctorUtils.of(handler));
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/types/JQueryObjectAjaxHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryObjectAjaxHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryObjectAjaxHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryObjectAjaxHandler extends JSObject {
void onComplete(JQueryEventObject event, JQueryXHR jqXHR, JQueryAjaxSettingsObject settings);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/types/JQueryObjectAjaxHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryObjectAjaxHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryObjectAjaxHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryObjectAjaxHandler extends JSObject {
void onComplete(JQueryEventObject event, JQueryXHR jqXHR, JQueryAjaxSettingsObject settings);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxBeforeSendHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxBeforeSendHandler extends JSObject {
void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxBeforeSendHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxBeforeSendHandler extends JSObject {
void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxCompleteHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxCompleteHandler extends JSObject {
void onComplete(JQueryXHR jqXHR, String textStatus);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/types/JQueryAnimationOptions.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // }
import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSBoolean; import org.teavm.jso.core.JSNumber; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryAnimationOptions implements JSObject { @JSBody(params = {}, script = "return {}") public static native final JQueryAnimationOptions create(); @JSProperty public abstract void setDuration(String value); @JSProperty public abstract void setDuration(int value); @JSProperty public abstract void setEasing(String value); @JSProperty
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryAnimationOptions.java import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSBoolean; import org.teavm.jso.core.JSNumber; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryAnimationOptions implements JSObject { @JSBody(params = {}, script = "return {}") public static native final JQueryAnimationOptions create(); @JSProperty public abstract void setDuration(String value); @JSProperty public abstract void setDuration(int value); @JSProperty public abstract void setEasing(String value); @JSProperty
public abstract void setComplete(JSVoidFunctor0 value);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/types/JQueryAnimationOptions.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // }
import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSBoolean; import org.teavm.jso.core.JSNumber; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryAnimationOptions implements JSObject { @JSBody(params = {}, script = "return {}") public static native final JQueryAnimationOptions create(); @JSProperty public abstract void setDuration(String value); @JSProperty public abstract void setDuration(int value); @JSProperty public abstract void setEasing(String value); @JSProperty public abstract void setComplete(JSVoidFunctor0 value); @JSProperty
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryAnimationOptions.java import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSBoolean; import org.teavm.jso.core.JSNumber; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryAnimationOptions implements JSObject { @JSBody(params = {}, script = "return {}") public static native final JQueryAnimationOptions create(); @JSProperty public abstract void setDuration(String value); @JSProperty public abstract void setDuration(int value); @JSProperty public abstract void setEasing(String value); @JSProperty public abstract void setComplete(JSVoidFunctor0 value); @JSProperty
public abstract void setStep(JSVoidFunctor2<JSNumber, JSObject> value);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/types/JQueryAnimationOptions.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // }
import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSBoolean; import org.teavm.jso.core.JSNumber; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryAnimationOptions implements JSObject { @JSBody(params = {}, script = "return {}") public static native final JQueryAnimationOptions create(); @JSProperty public abstract void setDuration(String value); @JSProperty public abstract void setDuration(int value); @JSProperty public abstract void setEasing(String value); @JSProperty public abstract void setComplete(JSVoidFunctor0 value); @JSProperty public abstract void setStep(JSVoidFunctor2<JSNumber, JSObject> value); @JSProperty public abstract void setProgress(JQueryPromise animation, int progress, int remainingMs); @JSProperty
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryAnimationOptions.java import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSBoolean; import org.teavm.jso.core.JSNumber; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryAnimationOptions implements JSObject { @JSBody(params = {}, script = "return {}") public static native final JQueryAnimationOptions create(); @JSProperty public abstract void setDuration(String value); @JSProperty public abstract void setDuration(int value); @JSProperty public abstract void setEasing(String value); @JSProperty public abstract void setComplete(JSVoidFunctor0 value); @JSProperty public abstract void setStep(JSVoidFunctor2<JSNumber, JSObject> value); @JSProperty public abstract void setProgress(JQueryPromise animation, int progress, int remainingMs); @JSProperty
public abstract void setStart(JSVoidFunctor1<JQueryPromise> funcWithAnimationPromise);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/types/JQueryObjectAjaxErrorHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryObjectAjaxErrorHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryObjectAjaxErrorHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryObjectAjaxErrorHandler extends JSObject {
void onError(JQueryEventObject event, JQueryXHR jqXHR, JQueryAjaxSettingsObject settings, String thrownError);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/types/JQueryObjectAjaxErrorHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryObjectAjaxErrorHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryObjectAjaxErrorHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryObjectAjaxErrorHandler extends JSObject {
void onError(JQueryEventObject event, JQueryXHR jqXHR, JQueryAjaxSettingsObject settings, String thrownError);
leobm/teavm-jquery
utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // }
import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3;
package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;")
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // } // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3; package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;")
public static native JSFunction of(JSVoidFunctor0 functor);
leobm/teavm-jquery
utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // }
import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3;
package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor0 functor); @JSBody(params = "functor", script = "return functor;")
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // } // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3; package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor0 functor); @JSBody(params = "functor", script = "return functor;")
public static native JSFunction of(JSVoidFunctor1<?> functor);
leobm/teavm-jquery
utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // }
import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3;
package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor0 functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor1<?> functor); @JSBody(params = "functor", script = "return functor;")
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // } // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3; package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor0 functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor1<?> functor); @JSBody(params = "functor", script = "return functor;")
public static native JSFunction of(JSVoidFunctor2<?, ?> functor);
leobm/teavm-jquery
utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // }
import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3;
package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor0 functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor1<?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor2<?, ?> functor); @JSBody(params = "functor", script = "return functor;")
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // } // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3; package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor0 functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor1<?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor2<?, ?> functor); @JSBody(params = "functor", script = "return functor;")
public static native JSFunction of(JSVoidFunctor3<?, ?, ?> functor);
leobm/teavm-jquery
utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // }
import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3;
package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor0 functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor1<?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor2<?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor3<?, ?, ?> functor); @JSBody(params = "functor", script = "return functor;")
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // } // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3; package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor0 functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor1<?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor2<?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor3<?, ?, ?> functor); @JSBody(params = "functor", script = "return functor;")
public static native JSFunction of(JSFunctor0<?> functor);
leobm/teavm-jquery
utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // }
import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3;
package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor0 functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor1<?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor2<?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor3<?, ?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSFunctor0<?> functor); @JSBody(params = "functor", script = "return functor;")
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // } // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3; package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor0 functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor1<?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor2<?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor3<?, ?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSFunctor0<?> functor); @JSBody(params = "functor", script = "return functor;")
public static native JSFunction of(JSFunctor1<?, ?> functor);
leobm/teavm-jquery
utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // }
import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3;
package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor0 functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor1<?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor2<?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor3<?, ?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSFunctor0<?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSFunctor1<?, ?> functor); @JSBody(params = "functor", script = "return functor;")
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // } // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3; package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor0 functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor1<?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor2<?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor3<?, ?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSFunctor0<?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSFunctor1<?, ?> functor); @JSBody(params = "functor", script = "return functor;")
public static native JSFunction of(JSFunctor2<?, ?, ?> functor);
leobm/teavm-jquery
utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // }
import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3;
package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor0 functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor1<?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor2<?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor3<?, ?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSFunctor0<?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSFunctor1<?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSFunctor2<?, ?, ?> functor); @JSBody(params = "functor", script = "return functor;")
// Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor1.java // @JSFunctor // public interface JSFunctor1<T1 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor2.java // @JSFunctor // public interface JSFunctor2<T1 extends JSObject, T2 extends JSObject, R extends JSObject> extends JSFunctorBase { // // public R apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor3.java // @JSFunctor // public interface JSFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject, R extends JSObject> // extends JSFunctorBase { // // public R apply(T1 a, T2 b, T3 c); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor0.java // @JSFunctor // public interface JSVoidFunctor0 extends JSFunctorBase { // // public void apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor1.java // @JSFunctor // public interface JSVoidFunctor1<T1 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor2.java // @JSFunctor // public interface JSVoidFunctor2<T1 extends JSObject, T2 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSVoidFunctor3.java // @JSFunctor // public interface JSVoidFunctor3<T1 extends JSObject, T2 extends JSObject, T3 extends JSObject> extends JSFunctorBase { // // public void apply(T1 a, T2 b, T3 c); // // } // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSFunctorUtils.java import org.teavm.jso.JSBody; import org.teavm.jso.core.JSFunction; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.functor.JSFunctor1; import de.iterable.teavm.utils.functor.JSFunctor2; import de.iterable.teavm.utils.functor.JSFunctor3; import de.iterable.teavm.utils.functor.JSVoidFunctor0; import de.iterable.teavm.utils.functor.JSVoidFunctor1; import de.iterable.teavm.utils.functor.JSVoidFunctor2; import de.iterable.teavm.utils.functor.JSVoidFunctor3; package de.iterable.teavm.utils.jso; public final class JSFunctorUtils { @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor0 functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor1<?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor2<?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSVoidFunctor3<?, ?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSFunctor0<?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSFunctor1<?, ?> functor); @JSBody(params = "functor", script = "return functor;") public static native JSFunction of(JSFunctor2<?, ?, ?> functor); @JSBody(params = "functor", script = "return functor;")
public static native JSFunction of(JSFunctor3<?, ?, ?, ?> functor);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/types/JQueryObjectAjaxSucessHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryObjectAjaxSucessHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryObjectAjaxSucessHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryObjectAjaxSucessHandler extends JSObject {
void onError(JQueryEventObject event, JQueryXHR jqXHR, JQueryAjaxSettingsObject settings, JSObject data);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/types/JQueryObjectAjaxSucessHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryObjectAjaxSucessHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/types/JQueryObjectAjaxSucessHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.types; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface JQueryObjectAjaxSucessHandler extends JSObject {
void onError(JQueryEventObject event, JQueryXHR jqXHR, JQueryAjaxSettingsObject settings, JSObject data);
leobm/teavm-jquery
demos/ajax/src/main/java/de/iterable/teavm/jso/browser/WindowEventTarget.java
// Path: demos/ajax/src/main/java/de/iterable/teavm/jso/dom/events/PopStateEvent.java // public interface PopStateEvent extends Event { // // @JSProperty // JSObject getState(); // // }
import org.teavm.jso.dom.events.Event; import org.teavm.jso.dom.events.EventListener; import org.teavm.jso.dom.events.EventTarget; import org.teavm.jso.dom.events.FocusEventTarget; import org.teavm.jso.dom.events.HashChangeEvent; import org.teavm.jso.dom.events.KeyboardEventTarget; import org.teavm.jso.dom.events.LoadEventTarget; import org.teavm.jso.dom.events.MessageEvent; import org.teavm.jso.dom.events.MouseEventTarget; import de.iterable.teavm.jso.dom.events.PopStateEvent;
/* * Copyright 2015 Alexey Andreev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jso.browser; /** * * @author Alexey Andreev */ public interface WindowEventTarget extends EventTarget, FocusEventTarget, MouseEventTarget, KeyboardEventTarget, LoadEventTarget { default void listenBeforeOnload(EventListener<Event> listener) { addEventListener("beforeunload", listener); } default void neglectBeforeOnload(EventListener<Event> listener) { removeEventListener("beforeunload", listener); } default void listenMessage(EventListener<MessageEvent> listener) { addEventListener("message", listener); } default void neglectMessage(EventListener<MessageEvent> listener) { removeEventListener("message", listener); } default void listenHashChange(EventListener<HashChangeEvent> listener) { addEventListener("hashchange", listener); } default void neglectHashChange(EventListener<HashChangeEvent> listener) { removeEventListener("hashchange", listener); }
// Path: demos/ajax/src/main/java/de/iterable/teavm/jso/dom/events/PopStateEvent.java // public interface PopStateEvent extends Event { // // @JSProperty // JSObject getState(); // // } // Path: demos/ajax/src/main/java/de/iterable/teavm/jso/browser/WindowEventTarget.java import org.teavm.jso.dom.events.Event; import org.teavm.jso.dom.events.EventListener; import org.teavm.jso.dom.events.EventTarget; import org.teavm.jso.dom.events.FocusEventTarget; import org.teavm.jso.dom.events.HashChangeEvent; import org.teavm.jso.dom.events.KeyboardEventTarget; import org.teavm.jso.dom.events.LoadEventTarget; import org.teavm.jso.dom.events.MessageEvent; import org.teavm.jso.dom.events.MouseEventTarget; import de.iterable.teavm.jso.dom.events.PopStateEvent; /* * Copyright 2015 Alexey Andreev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jso.browser; /** * * @author Alexey Andreev */ public interface WindowEventTarget extends EventTarget, FocusEventTarget, MouseEventTarget, KeyboardEventTarget, LoadEventTarget { default void listenBeforeOnload(EventListener<Event> listener) { addEventListener("beforeunload", listener); } default void neglectBeforeOnload(EventListener<Event> listener) { removeEventListener("beforeunload", listener); } default void listenMessage(EventListener<MessageEvent> listener) { addEventListener("message", listener); } default void neglectMessage(EventListener<MessageEvent> listener) { removeEventListener("message", listener); } default void listenHashChange(EventListener<HashChangeEvent> listener) { addEventListener("hashchange", listener); } default void neglectHashChange(EventListener<HashChangeEvent> listener) { removeEventListener("hashchange", listener); }
default void listenPopstate(EventListener<PopStateEvent> listener) {
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // }
import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryAjaxSettingsObject implements JSObject { private JQueryAjaxSettingsObject() { } @JSBody(params = {}, script = "return {}") public static native final JQueryAjaxSettingsObject create(); @JSProperty
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryAjaxSettingsObject implements JSObject { private JQueryAjaxSettingsObject() { } @JSBody(params = {}, script = "return {}") public static native final JQueryAjaxSettingsObject create(); @JSProperty
public abstract void setAccepts(JSDictonary obj);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // }
import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryAjaxSettingsObject implements JSObject { private JQueryAjaxSettingsObject() { } @JSBody(params = {}, script = "return {}") public static native final JQueryAjaxSettingsObject create(); @JSProperty public abstract void setAccepts(JSDictonary obj); @JSProperty public abstract void setAsync(boolean isAsync); @JSProperty("beforeSend")
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryAjaxSettingsObject implements JSObject { private JQueryAjaxSettingsObject() { } @JSBody(params = {}, script = "return {}") public static native final JQueryAjaxSettingsObject create(); @JSProperty public abstract void setAccepts(JSDictonary obj); @JSProperty public abstract void setAsync(boolean isAsync); @JSProperty("beforeSend")
public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // }
import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryAjaxSettingsObject implements JSObject { private JQueryAjaxSettingsObject() { } @JSBody(params = {}, script = "return {}") public static native final JQueryAjaxSettingsObject create(); @JSProperty public abstract void setAccepts(JSDictonary obj); @JSProperty public abstract void setAsync(boolean isAsync); @JSProperty("beforeSend") public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); @JSProperty public abstract void setCache(boolean isCache); @JSProperty("complete")
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax; /** * * @author Jan-Felix Wittmann */ public abstract class JQueryAjaxSettingsObject implements JSObject { private JQueryAjaxSettingsObject() { } @JSBody(params = {}, script = "return {}") public static native final JQueryAjaxSettingsObject create(); @JSProperty public abstract void setAccepts(JSDictonary obj); @JSProperty public abstract void setAsync(boolean isAsync); @JSProperty("beforeSend") public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); @JSProperty public abstract void setCache(boolean isCache); @JSProperty("complete")
public abstract void setCompleteHandler(AjaxCompleteHandler handler);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // }
import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary;
public abstract void setCompleteHandler(AjaxCompleteHandler handler); @JSProperty public abstract void setContentType(boolean hasContentType); @JSProperty public abstract void setContentType(String contentType); @JSProperty public abstract void setContext(JSObject context); @JSProperty public final native void setContents(JSDictonary contents); @JSProperty public final native void setConverters(JSDictonary converters); @JSProperty public abstract void setCrossDomain(boolean crossDomain); @JSProperty public abstract void setData(JSDictonary data); @JSProperty public abstract void setData(JSArray<JSObject> data); @JSProperty public abstract void setData(String data); @JSProperty
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary; public abstract void setCompleteHandler(AjaxCompleteHandler handler); @JSProperty public abstract void setContentType(boolean hasContentType); @JSProperty public abstract void setContentType(String contentType); @JSProperty public abstract void setContext(JSObject context); @JSProperty public final native void setContents(JSDictonary contents); @JSProperty public final native void setConverters(JSDictonary converters); @JSProperty public abstract void setCrossDomain(boolean crossDomain); @JSProperty public abstract void setData(JSDictonary data); @JSProperty public abstract void setData(JSArray<JSObject> data); @JSProperty public abstract void setData(String data); @JSProperty
public abstract void setDataFilter(AjaxFilterHandler filter);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // }
import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary;
public abstract void setContentType(String contentType); @JSProperty public abstract void setContext(JSObject context); @JSProperty public final native void setContents(JSDictonary contents); @JSProperty public final native void setConverters(JSDictonary converters); @JSProperty public abstract void setCrossDomain(boolean crossDomain); @JSProperty public abstract void setData(JSDictonary data); @JSProperty public abstract void setData(JSArray<JSObject> data); @JSProperty public abstract void setData(String data); @JSProperty public abstract void setDataFilter(AjaxFilterHandler filter); @JSProperty public abstract void setDataType(String dataType); @JSProperty("error")
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary; public abstract void setContentType(String contentType); @JSProperty public abstract void setContext(JSObject context); @JSProperty public final native void setContents(JSDictonary contents); @JSProperty public final native void setConverters(JSDictonary converters); @JSProperty public abstract void setCrossDomain(boolean crossDomain); @JSProperty public abstract void setData(JSDictonary data); @JSProperty public abstract void setData(JSArray<JSObject> data); @JSProperty public abstract void setData(String data); @JSProperty public abstract void setDataFilter(AjaxFilterHandler filter); @JSProperty public abstract void setDataType(String dataType); @JSProperty("error")
public abstract void setErrorHandler(AjaxErrorHandler handler);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // }
import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary;
public abstract void setData(String data); @JSProperty public abstract void setDataFilter(AjaxFilterHandler filter); @JSProperty public abstract void setDataType(String dataType); @JSProperty("error") public abstract void setErrorHandler(AjaxErrorHandler handler); @JSProperty public abstract void setGlobal(boolean isGlobal); @JSProperty public final native void setHeaders(JSDictonary headers); @JSProperty public abstract void setIfModified(boolean isIfModified); @JSProperty public abstract void setIsLocal(boolean isLocal); @JSProperty public abstract void setJsonp(String jsonp); @JSProperty public abstract void setJsonpCallback(String jsonpCallback); @JSProperty
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary; public abstract void setData(String data); @JSProperty public abstract void setDataFilter(AjaxFilterHandler filter); @JSProperty public abstract void setDataType(String dataType); @JSProperty("error") public abstract void setErrorHandler(AjaxErrorHandler handler); @JSProperty public abstract void setGlobal(boolean isGlobal); @JSProperty public final native void setHeaders(JSDictonary headers); @JSProperty public abstract void setIfModified(boolean isIfModified); @JSProperty public abstract void setIsLocal(boolean isLocal); @JSProperty public abstract void setJsonp(String jsonp); @JSProperty public abstract void setJsonpCallback(String jsonpCallback); @JSProperty
public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // }
import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary;
public abstract void setIsLocal(boolean isLocal); @JSProperty public abstract void setJsonp(String jsonp); @JSProperty public abstract void setJsonpCallback(String jsonpCallback); @JSProperty public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); @JSProperty public abstract void setMethod(String method); @JSProperty public abstract void setMimeType(String mimeType); @JSProperty public abstract void setPassword(String password); @JSProperty public abstract void setProcessData(boolean processData); @JSProperty public abstract void setScriptCharset(String scriptCharset); @JSProperty public abstract void setStatusCode(JSDictonary statusCode); @JSProperty("success")
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary; public abstract void setIsLocal(boolean isLocal); @JSProperty public abstract void setJsonp(String jsonp); @JSProperty public abstract void setJsonpCallback(String jsonpCallback); @JSProperty public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); @JSProperty public abstract void setMethod(String method); @JSProperty public abstract void setMimeType(String mimeType); @JSProperty public abstract void setPassword(String password); @JSProperty public abstract void setProcessData(boolean processData); @JSProperty public abstract void setScriptCharset(String scriptCharset); @JSProperty public abstract void setStatusCode(JSDictonary statusCode); @JSProperty("success")
public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // }
import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary;
public abstract void setPassword(String password); @JSProperty public abstract void setProcessData(boolean processData); @JSProperty public abstract void setScriptCharset(String scriptCharset); @JSProperty public abstract void setStatusCode(JSDictonary statusCode); @JSProperty("success") public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); @JSProperty public abstract void setTimeout(int timeout); @JSProperty public abstract void setTraditional(boolean traditional); @JSProperty public abstract void setType(String type); @JSProperty public abstract void setUrl(String url); @JSProperty public abstract void setUsername(String username); @JSProperty
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxBeforeSendHandler.java // @JSFunctor // public interface AjaxBeforeSendHandler extends JSObject { // void onBeforeSend(JQueryXHR jqXHR, JQueryAjaxSettingsObject settings); // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxCompleteHandler.java // @JSFunctor // public interface AjaxCompleteHandler extends JSObject { // // void onComplete(JQueryXHR jqXHR, String textStatus); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java // @JSFunctor // public interface AjaxErrorHandler extends JSObject { // // void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxFilterHandler.java // @JSFunctor // public interface AjaxFilterHandler extends JSObject { // // public abstract JSObject apply(JSObject data, String dataType); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxSuccessHandler.java // @JSFunctor // public interface AjaxSuccessHandler<T extends JSObject> extends JSObject { // // void onSuccess(T data, JSString textStatus, JQueryXHR jqXHR); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxXhrFunctionHandler.java // public interface AjaxXhrFunctionHandler extends JSObject { // // JSFunction onXhr(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/functor/JSFunctor0.java // @JSFunctor // public interface JSFunctor0<R extends JSObject> extends JSFunctorBase{ // // public R apply(); // // } // // Path: utils/src/main/java/de/iterable/teavm/utils/jso/JSDictonary.java // public abstract class JSDictonary implements JSObject { // // private JSDictonary() { // } // // @JSIndexer // public abstract <V extends JSObject> V get(String key); // // @JSIndexer // public abstract <V extends JSObject> void put(String key, V value); // // public <V extends JSObject> JSDictonary with(String key, V value) { // this.put(key, value); // return this; // } // // public JSDictonary with(String key, String value) { // return this.with(key, JSString.valueOf(value)); // } // // public JSDictonary with(String key, JSDictonary value) { // return this.with(key, (JSObject) value); // } // // public JSDictonary with(String key, Integer value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Float value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Double value) { // return this.with(key, JSNumber.valueOf(value)); // } // // public JSDictonary with(String key, Boolean value) { // return this.with(key, JSBoolean.valueOf(value)); // } // // public JSObject remove(String key) { // if (JSObjectUtils.hasOwnProperty(this, key)) { // final JSObject value = get(key); // JSObjectUtils.delete(this, key); // return value; // } // return null; // } // // public String[] keys() { // return JSObjectUtils.keys(this); // } // // public boolean has(String key) { // return JSObjectUtils.hasOwnProperty(this, key); // } // // public static <V extends JSObject> JSDictonary create() { // return JSObjectUtils.create(); // } // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; import org.teavm.jso.core.JSArray; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.handler.AjaxBeforeSendHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxCompleteHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxErrorHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxFilterHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxSuccessHandler; import de.iterable.teavm.jquery.ajax.handler.AjaxXhrFunctionHandler; import de.iterable.teavm.utils.functor.JSFunctor0; import de.iterable.teavm.utils.jso.JSDictonary; public abstract void setPassword(String password); @JSProperty public abstract void setProcessData(boolean processData); @JSProperty public abstract void setScriptCharset(String scriptCharset); @JSProperty public abstract void setStatusCode(JSDictonary statusCode); @JSProperty("success") public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); @JSProperty public abstract void setTimeout(int timeout); @JSProperty public abstract void setTraditional(boolean traditional); @JSProperty public abstract void setType(String type); @JSProperty public abstract void setUrl(String url); @JSProperty public abstract void setUsername(String username); @JSProperty
public abstract void setXhr(AjaxXhrFunctionHandler handler);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxPrefilterHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxPrefilterHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxPrefilterHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxPrefilterHandler extends JSObject {
public void apply(JSObject options, JQueryAjaxSettingsObject originalOptions, JQueryXHR jqXHR);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxPrefilterHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxPrefilterHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryAjaxSettingsObject.java // public abstract class JQueryAjaxSettingsObject implements JSObject { // // private JQueryAjaxSettingsObject() { // } // // @JSBody(params = {}, script = "return {}") // public static native final JQueryAjaxSettingsObject create(); // // @JSProperty // public abstract void setAccepts(JSDictonary obj); // // @JSProperty // public abstract void setAsync(boolean isAsync); // // @JSProperty("beforeSend") // public abstract void setBeforeSendHandler(AjaxBeforeSendHandler handler); // // @JSProperty // public abstract void setCache(boolean isCache); // // @JSProperty("complete") // public abstract void setCompleteHandler(AjaxCompleteHandler handler); // // @JSProperty // public abstract void setContentType(boolean hasContentType); // // @JSProperty // public abstract void setContentType(String contentType); // // @JSProperty // public abstract void setContext(JSObject context); // // @JSProperty // public final native void setContents(JSDictonary contents); // // @JSProperty // public final native void setConverters(JSDictonary converters); // // @JSProperty // public abstract void setCrossDomain(boolean crossDomain); // // @JSProperty // public abstract void setData(JSDictonary data); // // @JSProperty // public abstract void setData(JSArray<JSObject> data); // // @JSProperty // public abstract void setData(String data); // // @JSProperty // public abstract void setDataFilter(AjaxFilterHandler filter); // // @JSProperty // public abstract void setDataType(String dataType); // // @JSProperty("error") // public abstract void setErrorHandler(AjaxErrorHandler handler); // // @JSProperty // public abstract void setGlobal(boolean isGlobal); // // @JSProperty // public final native void setHeaders(JSDictonary headers); // // @JSProperty // public abstract void setIfModified(boolean isIfModified); // // @JSProperty // public abstract void setIsLocal(boolean isLocal); // // @JSProperty // public abstract void setJsonp(String jsonp); // // @JSProperty // public abstract void setJsonpCallback(String jsonpCallback); // // @JSProperty // public abstract void setJsonpCallback(JSFunctor0<JSString> jsonpCallback); // // @JSProperty // public abstract void setMethod(String method); // // @JSProperty // public abstract void setMimeType(String mimeType); // // @JSProperty // public abstract void setPassword(String password); // // @JSProperty // public abstract void setProcessData(boolean processData); // // @JSProperty // public abstract void setScriptCharset(String scriptCharset); // // @JSProperty // public abstract void setStatusCode(JSDictonary statusCode); // // @JSProperty("success") // public abstract <T extends JSObject> void setSuccessHandler(AjaxSuccessHandler<T> handler); // // @JSProperty // public abstract void setTimeout(int timeout); // // @JSProperty // public abstract void setTraditional(boolean traditional); // // @JSProperty // public abstract void setType(String type); // // @JSProperty // public abstract void setUrl(String url); // // @JSProperty // public abstract void setUsername(String username); // // @JSProperty // public abstract void setXhr(AjaxXhrFunctionHandler handler); // // @JSProperty // public abstract void setXhrFields(JSDictonary fields); // // } // // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxPrefilterHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import de.iterable.teavm.jquery.ajax.JQueryAjaxSettingsObject; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxPrefilterHandler extends JSObject {
public void apply(JSObject options, JQueryAjaxSettingsObject originalOptions, JQueryXHR jqXHR);
leobm/teavm-jquery
core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // }
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.JQueryXHR;
/* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxErrorHandler extends JSObject {
// Path: core/src/main/java/de/iterable/teavm/jquery/ajax/JQueryXHR.java // public abstract class JQueryXHR extends XMLHttpRequest implements JQueryPromise { // // @Override // public abstract void overrideMimeType(String mimeType); // // public abstract void abort(); // // public abstract void abort(String statusText); // // public abstract JQueryXHR done(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR fail(AjaxFailHandler failCallback); // // public abstract JQueryXHR always(AjaxAlwaysHandler alwaysCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback); // // public abstract JQueryXHR then(AjaxDoneHandler<?> doneCallback, AjaxFailHandler failCallback); // // @JSProperty // public abstract JSObject getResponseJSON(); // // } // Path: core/src/main/java/de/iterable/teavm/jquery/ajax/handler/AjaxErrorHandler.java import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import org.teavm.jso.core.JSString; import de.iterable.teavm.jquery.ajax.JQueryXHR; /* * Copyright 2015 Jan-Felix Wittmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.iterable.teavm.jquery.ajax.handler; /** * * @author Jan-Felix Wittmann */ @JSFunctor public interface AjaxErrorHandler extends JSObject {
void onError(JQueryXHR jqXHR, JSString textStatus, JSString errorThrow);
Kaljurand/speechutils
app/src/androidTest/java/ee/ioc/phon/android/speechutils/RecognitionServiceManagerTest.java
// Path: app/src/main/java/ee/ioc/phon/android/speechutils/RecognitionServiceManager.java // @TargetApi(Build.VERSION_CODES.LOLLIPOP) // public static String makeLangLabel(String localeAsStr) { // // Just to make sure we do not get a NPE from Locale.forLanguageTag // if (localeAsStr == null || localeAsStr.isEmpty()) { // return "?"; // } // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // return Locale.forLanguageTag(localeAsStr).getDisplayName(); // } // return localeAsStr; // }
import org.junit.Test; import static ee.ioc.phon.android.speechutils.RecognitionServiceManager.makeLangLabel; import static org.junit.Assert.assertEquals;
package ee.ioc.phon.android.speechutils; public class RecognitionServiceManagerTest { @Test public void makeLangLabel01() {
// Path: app/src/main/java/ee/ioc/phon/android/speechutils/RecognitionServiceManager.java // @TargetApi(Build.VERSION_CODES.LOLLIPOP) // public static String makeLangLabel(String localeAsStr) { // // Just to make sure we do not get a NPE from Locale.forLanguageTag // if (localeAsStr == null || localeAsStr.isEmpty()) { // return "?"; // } // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // return Locale.forLanguageTag(localeAsStr).getDisplayName(); // } // return localeAsStr; // } // Path: app/src/androidTest/java/ee/ioc/phon/android/speechutils/RecognitionServiceManagerTest.java import org.junit.Test; import static ee.ioc.phon.android.speechutils.RecognitionServiceManager.makeLangLabel; import static org.junit.Assert.assertEquals; package ee.ioc.phon.android.speechutils; public class RecognitionServiceManagerTest { @Test public void makeLangLabel01() {
assertEquals("?", makeLangLabel(null));
Kaljurand/speechutils
app/src/main/java/ee/ioc/phon/android/speechutils/utils/AudioUtils.java
// Path: app/src/main/java/ee/ioc/phon/android/speechutils/MediaFormatFactory.java // public class MediaFormatFactory { // // @TargetApi(Build.VERSION_CODES.JELLY_BEAN) // public static MediaFormat createMediaFormat(String mime, int sampleRate) { // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { // MediaFormat format = new MediaFormat(); // // TODO: this causes a crash in MediaCodec.configure // //format.setString(MediaFormat.KEY_FRAME_RATE, null); // format.setInteger(MediaFormat.KEY_SAMPLE_RATE, sampleRate); // format.setInteger(MediaFormat.KEY_CHANNEL_COUNT, 1); // format.setString(MediaFormat.KEY_MIME, mime); // if ("audio/mp4a-latm".equals(mime)) { // format.setInteger(MediaFormat.KEY_AAC_PROFILE, 2); // TODO: or 39? // format.setInteger(MediaFormat.KEY_BIT_RATE, 64000); // } else if ("audio/flac".equals(mime)) { // //format.setString(MediaFormat.KEY_MIME, MediaFormat.MIMETYPE_AUDIO_FLAC); // API=21 // format.setInteger(MediaFormat.KEY_BIT_RATE, 64000); // //TODO: use another bit rate, does not seem to have effect always // //format.setInteger(MediaFormat.KEY_BIT_RATE, 128000); // // TODO: experiment with 0 (fastest/least) to 8 (slowest/most) // //format.setInteger(MediaFormat.KEY_FLAC_COMPRESSION_LEVEL, 0); // } else if ("audio/opus".equals(mime)) { // //format.setString(MediaFormat.KEY_MIME, MediaFormat.MIMETYPE_AUDIO_OPUS); // API=21 // format.setInteger(MediaFormat.KEY_BIT_RATE, 64000); // } else { // // TODO: assuming: "audio/amr-wb" // format.setInteger(MediaFormat.KEY_BIT_RATE, 23050); // } // return format; // } // return null; // } // // //final int kAACProfiles[] = { // // 2 /* OMX_AUDIO_AACObjectLC */, // // 5 /* OMX_AUDIO_AACObjectHE */, // // 39 /* OMX_AUDIO_AACObjectELD */ // //}; // // //if (kAACProfiles[k] == 5 && kSampleRates[i] < 22050) { // // // Is this right? HE does not support sample rates < 22050Hz? // // continue; // //} // // final int kSampleRates[] = {8000, 11025, 22050, 44100, 48000}; // // final int kBitRates[] = {64000, 128000}; // }
import android.annotation.TargetApi; import android.media.MediaCodec; import android.media.MediaCodecInfo; import android.media.MediaCodecList; import android.media.MediaFormat; import android.os.Build; import android.text.TextUtils; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; import java.util.List; import ee.ioc.phon.android.speechutils.Log; import ee.ioc.phon.android.speechutils.MediaFormatFactory;
header[30] = (byte) ((byteRate >> 16) & 0xff); header[31] = (byte) ((byteRate >> 24) & 0xff); header[32] = (byte) (2 * 16 / 8); // block align header[33] = 0; header[34] = (byte) (8 * resolutionInBytes); // bits per sample header[35] = 0; header[36] = 'd'; header[37] = 'a'; header[38] = 't'; header[39] = 'a'; header[40] = (byte) (totalAudioLen & 0xff); header[41] = (byte) ((totalAudioLen >> 8) & 0xff); header[42] = (byte) ((totalAudioLen >> 16) & 0xff); header[43] = (byte) ((totalAudioLen >> 24) & 0xff); return header; } public static byte[] getRecordingAsWav(byte[] pcm, int sampleRate, short resolutionInBytes, short channels) { byte[] header = getWavHeader(pcm.length, sampleRate, resolutionInBytes, channels); byte[] wav = new byte[header.length + pcm.length]; System.arraycopy(header, 0, wav, 0, header.length); System.arraycopy(pcm, 0, wav, header.length, pcm.length); return wav; } // TODO: use MediaFormat.MIMETYPE_AUDIO_FLAC) on API>=21 @TargetApi(Build.VERSION_CODES.LOLLIPOP) public static List<String> getAvailableEncoders(String mime, int sampleRate) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// Path: app/src/main/java/ee/ioc/phon/android/speechutils/MediaFormatFactory.java // public class MediaFormatFactory { // // @TargetApi(Build.VERSION_CODES.JELLY_BEAN) // public static MediaFormat createMediaFormat(String mime, int sampleRate) { // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { // MediaFormat format = new MediaFormat(); // // TODO: this causes a crash in MediaCodec.configure // //format.setString(MediaFormat.KEY_FRAME_RATE, null); // format.setInteger(MediaFormat.KEY_SAMPLE_RATE, sampleRate); // format.setInteger(MediaFormat.KEY_CHANNEL_COUNT, 1); // format.setString(MediaFormat.KEY_MIME, mime); // if ("audio/mp4a-latm".equals(mime)) { // format.setInteger(MediaFormat.KEY_AAC_PROFILE, 2); // TODO: or 39? // format.setInteger(MediaFormat.KEY_BIT_RATE, 64000); // } else if ("audio/flac".equals(mime)) { // //format.setString(MediaFormat.KEY_MIME, MediaFormat.MIMETYPE_AUDIO_FLAC); // API=21 // format.setInteger(MediaFormat.KEY_BIT_RATE, 64000); // //TODO: use another bit rate, does not seem to have effect always // //format.setInteger(MediaFormat.KEY_BIT_RATE, 128000); // // TODO: experiment with 0 (fastest/least) to 8 (slowest/most) // //format.setInteger(MediaFormat.KEY_FLAC_COMPRESSION_LEVEL, 0); // } else if ("audio/opus".equals(mime)) { // //format.setString(MediaFormat.KEY_MIME, MediaFormat.MIMETYPE_AUDIO_OPUS); // API=21 // format.setInteger(MediaFormat.KEY_BIT_RATE, 64000); // } else { // // TODO: assuming: "audio/amr-wb" // format.setInteger(MediaFormat.KEY_BIT_RATE, 23050); // } // return format; // } // return null; // } // // //final int kAACProfiles[] = { // // 2 /* OMX_AUDIO_AACObjectLC */, // // 5 /* OMX_AUDIO_AACObjectHE */, // // 39 /* OMX_AUDIO_AACObjectELD */ // //}; // // //if (kAACProfiles[k] == 5 && kSampleRates[i] < 22050) { // // // Is this right? HE does not support sample rates < 22050Hz? // // continue; // //} // // final int kSampleRates[] = {8000, 11025, 22050, 44100, 48000}; // // final int kBitRates[] = {64000, 128000}; // } // Path: app/src/main/java/ee/ioc/phon/android/speechutils/utils/AudioUtils.java import android.annotation.TargetApi; import android.media.MediaCodec; import android.media.MediaCodecInfo; import android.media.MediaCodecList; import android.media.MediaFormat; import android.os.Build; import android.text.TextUtils; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; import java.util.List; import ee.ioc.phon.android.speechutils.Log; import ee.ioc.phon.android.speechutils.MediaFormatFactory; header[30] = (byte) ((byteRate >> 16) & 0xff); header[31] = (byte) ((byteRate >> 24) & 0xff); header[32] = (byte) (2 * 16 / 8); // block align header[33] = 0; header[34] = (byte) (8 * resolutionInBytes); // bits per sample header[35] = 0; header[36] = 'd'; header[37] = 'a'; header[38] = 't'; header[39] = 'a'; header[40] = (byte) (totalAudioLen & 0xff); header[41] = (byte) ((totalAudioLen >> 8) & 0xff); header[42] = (byte) ((totalAudioLen >> 16) & 0xff); header[43] = (byte) ((totalAudioLen >> 24) & 0xff); return header; } public static byte[] getRecordingAsWav(byte[] pcm, int sampleRate, short resolutionInBytes, short channels) { byte[] header = getWavHeader(pcm.length, sampleRate, resolutionInBytes, channels); byte[] wav = new byte[header.length + pcm.length]; System.arraycopy(header, 0, wav, 0, header.length); System.arraycopy(pcm, 0, wav, header.length, pcm.length); return wav; } // TODO: use MediaFormat.MIMETYPE_AUDIO_FLAC) on API>=21 @TargetApi(Build.VERSION_CODES.LOLLIPOP) public static List<String> getAvailableEncoders(String mime, int sampleRate) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
MediaFormat format = MediaFormatFactory.createMediaFormat(mime, sampleRate);
Kaljurand/speechutils
app/src/main/java/ee/ioc/phon/android/speechutils/utils/TextUtils.java
// Path: app/src/main/java/ee/ioc/phon/android/speechutils/editor/Constants.java // public class Constants { // // // Symbols that should not be preceded by space in a written text. // public static final Set<Character> CHARACTERS_STICKY_LEFT = // new HashSet<>(Arrays.asList(',', ':', ';', '.', '!', '?', '-', ')')); // // // Symbols after which the next word should be capitalized. // // We include ) because ;-) often finishes a sentence. // public static final Set<Character> CHARACTERS_EOS = // new HashSet<>(Arrays.asList('.', '!', '?', ')')); // // // These symbols stick to the next symbol, i.e. no whitespace is added in front of the // // following string. // public static final Set<Character> CHARACTERS_STICKY_RIGHT = // new HashSet<>(Arrays.asList('(', '[', '{', '<', '-')); // // // TODO: review these // public static final int REWRITE_PATTERN_FLAGS = Pattern.CASE_INSENSITIVE // | Pattern.UNICODE_CASE // | Pattern.MULTILINE // | Pattern.DOTALL; // // // Characters that are transparent (but not whitespace) when deciding if a word follows an EOS // // character and should thus be capitalized. // private static final Set<Character> CHARACTERS_TRANSPARENT = // new HashSet<>(Arrays.asList('(', '[', '{', '<')); // // public static final boolean isTransparent(char c) { // return Constants.CHARACTERS_TRANSPARENT.contains(c) || Character.isWhitespace(c); // } // }
import ee.ioc.phon.android.speechutils.editor.Constants;
package ee.ioc.phon.android.speechutils.utils; public class TextUtils { private TextUtils() { } /** * Pretty-prints the string returned by the server to be orthographically correct (Estonian), * assuming that the string represents a sequence of tokens separated by a single space character. * Note that a text editor (which has additional information about the context of the cursor) * will need to do additional pretty-printing, e.g. capitalization if the cursor follows a * sentence end marker. * * @param str String to be pretty-printed * @return Pretty-printed string (never null) */ public static String prettyPrint(String str) { boolean isSentenceStart = false; boolean isWhitespaceBefore = false; String text = ""; for (String tok : str.split(" ")) { if (tok.length() == 0) { continue; } String glue = " "; char firstChar = tok.charAt(0); if (isWhitespaceBefore || Character.isWhitespace(firstChar)
// Path: app/src/main/java/ee/ioc/phon/android/speechutils/editor/Constants.java // public class Constants { // // // Symbols that should not be preceded by space in a written text. // public static final Set<Character> CHARACTERS_STICKY_LEFT = // new HashSet<>(Arrays.asList(',', ':', ';', '.', '!', '?', '-', ')')); // // // Symbols after which the next word should be capitalized. // // We include ) because ;-) often finishes a sentence. // public static final Set<Character> CHARACTERS_EOS = // new HashSet<>(Arrays.asList('.', '!', '?', ')')); // // // These symbols stick to the next symbol, i.e. no whitespace is added in front of the // // following string. // public static final Set<Character> CHARACTERS_STICKY_RIGHT = // new HashSet<>(Arrays.asList('(', '[', '{', '<', '-')); // // // TODO: review these // public static final int REWRITE_PATTERN_FLAGS = Pattern.CASE_INSENSITIVE // | Pattern.UNICODE_CASE // | Pattern.MULTILINE // | Pattern.DOTALL; // // // Characters that are transparent (but not whitespace) when deciding if a word follows an EOS // // character and should thus be capitalized. // private static final Set<Character> CHARACTERS_TRANSPARENT = // new HashSet<>(Arrays.asList('(', '[', '{', '<')); // // public static final boolean isTransparent(char c) { // return Constants.CHARACTERS_TRANSPARENT.contains(c) || Character.isWhitespace(c); // } // } // Path: app/src/main/java/ee/ioc/phon/android/speechutils/utils/TextUtils.java import ee.ioc.phon.android.speechutils.editor.Constants; package ee.ioc.phon.android.speechutils.utils; public class TextUtils { private TextUtils() { } /** * Pretty-prints the string returned by the server to be orthographically correct (Estonian), * assuming that the string represents a sequence of tokens separated by a single space character. * Note that a text editor (which has additional information about the context of the cursor) * will need to do additional pretty-printing, e.g. capitalization if the cursor follows a * sentence end marker. * * @param str String to be pretty-printed * @return Pretty-printed string (never null) */ public static String prettyPrint(String str) { boolean isSentenceStart = false; boolean isWhitespaceBefore = false; String text = ""; for (String tok : str.split(" ")) { if (tok.length() == 0) { continue; } String glue = " "; char firstChar = tok.charAt(0); if (isWhitespaceBefore || Character.isWhitespace(firstChar)
|| Constants.CHARACTERS_STICKY_LEFT.contains(firstChar)) {
audit4j/audit4j-microservice
src/main/java/org/audit4j/microservice/ServerContext.java
// Path: src/main/java/org/audit4j/microservice/core/ConfigurationManager.java // public class ConfigurationManager { // // private ConfigProvider<ServerConfiguration> configProvider; // // private String configPath = "conf/server.config.yml"; // // public ConfigurationManager(String configPath) { // this.configPath = configPath; // configProvider = new YAMLConfigProvider<>(ServerConfiguration.class); // } // // public ServerConfiguration loadConfiguration() throws ConfigurationException { // ServerConfiguration config = null; // config = configProvider // .readConfig(configPath); // return config; // } // // static InputStream getClasspathResourceAsStream(String resourceName) { // return ClassLoaderUtils.getClassLoader(Configurations.class) // .getResourceAsStream(resourceName); // } // } // // Path: src/main/java/org/audit4j/microservice/core/Context.java // public interface Context { // // void start() throws InitializationException; // // void stop(); // // void enable(); // // void disable(); // // void terminate(); // } // // Path: src/main/java/org/audit4j/microservice/core/HTTPServer.java // public interface HTTPServer extends Initializable{ // // void setPort(int port); // // public static HTTPServer create(int port) { // return new VertxServer(port); // } // } // // Path: src/main/java/org/audit4j/microservice/core/Transport.java // public abstract class Transport implements Initializable { // // /** The reciever. */ // EventReceiver reciever = new EventReceiverImpl(); // // /** The properties. */ // private Map<String, String> properties; // // /** // * Receive. // * // * @param event the event // */ // public void receive(AuditEvent event) { // reciever.receive(event); // } // // /** // * Gets the property. // * // * @param key the key // * @return the property // */ // public String getProperty(String key) { // return properties.get(key); // } // // /** // * Sets the properties. // * // * @param properties the properties // */ // public void setProperties(final Map<String, String> properties) { // this.properties = properties; // } // // public EventReceiver getReciever() { // return reciever; // } // }
import java.io.IOException; import org.audit4j.core.AuditManager; import org.audit4j.core.exception.ConfigurationException; import org.audit4j.core.exception.InitializationException; import org.audit4j.microservice.core.ConfigurationManager; import org.audit4j.microservice.core.Context; import org.audit4j.microservice.core.HTTPServer; import org.audit4j.microservice.core.Transport;
package org.audit4j.microservice; class ServerContext implements Context { private String serverConfigFilePath = "../conf/server.config.yml"; private String audit4jConfigFilePath = "../conf/audit4j.conf.yml"; private ServerConfiguration config;
// Path: src/main/java/org/audit4j/microservice/core/ConfigurationManager.java // public class ConfigurationManager { // // private ConfigProvider<ServerConfiguration> configProvider; // // private String configPath = "conf/server.config.yml"; // // public ConfigurationManager(String configPath) { // this.configPath = configPath; // configProvider = new YAMLConfigProvider<>(ServerConfiguration.class); // } // // public ServerConfiguration loadConfiguration() throws ConfigurationException { // ServerConfiguration config = null; // config = configProvider // .readConfig(configPath); // return config; // } // // static InputStream getClasspathResourceAsStream(String resourceName) { // return ClassLoaderUtils.getClassLoader(Configurations.class) // .getResourceAsStream(resourceName); // } // } // // Path: src/main/java/org/audit4j/microservice/core/Context.java // public interface Context { // // void start() throws InitializationException; // // void stop(); // // void enable(); // // void disable(); // // void terminate(); // } // // Path: src/main/java/org/audit4j/microservice/core/HTTPServer.java // public interface HTTPServer extends Initializable{ // // void setPort(int port); // // public static HTTPServer create(int port) { // return new VertxServer(port); // } // } // // Path: src/main/java/org/audit4j/microservice/core/Transport.java // public abstract class Transport implements Initializable { // // /** The reciever. */ // EventReceiver reciever = new EventReceiverImpl(); // // /** The properties. */ // private Map<String, String> properties; // // /** // * Receive. // * // * @param event the event // */ // public void receive(AuditEvent event) { // reciever.receive(event); // } // // /** // * Gets the property. // * // * @param key the key // * @return the property // */ // public String getProperty(String key) { // return properties.get(key); // } // // /** // * Sets the properties. // * // * @param properties the properties // */ // public void setProperties(final Map<String, String> properties) { // this.properties = properties; // } // // public EventReceiver getReciever() { // return reciever; // } // } // Path: src/main/java/org/audit4j/microservice/ServerContext.java import java.io.IOException; import org.audit4j.core.AuditManager; import org.audit4j.core.exception.ConfigurationException; import org.audit4j.core.exception.InitializationException; import org.audit4j.microservice.core.ConfigurationManager; import org.audit4j.microservice.core.Context; import org.audit4j.microservice.core.HTTPServer; import org.audit4j.microservice.core.Transport; package org.audit4j.microservice; class ServerContext implements Context { private String serverConfigFilePath = "../conf/server.config.yml"; private String audit4jConfigFilePath = "../conf/audit4j.conf.yml"; private ServerConfiguration config;
HTTPServer httpServer = HTTPServer.create(8080);
audit4j/audit4j-microservice
src/main/java/org/audit4j/microservice/ServerContext.java
// Path: src/main/java/org/audit4j/microservice/core/ConfigurationManager.java // public class ConfigurationManager { // // private ConfigProvider<ServerConfiguration> configProvider; // // private String configPath = "conf/server.config.yml"; // // public ConfigurationManager(String configPath) { // this.configPath = configPath; // configProvider = new YAMLConfigProvider<>(ServerConfiguration.class); // } // // public ServerConfiguration loadConfiguration() throws ConfigurationException { // ServerConfiguration config = null; // config = configProvider // .readConfig(configPath); // return config; // } // // static InputStream getClasspathResourceAsStream(String resourceName) { // return ClassLoaderUtils.getClassLoader(Configurations.class) // .getResourceAsStream(resourceName); // } // } // // Path: src/main/java/org/audit4j/microservice/core/Context.java // public interface Context { // // void start() throws InitializationException; // // void stop(); // // void enable(); // // void disable(); // // void terminate(); // } // // Path: src/main/java/org/audit4j/microservice/core/HTTPServer.java // public interface HTTPServer extends Initializable{ // // void setPort(int port); // // public static HTTPServer create(int port) { // return new VertxServer(port); // } // } // // Path: src/main/java/org/audit4j/microservice/core/Transport.java // public abstract class Transport implements Initializable { // // /** The reciever. */ // EventReceiver reciever = new EventReceiverImpl(); // // /** The properties. */ // private Map<String, String> properties; // // /** // * Receive. // * // * @param event the event // */ // public void receive(AuditEvent event) { // reciever.receive(event); // } // // /** // * Gets the property. // * // * @param key the key // * @return the property // */ // public String getProperty(String key) { // return properties.get(key); // } // // /** // * Sets the properties. // * // * @param properties the properties // */ // public void setProperties(final Map<String, String> properties) { // this.properties = properties; // } // // public EventReceiver getReciever() { // return reciever; // } // }
import java.io.IOException; import org.audit4j.core.AuditManager; import org.audit4j.core.exception.ConfigurationException; import org.audit4j.core.exception.InitializationException; import org.audit4j.microservice.core.ConfigurationManager; import org.audit4j.microservice.core.Context; import org.audit4j.microservice.core.HTTPServer; import org.audit4j.microservice.core.Transport;
package org.audit4j.microservice; class ServerContext implements Context { private String serverConfigFilePath = "../conf/server.config.yml"; private String audit4jConfigFilePath = "../conf/audit4j.conf.yml"; private ServerConfiguration config; HTTPServer httpServer = HTTPServer.create(8080); @Override public void start() throws InitializationException { System.out.println("===================================================="); System.out.println("========= Starting Audit4j Microservice... ========="); System.out.println("===================================================="); try { if (AppRunningChecker.checkIfAlreadyRunning()) { System.out.println("An instance is already running...!"); System.exit(0); } } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // Load Configurations
// Path: src/main/java/org/audit4j/microservice/core/ConfigurationManager.java // public class ConfigurationManager { // // private ConfigProvider<ServerConfiguration> configProvider; // // private String configPath = "conf/server.config.yml"; // // public ConfigurationManager(String configPath) { // this.configPath = configPath; // configProvider = new YAMLConfigProvider<>(ServerConfiguration.class); // } // // public ServerConfiguration loadConfiguration() throws ConfigurationException { // ServerConfiguration config = null; // config = configProvider // .readConfig(configPath); // return config; // } // // static InputStream getClasspathResourceAsStream(String resourceName) { // return ClassLoaderUtils.getClassLoader(Configurations.class) // .getResourceAsStream(resourceName); // } // } // // Path: src/main/java/org/audit4j/microservice/core/Context.java // public interface Context { // // void start() throws InitializationException; // // void stop(); // // void enable(); // // void disable(); // // void terminate(); // } // // Path: src/main/java/org/audit4j/microservice/core/HTTPServer.java // public interface HTTPServer extends Initializable{ // // void setPort(int port); // // public static HTTPServer create(int port) { // return new VertxServer(port); // } // } // // Path: src/main/java/org/audit4j/microservice/core/Transport.java // public abstract class Transport implements Initializable { // // /** The reciever. */ // EventReceiver reciever = new EventReceiverImpl(); // // /** The properties. */ // private Map<String, String> properties; // // /** // * Receive. // * // * @param event the event // */ // public void receive(AuditEvent event) { // reciever.receive(event); // } // // /** // * Gets the property. // * // * @param key the key // * @return the property // */ // public String getProperty(String key) { // return properties.get(key); // } // // /** // * Sets the properties. // * // * @param properties the properties // */ // public void setProperties(final Map<String, String> properties) { // this.properties = properties; // } // // public EventReceiver getReciever() { // return reciever; // } // } // Path: src/main/java/org/audit4j/microservice/ServerContext.java import java.io.IOException; import org.audit4j.core.AuditManager; import org.audit4j.core.exception.ConfigurationException; import org.audit4j.core.exception.InitializationException; import org.audit4j.microservice.core.ConfigurationManager; import org.audit4j.microservice.core.Context; import org.audit4j.microservice.core.HTTPServer; import org.audit4j.microservice.core.Transport; package org.audit4j.microservice; class ServerContext implements Context { private String serverConfigFilePath = "../conf/server.config.yml"; private String audit4jConfigFilePath = "../conf/audit4j.conf.yml"; private ServerConfiguration config; HTTPServer httpServer = HTTPServer.create(8080); @Override public void start() throws InitializationException { System.out.println("===================================================="); System.out.println("========= Starting Audit4j Microservice... ========="); System.out.println("===================================================="); try { if (AppRunningChecker.checkIfAlreadyRunning()) { System.out.println("An instance is already running...!"); System.exit(0); } } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // Load Configurations
ConfigurationManager manager = new ConfigurationManager(serverConfigFilePath);
audit4j/audit4j-microservice
src/main/java/org/audit4j/microservice/ServerContext.java
// Path: src/main/java/org/audit4j/microservice/core/ConfigurationManager.java // public class ConfigurationManager { // // private ConfigProvider<ServerConfiguration> configProvider; // // private String configPath = "conf/server.config.yml"; // // public ConfigurationManager(String configPath) { // this.configPath = configPath; // configProvider = new YAMLConfigProvider<>(ServerConfiguration.class); // } // // public ServerConfiguration loadConfiguration() throws ConfigurationException { // ServerConfiguration config = null; // config = configProvider // .readConfig(configPath); // return config; // } // // static InputStream getClasspathResourceAsStream(String resourceName) { // return ClassLoaderUtils.getClassLoader(Configurations.class) // .getResourceAsStream(resourceName); // } // } // // Path: src/main/java/org/audit4j/microservice/core/Context.java // public interface Context { // // void start() throws InitializationException; // // void stop(); // // void enable(); // // void disable(); // // void terminate(); // } // // Path: src/main/java/org/audit4j/microservice/core/HTTPServer.java // public interface HTTPServer extends Initializable{ // // void setPort(int port); // // public static HTTPServer create(int port) { // return new VertxServer(port); // } // } // // Path: src/main/java/org/audit4j/microservice/core/Transport.java // public abstract class Transport implements Initializable { // // /** The reciever. */ // EventReceiver reciever = new EventReceiverImpl(); // // /** The properties. */ // private Map<String, String> properties; // // /** // * Receive. // * // * @param event the event // */ // public void receive(AuditEvent event) { // reciever.receive(event); // } // // /** // * Gets the property. // * // * @param key the key // * @return the property // */ // public String getProperty(String key) { // return properties.get(key); // } // // /** // * Sets the properties. // * // * @param properties the properties // */ // public void setProperties(final Map<String, String> properties) { // this.properties = properties; // } // // public EventReceiver getReciever() { // return reciever; // } // }
import java.io.IOException; import org.audit4j.core.AuditManager; import org.audit4j.core.exception.ConfigurationException; import org.audit4j.core.exception.InitializationException; import org.audit4j.microservice.core.ConfigurationManager; import org.audit4j.microservice.core.Context; import org.audit4j.microservice.core.HTTPServer; import org.audit4j.microservice.core.Transport;
package org.audit4j.microservice; class ServerContext implements Context { private String serverConfigFilePath = "../conf/server.config.yml"; private String audit4jConfigFilePath = "../conf/audit4j.conf.yml"; private ServerConfiguration config; HTTPServer httpServer = HTTPServer.create(8080); @Override public void start() throws InitializationException { System.out.println("===================================================="); System.out.println("========= Starting Audit4j Microservice... ========="); System.out.println("===================================================="); try { if (AppRunningChecker.checkIfAlreadyRunning()) { System.out.println("An instance is already running...!"); System.exit(0); } } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // Load Configurations ConfigurationManager manager = new ConfigurationManager(serverConfigFilePath); try { config = manager.loadConfiguration(); System.out.println("CONF: " + config); } catch (ConfigurationException e) { throw new InitializationException("Could not load configuraiton.!", e); } // Initializing transports
// Path: src/main/java/org/audit4j/microservice/core/ConfigurationManager.java // public class ConfigurationManager { // // private ConfigProvider<ServerConfiguration> configProvider; // // private String configPath = "conf/server.config.yml"; // // public ConfigurationManager(String configPath) { // this.configPath = configPath; // configProvider = new YAMLConfigProvider<>(ServerConfiguration.class); // } // // public ServerConfiguration loadConfiguration() throws ConfigurationException { // ServerConfiguration config = null; // config = configProvider // .readConfig(configPath); // return config; // } // // static InputStream getClasspathResourceAsStream(String resourceName) { // return ClassLoaderUtils.getClassLoader(Configurations.class) // .getResourceAsStream(resourceName); // } // } // // Path: src/main/java/org/audit4j/microservice/core/Context.java // public interface Context { // // void start() throws InitializationException; // // void stop(); // // void enable(); // // void disable(); // // void terminate(); // } // // Path: src/main/java/org/audit4j/microservice/core/HTTPServer.java // public interface HTTPServer extends Initializable{ // // void setPort(int port); // // public static HTTPServer create(int port) { // return new VertxServer(port); // } // } // // Path: src/main/java/org/audit4j/microservice/core/Transport.java // public abstract class Transport implements Initializable { // // /** The reciever. */ // EventReceiver reciever = new EventReceiverImpl(); // // /** The properties. */ // private Map<String, String> properties; // // /** // * Receive. // * // * @param event the event // */ // public void receive(AuditEvent event) { // reciever.receive(event); // } // // /** // * Gets the property. // * // * @param key the key // * @return the property // */ // public String getProperty(String key) { // return properties.get(key); // } // // /** // * Sets the properties. // * // * @param properties the properties // */ // public void setProperties(final Map<String, String> properties) { // this.properties = properties; // } // // public EventReceiver getReciever() { // return reciever; // } // } // Path: src/main/java/org/audit4j/microservice/ServerContext.java import java.io.IOException; import org.audit4j.core.AuditManager; import org.audit4j.core.exception.ConfigurationException; import org.audit4j.core.exception.InitializationException; import org.audit4j.microservice.core.ConfigurationManager; import org.audit4j.microservice.core.Context; import org.audit4j.microservice.core.HTTPServer; import org.audit4j.microservice.core.Transport; package org.audit4j.microservice; class ServerContext implements Context { private String serverConfigFilePath = "../conf/server.config.yml"; private String audit4jConfigFilePath = "../conf/audit4j.conf.yml"; private ServerConfiguration config; HTTPServer httpServer = HTTPServer.create(8080); @Override public void start() throws InitializationException { System.out.println("===================================================="); System.out.println("========= Starting Audit4j Microservice... ========="); System.out.println("===================================================="); try { if (AppRunningChecker.checkIfAlreadyRunning()) { System.out.println("An instance is already running...!"); System.exit(0); } } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // Load Configurations ConfigurationManager manager = new ConfigurationManager(serverConfigFilePath); try { config = manager.loadConfiguration(); System.out.println("CONF: " + config); } catch (ConfigurationException e) { throw new InitializationException("Could not load configuraiton.!", e); } // Initializing transports
for (Transport transport : config.getTransports()) {
audit4j/audit4j-microservice
src/main/java/org/audit4j/microservice/transport/WebsocketHandler.java
// Path: src/main/java/org/audit4j/microservice/core/Ack.java // public class Ack implements Serializable{ // // /** // * // */ // private static final long serialVersionUID = -8707468501787579530L; // // private String message; // // private int code; // // public String getMessage() { // return message; // } // // public void setMessage(String message) { // this.message = message; // } // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public static Ack SUCCESS(){ // Ack ack = new Ack(); // ack.setCode(200); // ack.setMessage("success"); // return ack; // } // // public static Ack FAIL(){ // Ack ack = new Ack(); // ack.setCode(500); // ack.setMessage("fail"); // return ack; // } // // public static Ack UNAUTHORIZED(){ // Ack ack = new Ack(); // ack.setCode(401); // ack.setMessage("unauthorized"); // return ack; // } // }
import io.vertx.core.Handler; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.WebSocket; import org.audit4j.core.Initializable; import org.audit4j.core.exception.InitializationException; import org.audit4j.microservice.core.Ack; import org.nustaq.serialization.FSTConfiguration;
package org.audit4j.microservice.transport; public class WebsocketHandler implements Handler<WebSocket>, Initializable{ FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration(); WebSocket websocket; @Override public void handle(WebSocket websocket) { this.websocket = websocket; websocket.handler(data -> {
// Path: src/main/java/org/audit4j/microservice/core/Ack.java // public class Ack implements Serializable{ // // /** // * // */ // private static final long serialVersionUID = -8707468501787579530L; // // private String message; // // private int code; // // public String getMessage() { // return message; // } // // public void setMessage(String message) { // this.message = message; // } // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public static Ack SUCCESS(){ // Ack ack = new Ack(); // ack.setCode(200); // ack.setMessage("success"); // return ack; // } // // public static Ack FAIL(){ // Ack ack = new Ack(); // ack.setCode(500); // ack.setMessage("fail"); // return ack; // } // // public static Ack UNAUTHORIZED(){ // Ack ack = new Ack(); // ack.setCode(401); // ack.setMessage("unauthorized"); // return ack; // } // } // Path: src/main/java/org/audit4j/microservice/transport/WebsocketHandler.java import io.vertx.core.Handler; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.WebSocket; import org.audit4j.core.Initializable; import org.audit4j.core.exception.InitializationException; import org.audit4j.microservice.core.Ack; import org.nustaq.serialization.FSTConfiguration; package org.audit4j.microservice.transport; public class WebsocketHandler implements Handler<WebSocket>, Initializable{ FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration(); WebSocket websocket; @Override public void handle(WebSocket websocket) { this.websocket = websocket; websocket.handler(data -> {
Ack ack = (Ack) conf.asObject(data.getBytes());
audit4j/audit4j-microservice
src/main/java/org/audit4j/microservice/web/WebRouter.java
// Path: src/main/java/org/audit4j/microservice/ServerConfiguration.java // public class ServerConfiguration extends Configuration { // // private List<Transport> transports = new ArrayList<>(); // // public List<Transport> getTransports() { // return transports; // } // // public void setTransports(List<Transport> transports) { // this.transports = transports; // } // // @Override // public String toString() { // return "ServerConfiguration [transports=" + transports + "]"; // } // }
import org.audit4j.microservice.ServerConfiguration; import io.vertx.core.Vertx; import io.vertx.ext.auth.AuthProvider; import io.vertx.ext.web.Router; import io.vertx.ext.web.handler.BodyHandler; import io.vertx.ext.web.handler.CookieHandler; import io.vertx.ext.web.handler.FormLoginHandler; import io.vertx.ext.web.handler.RedirectAuthHandler; import io.vertx.ext.web.handler.SessionHandler; import io.vertx.ext.web.handler.UserSessionHandler; import io.vertx.ext.web.sstore.LocalSessionStore;
package org.audit4j.microservice.web; public class WebRouter { Vertx vertx; public WebRouter(Vertx vertx) { this.vertx = vertx; } public Router getRouter() { Router router = Router.router(vertx); // We need cookies, sessions and request bodies router.route().handler(CookieHandler.create()); router.route().handler(BodyHandler.create()); router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
// Path: src/main/java/org/audit4j/microservice/ServerConfiguration.java // public class ServerConfiguration extends Configuration { // // private List<Transport> transports = new ArrayList<>(); // // public List<Transport> getTransports() { // return transports; // } // // public void setTransports(List<Transport> transports) { // this.transports = transports; // } // // @Override // public String toString() { // return "ServerConfiguration [transports=" + transports + "]"; // } // } // Path: src/main/java/org/audit4j/microservice/web/WebRouter.java import org.audit4j.microservice.ServerConfiguration; import io.vertx.core.Vertx; import io.vertx.ext.auth.AuthProvider; import io.vertx.ext.web.Router; import io.vertx.ext.web.handler.BodyHandler; import io.vertx.ext.web.handler.CookieHandler; import io.vertx.ext.web.handler.FormLoginHandler; import io.vertx.ext.web.handler.RedirectAuthHandler; import io.vertx.ext.web.handler.SessionHandler; import io.vertx.ext.web.handler.UserSessionHandler; import io.vertx.ext.web.sstore.LocalSessionStore; package org.audit4j.microservice.web; public class WebRouter { Vertx vertx; public WebRouter(Vertx vertx) { this.vertx = vertx; } public Router getRouter() { Router router = Router.router(vertx); // We need cookies, sessions and request bodies router.route().handler(CookieHandler.create()); router.route().handler(BodyHandler.create()); router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
AuthProvider authProvider = CustomAuth.create(vertx, new ServerConfiguration());
audit4j/audit4j-microservice
src/main/java/org/audit4j/microservice/core/HTTPServer.java
// Path: src/main/java/org/audit4j/microservice/web/VertxServer.java // public class VertxServer extends AbstractVerticle implements HTTPServer{ // // private int port; // // Vertx vertx; // // public VertxServer(int port) { // this.port = port; // } // // @Override // public void start() { // WebRouter webRouter = new WebRouter(vertx); // Router router = webRouter.getRouter(); // // RestRouter restRouter = new RestRouter(vertx); // router.mountSubRouter("/api", restRouter.getRouter()); // // // router.route("/*").handler(StaticHandler.create()); // // vertx.createHttpServer().requestHandler(router::accept).listen(port); // } // // // // public static void main(String[] args) { // VertxServer server = new VertxServer(8080); // server.vertx = Vertx.vertx(); // server.vertx.deployVerticle(server); // } // // @Override // public void init() throws InitializationException { // vertx = Vertx.vertx(); // vertx.deployVerticle(this); // System.out.println("Vertx HTTP server started.! port: " + port); // } // // @Override // public void stop() { // vertx.close(); // } // // @Override // public void setPort(int port) { // this.port = port; // } // }
import org.audit4j.core.Initializable; import org.audit4j.microservice.web.VertxServer;
package org.audit4j.microservice.core; public interface HTTPServer extends Initializable{ void setPort(int port); public static HTTPServer create(int port) {
// Path: src/main/java/org/audit4j/microservice/web/VertxServer.java // public class VertxServer extends AbstractVerticle implements HTTPServer{ // // private int port; // // Vertx vertx; // // public VertxServer(int port) { // this.port = port; // } // // @Override // public void start() { // WebRouter webRouter = new WebRouter(vertx); // Router router = webRouter.getRouter(); // // RestRouter restRouter = new RestRouter(vertx); // router.mountSubRouter("/api", restRouter.getRouter()); // // // router.route("/*").handler(StaticHandler.create()); // // vertx.createHttpServer().requestHandler(router::accept).listen(port); // } // // // // public static void main(String[] args) { // VertxServer server = new VertxServer(8080); // server.vertx = Vertx.vertx(); // server.vertx.deployVerticle(server); // } // // @Override // public void init() throws InitializationException { // vertx = Vertx.vertx(); // vertx.deployVerticle(this); // System.out.println("Vertx HTTP server started.! port: " + port); // } // // @Override // public void stop() { // vertx.close(); // } // // @Override // public void setPort(int port) { // this.port = port; // } // } // Path: src/main/java/org/audit4j/microservice/core/HTTPServer.java import org.audit4j.core.Initializable; import org.audit4j.microservice.web.VertxServer; package org.audit4j.microservice.core; public interface HTTPServer extends Initializable{ void setPort(int port); public static HTTPServer create(int port) {
return new VertxServer(port);
audit4j/audit4j-microservice
src/main/java/org/audit4j/microservice/web/VertxServer.java
// Path: src/main/java/org/audit4j/microservice/core/HTTPServer.java // public interface HTTPServer extends Initializable{ // // void setPort(int port); // // public static HTTPServer create(int port) { // return new VertxServer(port); // } // } // // Path: src/main/java/org/audit4j/microservice/web/rest/RestRouter.java // public class RestRouter { // // Vertx vertx; // // public RestRouter(Vertx vertx) { // this.vertx = vertx; // } // // public Router getRouter() { // Router router = Router.router(vertx); // // router.get("/health").handler(this::handlerHealth); // router.post("/rest/event").handler(new RESTAuditEventHandler()::handleEvent); // // return router; // } // // private void handlerHealth(RoutingContext routingContext) { // HttpServerResponse response = routingContext.response(); // response.putHeader("content-type", "application/json") // .end(new JsonObject().put("status", "running").encodePrettily()); // } // }
import org.audit4j.core.exception.InitializationException; import org.audit4j.microservice.core.HTTPServer; import org.audit4j.microservice.web.rest.RestRouter; import io.vertx.core.AbstractVerticle; import io.vertx.core.Vertx; import io.vertx.ext.web.Router; import io.vertx.ext.web.handler.StaticHandler;
package org.audit4j.microservice.web; public class VertxServer extends AbstractVerticle implements HTTPServer{ private int port; Vertx vertx; public VertxServer(int port) { this.port = port; } @Override public void start() { WebRouter webRouter = new WebRouter(vertx); Router router = webRouter.getRouter();
// Path: src/main/java/org/audit4j/microservice/core/HTTPServer.java // public interface HTTPServer extends Initializable{ // // void setPort(int port); // // public static HTTPServer create(int port) { // return new VertxServer(port); // } // } // // Path: src/main/java/org/audit4j/microservice/web/rest/RestRouter.java // public class RestRouter { // // Vertx vertx; // // public RestRouter(Vertx vertx) { // this.vertx = vertx; // } // // public Router getRouter() { // Router router = Router.router(vertx); // // router.get("/health").handler(this::handlerHealth); // router.post("/rest/event").handler(new RESTAuditEventHandler()::handleEvent); // // return router; // } // // private void handlerHealth(RoutingContext routingContext) { // HttpServerResponse response = routingContext.response(); // response.putHeader("content-type", "application/json") // .end(new JsonObject().put("status", "running").encodePrettily()); // } // } // Path: src/main/java/org/audit4j/microservice/web/VertxServer.java import org.audit4j.core.exception.InitializationException; import org.audit4j.microservice.core.HTTPServer; import org.audit4j.microservice.web.rest.RestRouter; import io.vertx.core.AbstractVerticle; import io.vertx.core.Vertx; import io.vertx.ext.web.Router; import io.vertx.ext.web.handler.StaticHandler; package org.audit4j.microservice.web; public class VertxServer extends AbstractVerticle implements HTTPServer{ private int port; Vertx vertx; public VertxServer(int port) { this.port = port; } @Override public void start() { WebRouter webRouter = new WebRouter(vertx); Router router = webRouter.getRouter();
RestRouter restRouter = new RestRouter(vertx);
audit4j/audit4j-microservice
src/main/java/org/audit4j/microservice/transport/WebSocketTransportServer.java
// Path: src/main/java/org/audit4j/microservice/core/Ack.java // public class Ack implements Serializable{ // // /** // * // */ // private static final long serialVersionUID = -8707468501787579530L; // // private String message; // // private int code; // // public String getMessage() { // return message; // } // // public void setMessage(String message) { // this.message = message; // } // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public static Ack SUCCESS(){ // Ack ack = new Ack(); // ack.setCode(200); // ack.setMessage("success"); // return ack; // } // // public static Ack FAIL(){ // Ack ack = new Ack(); // ack.setCode(500); // ack.setMessage("fail"); // return ack; // } // // public static Ack UNAUTHORIZED(){ // Ack ack = new Ack(); // ack.setCode(401); // ack.setMessage("unauthorized"); // return ack; // } // } // // Path: src/main/java/org/audit4j/microservice/core/Transport.java // public abstract class Transport implements Initializable { // // /** The reciever. */ // EventReceiver reciever = new EventReceiverImpl(); // // /** The properties. */ // private Map<String, String> properties; // // /** // * Receive. // * // * @param event the event // */ // public void receive(AuditEvent event) { // reciever.receive(event); // } // // /** // * Gets the property. // * // * @param key the key // * @return the property // */ // public String getProperty(String key) { // return properties.get(key); // } // // /** // * Sets the properties. // * // * @param properties the properties // */ // public void setProperties(final Map<String, String> properties) { // this.properties = properties; // } // // public EventReceiver getReciever() { // return reciever; // } // }
import org.audit4j.core.dto.AuditEvent; import org.audit4j.core.exception.InitializationException; import org.audit4j.core.util.Log; import org.audit4j.microservice.core.Ack; import org.audit4j.microservice.core.Transport; import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer;
package org.audit4j.microservice.transport; public class WebSocketTransportServer extends Transport { Serializer serializer; private int port = 9091; @Override public void init() throws InitializationException { serializer = new SerializerImpl(); // VertxOptions options = new VertxOptions(); Vertx vertx = Vertx.vertx(); vertx.createHttpServer() .websocketHandler( ws -> ws.handler(buffer -> { ws.frameHandler(event -> { if (event.isFinal()) { if (event.isBinary()) { byte[] buff = buffer.getBytes(); try { AuditEvent auditEvent = serializer .fromByteArray(buff, AuditEvent.class); Log.info("Recived Message.."); ws.writeBinaryMessage(Buffer.buffer(serializer
// Path: src/main/java/org/audit4j/microservice/core/Ack.java // public class Ack implements Serializable{ // // /** // * // */ // private static final long serialVersionUID = -8707468501787579530L; // // private String message; // // private int code; // // public String getMessage() { // return message; // } // // public void setMessage(String message) { // this.message = message; // } // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public static Ack SUCCESS(){ // Ack ack = new Ack(); // ack.setCode(200); // ack.setMessage("success"); // return ack; // } // // public static Ack FAIL(){ // Ack ack = new Ack(); // ack.setCode(500); // ack.setMessage("fail"); // return ack; // } // // public static Ack UNAUTHORIZED(){ // Ack ack = new Ack(); // ack.setCode(401); // ack.setMessage("unauthorized"); // return ack; // } // } // // Path: src/main/java/org/audit4j/microservice/core/Transport.java // public abstract class Transport implements Initializable { // // /** The reciever. */ // EventReceiver reciever = new EventReceiverImpl(); // // /** The properties. */ // private Map<String, String> properties; // // /** // * Receive. // * // * @param event the event // */ // public void receive(AuditEvent event) { // reciever.receive(event); // } // // /** // * Gets the property. // * // * @param key the key // * @return the property // */ // public String getProperty(String key) { // return properties.get(key); // } // // /** // * Sets the properties. // * // * @param properties the properties // */ // public void setProperties(final Map<String, String> properties) { // this.properties = properties; // } // // public EventReceiver getReciever() { // return reciever; // } // } // Path: src/main/java/org/audit4j/microservice/transport/WebSocketTransportServer.java import org.audit4j.core.dto.AuditEvent; import org.audit4j.core.exception.InitializationException; import org.audit4j.core.util.Log; import org.audit4j.microservice.core.Ack; import org.audit4j.microservice.core.Transport; import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; package org.audit4j.microservice.transport; public class WebSocketTransportServer extends Transport { Serializer serializer; private int port = 9091; @Override public void init() throws InitializationException { serializer = new SerializerImpl(); // VertxOptions options = new VertxOptions(); Vertx vertx = Vertx.vertx(); vertx.createHttpServer() .websocketHandler( ws -> ws.handler(buffer -> { ws.frameHandler(event -> { if (event.isFinal()) { if (event.isBinary()) { byte[] buff = buffer.getBytes(); try { AuditEvent auditEvent = serializer .fromByteArray(buff, AuditEvent.class); Log.info("Recived Message.."); ws.writeBinaryMessage(Buffer.buffer(serializer
.toByteArray(Ack.SUCCESS())));
audit4j/audit4j-microservice
src/main/java/org/audit4j/microservice/web/rest/RESTAuditEventHandler.java
// Path: src/main/java/org/audit4j/microservice/core/Ack.java // public class Ack implements Serializable{ // // /** // * // */ // private static final long serialVersionUID = -8707468501787579530L; // // private String message; // // private int code; // // public String getMessage() { // return message; // } // // public void setMessage(String message) { // this.message = message; // } // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public static Ack SUCCESS(){ // Ack ack = new Ack(); // ack.setCode(200); // ack.setMessage("success"); // return ack; // } // // public static Ack FAIL(){ // Ack ack = new Ack(); // ack.setCode(500); // ack.setMessage("fail"); // return ack; // } // // public static Ack UNAUTHORIZED(){ // Ack ack = new Ack(); // ack.setCode(401); // ack.setMessage("unauthorized"); // return ack; // } // } // // Path: src/main/java/org/audit4j/microservice/core/EventReceiver.java // public interface EventReceiver { // // Ack receive(AuditEvent event); // // } // // Path: src/main/java/org/audit4j/microservice/core/EventReceiverImpl.java // public class EventReceiverImpl implements EventReceiver { // @Override // public Ack receive(AuditEvent event) { // /*// Validate Event // if (clientContext.containsClient(event.getMeta().client)) { // AuditManager.getInstance().audit(event); // return Ack.SUCCESS(); // } else { // return Ack.UNAUTHORIZED(); // }*/ // // AuditManager.getInstance().audit(event); // return Ack.SUCCESS(); // } // }
import org.audit4j.core.dto.AuditEvent; import org.audit4j.microservice.core.Ack; import org.audit4j.microservice.core.EventReceiver; import org.audit4j.microservice.core.EventReceiverImpl; import io.vertx.core.http.HttpServerResponse; import io.vertx.core.json.Json; import io.vertx.core.json.JsonObject; import io.vertx.ext.web.RoutingContext;
package org.audit4j.microservice.web.rest; public class RESTAuditEventHandler { private EventReceiver reciever = new EventReceiverImpl(); public void handleEvent(RoutingContext routingContext) { JsonObject jsonEvent = routingContext.getBodyAsJson(); AuditEvent event = Json.decodeValue(jsonEvent.encode(), AuditEvent.class); reciever.receive(event); HttpServerResponse response = routingContext.response(); response.putHeader("content-type", "application/json")
// Path: src/main/java/org/audit4j/microservice/core/Ack.java // public class Ack implements Serializable{ // // /** // * // */ // private static final long serialVersionUID = -8707468501787579530L; // // private String message; // // private int code; // // public String getMessage() { // return message; // } // // public void setMessage(String message) { // this.message = message; // } // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public static Ack SUCCESS(){ // Ack ack = new Ack(); // ack.setCode(200); // ack.setMessage("success"); // return ack; // } // // public static Ack FAIL(){ // Ack ack = new Ack(); // ack.setCode(500); // ack.setMessage("fail"); // return ack; // } // // public static Ack UNAUTHORIZED(){ // Ack ack = new Ack(); // ack.setCode(401); // ack.setMessage("unauthorized"); // return ack; // } // } // // Path: src/main/java/org/audit4j/microservice/core/EventReceiver.java // public interface EventReceiver { // // Ack receive(AuditEvent event); // // } // // Path: src/main/java/org/audit4j/microservice/core/EventReceiverImpl.java // public class EventReceiverImpl implements EventReceiver { // @Override // public Ack receive(AuditEvent event) { // /*// Validate Event // if (clientContext.containsClient(event.getMeta().client)) { // AuditManager.getInstance().audit(event); // return Ack.SUCCESS(); // } else { // return Ack.UNAUTHORIZED(); // }*/ // // AuditManager.getInstance().audit(event); // return Ack.SUCCESS(); // } // } // Path: src/main/java/org/audit4j/microservice/web/rest/RESTAuditEventHandler.java import org.audit4j.core.dto.AuditEvent; import org.audit4j.microservice.core.Ack; import org.audit4j.microservice.core.EventReceiver; import org.audit4j.microservice.core.EventReceiverImpl; import io.vertx.core.http.HttpServerResponse; import io.vertx.core.json.Json; import io.vertx.core.json.JsonObject; import io.vertx.ext.web.RoutingContext; package org.audit4j.microservice.web.rest; public class RESTAuditEventHandler { private EventReceiver reciever = new EventReceiverImpl(); public void handleEvent(RoutingContext routingContext) { JsonObject jsonEvent = routingContext.getBodyAsJson(); AuditEvent event = Json.decodeValue(jsonEvent.encode(), AuditEvent.class); reciever.receive(event); HttpServerResponse response = routingContext.response(); response.putHeader("content-type", "application/json")
.end(new JsonObject(Json.encode(Ack.SUCCESS())).encodePrettily());
audit4j/audit4j-microservice
src/main/java/org/audit4j/microservice/web/CustomAuthImpl.java
// Path: src/main/java/org/audit4j/microservice/ServerConfiguration.java // public class ServerConfiguration extends Configuration { // // private List<Transport> transports = new ArrayList<>(); // // public List<Transport> getTransports() { // return transports; // } // // public void setTransports(List<Transport> transports) { // this.transports = transports; // } // // @Override // public String toString() { // return "ServerConfiguration [transports=" + transports + "]"; // } // }
import java.util.HashMap; import java.util.Map; import org.audit4j.microservice.ServerConfiguration; import io.vertx.core.AsyncResult; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Vertx; import io.vertx.core.json.JsonObject; import io.vertx.ext.auth.User;
package org.audit4j.microservice.web; public class CustomAuthImpl implements CustomAuth { Map<String, String> users = new HashMap<>();
// Path: src/main/java/org/audit4j/microservice/ServerConfiguration.java // public class ServerConfiguration extends Configuration { // // private List<Transport> transports = new ArrayList<>(); // // public List<Transport> getTransports() { // return transports; // } // // public void setTransports(List<Transport> transports) { // this.transports = transports; // } // // @Override // public String toString() { // return "ServerConfiguration [transports=" + transports + "]"; // } // } // Path: src/main/java/org/audit4j/microservice/web/CustomAuthImpl.java import java.util.HashMap; import java.util.Map; import org.audit4j.microservice.ServerConfiguration; import io.vertx.core.AsyncResult; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Vertx; import io.vertx.core.json.JsonObject; import io.vertx.ext.auth.User; package org.audit4j.microservice.web; public class CustomAuthImpl implements CustomAuth { Map<String, String> users = new HashMap<>();
public CustomAuthImpl(Vertx vertx, ServerConfiguration config) {
simonpercic/AirCycle
example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/CountdownModule.java
// Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/manager/CountdownManager.java // public class CountdownManager { // // @Inject // public CountdownManager() { // } // // public Observable<Integer> countdownFrom(@IntRange(from = 1) int fromValue) { // if (fromValue < 1) { // throw new IllegalArgumentException("fromValue must be at least 1"); // } // // return Observable.interval(1, 1, TimeUnit.SECONDS) // .map(value -> fromValue - value.intValue()) // .takeUntil(value -> value <= 0); // } // }
import com.github.simonpercic.mvp.example.aircycle.ui.base.scope.PerActivity; import com.github.simonpercic.mvp.example.aircycle.ui.countdown.manager.CountdownManager; import dagger.Module; import dagger.Provides;
package com.github.simonpercic.mvp.example.aircycle.ui.countdown; /** * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a> */ @Module public class CountdownModule { private final CountdownMvp.View view; public CountdownModule(CountdownMvp.View view) { this.view = view; } @Provides @PerActivity CountdownMvp.View provideView() { return view; } @Provides @PerActivity CountdownMvp.Presenter providePresenter(CountdownMvp.View view,
// Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/manager/CountdownManager.java // public class CountdownManager { // // @Inject // public CountdownManager() { // } // // public Observable<Integer> countdownFrom(@IntRange(from = 1) int fromValue) { // if (fromValue < 1) { // throw new IllegalArgumentException("fromValue must be at least 1"); // } // // return Observable.interval(1, 1, TimeUnit.SECONDS) // .map(value -> fromValue - value.intValue()) // .takeUntil(value -> value <= 0); // } // } // Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/CountdownModule.java import com.github.simonpercic.mvp.example.aircycle.ui.base.scope.PerActivity; import com.github.simonpercic.mvp.example.aircycle.ui.countdown.manager.CountdownManager; import dagger.Module; import dagger.Provides; package com.github.simonpercic.mvp.example.aircycle.ui.countdown; /** * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a> */ @Module public class CountdownModule { private final CountdownMvp.View view; public CountdownModule(CountdownMvp.View view) { this.view = view; } @Provides @PerActivity CountdownMvp.View provideView() { return view; } @Provides @PerActivity CountdownMvp.Presenter providePresenter(CountdownMvp.View view,
CountdownManager countdownManager) {
simonpercic/AirCycle
example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/CountdownPresenter.java
// Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/manager/utils/rx/SubscriptionUtils.java // public final class SubscriptionUtils { // // private SubscriptionUtils() { // // no instance // } // // public static void unsubscribe(@Nullable Subscription subscription) { // if (subscription != null && !subscription.isUnsubscribed()) { // subscription.unsubscribe(); // } // } // } // // Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/CountdownMvp.java // interface View { // // void showStart(); // // void showValue(String value); // // void showComplete(); // // void showError(String message); // // void showCloseButton(); // // void hideCloseButton(); // } // // Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/manager/CountdownManager.java // public class CountdownManager { // // @Inject // public CountdownManager() { // } // // public Observable<Integer> countdownFrom(@IntRange(from = 1) int fromValue) { // if (fromValue < 1) { // throw new IllegalArgumentException("fromValue must be at least 1"); // } // // return Observable.interval(1, 1, TimeUnit.SECONDS) // .map(value -> fromValue - value.intValue()) // .takeUntil(value -> value <= 0); // } // }
import com.github.simonpercic.mvp.example.aircycle.manager.utils.rx.SubscriptionUtils; import com.github.simonpercic.mvp.example.aircycle.ui.countdown.CountdownMvp.View; import com.github.simonpercic.mvp.example.aircycle.ui.countdown.manager.CountdownManager; import rx.Observer; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers;
package com.github.simonpercic.mvp.example.aircycle.ui.countdown; /** * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a> */ class CountdownPresenter implements CountdownMvp.Presenter { private final CountdownMvp.View view;
// Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/manager/utils/rx/SubscriptionUtils.java // public final class SubscriptionUtils { // // private SubscriptionUtils() { // // no instance // } // // public static void unsubscribe(@Nullable Subscription subscription) { // if (subscription != null && !subscription.isUnsubscribed()) { // subscription.unsubscribe(); // } // } // } // // Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/CountdownMvp.java // interface View { // // void showStart(); // // void showValue(String value); // // void showComplete(); // // void showError(String message); // // void showCloseButton(); // // void hideCloseButton(); // } // // Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/manager/CountdownManager.java // public class CountdownManager { // // @Inject // public CountdownManager() { // } // // public Observable<Integer> countdownFrom(@IntRange(from = 1) int fromValue) { // if (fromValue < 1) { // throw new IllegalArgumentException("fromValue must be at least 1"); // } // // return Observable.interval(1, 1, TimeUnit.SECONDS) // .map(value -> fromValue - value.intValue()) // .takeUntil(value -> value <= 0); // } // } // Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/CountdownPresenter.java import com.github.simonpercic.mvp.example.aircycle.manager.utils.rx.SubscriptionUtils; import com.github.simonpercic.mvp.example.aircycle.ui.countdown.CountdownMvp.View; import com.github.simonpercic.mvp.example.aircycle.ui.countdown.manager.CountdownManager; import rx.Observer; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; package com.github.simonpercic.mvp.example.aircycle.ui.countdown; /** * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a> */ class CountdownPresenter implements CountdownMvp.Presenter { private final CountdownMvp.View view;
private final CountdownManager countdownManager;
simonpercic/AirCycle
example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/CountdownPresenter.java
// Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/manager/utils/rx/SubscriptionUtils.java // public final class SubscriptionUtils { // // private SubscriptionUtils() { // // no instance // } // // public static void unsubscribe(@Nullable Subscription subscription) { // if (subscription != null && !subscription.isUnsubscribed()) { // subscription.unsubscribe(); // } // } // } // // Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/CountdownMvp.java // interface View { // // void showStart(); // // void showValue(String value); // // void showComplete(); // // void showError(String message); // // void showCloseButton(); // // void hideCloseButton(); // } // // Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/manager/CountdownManager.java // public class CountdownManager { // // @Inject // public CountdownManager() { // } // // public Observable<Integer> countdownFrom(@IntRange(from = 1) int fromValue) { // if (fromValue < 1) { // throw new IllegalArgumentException("fromValue must be at least 1"); // } // // return Observable.interval(1, 1, TimeUnit.SECONDS) // .map(value -> fromValue - value.intValue()) // .takeUntil(value -> value <= 0); // } // }
import com.github.simonpercic.mvp.example.aircycle.manager.utils.rx.SubscriptionUtils; import com.github.simonpercic.mvp.example.aircycle.ui.countdown.CountdownMvp.View; import com.github.simonpercic.mvp.example.aircycle.ui.countdown.manager.CountdownManager; import rx.Observer; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers;
this.countdownManager = countdownManager; } @Override public void onCreate() { view.hideCloseButton(); } @Override public void onStart() { view.showStart(); subscription = countdownManager.countdownFrom(5) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<Integer>() { @Override public void onCompleted() { view.showComplete(); view.showCloseButton(); } @Override public void onError(Throwable e) { view.showError(e.getMessage()); view.showCloseButton(); } @Override public void onNext(Integer value) { view.showValue(String.valueOf(value)); } }); } @Override public void onStop() {
// Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/manager/utils/rx/SubscriptionUtils.java // public final class SubscriptionUtils { // // private SubscriptionUtils() { // // no instance // } // // public static void unsubscribe(@Nullable Subscription subscription) { // if (subscription != null && !subscription.isUnsubscribed()) { // subscription.unsubscribe(); // } // } // } // // Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/CountdownMvp.java // interface View { // // void showStart(); // // void showValue(String value); // // void showComplete(); // // void showError(String message); // // void showCloseButton(); // // void hideCloseButton(); // } // // Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/manager/CountdownManager.java // public class CountdownManager { // // @Inject // public CountdownManager() { // } // // public Observable<Integer> countdownFrom(@IntRange(from = 1) int fromValue) { // if (fromValue < 1) { // throw new IllegalArgumentException("fromValue must be at least 1"); // } // // return Observable.interval(1, 1, TimeUnit.SECONDS) // .map(value -> fromValue - value.intValue()) // .takeUntil(value -> value <= 0); // } // } // Path: example-mvp/src/main/java/com/github/simonpercic/mvp/example/aircycle/ui/countdown/CountdownPresenter.java import com.github.simonpercic.mvp.example.aircycle.manager.utils.rx.SubscriptionUtils; import com.github.simonpercic.mvp.example.aircycle.ui.countdown.CountdownMvp.View; import com.github.simonpercic.mvp.example.aircycle.ui.countdown.manager.CountdownManager; import rx.Observer; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; this.countdownManager = countdownManager; } @Override public void onCreate() { view.hideCloseButton(); } @Override public void onStart() { view.showStart(); subscription = countdownManager.countdownFrom(5) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<Integer>() { @Override public void onCompleted() { view.showComplete(); view.showCloseButton(); } @Override public void onError(Throwable e) { view.showError(e.getMessage()); view.showCloseButton(); } @Override public void onNext(Integer value) { view.showValue(String.valueOf(value)); } }); } @Override public void onStop() {
SubscriptionUtils.unsubscribe(subscription);
simonpercic/AirCycle
aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/ListenerMethod.java
// Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/exception/MethodArgumentsException.java // public class MethodArgumentsException extends Exception { // // public MethodArgumentsException(String message) { // super(message); // } // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ActivityLifecycleType.java // public enum ActivityLifecycleType { // CREATE, // START, // RESUME, // PAUSE, // STOP, // SAVE_INSTANCE_STATE, // DESTROY // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ListenerArgType.java // public enum ListenerArgType { // ACTIVITY, // BUNDLE // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/utils/StringUtils.java // public final class StringUtils { // // private StringUtils() { // // no instance // } // // /** // * Returns <tt>true</tt> if the charSequence is null or of zero length. // * // * @param charSequence char sequence // * @return <tt>true</tt> if charSequence is null or of zero length // */ // public static boolean isEmpty(CharSequence charSequence) { // return charSequence == null || charSequence.length() == 0; // } // }
import com.github.simonpercic.aircycle.exception.MethodArgumentsException; import com.github.simonpercic.aircycle.model.type.ActivityLifecycleType; import com.github.simonpercic.aircycle.model.type.ListenerArgType; import com.github.simonpercic.aircycle.utils.StringUtils; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.List;
package com.github.simonpercic.aircycle.model; /** * Listener method spec. * * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a> */ public class ListenerMethod { private final String methodName;
// Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/exception/MethodArgumentsException.java // public class MethodArgumentsException extends Exception { // // public MethodArgumentsException(String message) { // super(message); // } // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ActivityLifecycleType.java // public enum ActivityLifecycleType { // CREATE, // START, // RESUME, // PAUSE, // STOP, // SAVE_INSTANCE_STATE, // DESTROY // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ListenerArgType.java // public enum ListenerArgType { // ACTIVITY, // BUNDLE // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/utils/StringUtils.java // public final class StringUtils { // // private StringUtils() { // // no instance // } // // /** // * Returns <tt>true</tt> if the charSequence is null or of zero length. // * // * @param charSequence char sequence // * @return <tt>true</tt> if charSequence is null or of zero length // */ // public static boolean isEmpty(CharSequence charSequence) { // return charSequence == null || charSequence.length() == 0; // } // } // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/ListenerMethod.java import com.github.simonpercic.aircycle.exception.MethodArgumentsException; import com.github.simonpercic.aircycle.model.type.ActivityLifecycleType; import com.github.simonpercic.aircycle.model.type.ListenerArgType; import com.github.simonpercic.aircycle.utils.StringUtils; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.List; package com.github.simonpercic.aircycle.model; /** * Listener method spec. * * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a> */ public class ListenerMethod { private final String methodName;
private final List<ListenerArgType> args;
simonpercic/AirCycle
aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/ListenerMethod.java
// Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/exception/MethodArgumentsException.java // public class MethodArgumentsException extends Exception { // // public MethodArgumentsException(String message) { // super(message); // } // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ActivityLifecycleType.java // public enum ActivityLifecycleType { // CREATE, // START, // RESUME, // PAUSE, // STOP, // SAVE_INSTANCE_STATE, // DESTROY // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ListenerArgType.java // public enum ListenerArgType { // ACTIVITY, // BUNDLE // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/utils/StringUtils.java // public final class StringUtils { // // private StringUtils() { // // no instance // } // // /** // * Returns <tt>true</tt> if the charSequence is null or of zero length. // * // * @param charSequence char sequence // * @return <tt>true</tt> if charSequence is null or of zero length // */ // public static boolean isEmpty(CharSequence charSequence) { // return charSequence == null || charSequence.length() == 0; // } // }
import com.github.simonpercic.aircycle.exception.MethodArgumentsException; import com.github.simonpercic.aircycle.model.type.ActivityLifecycleType; import com.github.simonpercic.aircycle.model.type.ListenerArgType; import com.github.simonpercic.aircycle.utils.StringUtils; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.List;
package com.github.simonpercic.aircycle.model; /** * Listener method spec. * * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a> */ public class ListenerMethod { private final String methodName; private final List<ListenerArgType> args; public ListenerMethod(String methodName, List<ListenerArgType> args) { this.methodName = methodName; this.args = ImmutableList.copyOf(args); } public String getMethodName() { return methodName; } public List<ListenerArgType> getArgs() { return args; }
// Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/exception/MethodArgumentsException.java // public class MethodArgumentsException extends Exception { // // public MethodArgumentsException(String message) { // super(message); // } // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ActivityLifecycleType.java // public enum ActivityLifecycleType { // CREATE, // START, // RESUME, // PAUSE, // STOP, // SAVE_INSTANCE_STATE, // DESTROY // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ListenerArgType.java // public enum ListenerArgType { // ACTIVITY, // BUNDLE // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/utils/StringUtils.java // public final class StringUtils { // // private StringUtils() { // // no instance // } // // /** // * Returns <tt>true</tt> if the charSequence is null or of zero length. // * // * @param charSequence char sequence // * @return <tt>true</tt> if charSequence is null or of zero length // */ // public static boolean isEmpty(CharSequence charSequence) { // return charSequence == null || charSequence.length() == 0; // } // } // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/ListenerMethod.java import com.github.simonpercic.aircycle.exception.MethodArgumentsException; import com.github.simonpercic.aircycle.model.type.ActivityLifecycleType; import com.github.simonpercic.aircycle.model.type.ListenerArgType; import com.github.simonpercic.aircycle.utils.StringUtils; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.List; package com.github.simonpercic.aircycle.model; /** * Listener method spec. * * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a> */ public class ListenerMethod { private final String methodName; private final List<ListenerArgType> args; public ListenerMethod(String methodName, List<ListenerArgType> args) { this.methodName = methodName; this.args = ImmutableList.copyOf(args); } public String getMethodName() { return methodName; } public List<ListenerArgType> getArgs() { return args; }
public static Builder builder(ActivityLifecycleType activityLifecycle, String methodName) {
simonpercic/AirCycle
aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/ListenerMethod.java
// Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/exception/MethodArgumentsException.java // public class MethodArgumentsException extends Exception { // // public MethodArgumentsException(String message) { // super(message); // } // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ActivityLifecycleType.java // public enum ActivityLifecycleType { // CREATE, // START, // RESUME, // PAUSE, // STOP, // SAVE_INSTANCE_STATE, // DESTROY // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ListenerArgType.java // public enum ListenerArgType { // ACTIVITY, // BUNDLE // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/utils/StringUtils.java // public final class StringUtils { // // private StringUtils() { // // no instance // } // // /** // * Returns <tt>true</tt> if the charSequence is null or of zero length. // * // * @param charSequence char sequence // * @return <tt>true</tt> if charSequence is null or of zero length // */ // public static boolean isEmpty(CharSequence charSequence) { // return charSequence == null || charSequence.length() == 0; // } // }
import com.github.simonpercic.aircycle.exception.MethodArgumentsException; import com.github.simonpercic.aircycle.model.type.ActivityLifecycleType; import com.github.simonpercic.aircycle.model.type.ListenerArgType; import com.github.simonpercic.aircycle.utils.StringUtils; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.List;
package com.github.simonpercic.aircycle.model; /** * Listener method spec. * * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a> */ public class ListenerMethod { private final String methodName; private final List<ListenerArgType> args; public ListenerMethod(String methodName, List<ListenerArgType> args) { this.methodName = methodName; this.args = ImmutableList.copyOf(args); } public String getMethodName() { return methodName; } public List<ListenerArgType> getArgs() { return args; } public static Builder builder(ActivityLifecycleType activityLifecycle, String methodName) { if (activityLifecycle == null) { throw new IllegalArgumentException("activityLifecycle is null"); }
// Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/exception/MethodArgumentsException.java // public class MethodArgumentsException extends Exception { // // public MethodArgumentsException(String message) { // super(message); // } // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ActivityLifecycleType.java // public enum ActivityLifecycleType { // CREATE, // START, // RESUME, // PAUSE, // STOP, // SAVE_INSTANCE_STATE, // DESTROY // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ListenerArgType.java // public enum ListenerArgType { // ACTIVITY, // BUNDLE // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/utils/StringUtils.java // public final class StringUtils { // // private StringUtils() { // // no instance // } // // /** // * Returns <tt>true</tt> if the charSequence is null or of zero length. // * // * @param charSequence char sequence // * @return <tt>true</tt> if charSequence is null or of zero length // */ // public static boolean isEmpty(CharSequence charSequence) { // return charSequence == null || charSequence.length() == 0; // } // } // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/ListenerMethod.java import com.github.simonpercic.aircycle.exception.MethodArgumentsException; import com.github.simonpercic.aircycle.model.type.ActivityLifecycleType; import com.github.simonpercic.aircycle.model.type.ListenerArgType; import com.github.simonpercic.aircycle.utils.StringUtils; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.List; package com.github.simonpercic.aircycle.model; /** * Listener method spec. * * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a> */ public class ListenerMethod { private final String methodName; private final List<ListenerArgType> args; public ListenerMethod(String methodName, List<ListenerArgType> args) { this.methodName = methodName; this.args = ImmutableList.copyOf(args); } public String getMethodName() { return methodName; } public List<ListenerArgType> getArgs() { return args; } public static Builder builder(ActivityLifecycleType activityLifecycle, String methodName) { if (activityLifecycle == null) { throw new IllegalArgumentException("activityLifecycle is null"); }
if (StringUtils.isEmpty(methodName)) {
simonpercic/AirCycle
aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/ListenerMethod.java
// Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/exception/MethodArgumentsException.java // public class MethodArgumentsException extends Exception { // // public MethodArgumentsException(String message) { // super(message); // } // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ActivityLifecycleType.java // public enum ActivityLifecycleType { // CREATE, // START, // RESUME, // PAUSE, // STOP, // SAVE_INSTANCE_STATE, // DESTROY // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ListenerArgType.java // public enum ListenerArgType { // ACTIVITY, // BUNDLE // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/utils/StringUtils.java // public final class StringUtils { // // private StringUtils() { // // no instance // } // // /** // * Returns <tt>true</tt> if the charSequence is null or of zero length. // * // * @param charSequence char sequence // * @return <tt>true</tt> if charSequence is null or of zero length // */ // public static boolean isEmpty(CharSequence charSequence) { // return charSequence == null || charSequence.length() == 0; // } // }
import com.github.simonpercic.aircycle.exception.MethodArgumentsException; import com.github.simonpercic.aircycle.model.type.ActivityLifecycleType; import com.github.simonpercic.aircycle.model.type.ListenerArgType; import com.github.simonpercic.aircycle.utils.StringUtils; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.List;
} public List<ListenerArgType> getArgs() { return args; } public static Builder builder(ActivityLifecycleType activityLifecycle, String methodName) { if (activityLifecycle == null) { throw new IllegalArgumentException("activityLifecycle is null"); } if (StringUtils.isEmpty(methodName)) { throw new IllegalArgumentException("methodName is empty"); } return new Builder(activityLifecycle, methodName); } public static class Builder { private final ActivityLifecycleType lifecycleType; private final String methodName; private final List<ListenerArgType> args; private Builder(ActivityLifecycleType lifecycleType, String methodName) { this.lifecycleType = lifecycleType; this.methodName = methodName; this.args = new ArrayList<>(2); }
// Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/exception/MethodArgumentsException.java // public class MethodArgumentsException extends Exception { // // public MethodArgumentsException(String message) { // super(message); // } // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ActivityLifecycleType.java // public enum ActivityLifecycleType { // CREATE, // START, // RESUME, // PAUSE, // STOP, // SAVE_INSTANCE_STATE, // DESTROY // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/type/ListenerArgType.java // public enum ListenerArgType { // ACTIVITY, // BUNDLE // } // // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/utils/StringUtils.java // public final class StringUtils { // // private StringUtils() { // // no instance // } // // /** // * Returns <tt>true</tt> if the charSequence is null or of zero length. // * // * @param charSequence char sequence // * @return <tt>true</tt> if charSequence is null or of zero length // */ // public static boolean isEmpty(CharSequence charSequence) { // return charSequence == null || charSequence.length() == 0; // } // } // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/model/ListenerMethod.java import com.github.simonpercic.aircycle.exception.MethodArgumentsException; import com.github.simonpercic.aircycle.model.type.ActivityLifecycleType; import com.github.simonpercic.aircycle.model.type.ListenerArgType; import com.github.simonpercic.aircycle.utils.StringUtils; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.List; } public List<ListenerArgType> getArgs() { return args; } public static Builder builder(ActivityLifecycleType activityLifecycle, String methodName) { if (activityLifecycle == null) { throw new IllegalArgumentException("activityLifecycle is null"); } if (StringUtils.isEmpty(methodName)) { throw new IllegalArgumentException("methodName is empty"); } return new Builder(activityLifecycle, methodName); } public static class Builder { private final ActivityLifecycleType lifecycleType; private final String methodName; private final List<ListenerArgType> args; private Builder(ActivityLifecycleType lifecycleType, String methodName) { this.lifecycleType = lifecycleType; this.methodName = methodName; this.args = new ArrayList<>(2); }
public Builder addBundleArg() throws MethodArgumentsException {
simonpercic/AirCycle
aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/dagger/ProcessorComponent.java
// Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/AirCycleProcessor.java // @AutoService(Processor.class) // public class AirCycleProcessor extends AbstractProcessor { // // @Inject FieldValidator fieldValidator; // @Inject MethodParser methodParser; // @Inject ActivityLifecycleConverter activityLifecycleConverter; // @Inject ClassGenerator classGenerator; // @Inject ClassFileWriter classFileWriter; // // @Override // public synchronized void init(ProcessingEnvironment processingEnv) { // super.init(processingEnv); // // DaggerProcessorComponent.builder() // .processorModule(new ProcessorModule(processingEnv)) // .build() // .inject(this); // } // // @Override // public Set<String> getSupportedAnnotationTypes() { // Set<String> annotations = new HashSet<>(); // annotations.add(AirCycle.class.getCanonicalName()); // annotations.add(Ignore.class.getCanonicalName()); // return annotations; // } // // @Override // public SourceVersion getSupportedSourceVersion() { // return SourceVersion.latestSupported(); // } // // @Override // public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { // Map<TypeElement, List<VariableElement>> enclosingElements = new HashMap<>(); // // for (Element annotatedElement : roundEnv.getElementsAnnotatedWith(AirCycle.class)) { // VariableElement field = (VariableElement) annotatedElement; // if (!fieldValidator.isFieldValid(field)) { // return true; // } // // TypeElement enclosingElement = (TypeElement) field.getEnclosingElement(); // // List<VariableElement> fields = enclosingElements.get(enclosingElement); // if (fields == null) { // fields = new ArrayList<>(); // enclosingElements.put(enclosingElement, fields); // } // // fields.add(field); // } // // Map<TypeElement, List<ExecutableElement>> ignoredMethods = new HashMap<>(); // // for (Element ignoredElement : roundEnv.getElementsAnnotatedWith(Ignore.class)) { // ExecutableElement method = (ExecutableElement) ignoredElement; // TypeElement enclosingElement = (TypeElement) method.getEnclosingElement(); // // List<ExecutableElement> methods = ignoredMethods.get(enclosingElement); // if (methods == null) { // methods = new ArrayList<>(); // ignoredMethods.put(enclosingElement, methods); // } // // methods.add(method); // } // // for (TypeElement enclosingElement : enclosingElements.keySet()) { // Map<ActivityLifecycleType, List<FieldListenerMethods>> lifecycleListenerMethods = new TreeMap<>(); // // List<VariableElement> fields = enclosingElements.get(enclosingElement); // for (VariableElement field : fields) { // DeclaredType declaredType = (DeclaredType) field.asType(); // TypeElement element = (TypeElement) declaredType.asElement(); // // List<ExecutableElement> typeIgnoredMethods = ignoredMethods.get(element); // // int[] ignoreLifecycleInts = field.getAnnotation(AirCycle.class).ignore(); // // List<ActivityLifecycleType> ignoreLifecycleTypes = activityLifecycleConverter.fromInts( // ignoreLifecycleInts, field, enclosingElement); // // Map<ActivityLifecycleType, List<ListenerMethod>> methods = // methodParser.parseLifecycleMethods(element, typeIgnoredMethods, ignoreLifecycleTypes); // // if (methods == null) { // return true; // } // // for (ActivityLifecycleType lifecycle : methods.keySet()) { // List<FieldListenerMethods> fieldListenerMethods = lifecycleListenerMethods.get(lifecycle); // if (fieldListenerMethods == null) { // fieldListenerMethods = new ArrayList<>(); // lifecycleListenerMethods.put(lifecycle, fieldListenerMethods); // } // // fieldListenerMethods.add(new FieldListenerMethods(field, methods.get(lifecycle))); // } // } // // TypeSpec typeSpec = classGenerator.generateClass(enclosingElement, lifecycleListenerMethods); // // boolean success = classFileWriter.writeClass(typeSpec, enclosingElement); // if (!success) { // return true; // } // } // // return true; // } // }
import com.github.simonpercic.aircycle.AirCycleProcessor; import javax.inject.Singleton; import dagger.Component;
package com.github.simonpercic.aircycle.dagger; /** * Annotation processor Dagger component. * * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a> */ @Singleton @Component(modules = ProcessorModule.class) public interface ProcessorComponent {
// Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/AirCycleProcessor.java // @AutoService(Processor.class) // public class AirCycleProcessor extends AbstractProcessor { // // @Inject FieldValidator fieldValidator; // @Inject MethodParser methodParser; // @Inject ActivityLifecycleConverter activityLifecycleConverter; // @Inject ClassGenerator classGenerator; // @Inject ClassFileWriter classFileWriter; // // @Override // public synchronized void init(ProcessingEnvironment processingEnv) { // super.init(processingEnv); // // DaggerProcessorComponent.builder() // .processorModule(new ProcessorModule(processingEnv)) // .build() // .inject(this); // } // // @Override // public Set<String> getSupportedAnnotationTypes() { // Set<String> annotations = new HashSet<>(); // annotations.add(AirCycle.class.getCanonicalName()); // annotations.add(Ignore.class.getCanonicalName()); // return annotations; // } // // @Override // public SourceVersion getSupportedSourceVersion() { // return SourceVersion.latestSupported(); // } // // @Override // public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { // Map<TypeElement, List<VariableElement>> enclosingElements = new HashMap<>(); // // for (Element annotatedElement : roundEnv.getElementsAnnotatedWith(AirCycle.class)) { // VariableElement field = (VariableElement) annotatedElement; // if (!fieldValidator.isFieldValid(field)) { // return true; // } // // TypeElement enclosingElement = (TypeElement) field.getEnclosingElement(); // // List<VariableElement> fields = enclosingElements.get(enclosingElement); // if (fields == null) { // fields = new ArrayList<>(); // enclosingElements.put(enclosingElement, fields); // } // // fields.add(field); // } // // Map<TypeElement, List<ExecutableElement>> ignoredMethods = new HashMap<>(); // // for (Element ignoredElement : roundEnv.getElementsAnnotatedWith(Ignore.class)) { // ExecutableElement method = (ExecutableElement) ignoredElement; // TypeElement enclosingElement = (TypeElement) method.getEnclosingElement(); // // List<ExecutableElement> methods = ignoredMethods.get(enclosingElement); // if (methods == null) { // methods = new ArrayList<>(); // ignoredMethods.put(enclosingElement, methods); // } // // methods.add(method); // } // // for (TypeElement enclosingElement : enclosingElements.keySet()) { // Map<ActivityLifecycleType, List<FieldListenerMethods>> lifecycleListenerMethods = new TreeMap<>(); // // List<VariableElement> fields = enclosingElements.get(enclosingElement); // for (VariableElement field : fields) { // DeclaredType declaredType = (DeclaredType) field.asType(); // TypeElement element = (TypeElement) declaredType.asElement(); // // List<ExecutableElement> typeIgnoredMethods = ignoredMethods.get(element); // // int[] ignoreLifecycleInts = field.getAnnotation(AirCycle.class).ignore(); // // List<ActivityLifecycleType> ignoreLifecycleTypes = activityLifecycleConverter.fromInts( // ignoreLifecycleInts, field, enclosingElement); // // Map<ActivityLifecycleType, List<ListenerMethod>> methods = // methodParser.parseLifecycleMethods(element, typeIgnoredMethods, ignoreLifecycleTypes); // // if (methods == null) { // return true; // } // // for (ActivityLifecycleType lifecycle : methods.keySet()) { // List<FieldListenerMethods> fieldListenerMethods = lifecycleListenerMethods.get(lifecycle); // if (fieldListenerMethods == null) { // fieldListenerMethods = new ArrayList<>(); // lifecycleListenerMethods.put(lifecycle, fieldListenerMethods); // } // // fieldListenerMethods.add(new FieldListenerMethods(field, methods.get(lifecycle))); // } // } // // TypeSpec typeSpec = classGenerator.generateClass(enclosingElement, lifecycleListenerMethods); // // boolean success = classFileWriter.writeClass(typeSpec, enclosingElement); // if (!success) { // return true; // } // } // // return true; // } // } // Path: aircycle-compiler/src/main/java/com/github/simonpercic/aircycle/dagger/ProcessorComponent.java import com.github.simonpercic.aircycle.AirCycleProcessor; import javax.inject.Singleton; import dagger.Component; package com.github.simonpercic.aircycle.dagger; /** * Annotation processor Dagger component. * * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a> */ @Singleton @Component(modules = ProcessorModule.class) public interface ProcessorComponent {
void inject(AirCycleProcessor processor);