id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
36,500
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
JsUtils.prop
public static <T> T prop(JavaScriptObject o, Object id, Class<? extends T> type) { return o == null ? null : o.<JsCache> cast().get(id, type); }
java
public static <T> T prop(JavaScriptObject o, Object id, Class<? extends T> type) { return o == null ? null : o.<JsCache> cast().get(id, type); }
[ "public", "static", "<", "T", ">", "T", "prop", "(", "JavaScriptObject", "o", ",", "Object", "id", ",", "Class", "<", "?", "extends", "T", ">", "type", ")", "{", "return", "o", "==", "null", "?", "null", ":", "o", ".", "<", "JsCache", ">", "cast"...
Returns a property present in a javascript object.
[ "Returns", "a", "property", "present", "in", "a", "javascript", "object", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L211-L213
36,501
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
JsUtils.prop
public static void prop(JavaScriptObject o, Object id, Object val) { if (o != null) { o.<JsCache> cast().put(id, val); } }
java
public static void prop(JavaScriptObject o, Object id, Object val) { if (o != null) { o.<JsCache> cast().put(id, val); } }
[ "public", "static", "void", "prop", "(", "JavaScriptObject", "o", ",", "Object", "id", ",", "Object", "val", ")", "{", "if", "(", "o", "!=", "null", ")", "{", "o", ".", "<", "JsCache", ">", "cast", "(", ")", ".", "put", "(", "id", ",", "val", "...
Set a property to a javascript object.
[ "Set", "a", "property", "to", "a", "javascript", "object", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L225-L229
36,502
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
JsUtils.exec
public static <T> T exec(JavaScriptObject jsFunction, Object... args) { assert isFunction(jsFunction); return jsni(jsFunction, "call", jsFunction, args); }
java
public static <T> T exec(JavaScriptObject jsFunction, Object... args) { assert isFunction(jsFunction); return jsni(jsFunction, "call", jsFunction, args); }
[ "public", "static", "<", "T", ">", "T", "exec", "(", "JavaScriptObject", "jsFunction", ",", "Object", "...", "args", ")", "{", "assert", "isFunction", "(", "jsFunction", ")", ";", "return", "jsni", "(", "jsFunction", ",", "\"call\"", ",", "jsFunction", ","...
Execute a native javascript function.
[ "Execute", "a", "native", "javascript", "function", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L234-L237
36,503
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
JsUtils.export
public static void export(String name, Function f) { export(GQuery.window, name, f); }
java
public static void export(String name, Function f) { export(GQuery.window, name, f); }
[ "public", "static", "void", "export", "(", "String", "name", ",", "Function", "f", ")", "{", "export", "(", "GQuery", ".", "window", ",", "name", ",", "f", ")", ";", "}" ]
Assign a function to a property of the window object.
[ "Assign", "a", "function", "to", "a", "property", "of", "the", "window", "object", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L242-L244
36,504
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
JsUtils.export
public static void export(JavaScriptObject o, String name, Function f) { prop(o, name, (Object)(f != null ? wrapFunction(f) : null)); }
java
public static void export(JavaScriptObject o, String name, Function f) { prop(o, name, (Object)(f != null ? wrapFunction(f) : null)); }
[ "public", "static", "void", "export", "(", "JavaScriptObject", "o", ",", "String", "name", ",", "Function", "f", ")", "{", "prop", "(", "o", ",", "name", ",", "(", "Object", ")", "(", "f", "!=", "null", "?", "wrapFunction", "(", "f", ")", ":", "nul...
Export a function as a property of a javascript object.
[ "Export", "a", "function", "as", "a", "property", "of", "a", "javascript", "object", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L249-L251
36,505
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
JsUtils.copyNodeList
public static NodeList<Element> copyNodeList(NodeList<Element> oldNodes, NodeList<Element> newNodes, boolean create) { NodeList<Element> ret = oldNodes == null || create ? JsNodeArray.create() : oldNodes; JsCache idlist = JsCache.create(); for (int i = 0; oldNodes != null && i < oldNodes.getLength(); i++) { Element e = oldNodes.getItem(i); idlist.put(e.hashCode(), 1); if (create) { ret.<JsNodeArray> cast().addNode(e, i); } } for (int i = 0, l = newNodes.getLength(), j = ret.getLength(); i < l; i++) { Element e = newNodes.getItem(i); if (!idlist.exists(e.hashCode())) { ret.<JsNodeArray> cast().addNode(newNodes.getItem(i), j++); } } return ret; }
java
public static NodeList<Element> copyNodeList(NodeList<Element> oldNodes, NodeList<Element> newNodes, boolean create) { NodeList<Element> ret = oldNodes == null || create ? JsNodeArray.create() : oldNodes; JsCache idlist = JsCache.create(); for (int i = 0; oldNodes != null && i < oldNodes.getLength(); i++) { Element e = oldNodes.getItem(i); idlist.put(e.hashCode(), 1); if (create) { ret.<JsNodeArray> cast().addNode(e, i); } } for (int i = 0, l = newNodes.getLength(), j = ret.getLength(); i < l; i++) { Element e = newNodes.getItem(i); if (!idlist.exists(e.hashCode())) { ret.<JsNodeArray> cast().addNode(newNodes.getItem(i), j++); } } return ret; }
[ "public", "static", "NodeList", "<", "Element", ">", "copyNodeList", "(", "NodeList", "<", "Element", ">", "oldNodes", ",", "NodeList", "<", "Element", ">", "newNodes", ",", "boolean", "create", ")", "{", "NodeList", "<", "Element", ">", "ret", "=", "oldNo...
Merge the oldNodes list into the newNodes one. If oldNodes is null, a new list will be created and returned. If oldNodes is not null, a new list will be created depending on the create flag.
[ "Merge", "the", "oldNodes", "list", "into", "the", "newNodes", "one", ".", "If", "oldNodes", "is", "null", "a", "new", "list", "will", "be", "created", "and", "returned", ".", "If", "oldNodes", "is", "not", "null", "a", "new", "list", "will", "be", "cr...
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L268-L287
36,506
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
JsUtils.getOwnerDocument
public static Document getOwnerDocument(Node n) { return n == null || !isElement(n) ? null : n.getNodeType() == Node.DOCUMENT_NODE ? n.<Document> cast() : n.getOwnerDocument(); }
java
public static Document getOwnerDocument(Node n) { return n == null || !isElement(n) ? null : n.getNodeType() == Node.DOCUMENT_NODE ? n.<Document> cast() : n.getOwnerDocument(); }
[ "public", "static", "Document", "getOwnerDocument", "(", "Node", "n", ")", "{", "return", "n", "==", "null", "||", "!", "isElement", "(", "n", ")", "?", "null", ":", "n", ".", "getNodeType", "(", ")", "==", "Node", ".", "DOCUMENT_NODE", "?", "n", "."...
Returns the owner document element of an element.
[ "Returns", "the", "owner", "document", "element", "of", "an", "element", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L315-L318
36,507
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
JsUtils.isDetached
public static boolean isDetached(Node n) { assert n != null; if ("html".equalsIgnoreCase(n.getNodeName())) { return false; } return !getOwnerDocument(n).getBody().isOrHasChild(n); }
java
public static boolean isDetached(Node n) { assert n != null; if ("html".equalsIgnoreCase(n.getNodeName())) { return false; } return !getOwnerDocument(n).getBody().isOrHasChild(n); }
[ "public", "static", "boolean", "isDetached", "(", "Node", "n", ")", "{", "assert", "n", "!=", "null", ";", "if", "(", "\"html\"", ".", "equalsIgnoreCase", "(", "n", ".", "getNodeName", "(", ")", ")", ")", "{", "return", "false", ";", "}", "return", "...
Return whether a node is detached to the DOM. Be careful : This method works only on node that should be inserted within the body node.
[ "Return", "whether", "a", "node", "is", "detached", "to", "the", "DOM", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L384-L392
36,508
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
JsUtils.isXML
public static boolean isXML(Node o) { return o == null ? false : !"HTML".equals(getOwnerDocument(o).getDocumentElement().getNodeName()); }
java
public static boolean isXML(Node o) { return o == null ? false : !"HTML".equals(getOwnerDocument(o).getDocumentElement().getNodeName()); }
[ "public", "static", "boolean", "isXML", "(", "Node", "o", ")", "{", "return", "o", "==", "null", "?", "false", ":", "!", "\"HTML\"", ".", "equals", "(", "getOwnerDocument", "(", "o", ")", ".", "getDocumentElement", "(", ")", ".", "getNodeName", "(", ")...
Check if an element is a DOM or a XML node.
[ "Check", "if", "an", "element", "is", "a", "DOM", "or", "a", "XML", "node", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L434-L437
36,509
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
JsUtils.parseJSON
public static Properties parseJSON(String json) { try { return utilsImpl.parseJSON(json); } catch (Exception e) { if (!GWT.isProdMode()) { System.err.println("Error while parsing json: " + e.getMessage() + ".\n" + json); } return Properties.create(); } }
java
public static Properties parseJSON(String json) { try { return utilsImpl.parseJSON(json); } catch (Exception e) { if (!GWT.isProdMode()) { System.err.println("Error while parsing json: " + e.getMessage() + ".\n" + json); } return Properties.create(); } }
[ "public", "static", "Properties", "parseJSON", "(", "String", "json", ")", "{", "try", "{", "return", "utilsImpl", ".", "parseJSON", "(", "json", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "!", "GWT", ".", "isProdMode", "(", ...
Parses a json string returning a Object with useful method to get the content.
[ "Parses", "a", "json", "string", "returning", "a", "Object", "with", "useful", "method", "to", "get", "the", "content", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L474-L483
36,510
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
JsUtils.jsni
public static <T> T jsni(JavaScriptObject jso, String meth, Object... args) { return runJavascriptFunction(jso, meth, args); }
java
public static <T> T jsni(JavaScriptObject jso, String meth, Object... args) { return runJavascriptFunction(jso, meth, args); }
[ "public", "static", "<", "T", ">", "T", "jsni", "(", "JavaScriptObject", "jso", ",", "String", "meth", ",", "Object", "...", "args", ")", "{", "return", "runJavascriptFunction", "(", "jso", ",", "meth", ",", "args", ")", ";", "}" ]
Call any arbitrary function present in a Javascript object. It checks the existence of the function and object hierarchy before executing it. It's very useful in order to avoid writing jsni blocks for very simple snippets. Note that GWT 3.0 jsinterop will come with a method similar, so we might deprecate this in the future. Example <pre> // Create a svg node in our document. Element svg = jsni(document, "createElementNS", "http://www.w3.org/2000/svg", "svg"); // Append it to the dom $(svg).appendTo(document); // show the svg element in the debug console jsni("console.log", svg); </pre> @param jso the object containing the method to execute @param meth the literal name of the function to call, dot separators are allowed. @param args an array with the arguments to pass to the function. @return the java ready boxed object returned by the jsni method or null, if the call return a number we will get a Double, if it returns a boolean we get a java Boolean, strings comes as java String, otherwise we get the javascript object.
[ "Call", "any", "arbitrary", "function", "present", "in", "a", "Javascript", "object", ".", "It", "checks", "the", "existence", "of", "the", "function", "and", "object", "hierarchy", "before", "executing", "it", ".", "It", "s", "very", "useful", "in", "order"...
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L538-L540
36,511
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
JsUtils.jsni
public static <T> T jsni(String meth, Object... args) { return runJavascriptFunction(null, meth, args); }
java
public static <T> T jsni(String meth, Object... args) { return runJavascriptFunction(null, meth, args); }
[ "public", "static", "<", "T", ">", "T", "jsni", "(", "String", "meth", ",", "Object", "...", "args", ")", "{", "return", "runJavascriptFunction", "(", "null", ",", "meth", ",", "args", ")", ";", "}" ]
Run any arbitrary function in javascript scope using the window as the base object. It checks the existence of the function and object hierarchy before executing it. It's very useful in order to avoid writing jsni blocks for very simple snippets. Note that GWT 3.0 jsinterop will come with a method similar, so we might deprecate this in the future. Example <pre> // Create a svg node in our document. Element svg = jsni("document.createElementNS", "http://www.w3.org/2000/svg", "svg"); // Append it to the dom $(svg).appendTo(document); // show the svg element in the debug console jsni("console.log", svg); </pre> @param meth the literal name of the function to call, dot separators are allowed. @param args an array with the arguments to pass to the function. @return the java ready boxed object returned by the jsni method or null, if the call return a number we will get a Double, if it returns a boolean we get a java Boolean, strings comes as java String, otherwise we get the javascript object.
[ "Run", "any", "arbitrary", "function", "in", "javascript", "scope", "using", "the", "window", "as", "the", "base", "object", ".", "It", "checks", "the", "existence", "of", "the", "function", "and", "object", "hierarchy", "before", "executing", "it", ".", "It...
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L566-L568
36,512
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
JsUtils.runJavascriptFunction
public static <T> T runJavascriptFunction(JavaScriptObject o, String meth, Object... args) { return runJavascriptFunctionImpl(o, meth, JsObjectArray.create().add(args).<JsArrayMixed>cast()); }
java
public static <T> T runJavascriptFunction(JavaScriptObject o, String meth, Object... args) { return runJavascriptFunctionImpl(o, meth, JsObjectArray.create().add(args).<JsArrayMixed>cast()); }
[ "public", "static", "<", "T", ">", "T", "runJavascriptFunction", "(", "JavaScriptObject", "o", ",", "String", "meth", ",", "Object", "...", "args", ")", "{", "return", "runJavascriptFunctionImpl", "(", "o", ",", "meth", ",", "JsObjectArray", ".", "create", "...
Call via jsni any arbitrary function present in a Javascript object. It's thought for avoiding to create jsni methods to call external functions and facilitate the writing of js wrappers. Example <pre> // Create a svg node in our document. Element svg = runJavascriptFunction(document, "createElementNS", "http://www.w3.org/2000/svg", "svg"); // Append it to the dom $(svg).appendTo(document); </pre> @param o the javascript object where the function is, it it is null we use window. @param meth the literal name of the function to call, dot separators are allowed. @param args an array with the arguments to pass to the function. @return the java ready boxed object returned by the jsni method or null, if the call return a number we will get a Double, if it returns a boolean we get a java Boolean, strings comes as java String, otherwise we get the javascript object. @deprecated use jsni instead.
[ "Call", "via", "jsni", "any", "arbitrary", "function", "present", "in", "a", "Javascript", "object", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L593-L595
36,513
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
JsUtils.param
public static String param(JavaScriptObject js) { Properties prop = js.cast(); String ret = ""; for (String k : prop.keys()) { ret += ret.isEmpty() ? "" : "&"; JsCache o = prop.getArray(k).cast(); if (o != null) { for (int i = 0, l = o.length(); i < l; i++) { ret += i > 0 ? "&" : ""; Properties p = o.<JsCache> cast().getJavaScriptObject(i); if (p != null) { ret += k + "[]=" + p.toJsonString(); } else { ret += k + "[]=" + o.getString(i); } } } else { Properties p = prop.getJavaScriptObject(k); if (p != null) { ret += k + "=" + p.tostring(); } else { String v = prop.getStr(k); if (v != null && !v.isEmpty() && !"null".equalsIgnoreCase(v)) { ret += k + "=" + v; } } } } return ret; }
java
public static String param(JavaScriptObject js) { Properties prop = js.cast(); String ret = ""; for (String k : prop.keys()) { ret += ret.isEmpty() ? "" : "&"; JsCache o = prop.getArray(k).cast(); if (o != null) { for (int i = 0, l = o.length(); i < l; i++) { ret += i > 0 ? "&" : ""; Properties p = o.<JsCache> cast().getJavaScriptObject(i); if (p != null) { ret += k + "[]=" + p.toJsonString(); } else { ret += k + "[]=" + o.getString(i); } } } else { Properties p = prop.getJavaScriptObject(k); if (p != null) { ret += k + "=" + p.tostring(); } else { String v = prop.getStr(k); if (v != null && !v.isEmpty() && !"null".equalsIgnoreCase(v)) { ret += k + "=" + v; } } } } return ret; }
[ "public", "static", "String", "param", "(", "JavaScriptObject", "js", ")", "{", "Properties", "prop", "=", "js", ".", "cast", "(", ")", ";", "String", "ret", "=", "\"\"", ";", "for", "(", "String", "k", ":", "prop", ".", "keys", "(", ")", ")", "{",...
Returns a QueryString representation of a JavascriptObject. TODO: jquery implementation accepts a second parameter (traditional)
[ "Returns", "a", "QueryString", "representation", "of", "a", "JavascriptObject", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L642-L671
36,514
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImplIE.java
DocumentStyleImplIE.setStyleProperty
@Override public void setStyleProperty(Element e, String prop, String val) { if ("opacity".equals(prop)) { setOpacity(e, val); } else { super.setStyleProperty(e, prop, val); } }
java
@Override public void setStyleProperty(Element e, String prop, String val) { if ("opacity".equals(prop)) { setOpacity(e, val); } else { super.setStyleProperty(e, prop, val); } }
[ "@", "Override", "public", "void", "setStyleProperty", "(", "Element", "e", ",", "String", "prop", ",", "String", "val", ")", "{", "if", "(", "\"opacity\"", ".", "equals", "(", "prop", ")", ")", "{", "setOpacity", "(", "e", ",", "val", ")", ";", "}",...
Set the value of a style property of an element. IE needs a special workaround to handle opacity
[ "Set", "the", "value", "of", "a", "style", "property", "of", "an", "element", ".", "IE", "needs", "a", "special", "workaround", "to", "handle", "opacity" ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImplIE.java#L76-L83
36,515
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/GQ.java
GQ.create
public static IsProperties create(String s, boolean fixJson) { return getFactory().create(fixJson ? Properties.wrapPropertiesString(s) : s); }
java
public static IsProperties create(String s, boolean fixJson) { return getFactory().create(fixJson ? Properties.wrapPropertiesString(s) : s); }
[ "public", "static", "IsProperties", "create", "(", "String", "s", ",", "boolean", "fixJson", ")", "{", "return", "getFactory", "(", ")", ".", "create", "(", "fixJson", "?", "Properties", ".", "wrapPropertiesString", "(", "s", ")", ":", "s", ")", ";", "}"...
Create an instance of IsProperties, a Properties JavaScriptObject in the client side and a proxy object in the JVM. If fixJson is set, we correct certain errors in the Json string. It is useful for generating Properties using java strings, so as we can use a more relaxed syntax.
[ "Create", "an", "instance", "of", "IsProperties", "a", "Properties", "JavaScriptObject", "in", "the", "client", "side", "and", "a", "proxy", "object", "in", "the", "JVM", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/GQ.java#L86-L88
36,516
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBReflector.java
DynamoDBReflector.getCustomMarshalledValue
@SuppressWarnings({ "rawtypes", "unchecked" }) private <T> T getCustomMarshalledValue(T toReturn, Method getter, AttributeValue value) { DynamoDBMarshalling annotation = getter.getAnnotation(DynamoDBMarshalling.class); Class<? extends DynamoDBMarshaller<? extends Object>> marshallerClass = annotation.marshallerClass(); DynamoDBMarshaller marshaller; try { marshaller = marshallerClass.newInstance(); } catch ( InstantiationException e ) { throw new DynamoDBMappingException("Couldn't instantiate marshaller of class " + marshallerClass, e); } catch ( IllegalAccessException e ) { throw new DynamoDBMappingException("Couldn't instantiate marshaller of class " + marshallerClass, e); } return (T) marshaller.unmarshall(getter.getReturnType(), value.getS()); }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) private <T> T getCustomMarshalledValue(T toReturn, Method getter, AttributeValue value) { DynamoDBMarshalling annotation = getter.getAnnotation(DynamoDBMarshalling.class); Class<? extends DynamoDBMarshaller<? extends Object>> marshallerClass = annotation.marshallerClass(); DynamoDBMarshaller marshaller; try { marshaller = marshallerClass.newInstance(); } catch ( InstantiationException e ) { throw new DynamoDBMappingException("Couldn't instantiate marshaller of class " + marshallerClass, e); } catch ( IllegalAccessException e ) { throw new DynamoDBMappingException("Couldn't instantiate marshaller of class " + marshallerClass, e); } return (T) marshaller.unmarshall(getter.getReturnType(), value.getS()); }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "private", "<", "T", ">", "T", "getCustomMarshalledValue", "(", "T", "toReturn", ",", "Method", "getter", ",", "AttributeValue", "value", ")", "{", "DynamoDBMarshalling", "annotat...
Marshalls the custom value given into the proper return type.
[ "Marshalls", "the", "custom", "value", "given", "into", "the", "proper", "return", "type", "." ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBReflector.java#L566-L581
36,517
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBReflector.java
DynamoDBReflector.getCustomerMarshallerAttributeValue
@SuppressWarnings({ "rawtypes", "unchecked" }) private AttributeValue getCustomerMarshallerAttributeValue(Method getter, Object getterReturnResult) { DynamoDBMarshalling annotation = getter.getAnnotation(DynamoDBMarshalling.class); Class<? extends DynamoDBMarshaller<? extends Object>> marshallerClass = annotation.marshallerClass(); DynamoDBMarshaller marshaller; try { marshaller = marshallerClass.newInstance(); } catch ( InstantiationException e ) { throw new DynamoDBMappingException("Failed to instantiate custom marshaller for class " + marshallerClass, e); } catch ( IllegalAccessException e ) { throw new DynamoDBMappingException("Failed to instantiate custom marshaller for class " + marshallerClass, e); } String stringValue = marshaller.marshall(getterReturnResult); return new AttributeValue().withS(stringValue); }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) private AttributeValue getCustomerMarshallerAttributeValue(Method getter, Object getterReturnResult) { DynamoDBMarshalling annotation = getter.getAnnotation(DynamoDBMarshalling.class); Class<? extends DynamoDBMarshaller<? extends Object>> marshallerClass = annotation.marshallerClass(); DynamoDBMarshaller marshaller; try { marshaller = marshallerClass.newInstance(); } catch ( InstantiationException e ) { throw new DynamoDBMappingException("Failed to instantiate custom marshaller for class " + marshallerClass, e); } catch ( IllegalAccessException e ) { throw new DynamoDBMappingException("Failed to instantiate custom marshaller for class " + marshallerClass, e); } String stringValue = marshaller.marshall(getterReturnResult); return new AttributeValue().withS(stringValue); }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "private", "AttributeValue", "getCustomerMarshallerAttributeValue", "(", "Method", "getter", ",", "Object", "getterReturnResult", ")", "{", "DynamoDBMarshalling", "annotation", "=", "gett...
Returns an attribute value for the getter method with a custom marshaller
[ "Returns", "an", "attribute", "value", "for", "the", "getter", "method", "with", "a", "custom", "marshaller" ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBReflector.java#L586-L604
36,518
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBReflector.java
DynamoDBReflector.parseBoolean
private boolean parseBoolean(String s) { if ( "1".equals(s) ) { return true; } else if ( "0".equals(s) ) { return false; } else { throw new IllegalArgumentException("Expected 1 or 0 for boolean value, was " + s); } }
java
private boolean parseBoolean(String s) { if ( "1".equals(s) ) { return true; } else if ( "0".equals(s) ) { return false; } else { throw new IllegalArgumentException("Expected 1 or 0 for boolean value, was " + s); } }
[ "private", "boolean", "parseBoolean", "(", "String", "s", ")", "{", "if", "(", "\"1\"", ".", "equals", "(", "s", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "\"0\"", ".", "equals", "(", "s", ")", ")", "{", "return", "false", ";"...
Attempts to parse the string given as a boolean and return its value. Throws an exception if the value is anything other than 0 or 1.
[ "Attempts", "to", "parse", "the", "string", "given", "as", "a", "boolean", "and", "return", "its", "value", ".", "Throws", "an", "exception", "if", "the", "value", "is", "anything", "other", "than", "0", "or", "1", "." ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBReflector.java#L811-L819
36,519
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBReflector.java
DynamoDBReflector.getVersionedArgumentMarshaller
ArgumentMarshaller getVersionedArgumentMarshaller(final Method getter, Object getterReturnResult) { synchronized (versionArgumentMarshallerCache) { if ( !versionArgumentMarshallerCache.containsKey(getter) ) { ArgumentMarshaller marshaller = null; final Class<?> returnType = getter.getReturnType(); if ( BigInteger.class.isAssignableFrom(returnType) ) { marshaller = new ArgumentMarshaller() { @Override public AttributeValue marshall(Object obj) { if ( obj == null ) obj = BigInteger.ZERO; Object newValue = ((BigInteger) obj).add(BigInteger.ONE); return getArgumentMarshaller(getter).marshall(newValue); } }; } else if ( Integer.class.isAssignableFrom(returnType) ) { marshaller = new ArgumentMarshaller() { @Override public AttributeValue marshall(Object obj) { if ( obj == null ) obj = new Integer(0); Object newValue = ((Integer) obj).intValue() + 1; return getArgumentMarshaller(getter).marshall(newValue); } }; } else if ( Byte.class.isAssignableFrom(returnType) ) { marshaller = new ArgumentMarshaller() { @Override public AttributeValue marshall(Object obj) { if ( obj == null ) obj = new Byte((byte) 0); Object newValue = (byte) ((((Byte) obj).byteValue() + 1) % Byte.MAX_VALUE); return getArgumentMarshaller(getter).marshall(newValue); } }; } else if ( Long.class.isAssignableFrom(returnType) ) { marshaller = new ArgumentMarshaller() { @Override public AttributeValue marshall(Object obj) { if ( obj == null ) obj = new Long(0); Object newValue = ((Long) obj).longValue() + 1L; return getArgumentMarshaller(getter).marshall(newValue); } }; } else { throw new DynamoDBMappingException("Unsupported parameter type for " + DynamoDBVersionAttribute.class + ": " + returnType + ". Must be a whole-number type."); } versionArgumentMarshallerCache.put(getter, marshaller); } } return versionArgumentMarshallerCache.get(getter); }
java
ArgumentMarshaller getVersionedArgumentMarshaller(final Method getter, Object getterReturnResult) { synchronized (versionArgumentMarshallerCache) { if ( !versionArgumentMarshallerCache.containsKey(getter) ) { ArgumentMarshaller marshaller = null; final Class<?> returnType = getter.getReturnType(); if ( BigInteger.class.isAssignableFrom(returnType) ) { marshaller = new ArgumentMarshaller() { @Override public AttributeValue marshall(Object obj) { if ( obj == null ) obj = BigInteger.ZERO; Object newValue = ((BigInteger) obj).add(BigInteger.ONE); return getArgumentMarshaller(getter).marshall(newValue); } }; } else if ( Integer.class.isAssignableFrom(returnType) ) { marshaller = new ArgumentMarshaller() { @Override public AttributeValue marshall(Object obj) { if ( obj == null ) obj = new Integer(0); Object newValue = ((Integer) obj).intValue() + 1; return getArgumentMarshaller(getter).marshall(newValue); } }; } else if ( Byte.class.isAssignableFrom(returnType) ) { marshaller = new ArgumentMarshaller() { @Override public AttributeValue marshall(Object obj) { if ( obj == null ) obj = new Byte((byte) 0); Object newValue = (byte) ((((Byte) obj).byteValue() + 1) % Byte.MAX_VALUE); return getArgumentMarshaller(getter).marshall(newValue); } }; } else if ( Long.class.isAssignableFrom(returnType) ) { marshaller = new ArgumentMarshaller() { @Override public AttributeValue marshall(Object obj) { if ( obj == null ) obj = new Long(0); Object newValue = ((Long) obj).longValue() + 1L; return getArgumentMarshaller(getter).marshall(newValue); } }; } else { throw new DynamoDBMappingException("Unsupported parameter type for " + DynamoDBVersionAttribute.class + ": " + returnType + ". Must be a whole-number type."); } versionArgumentMarshallerCache.put(getter, marshaller); } } return versionArgumentMarshallerCache.get(getter); }
[ "ArgumentMarshaller", "getVersionedArgumentMarshaller", "(", "final", "Method", "getter", ",", "Object", "getterReturnResult", ")", "{", "synchronized", "(", "versionArgumentMarshallerCache", ")", "{", "if", "(", "!", "versionArgumentMarshallerCache", ".", "containsKey", ...
Returns a marshaller that knows how to provide an AttributeValue for the getter method given. Also increments the value of the getterReturnResult given.
[ "Returns", "a", "marshaller", "that", "knows", "how", "to", "provide", "an", "AttributeValue", "for", "the", "getter", "method", "given", ".", "Also", "increments", "the", "value", "of", "the", "getterReturnResult", "given", "." ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBReflector.java#L907-L972
36,520
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBReflector.java
DynamoDBReflector.getAutoGeneratedKeyArgumentMarshaller
ArgumentMarshaller getAutoGeneratedKeyArgumentMarshaller(final Method getter) { synchronized (keyArgumentMarshallerCache) { if ( !keyArgumentMarshallerCache.containsKey(getter) ) { ArgumentMarshaller marshaller = null; Class<?> returnType = getter.getReturnType(); if ( String.class.isAssignableFrom(returnType) ) { marshaller = new ArgumentMarshaller() { @Override public AttributeValue marshall(Object obj) { String newValue = UUID.randomUUID().toString(); return getArgumentMarshaller(getter).marshall(newValue); } }; } else { throw new DynamoDBMappingException("Unsupported type for " + getter + ": " + returnType + ". Only Strings are supported when auto-generating keys."); } keyArgumentMarshallerCache.put(getter, marshaller); } } return keyArgumentMarshallerCache.get(getter); }
java
ArgumentMarshaller getAutoGeneratedKeyArgumentMarshaller(final Method getter) { synchronized (keyArgumentMarshallerCache) { if ( !keyArgumentMarshallerCache.containsKey(getter) ) { ArgumentMarshaller marshaller = null; Class<?> returnType = getter.getReturnType(); if ( String.class.isAssignableFrom(returnType) ) { marshaller = new ArgumentMarshaller() { @Override public AttributeValue marshall(Object obj) { String newValue = UUID.randomUUID().toString(); return getArgumentMarshaller(getter).marshall(newValue); } }; } else { throw new DynamoDBMappingException("Unsupported type for " + getter + ": " + returnType + ". Only Strings are supported when auto-generating keys."); } keyArgumentMarshallerCache.put(getter, marshaller); } } return keyArgumentMarshallerCache.get(getter); }
[ "ArgumentMarshaller", "getAutoGeneratedKeyArgumentMarshaller", "(", "final", "Method", "getter", ")", "{", "synchronized", "(", "keyArgumentMarshallerCache", ")", "{", "if", "(", "!", "keyArgumentMarshallerCache", ".", "containsKey", "(", "getter", ")", ")", "{", "Arg...
Returns a marshaller for the auto-generated key returned by the getter given.
[ "Returns", "a", "marshaller", "for", "the", "auto", "-", "generated", "key", "returned", "by", "the", "getter", "given", "." ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBReflector.java#L977-L1002
36,521
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java
MousePlugin.mouseDown
protected boolean mouseDown(Element element, GqEvent event) { // test if an other plugin handle the mouseStart if (isEventAlreadyHandled(event)) { return false; } if (started) { // case where we missed a mouseup mouseUp(element, event); } // calculate all interesting variables reset(event); if (notHandleMouseDown(element, event)) { return true; } if (delayConditionMet() && distanceConditionMet(event)) { started = mouseStart(element, event); if (!started) { event.getOriginalEvent().preventDefault(); return true; } } bindOtherEvents(element); if (!touchSupported) { // click event are not triggered if we call preventDefault on touchstart event. event.getOriginalEvent().preventDefault(); } markEventAsHandled(event); return true; }
java
protected boolean mouseDown(Element element, GqEvent event) { // test if an other plugin handle the mouseStart if (isEventAlreadyHandled(event)) { return false; } if (started) { // case where we missed a mouseup mouseUp(element, event); } // calculate all interesting variables reset(event); if (notHandleMouseDown(element, event)) { return true; } if (delayConditionMet() && distanceConditionMet(event)) { started = mouseStart(element, event); if (!started) { event.getOriginalEvent().preventDefault(); return true; } } bindOtherEvents(element); if (!touchSupported) { // click event are not triggered if we call preventDefault on touchstart event. event.getOriginalEvent().preventDefault(); } markEventAsHandled(event); return true; }
[ "protected", "boolean", "mouseDown", "(", "Element", "element", ",", "GqEvent", "event", ")", "{", "// test if an other plugin handle the mouseStart", "if", "(", "isEventAlreadyHandled", "(", "event", ")", ")", "{", "return", "false", ";", "}", "if", "(", "started...
Method called when mouse down occur on the element. You should not override this method. Instead, override {@link #mouseStart(Element, GqEvent)} method.
[ "Method", "called", "when", "mouse", "down", "occur", "on", "the", "element", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java#L119-L154
36,522
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java
MousePlugin.mouseMove
protected boolean mouseMove(Element element, GqEvent event) { if (started) { event.getOriginalEvent().preventDefault(); return mouseDrag(element, event); } if (delayConditionMet() && distanceConditionMet(event)) { started = mouseStart(element, startEvent); if (started) { mouseDrag(element, event); } else { mouseUp(element, event); } } return !started; }
java
protected boolean mouseMove(Element element, GqEvent event) { if (started) { event.getOriginalEvent().preventDefault(); return mouseDrag(element, event); } if (delayConditionMet() && distanceConditionMet(event)) { started = mouseStart(element, startEvent); if (started) { mouseDrag(element, event); } else { mouseUp(element, event); } } return !started; }
[ "protected", "boolean", "mouseMove", "(", "Element", "element", ",", "GqEvent", "event", ")", "{", "if", "(", "started", ")", "{", "event", ".", "getOriginalEvent", "(", ")", ".", "preventDefault", "(", ")", ";", "return", "mouseDrag", "(", "element", ",",...
Method called on MouseMove event. You should not override this method. Instead, override {@link #mouseMove(Element, GqEvent)} method
[ "Method", "called", "on", "MouseMove", "event", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java#L168-L185
36,523
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java
MousePlugin.mouseUp
protected boolean mouseUp(Element element, GqEvent event) { unbindOtherEvents(); if (started) { started = false; preventClickEvent = event.getCurrentEventTarget() == startEvent.getCurrentEventTarget(); mouseStop(element, event); } return true; }
java
protected boolean mouseUp(Element element, GqEvent event) { unbindOtherEvents(); if (started) { started = false; preventClickEvent = event.getCurrentEventTarget() == startEvent.getCurrentEventTarget(); mouseStop(element, event); } return true; }
[ "protected", "boolean", "mouseUp", "(", "Element", "element", ",", "GqEvent", "event", ")", "{", "unbindOtherEvents", "(", ")", ";", "if", "(", "started", ")", "{", "started", "=", "false", ";", "preventClickEvent", "=", "event", ".", "getCurrentEventTarget", ...
Method called when mouse is released.. You should not override this method. Instead, override {@link #mouseStop(Element, GqEvent)} method.
[ "Method", "called", "when", "mouse", "is", "released", ".." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java#L204-L214
36,524
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsniBundleGenerator.java
JsniBundleGenerator.getContent
private String getContent(TreeLogger logger, String path, String src) throws UnableToCompleteException { HttpURLConnection connection = null; InputStream in = null; try { if (!src.matches("(?i)https?://.*")) { String file = path + "/" + src; in = this.getClass().getClassLoader().getResourceAsStream(file); if (in == null) { // If we didn't find the resource relative to the package, assume it is absolute. file = src; in = this.getClass().getClassLoader().getResourceAsStream(file); } if (in != null) { logger.log(TreeLogger.INFO, getClass().getSimpleName() + " - importing external javascript: " + file); } else { logger.log(TreeLogger.ERROR, "Unable to read javascript file: " + file); } } else { logger.log(TreeLogger.INFO, getClass().getSimpleName() + " - downloading external javascript: " + src); URL url = new URL(src); connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("Accept-Encoding", "gzip, deflate"); connection.setRequestProperty("Host", url.getHost()); connection.setConnectTimeout(3000); connection.setReadTimeout(3000); int status = connection.getResponseCode(); if (status != HttpURLConnection.HTTP_OK) { logger.log(TreeLogger.ERROR, "Server Error: " + status + " " + connection.getResponseMessage()); throw new UnableToCompleteException(); } String encoding = connection.getContentEncoding(); in = connection.getInputStream(); if ("gzip".equalsIgnoreCase(encoding)) { in = new GZIPInputStream(in); } else if ("deflate".equalsIgnoreCase(encoding)) { in = new InflaterInputStream(in); } } return inputStreamToString(in); } catch (IOException e) { logger.log(TreeLogger.ERROR, "Error: " + e.getMessage()); throw new UnableToCompleteException(); } finally { if (connection != null) { connection.disconnect(); } } }
java
private String getContent(TreeLogger logger, String path, String src) throws UnableToCompleteException { HttpURLConnection connection = null; InputStream in = null; try { if (!src.matches("(?i)https?://.*")) { String file = path + "/" + src; in = this.getClass().getClassLoader().getResourceAsStream(file); if (in == null) { // If we didn't find the resource relative to the package, assume it is absolute. file = src; in = this.getClass().getClassLoader().getResourceAsStream(file); } if (in != null) { logger.log(TreeLogger.INFO, getClass().getSimpleName() + " - importing external javascript: " + file); } else { logger.log(TreeLogger.ERROR, "Unable to read javascript file: " + file); } } else { logger.log(TreeLogger.INFO, getClass().getSimpleName() + " - downloading external javascript: " + src); URL url = new URL(src); connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("Accept-Encoding", "gzip, deflate"); connection.setRequestProperty("Host", url.getHost()); connection.setConnectTimeout(3000); connection.setReadTimeout(3000); int status = connection.getResponseCode(); if (status != HttpURLConnection.HTTP_OK) { logger.log(TreeLogger.ERROR, "Server Error: " + status + " " + connection.getResponseMessage()); throw new UnableToCompleteException(); } String encoding = connection.getContentEncoding(); in = connection.getInputStream(); if ("gzip".equalsIgnoreCase(encoding)) { in = new GZIPInputStream(in); } else if ("deflate".equalsIgnoreCase(encoding)) { in = new InflaterInputStream(in); } } return inputStreamToString(in); } catch (IOException e) { logger.log(TreeLogger.ERROR, "Error: " + e.getMessage()); throw new UnableToCompleteException(); } finally { if (connection != null) { connection.disconnect(); } } }
[ "private", "String", "getContent", "(", "TreeLogger", "logger", ",", "String", "path", ",", "String", "src", ")", "throws", "UnableToCompleteException", "{", "HttpURLConnection", "connection", "=", "null", ";", "InputStream", "in", "=", "null", ";", "try", "{", ...
Get the content of a javascript source. It supports remote sources hosted in CDN's.
[ "Get", "the", "content", "of", "a", "javascript", "source", ".", "It", "supports", "remote", "sources", "hosted", "in", "CDN", "s", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsniBundleGenerator.java#L127-L181
36,525
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.load
public <T extends Object> T load(Class<T> clazz, Object hashKey, DynamoDBMapperConfig config) { return load(clazz, hashKey, null, config); }
java
public <T extends Object> T load(Class<T> clazz, Object hashKey, DynamoDBMapperConfig config) { return load(clazz, hashKey, null, config); }
[ "public", "<", "T", "extends", "Object", ">", "T", "load", "(", "Class", "<", "T", ">", "clazz", ",", "Object", "hashKey", ",", "DynamoDBMapperConfig", "config", ")", "{", "return", "load", "(", "clazz", ",", "hashKey", ",", "null", ",", "config", ")",...
Loads an object with the hash key given and a configuration override. This configuration overrides the default provided at object construction. @see DynamoDBMapper#load(Class, Object, Object, DynamoDBMapperConfig)
[ "Loads", "an", "object", "with", "the", "hash", "key", "given", "and", "a", "configuration", "override", ".", "This", "configuration", "overrides", "the", "default", "provided", "at", "object", "construction", "." ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L193-L195
36,526
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.load
public <T extends Object> T load(Class<T> clazz, Object hashKey, Object rangeKey, DynamoDBMapperConfig config) { config = mergeConfig(config); String tableName = getTableName(clazz, config); // Fill in the hash key element in the service request Method hashKeyGetter = reflector.getHashKeyGetter(clazz); AttributeValue hashKeyElement = getHashKeyElement(hashKey, hashKeyGetter); // Determine the range key, if provided AttributeValue rangeKeyElement = null; if ( rangeKey != null ) { Method rangeKeyMethod = reflector.getRangeKeyGetter(clazz); if ( rangeKeyMethod == null ) { throw new DynamoDBMappingException("Zero-parameter range key property must be annotated with " + DynamoDBRangeKey.class); } rangeKeyElement = getRangeKeyElement(rangeKey, rangeKeyMethod); } GetItemResult item = db.getItem(applyUserAgent(new GetItemRequest().withTableName(tableName) .withKey(new Key().withHashKeyElement(hashKeyElement).withRangeKeyElement(rangeKeyElement)) .withConsistentRead(config.getConsistentReads() == ConsistentReads.CONSISTENT))); Map<String, AttributeValue> itemAttributes = item.getItem(); if ( itemAttributes == null ) { return null; } return marshallIntoObject(clazz, itemAttributes); }
java
public <T extends Object> T load(Class<T> clazz, Object hashKey, Object rangeKey, DynamoDBMapperConfig config) { config = mergeConfig(config); String tableName = getTableName(clazz, config); // Fill in the hash key element in the service request Method hashKeyGetter = reflector.getHashKeyGetter(clazz); AttributeValue hashKeyElement = getHashKeyElement(hashKey, hashKeyGetter); // Determine the range key, if provided AttributeValue rangeKeyElement = null; if ( rangeKey != null ) { Method rangeKeyMethod = reflector.getRangeKeyGetter(clazz); if ( rangeKeyMethod == null ) { throw new DynamoDBMappingException("Zero-parameter range key property must be annotated with " + DynamoDBRangeKey.class); } rangeKeyElement = getRangeKeyElement(rangeKey, rangeKeyMethod); } GetItemResult item = db.getItem(applyUserAgent(new GetItemRequest().withTableName(tableName) .withKey(new Key().withHashKeyElement(hashKeyElement).withRangeKeyElement(rangeKeyElement)) .withConsistentRead(config.getConsistentReads() == ConsistentReads.CONSISTENT))); Map<String, AttributeValue> itemAttributes = item.getItem(); if ( itemAttributes == null ) { return null; } return marshallIntoObject(clazz, itemAttributes); }
[ "public", "<", "T", "extends", "Object", ">", "T", "load", "(", "Class", "<", "T", ">", "clazz", ",", "Object", "hashKey", ",", "Object", "rangeKey", ",", "DynamoDBMapperConfig", "config", ")", "{", "config", "=", "mergeConfig", "(", "config", ")", ";", ...
Returns an object with the given hash key, or null if no such object exists. @param clazz The class to load, corresponding to a DynamoDB table. @param hashKey The key of the object. @param rangeKey The range key of the object, or null for tables without a range key. @param config Configuration for the service call to retrieve the object from DynamoDB. This configuration overrides the default given at construction.
[ "Returns", "an", "object", "with", "the", "given", "hash", "key", "or", "null", "if", "no", "such", "object", "exists", "." ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L232-L261
36,527
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.marshallIntoObjects
public <T> List<T> marshallIntoObjects(Class<T> clazz, List<Map<String, AttributeValue>> itemAttributes) { List<T> result = new ArrayList<T>(); for (Map<String, AttributeValue> item : itemAttributes) { result.add(marshallIntoObject(clazz, item)); } return result; }
java
public <T> List<T> marshallIntoObjects(Class<T> clazz, List<Map<String, AttributeValue>> itemAttributes) { List<T> result = new ArrayList<T>(); for (Map<String, AttributeValue> item : itemAttributes) { result.add(marshallIntoObject(clazz, item)); } return result; }
[ "public", "<", "T", ">", "List", "<", "T", ">", "marshallIntoObjects", "(", "Class", "<", "T", ">", "clazz", ",", "List", "<", "Map", "<", "String", ",", "AttributeValue", ">", ">", "itemAttributes", ")", "{", "List", "<", "T", ">", "result", "=", ...
Marshalls the list of item attributes into objects of type clazz @see DynamoDBMapper#marshallIntoObject(Class, Map)
[ "Marshalls", "the", "list", "of", "item", "attributes", "into", "objects", "of", "type", "clazz" ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L328-L334
36,528
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.setValue
private <T> void setValue(final T toReturn, final Method getter, AttributeValue value) { Method setter = reflector.getSetter(getter); ArgumentUnmarshaller unmarhsaller = reflector.getArgumentUnmarshaller(toReturn, getter, setter); unmarhsaller.typeCheck(value, setter); Object argument; try { argument = unmarhsaller.unmarshall(value); } catch ( IllegalArgumentException e ) { throw new DynamoDBMappingException("Couldn't unmarshall value " + value + " for " + setter, e); } catch ( ParseException e ) { throw new DynamoDBMappingException("Error attempting to parse date string " + value + " for "+ setter, e); } safeInvoke(setter, toReturn, argument); }
java
private <T> void setValue(final T toReturn, final Method getter, AttributeValue value) { Method setter = reflector.getSetter(getter); ArgumentUnmarshaller unmarhsaller = reflector.getArgumentUnmarshaller(toReturn, getter, setter); unmarhsaller.typeCheck(value, setter); Object argument; try { argument = unmarhsaller.unmarshall(value); } catch ( IllegalArgumentException e ) { throw new DynamoDBMappingException("Couldn't unmarshall value " + value + " for " + setter, e); } catch ( ParseException e ) { throw new DynamoDBMappingException("Error attempting to parse date string " + value + " for "+ setter, e); } safeInvoke(setter, toReturn, argument); }
[ "private", "<", "T", ">", "void", "setValue", "(", "final", "T", "toReturn", ",", "final", "Method", "getter", ",", "AttributeValue", "value", ")", "{", "Method", "setter", "=", "reflector", ".", "getSetter", "(", "getter", ")", ";", "ArgumentUnmarshaller", ...
Sets the value in the return object corresponding to the service result.
[ "Sets", "the", "value", "in", "the", "return", "object", "corresponding", "to", "the", "service", "result", "." ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L339-L355
36,529
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.delete
public void delete(Object object, DynamoDBMapperConfig config) { config = mergeConfig(config); Class<?> clazz = object.getClass(); String tableName = getTableName(clazz, config); Method hashKeyGetter = reflector.getHashKeyGetter(clazz); AttributeValue hashKeyElement = getHashKeyElement(safeInvoke(hashKeyGetter, object), hashKeyGetter); AttributeValue rangeKeyElement = null; Method rangeKeyGetter = reflector.getRangeKeyGetter(clazz); if ( rangeKeyGetter != null ) { rangeKeyElement = getRangeKeyElement(safeInvoke(rangeKeyGetter, object), rangeKeyGetter); } Key objectKey = new Key().withHashKeyElement(hashKeyElement).withRangeKeyElement(rangeKeyElement); /* * If there is a version field, make sure we assert its value. If the * version field is null (only should happen in unusual circumstances), * pretend it doesn't have a version field after all. */ Map<String, ExpectedAttributeValue> expectedValues = new HashMap<String, ExpectedAttributeValue>(); if ( config.getSaveBehavior() != SaveBehavior.CLOBBER ) { for ( Method method : reflector.getRelevantGetters(clazz) ) { if ( reflector.isVersionAttributeGetter(method) ) { Object getterResult = safeInvoke(method, object); String attributeName = reflector.getAttributeName(method); ExpectedAttributeValue expected = new ExpectedAttributeValue(); AttributeValue currentValue = getSimpleAttributeValue(method, getterResult); expected.setExists(currentValue != null); if ( currentValue != null ) expected.setValue(currentValue); expectedValues.put(attributeName, expected); break; } } } db.deleteItem(applyUserAgent(new DeleteItemRequest().withKey(objectKey).withTableName(tableName).withExpected(expectedValues))); }
java
public void delete(Object object, DynamoDBMapperConfig config) { config = mergeConfig(config); Class<?> clazz = object.getClass(); String tableName = getTableName(clazz, config); Method hashKeyGetter = reflector.getHashKeyGetter(clazz); AttributeValue hashKeyElement = getHashKeyElement(safeInvoke(hashKeyGetter, object), hashKeyGetter); AttributeValue rangeKeyElement = null; Method rangeKeyGetter = reflector.getRangeKeyGetter(clazz); if ( rangeKeyGetter != null ) { rangeKeyElement = getRangeKeyElement(safeInvoke(rangeKeyGetter, object), rangeKeyGetter); } Key objectKey = new Key().withHashKeyElement(hashKeyElement).withRangeKeyElement(rangeKeyElement); /* * If there is a version field, make sure we assert its value. If the * version field is null (only should happen in unusual circumstances), * pretend it doesn't have a version field after all. */ Map<String, ExpectedAttributeValue> expectedValues = new HashMap<String, ExpectedAttributeValue>(); if ( config.getSaveBehavior() != SaveBehavior.CLOBBER ) { for ( Method method : reflector.getRelevantGetters(clazz) ) { if ( reflector.isVersionAttributeGetter(method) ) { Object getterResult = safeInvoke(method, object); String attributeName = reflector.getAttributeName(method); ExpectedAttributeValue expected = new ExpectedAttributeValue(); AttributeValue currentValue = getSimpleAttributeValue(method, getterResult); expected.setExists(currentValue != null); if ( currentValue != null ) expected.setValue(currentValue); expectedValues.put(attributeName, expected); break; } } } db.deleteItem(applyUserAgent(new DeleteItemRequest().withKey(objectKey).withTableName(tableName).withExpected(expectedValues))); }
[ "public", "void", "delete", "(", "Object", "object", ",", "DynamoDBMapperConfig", "config", ")", "{", "config", "=", "mergeConfig", "(", "config", ")", ";", "Class", "<", "?", ">", "clazz", "=", "object", ".", "getClass", "(", ")", ";", "String", "tableN...
Deletes the given object from its DynamoDB table. @param config Config override object. If {@link SaveBehavior#CLOBBER} is supplied, version fields will not be considered when deleting the object.
[ "Deletes", "the", "given", "object", "from", "its", "DynamoDB", "table", "." ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L604-L647
36,530
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.validBatchGetRequest
private boolean validBatchGetRequest(Map<Class<?>, List<KeyPair>> itemsToGet) { if (itemsToGet == null || itemsToGet.size() == 0) { return false; } for (Class<?> clazz : itemsToGet.keySet()) { if (itemsToGet.get(clazz) != null && itemsToGet.get(clazz).size() > 0) { return true; } } return false; }
java
private boolean validBatchGetRequest(Map<Class<?>, List<KeyPair>> itemsToGet) { if (itemsToGet == null || itemsToGet.size() == 0) { return false; } for (Class<?> clazz : itemsToGet.keySet()) { if (itemsToGet.get(clazz) != null && itemsToGet.get(clazz).size() > 0) { return true; } } return false; }
[ "private", "boolean", "validBatchGetRequest", "(", "Map", "<", "Class", "<", "?", ">", ",", "List", "<", "KeyPair", ">", ">", "itemsToGet", ")", "{", "if", "(", "itemsToGet", "==", "null", "||", "itemsToGet", ".", "size", "(", ")", "==", "0", ")", "{...
Check whether the batchGetRequest meet all the constraints. @param itemsToGet
[ "Check", "whether", "the", "batchGetRequest", "meet", "all", "the", "constraints", "." ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L950-L961
36,531
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.getAutoGeneratedKeyAttributeValue
private AttributeValue getAutoGeneratedKeyAttributeValue(Method getter, Object getterResult) { ArgumentMarshaller marshaller = reflector.getAutoGeneratedKeyArgumentMarshaller(getter); return marshaller.marshall(getterResult); }
java
private AttributeValue getAutoGeneratedKeyAttributeValue(Method getter, Object getterResult) { ArgumentMarshaller marshaller = reflector.getAutoGeneratedKeyArgumentMarshaller(getter); return marshaller.marshall(getterResult); }
[ "private", "AttributeValue", "getAutoGeneratedKeyAttributeValue", "(", "Method", "getter", ",", "Object", "getterResult", ")", "{", "ArgumentMarshaller", "marshaller", "=", "reflector", ".", "getAutoGeneratedKeyArgumentMarshaller", "(", "getter", ")", ";", "return", "mars...
Returns an attribute value corresponding to the key method and value given.
[ "Returns", "an", "attribute", "value", "corresponding", "to", "the", "key", "method", "and", "value", "given", "." ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L1028-L1031
36,532
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.scanPage
public <T> ScanResultPage<T> scanPage(Class<T> clazz, DynamoDBScanExpression scanExpression, DynamoDBMapperConfig config) { config = mergeConfig(config); ScanRequest scanRequest = createScanRequestFromExpression(clazz, scanExpression, config); ScanResult scanResult = db.scan(applyUserAgent(scanRequest)); ScanResultPage<T> result = new ScanResultPage<T>(); result.setResults(marshallIntoObjects(clazz, scanResult.getItems())); result.setLastEvaluatedKey(scanResult.getLastEvaluatedKey()); return result; }
java
public <T> ScanResultPage<T> scanPage(Class<T> clazz, DynamoDBScanExpression scanExpression, DynamoDBMapperConfig config) { config = mergeConfig(config); ScanRequest scanRequest = createScanRequestFromExpression(clazz, scanExpression, config); ScanResult scanResult = db.scan(applyUserAgent(scanRequest)); ScanResultPage<T> result = new ScanResultPage<T>(); result.setResults(marshallIntoObjects(clazz, scanResult.getItems())); result.setLastEvaluatedKey(scanResult.getLastEvaluatedKey()); return result; }
[ "public", "<", "T", ">", "ScanResultPage", "<", "T", ">", "scanPage", "(", "Class", "<", "T", ">", "clazz", ",", "DynamoDBScanExpression", "scanExpression", ",", "DynamoDBMapperConfig", "config", ")", "{", "config", "=", "mergeConfig", "(", "config", ")", ";...
Scans through an Amazon DynamoDB table and returns a single page of matching results. The table to scan is determined by looking at the annotations on the specified class, which declares where to store the object data in AWS DynamoDB, and the scan expression parameter allows the caller to filter results and control how the scan is executed. @param <T> The type of the objects being returned. @param clazz The class annotated with DynamoDB annotations describing how to store the object data in Amazon DynamoDB. @param scanExpression Details on how to run the scan, including any filters to apply to limit results. @param config The configuration to use for this scan, which overrides the default provided at object construction.
[ "Scans", "through", "an", "Amazon", "DynamoDB", "table", "and", "returns", "a", "single", "page", "of", "matching", "results", ".", "The", "table", "to", "scan", "is", "determined", "by", "looking", "at", "the", "annotations", "on", "the", "specified", "clas...
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L1101-L1112
36,533
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.query
public <T> PaginatedQueryList<T> query(Class<T> clazz, DynamoDBQueryExpression queryExpression) { return query(clazz, queryExpression, config); }
java
public <T> PaginatedQueryList<T> query(Class<T> clazz, DynamoDBQueryExpression queryExpression) { return query(clazz, queryExpression, config); }
[ "public", "<", "T", ">", "PaginatedQueryList", "<", "T", ">", "query", "(", "Class", "<", "T", ">", "clazz", ",", "DynamoDBQueryExpression", "queryExpression", ")", "{", "return", "query", "(", "clazz", ",", "queryExpression", ",", "config", ")", ";", "}" ...
Queries an Amazon DynamoDB table and returns the matching results as an unmodifiable list of instantiated objects, using the default configuration. @see DynamoDBMapper#query(Class, DynamoDBQueryExpression, DynamoDBMapperConfig)
[ "Queries", "an", "Amazon", "DynamoDB", "table", "and", "returns", "the", "matching", "results", "as", "an", "unmodifiable", "list", "of", "instantiated", "objects", "using", "the", "default", "configuration", "." ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L1132-L1134
36,534
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.count
public int count(Class<?> clazz, DynamoDBQueryExpression queryExpression, DynamoDBMapperConfig config) { config = mergeConfig(config); QueryRequest queryRequest = createQueryRequestFromExpression(clazz, queryExpression, config); queryRequest.setCount(true); // Count queries can also be truncated for large datasets int count = 0; QueryResult queryResult = null; do { queryResult = db.query(applyUserAgent(queryRequest)); count += queryResult.getCount(); queryRequest.setExclusiveStartKey(queryResult.getLastEvaluatedKey()); } while (queryResult.getLastEvaluatedKey() != null); return count; }
java
public int count(Class<?> clazz, DynamoDBQueryExpression queryExpression, DynamoDBMapperConfig config) { config = mergeConfig(config); QueryRequest queryRequest = createQueryRequestFromExpression(clazz, queryExpression, config); queryRequest.setCount(true); // Count queries can also be truncated for large datasets int count = 0; QueryResult queryResult = null; do { queryResult = db.query(applyUserAgent(queryRequest)); count += queryResult.getCount(); queryRequest.setExclusiveStartKey(queryResult.getLastEvaluatedKey()); } while (queryResult.getLastEvaluatedKey() != null); return count; }
[ "public", "int", "count", "(", "Class", "<", "?", ">", "clazz", ",", "DynamoDBQueryExpression", "queryExpression", ",", "DynamoDBMapperConfig", "config", ")", "{", "config", "=", "mergeConfig", "(", "config", ")", ";", "QueryRequest", "queryRequest", "=", "creat...
Evaluates the specified query expression and returns the count of matching items, without returning any of the actual item data. @param clazz The class mapped to a DynamoDB table. @param queryExpression The parameters for running the scan. @param config The mapper configuration to use for the query, which overrides the default provided at object construction. @return The count of matching items, without returning any of the actual item data.
[ "Evaluates", "the", "specified", "query", "expression", "and", "returns", "the", "count", "of", "matching", "items", "without", "returning", "any", "of", "the", "actual", "item", "data", "." ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L1290-L1306
36,535
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.mergeConfig
private DynamoDBMapperConfig mergeConfig(DynamoDBMapperConfig config) { if ( config != this.config ) config = new DynamoDBMapperConfig(this.config, config); return config; }
java
private DynamoDBMapperConfig mergeConfig(DynamoDBMapperConfig config) { if ( config != this.config ) config = new DynamoDBMapperConfig(this.config, config); return config; }
[ "private", "DynamoDBMapperConfig", "mergeConfig", "(", "DynamoDBMapperConfig", "config", ")", "{", "if", "(", "config", "!=", "this", ".", "config", ")", "config", "=", "new", "DynamoDBMapperConfig", "(", "this", ".", "config", ",", "config", ")", ";", "return...
Merges the config object given with the one specified at construction and returns the result.
[ "Merges", "the", "config", "object", "given", "with", "the", "one", "specified", "at", "construction", "and", "returns", "the", "result", "." ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L1312-L1316
36,536
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.transformAttributeUpdates
private Map<String, AttributeValueUpdate> transformAttributeUpdates(Class<?> clazz, Key objectKey, Map<String, AttributeValueUpdate> updateValues) { Map<String, AttributeValue> item = convertToItem(updateValues); boolean hashKeyAdded = false; boolean rangeKeyAdded = false; String hashKey = reflector.getAttributeName(reflector.getHashKeyGetter(clazz)); if(!item.containsKey(hashKey)) { item.put(hashKey, objectKey.getHashKeyElement()); hashKeyAdded = true; } String rangeKey = null; Method rangeKeyGetter = reflector.getRangeKeyGetter(clazz); if (rangeKeyGetter != null) { rangeKey = reflector.getAttributeName(rangeKeyGetter); if (!item.containsKey(rangeKey)) { item.put(rangeKey, objectKey.getRangeKeyElement()); rangeKeyAdded = true; } } item = transformAttributes(clazz, item); // Remove the keys if we added them before. if (hashKeyAdded) { item.remove(hashKey); } if (rangeKeyAdded) { item.remove(rangeKey); } for(String key: item.keySet()) { if (updateValues.containsKey(key)) { updateValues.get(key).getValue() .withB(item.get(key).getB()) .withBS(item.get(key).getBS()) .withN(item.get(key).getN()) .withNS(item.get(key).getNS()) .withS(item.get(key).getS()) .withSS(item.get(key).getSS()); } else { updateValues.put(key, new AttributeValueUpdate(item.get(key), "PUT")); } } return updateValues; }
java
private Map<String, AttributeValueUpdate> transformAttributeUpdates(Class<?> clazz, Key objectKey, Map<String, AttributeValueUpdate> updateValues) { Map<String, AttributeValue> item = convertToItem(updateValues); boolean hashKeyAdded = false; boolean rangeKeyAdded = false; String hashKey = reflector.getAttributeName(reflector.getHashKeyGetter(clazz)); if(!item.containsKey(hashKey)) { item.put(hashKey, objectKey.getHashKeyElement()); hashKeyAdded = true; } String rangeKey = null; Method rangeKeyGetter = reflector.getRangeKeyGetter(clazz); if (rangeKeyGetter != null) { rangeKey = reflector.getAttributeName(rangeKeyGetter); if (!item.containsKey(rangeKey)) { item.put(rangeKey, objectKey.getRangeKeyElement()); rangeKeyAdded = true; } } item = transformAttributes(clazz, item); // Remove the keys if we added them before. if (hashKeyAdded) { item.remove(hashKey); } if (rangeKeyAdded) { item.remove(rangeKey); } for(String key: item.keySet()) { if (updateValues.containsKey(key)) { updateValues.get(key).getValue() .withB(item.get(key).getB()) .withBS(item.get(key).getBS()) .withN(item.get(key).getN()) .withNS(item.get(key).getNS()) .withS(item.get(key).getS()) .withSS(item.get(key).getSS()); } else { updateValues.put(key, new AttributeValueUpdate(item.get(key), "PUT")); } } return updateValues; }
[ "private", "Map", "<", "String", ",", "AttributeValueUpdate", ">", "transformAttributeUpdates", "(", "Class", "<", "?", ">", "clazz", ",", "Key", "objectKey", ",", "Map", "<", "String", ",", "AttributeValueUpdate", ">", "updateValues", ")", "{", "Map", "<", ...
A transformation expects to see all values, including keys, when determining the transformation, therefore we must insert them if they are not already present. However, we must remove the keys prior to actual storage as this method is called when updating DynamoDB, which does not permit the modification of key attributes as part of an update call.
[ "A", "transformation", "expects", "to", "see", "all", "values", "including", "keys", "when", "determining", "the", "transformation", "therefore", "we", "must", "insert", "them", "if", "they", "are", "not", "already", "present", ".", "However", "we", "must", "r...
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L1407-L1452
36,537
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java
EventsListener.rebind
public static void rebind(Element e) { EventsListener ret = getGQueryEventListener(e); if (ret != null) { DOM.setEventListener((com.google.gwt.user.client.Element) e, ret); } }
java
public static void rebind(Element e) { EventsListener ret = getGQueryEventListener(e); if (ret != null) { DOM.setEventListener((com.google.gwt.user.client.Element) e, ret); } }
[ "public", "static", "void", "rebind", "(", "Element", "e", ")", "{", "EventsListener", "ret", "=", "getGQueryEventListener", "(", "e", ")", ";", "if", "(", "ret", "!=", "null", ")", "{", "DOM", ".", "setEventListener", "(", "(", "com", ".", "google", "...
We have to set the gQuery event listener to the element again when the element is a widget, because when GWT detaches a widget it removes the event listener.
[ "We", "have", "to", "set", "the", "gQuery", "event", "listener", "to", "the", "element", "again", "when", "the", "element", "is", "a", "widget", "because", "when", "GWT", "detaches", "a", "widget", "it", "removes", "the", "event", "listener", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java#L386-L391
36,538
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java
EventsListener.hasHandlers
public boolean hasHandlers(int eventBits, String eventName, Function handler) { for (int i = 0, j = elementEvents.length(); i < j; i++) { BindFunction function = elementEvents.get(i); if ((function.hasEventType(eventBits) || function.isTypeOf(eventName)) && (handler == null || function.isEquals(handler))) { return true; } } return false; }
java
public boolean hasHandlers(int eventBits, String eventName, Function handler) { for (int i = 0, j = elementEvents.length(); i < j; i++) { BindFunction function = elementEvents.get(i); if ((function.hasEventType(eventBits) || function.isTypeOf(eventName)) && (handler == null || function.isEquals(handler))) { return true; } } return false; }
[ "public", "boolean", "hasHandlers", "(", "int", "eventBits", ",", "String", "eventName", ",", "Function", "handler", ")", "{", "for", "(", "int", "i", "=", "0", ",", "j", "=", "elementEvents", ".", "length", "(", ")", ";", "i", "<", "j", ";", "i", ...
Return true if the element is listening for the given eventBit or eventName and the handler matches.
[ "Return", "true", "if", "the", "element", "is", "listening", "for", "the", "given", "eventBit", "or", "eventName", "and", "the", "handler", "matches", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java#L705-L714
36,539
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/vm/CookieManager.java
CookieManager.storeCookies
public void storeCookies(URLConnection conn) throws IOException { // let's determine the domain from where these cookies are being sent String domain = getDomainFromHost(conn.getURL().getHost()); Map<String, Map<String, String>> domainStore; // this is where we will store cookies for this domain // now let's check the store to see if we have an entry for this domain if (store.containsKey(domain)) { // we do, so lets retrieve it from the store domainStore = store.get(domain); } else { // we don't, so let's create it and put it in the store domainStore = new HashMap<>(); store.put(domain, domainStore); } // OK, now we are ready to get the cookies out of the URLConnection String headerName = null; for (int i = 1; (headerName = conn.getHeaderFieldKey(i)) != null; i++) { if (headerName.equalsIgnoreCase(SET_COOKIE)) { Map<String, String> cookie = new HashMap<>(); StringTokenizer st = new StringTokenizer(conn.getHeaderField(i), COOKIE_VALUE_DELIMITER); // the specification dictates that the first name/value pair // in the string is the cookie name and value, so let's handle // them as a special case: if (st.hasMoreTokens()) { String token = st.nextToken(); String name = token.substring(0, token.indexOf(NAME_VALUE_SEPARATOR)); String value = token.substring(token.indexOf(NAME_VALUE_SEPARATOR) + 1, token.length()); domainStore.put(name, cookie); cookie.put(name, value); } while (st.hasMoreTokens()) { String token = st.nextToken().toLowerCase(); int idx = token.indexOf(NAME_VALUE_SEPARATOR); if (idx > 0 && idx < token.length() - 1) { cookie.put(token.substring(0, idx).toLowerCase(), token.substring(idx + 1, token .length())); } } } } }
java
public void storeCookies(URLConnection conn) throws IOException { // let's determine the domain from where these cookies are being sent String domain = getDomainFromHost(conn.getURL().getHost()); Map<String, Map<String, String>> domainStore; // this is where we will store cookies for this domain // now let's check the store to see if we have an entry for this domain if (store.containsKey(domain)) { // we do, so lets retrieve it from the store domainStore = store.get(domain); } else { // we don't, so let's create it and put it in the store domainStore = new HashMap<>(); store.put(domain, domainStore); } // OK, now we are ready to get the cookies out of the URLConnection String headerName = null; for (int i = 1; (headerName = conn.getHeaderFieldKey(i)) != null; i++) { if (headerName.equalsIgnoreCase(SET_COOKIE)) { Map<String, String> cookie = new HashMap<>(); StringTokenizer st = new StringTokenizer(conn.getHeaderField(i), COOKIE_VALUE_DELIMITER); // the specification dictates that the first name/value pair // in the string is the cookie name and value, so let's handle // them as a special case: if (st.hasMoreTokens()) { String token = st.nextToken(); String name = token.substring(0, token.indexOf(NAME_VALUE_SEPARATOR)); String value = token.substring(token.indexOf(NAME_VALUE_SEPARATOR) + 1, token.length()); domainStore.put(name, cookie); cookie.put(name, value); } while (st.hasMoreTokens()) { String token = st.nextToken().toLowerCase(); int idx = token.indexOf(NAME_VALUE_SEPARATOR); if (idx > 0 && idx < token.length() - 1) { cookie.put(token.substring(0, idx).toLowerCase(), token.substring(idx + 1, token .length())); } } } } }
[ "public", "void", "storeCookies", "(", "URLConnection", "conn", ")", "throws", "IOException", "{", "// let's determine the domain from where these cookies are being sent", "String", "domain", "=", "getDomainFromHost", "(", "conn", ".", "getURL", "(", ")", ".", "getHost", ...
Retrieves and stores cookies returned by the host on the other side of the the open java.net.URLConnection. The connection MUST have been opened using the connect() method or a IOException will be thrown. @param conn a java.net.URLConnection - must be open, or IOException will be thrown @throws java.io.IOException Thrown if conn is not open.
[ "Retrieves", "and", "stores", "cookies", "returned", "by", "the", "host", "on", "the", "other", "side", "of", "the", "the", "open", "java", ".", "net", ".", "URLConnection", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/vm/CookieManager.java#L106-L152
36,540
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/vm/CookieManager.java
CookieManager.setCookies
public void setCookies(URLConnection conn) throws IOException { // let's determine the domain and path to retrieve the appropriate cookies URL url = conn.getURL(); String domain = getDomainFromHost(url.getHost()); if (domain.equals("localhost")) { domain = "linkedin.com"; } String path = url.getPath(); Map<String, Map<String, String>> domainStore = store.get(domain); if (domainStore == null) return; StringBuilder cookieStringBuffer = new StringBuilder(); Iterator<String> cookieNames = domainStore.keySet().iterator(); while (cookieNames.hasNext()) { String cookieName = cookieNames.next(); Map<String, String> cookie = domainStore.get(cookieName); // check cookie to ensure path matches and cookie is not expired // if all is cool, add cookie to header string if (comparePaths((String) cookie.get(PATH), path) && isNotExpired(cookie.get(EXPIRES))) { cookieStringBuffer.append(cookieName); cookieStringBuffer.append("="); cookieStringBuffer.append(cookie.get(cookieName)); if (cookieNames.hasNext()) cookieStringBuffer.append(SET_COOKIE_SEPARATOR); } } try { conn.setRequestProperty(COOKIE, cookieStringBuffer.toString()); } catch (java.lang.IllegalStateException ise) { IOException ioe = new IOException( "Illegal State! Cookies cannot be set on a URLConnection that is already connected. " + "Only call setCookies(java.net.URLConnection) AFTER calling java.net.URLConnection.connect()."); throw ioe; } }
java
public void setCookies(URLConnection conn) throws IOException { // let's determine the domain and path to retrieve the appropriate cookies URL url = conn.getURL(); String domain = getDomainFromHost(url.getHost()); if (domain.equals("localhost")) { domain = "linkedin.com"; } String path = url.getPath(); Map<String, Map<String, String>> domainStore = store.get(domain); if (domainStore == null) return; StringBuilder cookieStringBuffer = new StringBuilder(); Iterator<String> cookieNames = domainStore.keySet().iterator(); while (cookieNames.hasNext()) { String cookieName = cookieNames.next(); Map<String, String> cookie = domainStore.get(cookieName); // check cookie to ensure path matches and cookie is not expired // if all is cool, add cookie to header string if (comparePaths((String) cookie.get(PATH), path) && isNotExpired(cookie.get(EXPIRES))) { cookieStringBuffer.append(cookieName); cookieStringBuffer.append("="); cookieStringBuffer.append(cookie.get(cookieName)); if (cookieNames.hasNext()) cookieStringBuffer.append(SET_COOKIE_SEPARATOR); } } try { conn.setRequestProperty(COOKIE, cookieStringBuffer.toString()); } catch (java.lang.IllegalStateException ise) { IOException ioe = new IOException( "Illegal State! Cookies cannot be set on a URLConnection that is already connected. " + "Only call setCookies(java.net.URLConnection) AFTER calling java.net.URLConnection.connect()."); throw ioe; } }
[ "public", "void", "setCookies", "(", "URLConnection", "conn", ")", "throws", "IOException", "{", "// let's determine the domain and path to retrieve the appropriate cookies", "URL", "url", "=", "conn", ".", "getURL", "(", ")", ";", "String", "domain", "=", "getDomainFro...
Prior to opening a URLConnection, calling this method will set all unexpired cookies that match the path or subpaths for thi underlying URL The connection MUST NOT have been opened method or an IOException will be thrown. @param conn a java.net.URLConnection - must NOT be open, or IOException will be thrown @throws java.io.IOException Thrown if conn has already been opened.
[ "Prior", "to", "opening", "a", "URLConnection", "calling", "this", "method", "will", "set", "all", "unexpired", "cookies", "that", "match", "the", "path", "or", "subpaths", "for", "thi", "underlying", "URL" ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/vm/CookieManager.java#L163-L202
36,541
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/WidgetsUtils.java
WidgetsUtils.matchesTags
public static boolean matchesTags(Element e, String... tagNames) { assert e != null : "Element cannot be null"; StringBuilder regExp = new StringBuilder("^("); int tagNameLenght = tagNames != null ? tagNames.length : 0; for (int i = 0; i < tagNameLenght; i++) { regExp.append(tagNames[i].toUpperCase()); if (i < tagNameLenght - 1) { regExp.append("|"); } } regExp.append(")$"); return e.getTagName().toUpperCase().matches(regExp.toString()); }
java
public static boolean matchesTags(Element e, String... tagNames) { assert e != null : "Element cannot be null"; StringBuilder regExp = new StringBuilder("^("); int tagNameLenght = tagNames != null ? tagNames.length : 0; for (int i = 0; i < tagNameLenght; i++) { regExp.append(tagNames[i].toUpperCase()); if (i < tagNameLenght - 1) { regExp.append("|"); } } regExp.append(")$"); return e.getTagName().toUpperCase().matches(regExp.toString()); }
[ "public", "static", "boolean", "matchesTags", "(", "Element", "e", ",", "String", "...", "tagNames", ")", "{", "assert", "e", "!=", "null", ":", "\"Element cannot be null\"", ";", "StringBuilder", "regExp", "=", "new", "StringBuilder", "(", "\"^(\"", ")", ";",...
Test if the tag name of the element is one of tag names given in parameter. @param tagNames @return
[ "Test", "if", "the", "tag", "name", "of", "the", "element", "is", "one", "of", "tag", "names", "given", "in", "parameter", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/WidgetsUtils.java#L67-L82
36,542
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/WidgetsUtils.java
WidgetsUtils.attachWidget
public static void attachWidget(Widget widget, Widget firstParentWidget) { if (widget != null && widget.getParent() == null) { if (firstParentWidget == null) { firstParentWidget = getFirstParentWidget(widget); if (firstParentWidget == null) { RootPanel.detachOnWindowClose(widget); widgetOnAttach(widget); } else { attachWidget(widget, firstParentWidget); } } else if (firstParentWidget instanceof HTMLPanel) { HTMLPanel h = (HTMLPanel) firstParentWidget; Element p = widget.getElement().getParentElement(); if (p != null) { h.add(widget, p); } else { h.add(widget); } } else if (firstParentWidget instanceof HasOneWidget) { ((HasOneWidget) firstParentWidget).setWidget(widget); } else if (firstParentWidget instanceof HasWidgets) { try { ((HasWidgets) firstParentWidget).add(widget); } catch (UnsupportedOperationException e) { // Some widgets like 'table' has no implementation of 'add(widget)' widgetSetParent(widget, firstParentWidget); } } else { widgetSetParent(widget, firstParentWidget); } } }
java
public static void attachWidget(Widget widget, Widget firstParentWidget) { if (widget != null && widget.getParent() == null) { if (firstParentWidget == null) { firstParentWidget = getFirstParentWidget(widget); if (firstParentWidget == null) { RootPanel.detachOnWindowClose(widget); widgetOnAttach(widget); } else { attachWidget(widget, firstParentWidget); } } else if (firstParentWidget instanceof HTMLPanel) { HTMLPanel h = (HTMLPanel) firstParentWidget; Element p = widget.getElement().getParentElement(); if (p != null) { h.add(widget, p); } else { h.add(widget); } } else if (firstParentWidget instanceof HasOneWidget) { ((HasOneWidget) firstParentWidget).setWidget(widget); } else if (firstParentWidget instanceof HasWidgets) { try { ((HasWidgets) firstParentWidget).add(widget); } catch (UnsupportedOperationException e) { // Some widgets like 'table' has no implementation of 'add(widget)' widgetSetParent(widget, firstParentWidget); } } else { widgetSetParent(widget, firstParentWidget); } } }
[ "public", "static", "void", "attachWidget", "(", "Widget", "widget", ",", "Widget", "firstParentWidget", ")", "{", "if", "(", "widget", "!=", "null", "&&", "widget", ".", "getParent", "(", ")", "==", "null", ")", "{", "if", "(", "firstParentWidget", "==", ...
Attach a widget to the GWT widget list. Normally used when GQuery creates widgets wrapping existing dom elements. It does nothing if the widget is already attached to another widget. @param widget to attach @param firstParentWidget the parent widget, If it is null and it is not inside any other widget, we just add the widget to the gwt detach list
[ "Attach", "a", "widget", "to", "the", "GWT", "widget", "list", ".", "Normally", "used", "when", "GQuery", "creates", "widgets", "wrapping", "existing", "dom", "elements", ".", "It", "does", "nothing", "if", "the", "widget", "is", "already", "attached", "to",...
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/WidgetsUtils.java#L186-L217
36,543
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/WidgetsUtils.java
WidgetsUtils.getChildren
public static Iterator<Widget> getChildren(Widget w) { if (w instanceof Panel) { return ((Panel) w).iterator(); } if (w instanceof Composite) { return getChildren(compositeGetWidget((Composite) w)); } return null; }
java
public static Iterator<Widget> getChildren(Widget w) { if (w instanceof Panel) { return ((Panel) w).iterator(); } if (w instanceof Composite) { return getChildren(compositeGetWidget((Composite) w)); } return null; }
[ "public", "static", "Iterator", "<", "Widget", ">", "getChildren", "(", "Widget", "w", ")", "{", "if", "(", "w", "instanceof", "Panel", ")", "{", "return", "(", "(", "Panel", ")", "w", ")", ".", "iterator", "(", ")", ";", "}", "if", "(", "w", "in...
Return children of the first widget's panel.
[ "Return", "children", "of", "the", "first", "widget", "s", "panel", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/WidgetsUtils.java#L247-L255
36,544
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/GqEvent.java
GqEvent.pageX
public final int pageX() { if (getTouches() != null && getTouches().length() > 0) { return getTouches().get(0).getPageX(); } else { return getClientX() + GQuery.document.getScrollLeft(); } }
java
public final int pageX() { if (getTouches() != null && getTouches().length() > 0) { return getTouches().get(0).getPageX(); } else { return getClientX() + GQuery.document.getScrollLeft(); } }
[ "public", "final", "int", "pageX", "(", ")", "{", "if", "(", "getTouches", "(", ")", "!=", "null", "&&", "getTouches", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "return", "getTouches", "(", ")", ".", "get", "(", "0", ")", ".", "get...
The mouse position relative to the left edge of the document.
[ "The", "mouse", "position", "relative", "to", "the", "left", "edge", "of", "the", "document", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/GqEvent.java#L91-L97
36,545
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/GqEvent.java
GqEvent.pageY
public final int pageY() { if (getTouches() != null && getTouches().length() > 0) { return getTouches().get(0).getPageY(); } else { return getClientY() + GQuery.document.getScrollTop(); } }
java
public final int pageY() { if (getTouches() != null && getTouches().length() > 0) { return getTouches().get(0).getPageY(); } else { return getClientY() + GQuery.document.getScrollTop(); } }
[ "public", "final", "int", "pageY", "(", ")", "{", "if", "(", "getTouches", "(", ")", "!=", "null", "&&", "getTouches", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "return", "getTouches", "(", ")", ".", "get", "(", "0", ")", ".", "get...
The mouse position relative to the top edge of the document.
[ "The", "mouse", "position", "relative", "to", "the", "top", "edge", "of", "the", "document", "." ]
93e02bc8eb030081061c56134ebee1f585981107
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/GqEvent.java#L103-L109
36,546
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/model/ListTablesResult.java
ListTablesResult.setTableNames
public void setTableNames(java.util.Collection<String> tableNames) { if (tableNames == null) { this.tableNames = null; return; } java.util.List<String> tableNamesCopy = new java.util.ArrayList<String>(tableNames.size()); tableNamesCopy.addAll(tableNames); this.tableNames = tableNamesCopy; }
java
public void setTableNames(java.util.Collection<String> tableNames) { if (tableNames == null) { this.tableNames = null; return; } java.util.List<String> tableNamesCopy = new java.util.ArrayList<String>(tableNames.size()); tableNamesCopy.addAll(tableNames); this.tableNames = tableNamesCopy; }
[ "public", "void", "setTableNames", "(", "java", ".", "util", ".", "Collection", "<", "String", ">", "tableNames", ")", "{", "if", "(", "tableNames", "==", "null", ")", "{", "this", ".", "tableNames", "=", "null", ";", "return", ";", "}", "java", ".", ...
Sets the value of the TableNames property for this object. @param tableNames The new value for the TableNames property for this object.
[ "Sets", "the", "value", "of", "the", "TableNames", "property", "for", "this", "object", "." ]
4b230ac843494cb10e46ddc2848f5b5d377d7b72
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/model/ListTablesResult.java#L54-L63
36,547
beckchr/juel
modules/api/src/main/java/javax/el/ELContext.java
ELContext.getContext
public Object getContext(Class<?> key) { if (key == null) { throw new NullPointerException("key is null"); } if (context == null) { return null; } return context.get(key); }
java
public Object getContext(Class<?> key) { if (key == null) { throw new NullPointerException("key is null"); } if (context == null) { return null; } return context.get(key); }
[ "public", "Object", "getContext", "(", "Class", "<", "?", ">", "key", ")", "{", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"key is null\"", ")", ";", "}", "if", "(", "context", "==", "null", ")", "{", "re...
Returns the context object associated with the given key. The ELContext maintains a collection of context objects relevant to the evaluation of an expression. These context objects are used by ELResolvers. This method is used to retrieve the context with the given key from the collection. By convention, the object returned will be of the type specified by the key. However, this is not required and the key is used strictly as a unique identifier. @param key The unique identifier that was used to associate the context object with this ELContext. @return The context object associated with the given key, or null if no such context was found. @throws NullPointerException if key is null.
[ "Returns", "the", "context", "object", "associated", "with", "the", "given", "key", ".", "The", "ELContext", "maintains", "a", "collection", "of", "context", "objects", "relevant", "to", "the", "evaluation", "of", "an", "expression", ".", "These", "context", "...
1a8fb366b7349ddae81f806dee1ab2de11b672c7
https://github.com/beckchr/juel/blob/1a8fb366b7349ddae81f806dee1ab2de11b672c7/modules/api/src/main/java/javax/el/ELContext.java#L64-L72
36,548
beckchr/juel
modules/api/src/main/java/javax/el/ELContext.java
ELContext.putContext
public void putContext(Class<?> key, Object contextObject) { if (key == null) { throw new NullPointerException("key is null"); } if (context == null) { context = new HashMap<Class<?>, Object>(); } context.put(key, contextObject); }
java
public void putContext(Class<?> key, Object contextObject) { if (key == null) { throw new NullPointerException("key is null"); } if (context == null) { context = new HashMap<Class<?>, Object>(); } context.put(key, contextObject); }
[ "public", "void", "putContext", "(", "Class", "<", "?", ">", "key", ",", "Object", "contextObject", ")", "{", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"key is null\"", ")", ";", "}", "if", "(", "context", ...
Associates a context object with this ELContext. The ELContext maintains a collection of context objects relevant to the evaluation of an expression. These context objects are used by ELResolvers. This method is used to add a context object to that collection. By convention, the contextObject will be of the type specified by the key. However, this is not required and the key is used strictly as a unique identifier. @param key The key used by an {@link ELResolver} to identify this context object. @param contextObject The context object to add to the collection. @throws NullPointerException if key is null or contextObject is null.
[ "Associates", "a", "context", "object", "with", "this", "ELContext", ".", "The", "ELContext", "maintains", "a", "collection", "of", "context", "objects", "relevant", "to", "the", "evaluation", "of", "an", "expression", ".", "These", "context", "objects", "are", ...
1a8fb366b7349ddae81f806dee1ab2de11b672c7
https://github.com/beckchr/juel/blob/1a8fb366b7349ddae81f806dee1ab2de11b672c7/modules/api/src/main/java/javax/el/ELContext.java#L138-L146
36,549
beckchr/juel
samples/src/de/odysseus/el/samples/xml/sax/XMELFilter.java
XMELFilter.main
public static void main(String[] args) throws SAXException, IOException { // create our expression context ELContext context = new SimpleContext(); // set value for top-level property "home" context.getELResolver().setValue(context, null, "home", "/foo/bar"); // create our filtered reader XMLReader reader = new XMELFilter(XMLReaderFactory.createXMLReader(), context); // simple test content handler to print elements and attributes to stdout reader.setContentHandler(new DefaultHandler() { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) { System.out.println("start " + localName); for (int i = 0; i < attributes.getLength(); i++) { System.out.println(" @" + attributes.getLocalName(i) + " = " + attributes.getValue(i)); } } @Override public void endElement(String uri, String localName, String qName) { System.out.println("end " + localName); } @Override public void characters(char[] ch, int start, int length) throws SAXException { System.out.println("text: " + new String(ch, start, length)); } }); // parse our test input and watch the evaluated attributes and template text String xml ="<test>foo<math>1+2=${1+2}</math><config file='${home}/config.xml'/>bar</test>"; reader.parse(new InputSource(new StringReader(xml))); }
java
public static void main(String[] args) throws SAXException, IOException { // create our expression context ELContext context = new SimpleContext(); // set value for top-level property "home" context.getELResolver().setValue(context, null, "home", "/foo/bar"); // create our filtered reader XMLReader reader = new XMELFilter(XMLReaderFactory.createXMLReader(), context); // simple test content handler to print elements and attributes to stdout reader.setContentHandler(new DefaultHandler() { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) { System.out.println("start " + localName); for (int i = 0; i < attributes.getLength(); i++) { System.out.println(" @" + attributes.getLocalName(i) + " = " + attributes.getValue(i)); } } @Override public void endElement(String uri, String localName, String qName) { System.out.println("end " + localName); } @Override public void characters(char[] ch, int start, int length) throws SAXException { System.out.println("text: " + new String(ch, start, length)); } }); // parse our test input and watch the evaluated attributes and template text String xml ="<test>foo<math>1+2=${1+2}</math><config file='${home}/config.xml'/>bar</test>"; reader.parse(new InputSource(new StringReader(xml))); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "SAXException", ",", "IOException", "{", "// create our expression context\r", "ELContext", "context", "=", "new", "SimpleContext", "(", ")", ";", "// set value for top-level property ...
Usage example.
[ "Usage", "example", "." ]
1a8fb366b7349ddae81f806dee1ab2de11b672c7
https://github.com/beckchr/juel/blob/1a8fb366b7349ddae81f806dee1ab2de11b672c7/samples/src/de/odysseus/el/samples/xml/sax/XMELFilter.java#L53-L81
36,550
beckchr/juel
modules/impl/src/main/java/de/odysseus/el/tree/Bindings.java
Bindings.convert
public <T> T convert(Object value, Class<T> type) { return converter.convert(value, type); }
java
public <T> T convert(Object value, Class<T> type) { return converter.convert(value, type); }
[ "public", "<", "T", ">", "T", "convert", "(", "Object", "value", ",", "Class", "<", "T", ">", "type", ")", "{", "return", "converter", ".", "convert", "(", "value", ",", "type", ")", ";", "}" ]
Apply type conversion. @param value value to convert @param type target type @return converted value @throws ELException
[ "Apply", "type", "conversion", "." ]
1a8fb366b7349ddae81f806dee1ab2de11b672c7
https://github.com/beckchr/juel/blob/1a8fb366b7349ddae81f806dee1ab2de11b672c7/modules/impl/src/main/java/de/odysseus/el/tree/Bindings.java#L137-L139
36,551
druid-io/druid-api
src/main/java/io/druid/segment/loading/DataSegmentPusherUtil.java
DataSegmentPusherUtil.getStorageDir
public static String getStorageDir(DataSegment segment) { return JOINER.join( segment.getDataSource(), String.format( "%s_%s", segment.getInterval().getStart(), segment.getInterval().getEnd() ), segment.getVersion(), segment.getShardSpec().getPartitionNum() ); }
java
public static String getStorageDir(DataSegment segment) { return JOINER.join( segment.getDataSource(), String.format( "%s_%s", segment.getInterval().getStart(), segment.getInterval().getEnd() ), segment.getVersion(), segment.getShardSpec().getPartitionNum() ); }
[ "public", "static", "String", "getStorageDir", "(", "DataSegment", "segment", ")", "{", "return", "JOINER", ".", "join", "(", "segment", ".", "getDataSource", "(", ")", ",", "String", ".", "format", "(", "\"%s_%s\"", ",", "segment", ".", "getInterval", "(", ...
on segment deletion if segment being deleted was the only segment
[ "on", "segment", "deletion", "if", "segment", "being", "deleted", "was", "the", "only", "segment" ]
d822339d30bcac5c59eeffd6e255f69671d5e57c
https://github.com/druid-io/druid-api/blob/d822339d30bcac5c59eeffd6e255f69671d5e57c/src/main/java/io/druid/segment/loading/DataSegmentPusherUtil.java#L36-L48
36,552
dvdme/forecastio-lib-java
src/com/github/dvdme/ForecastIOLib/FIODataPoint.java
FIODataPoint.update
void update(JsonObject dp){ for(int i = 0; i < dp.names().size(); i++){ datapoint.put(dp.names().get(i), dp.get(dp.names().get(i))); } }
java
void update(JsonObject dp){ for(int i = 0; i < dp.names().size(); i++){ datapoint.put(dp.names().get(i), dp.get(dp.names().get(i))); } }
[ "void", "update", "(", "JsonObject", "dp", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dp", ".", "names", "(", ")", ".", "size", "(", ")", ";", "i", "++", ")", "{", "datapoint", ".", "put", "(", "dp", ".", "names", "(", ")",...
Updates the data point data @param dp JsonObect with the data
[ "Updates", "the", "data", "point", "data" ]
63c0ff17446eb7eb4e9f8bef4e19272f14c74e85
https://github.com/dvdme/forecastio-lib-java/blob/63c0ff17446eb7eb4e9f8bef4e19272f14c74e85/src/com/github/dvdme/ForecastIOLib/FIODataPoint.java#L38-L42
36,553
dvdme/forecastio-lib-java
src/com/github/dvdme/ForecastIOLib/FIODataPoint.java
FIODataPoint.getFieldsArray
public String [] getFieldsArray(){ Object [] obj = datapoint.keySet().toArray(); String [] out = new String[obj.length]; for(int i=0; i<obj.length; i++) out[i] = String.valueOf(obj[i]); return out; }
java
public String [] getFieldsArray(){ Object [] obj = datapoint.keySet().toArray(); String [] out = new String[obj.length]; for(int i=0; i<obj.length; i++) out[i] = String.valueOf(obj[i]); return out; }
[ "public", "String", "[", "]", "getFieldsArray", "(", ")", "{", "Object", "[", "]", "obj", "=", "datapoint", ".", "keySet", "(", ")", ".", "toArray", "(", ")", ";", "String", "[", "]", "out", "=", "new", "String", "[", "obj", ".", "length", "]", "...
Returns a String array with all the Forecast.io fields available in this data point. It can be usefull to iterate over all available fields in a data point. @return the String array with the field's names.
[ "Returns", "a", "String", "array", "with", "all", "the", "Forecast", ".", "io", "fields", "available", "in", "this", "data", "point", ".", "It", "can", "be", "usefull", "to", "iterate", "over", "all", "available", "fields", "in", "a", "data", "point", "....
63c0ff17446eb7eb4e9f8bef4e19272f14c74e85
https://github.com/dvdme/forecastio-lib-java/blob/63c0ff17446eb7eb4e9f8bef4e19272f14c74e85/src/com/github/dvdme/ForecastIOLib/FIODataPoint.java#L62-L68
36,554
dvdme/forecastio-lib-java
src/com/github/dvdme/ForecastIOLib/FIODataPoint.java
FIODataPoint.getByKey
public String getByKey(String key){ String out = ""; if(key.equals("time")) return time(); if(key.contains("Time")){ DateFormat dfm = new SimpleDateFormat("HH:mm:ss"); dfm.setTimeZone(TimeZone.getTimeZone(timezone)); out = dfm.format( Long.parseLong(String.valueOf(this.datapoint.get(key))) * 1000 ); } else out = String.valueOf( datapoint.get(key) ); return out; }
java
public String getByKey(String key){ String out = ""; if(key.equals("time")) return time(); if(key.contains("Time")){ DateFormat dfm = new SimpleDateFormat("HH:mm:ss"); dfm.setTimeZone(TimeZone.getTimeZone(timezone)); out = dfm.format( Long.parseLong(String.valueOf(this.datapoint.get(key))) * 1000 ); } else out = String.valueOf( datapoint.get(key) ); return out; }
[ "public", "String", "getByKey", "(", "String", "key", ")", "{", "String", "out", "=", "\"\"", ";", "if", "(", "key", ".", "equals", "(", "\"time\"", ")", ")", "return", "time", "(", ")", ";", "if", "(", "key", ".", "contains", "(", "\"Time\"", ")",...
Return the data point field with the corresponding key @param key name of the field in the data point @return the field value
[ "Return", "the", "data", "point", "field", "with", "the", "corresponding", "key" ]
63c0ff17446eb7eb4e9f8bef4e19272f14c74e85
https://github.com/dvdme/forecastio-lib-java/blob/63c0ff17446eb7eb4e9f8bef4e19272f14c74e85/src/com/github/dvdme/ForecastIOLib/FIODataPoint.java#L94-L106
36,555
dvdme/forecastio-lib-java
src/com/github/dvdme/ForecastIOLib/ForecastIO.java
ForecastIO.setHTTPProxy
public void setHTTPProxy(String PROXYNAME, int PROXYPORT) { if (PROXYNAME == null) { this.proxy_to_use = null; } else { this.proxy_to_use = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(PROXYNAME, PROXYPORT)); } }
java
public void setHTTPProxy(String PROXYNAME, int PROXYPORT) { if (PROXYNAME == null) { this.proxy_to_use = null; } else { this.proxy_to_use = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(PROXYNAME, PROXYPORT)); } }
[ "public", "void", "setHTTPProxy", "(", "String", "PROXYNAME", ",", "int", "PROXYPORT", ")", "{", "if", "(", "PROXYNAME", "==", "null", ")", "{", "this", ".", "proxy_to_use", "=", "null", ";", "}", "else", "{", "this", ".", "proxy_to_use", "=", "new", "...
Sets the http-proxy to use. @param PROXYNAME hostname or ip of the proxy to use (e.g. "127.0.0.1"). If proxyname equals null, no proxy will be used. @param PROXYPORT port of the proxy to use (e.g. 8080)
[ "Sets", "the", "http", "-", "proxy", "to", "use", "." ]
63c0ff17446eb7eb4e9f8bef4e19272f14c74e85
https://github.com/dvdme/forecastio-lib-java/blob/63c0ff17446eb7eb4e9f8bef4e19272f14c74e85/src/com/github/dvdme/ForecastIOLib/ForecastIO.java#L285-L292
36,556
dvdme/forecastio-lib-java
src/com/github/dvdme/ForecastIOLib/ForecastIO.java
ForecastIO.update
public boolean update(){ boolean b = getForecast(String.valueOf(getLatitude()), String.valueOf(getLongitude())); return b; }
java
public boolean update(){ boolean b = getForecast(String.valueOf(getLatitude()), String.valueOf(getLongitude())); return b; }
[ "public", "boolean", "update", "(", ")", "{", "boolean", "b", "=", "getForecast", "(", "String", ".", "valueOf", "(", "getLatitude", "(", ")", ")", ",", "String", ".", "valueOf", "(", "getLongitude", "(", ")", ")", ")", ";", "return", "b", ";", "}" ]
Does another query to the API and updates the data This only updates the data in ForecastIO class @return True if successful
[ "Does", "another", "query", "to", "the", "API", "and", "updates", "the", "data", "This", "only", "updates", "the", "data", "in", "ForecastIO", "class" ]
63c0ff17446eb7eb4e9f8bef4e19272f14c74e85
https://github.com/dvdme/forecastio-lib-java/blob/63c0ff17446eb7eb4e9f8bef4e19272f14c74e85/src/com/github/dvdme/ForecastIOLib/ForecastIO.java#L544-L547
36,557
dvdme/forecastio-lib-java
src/com/github/dvdme/ForecastIOLib/ForecastIO.java
ForecastIO.getForecast
public boolean getForecast(String LATITUDE, String LONGITUDE) { try { String reply = httpGET( urlBuilder(LATITUDE, LONGITUDE) ); if(reply == null) return false; this.forecast = Json.parse(reply).asObject(); //this.forecast = JsonObject.readFrom(reply); } catch (NullPointerException e) { System.err.println("Unable to connect to the API: "+e.getMessage()); return false; } return getForecast(this.forecast); }
java
public boolean getForecast(String LATITUDE, String LONGITUDE) { try { String reply = httpGET( urlBuilder(LATITUDE, LONGITUDE) ); if(reply == null) return false; this.forecast = Json.parse(reply).asObject(); //this.forecast = JsonObject.readFrom(reply); } catch (NullPointerException e) { System.err.println("Unable to connect to the API: "+e.getMessage()); return false; } return getForecast(this.forecast); }
[ "public", "boolean", "getForecast", "(", "String", "LATITUDE", ",", "String", "LONGITUDE", ")", "{", "try", "{", "String", "reply", "=", "httpGET", "(", "urlBuilder", "(", "LATITUDE", ",", "LONGITUDE", ")", ")", ";", "if", "(", "reply", "==", "null", ")"...
Gets the forecast reports for the given coordinates with the set options @param LATITUDE the geographical latitude @param LONGITUDE the geographical longitude @return True if successful
[ "Gets", "the", "forecast", "reports", "for", "the", "given", "coordinates", "with", "the", "set", "options" ]
63c0ff17446eb7eb4e9f8bef4e19272f14c74e85
https://github.com/dvdme/forecastio-lib-java/blob/63c0ff17446eb7eb4e9f8bef4e19272f14c74e85/src/com/github/dvdme/ForecastIOLib/ForecastIO.java#L555-L572
36,558
dvdme/forecastio-lib-java
src/com/github/dvdme/ForecastIOLib/ForecastIO.java
ForecastIO.getForecast
public boolean getForecast(String http_response) { this.forecast = Json.parse(http_response).asObject(); //this.forecast = JsonObject.readFrom(http_response); return getForecast(this.forecast); }
java
public boolean getForecast(String http_response) { this.forecast = Json.parse(http_response).asObject(); //this.forecast = JsonObject.readFrom(http_response); return getForecast(this.forecast); }
[ "public", "boolean", "getForecast", "(", "String", "http_response", ")", "{", "this", ".", "forecast", "=", "Json", ".", "parse", "(", "http_response", ")", ".", "asObject", "(", ")", ";", "//this.forecast = JsonObject.readFrom(http_response);", "return", "getForeca...
Parses the forecast reports for the given coordinates with the set options Useful to use with an external http library @param http_response String @return boolean
[ "Parses", "the", "forecast", "reports", "for", "the", "given", "coordinates", "with", "the", "set", "options", "Useful", "to", "use", "with", "an", "external", "http", "library" ]
63c0ff17446eb7eb4e9f8bef4e19272f14c74e85
https://github.com/dvdme/forecastio-lib-java/blob/63c0ff17446eb7eb4e9f8bef4e19272f14c74e85/src/com/github/dvdme/ForecastIOLib/ForecastIO.java#L590-L594
36,559
canoo/dolphin-platform
platform/dolphin-platform-remoting-client/src/main/java/com/canoo/dp/impl/client/legacy/communication/AbstractClientConnector.java
AbstractClientConnector.listen
protected void listen() { if (!connectedFlag.get() || releaseNeeded.get()) { return; } releaseNeeded.set(true); try { send(pushListener, new OnFinishedHandler() { @Override public void onFinished() { releaseNeeded.set(false); listen(); } }); } catch (Exception e) { LOG.error("Error in sending long poll", e); } }
java
protected void listen() { if (!connectedFlag.get() || releaseNeeded.get()) { return; } releaseNeeded.set(true); try { send(pushListener, new OnFinishedHandler() { @Override public void onFinished() { releaseNeeded.set(false); listen(); } }); } catch (Exception e) { LOG.error("Error in sending long poll", e); } }
[ "protected", "void", "listen", "(", ")", "{", "if", "(", "!", "connectedFlag", ".", "get", "(", ")", "||", "releaseNeeded", ".", "get", "(", ")", ")", "{", "return", ";", "}", "releaseNeeded", ".", "set", "(", "true", ")", ";", "try", "{", "send", ...
listens for the pushListener to return. The pushListener must be set and pushEnabled must be true.
[ "listens", "for", "the", "pushListener", "to", "return", ".", "The", "pushListener", "must", "be", "set", "and", "pushEnabled", "must", "be", "true", "." ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-client/src/main/java/com/canoo/dp/impl/client/legacy/communication/AbstractClientConnector.java#L205-L222
36,560
canoo/dolphin-platform
platform/dolphin-platform-remoting-client/src/main/java/com/canoo/dp/impl/client/legacy/communication/AbstractClientConnector.java
AbstractClientConnector.release
protected void release() { if (!releaseNeeded.get()) { return; // there is no point in releasing if we do not wait. Avoid excessive releasing. } releaseNeeded.set(false);// release is under way backgroundExecutor.execute(new Runnable() { @Override public void run() { try { List<Command> releaseCommandList = new ArrayList<Command>(Collections.singletonList(releaseCommand)); transmit(releaseCommandList); } catch (DolphinRemotingException e) { handleError(e); } } }); }
java
protected void release() { if (!releaseNeeded.get()) { return; // there is no point in releasing if we do not wait. Avoid excessive releasing. } releaseNeeded.set(false);// release is under way backgroundExecutor.execute(new Runnable() { @Override public void run() { try { List<Command> releaseCommandList = new ArrayList<Command>(Collections.singletonList(releaseCommand)); transmit(releaseCommandList); } catch (DolphinRemotingException e) { handleError(e); } } }); }
[ "protected", "void", "release", "(", ")", "{", "if", "(", "!", "releaseNeeded", ".", "get", "(", ")", ")", "{", "return", ";", "// there is no point in releasing if we do not wait. Avoid excessive releasing.", "}", "releaseNeeded", ".", "set", "(", "false", ")", "...
Release the current push listener, which blocks the sending queue. Does nothing in case that the push listener is not active.
[ "Release", "the", "current", "push", "listener", "which", "blocks", "the", "sending", "queue", ".", "Does", "nothing", "in", "case", "that", "the", "push", "listener", "is", "not", "active", "." ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-client/src/main/java/com/canoo/dp/impl/client/legacy/communication/AbstractClientConnector.java#L228-L245
36,561
canoo/dolphin-platform
platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerConnector.java
ServerConnector.receive
public List<Command> receive(final Command command) { Assert.requireNonNull(command, "command"); LOG.trace("Received command of type {}", command.getClass().getSimpleName()); List<Command> response = new LinkedList();// collecting parameter pattern if (!(command instanceof InterruptLongPollCommand)) {// signal commands must not update thread-confined state for (DolphinServerAction it : dolphinServerActions) { it.setDolphinResponse(response);// todo: can be deleted as soon as all action refer to the SMS } serverModelStore.setCurrentResponse(response); } List<CommandHandler> actions = registry.getActionsFor(command.getClass()); if (actions.isEmpty()) { LOG.warn("There is no server action registered for received command type {}, known commands types are {}", command.getClass().getSimpleName(), registry.getActions().keySet()); return response; } // copying the list of actions allows an Action to unregister itself // avoiding ConcurrentModificationException to be thrown by the loop List<CommandHandler> actionsCopy = new ArrayList<CommandHandler>(); actionsCopy.addAll(actions); try { for (CommandHandler action : actionsCopy) { action.handleCommand(command, response); } } catch (Exception exception) { throw exception; } return response; }
java
public List<Command> receive(final Command command) { Assert.requireNonNull(command, "command"); LOG.trace("Received command of type {}", command.getClass().getSimpleName()); List<Command> response = new LinkedList();// collecting parameter pattern if (!(command instanceof InterruptLongPollCommand)) {// signal commands must not update thread-confined state for (DolphinServerAction it : dolphinServerActions) { it.setDolphinResponse(response);// todo: can be deleted as soon as all action refer to the SMS } serverModelStore.setCurrentResponse(response); } List<CommandHandler> actions = registry.getActionsFor(command.getClass()); if (actions.isEmpty()) { LOG.warn("There is no server action registered for received command type {}, known commands types are {}", command.getClass().getSimpleName(), registry.getActions().keySet()); return response; } // copying the list of actions allows an Action to unregister itself // avoiding ConcurrentModificationException to be thrown by the loop List<CommandHandler> actionsCopy = new ArrayList<CommandHandler>(); actionsCopy.addAll(actions); try { for (CommandHandler action : actionsCopy) { action.handleCommand(command, response); } } catch (Exception exception) { throw exception; } return response; }
[ "public", "List", "<", "Command", ">", "receive", "(", "final", "Command", "command", ")", "{", "Assert", ".", "requireNonNull", "(", "command", ",", "\"command\"", ")", ";", "LOG", ".", "trace", "(", "\"Received command of type {}\"", ",", "command", ".", "...
doesn't fail on missing commands
[ "doesn", "t", "fail", "on", "missing", "commands" ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerConnector.java#L59-L94
36,562
canoo/dolphin-platform
platform-extras/dolphin-platform-projector-client/src/main/java/com/canoo/dp/impl/platform/projector/client/css/CssHelper.java
CssHelper.createMetaData
public static <S extends Styleable, V> DefaultPropertyBasedCssMetaData<S, V> createMetaData(String property, StyleConverter<?, V> converter, String propertyName, V defaultValue) { return new DefaultPropertyBasedCssMetaData<S, V>(property, converter, propertyName, defaultValue); }
java
public static <S extends Styleable, V> DefaultPropertyBasedCssMetaData<S, V> createMetaData(String property, StyleConverter<?, V> converter, String propertyName, V defaultValue) { return new DefaultPropertyBasedCssMetaData<S, V>(property, converter, propertyName, defaultValue); }
[ "public", "static", "<", "S", "extends", "Styleable", ",", "V", ">", "DefaultPropertyBasedCssMetaData", "<", "S", ",", "V", ">", "createMetaData", "(", "String", "property", ",", "StyleConverter", "<", "?", ",", "V", ">", "converter", ",", "String", "propert...
Creates a CssMetaData instance that can be used in a Styleable class. @param property name of the CSS property @param converter the StyleConverter used to convert the CSS parsed value to a Java object. @param propertyName Name of the property field in the Styleable class @param defaultValue The default value of the corresponding StyleableProperty @param <S> Type of the Styleable instance @param <V> Value type of the property @return the CssMetaData instance
[ "Creates", "a", "CssMetaData", "instance", "that", "can", "be", "used", "in", "a", "Styleable", "class", "." ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform-extras/dolphin-platform-projector-client/src/main/java/com/canoo/dp/impl/platform/projector/client/css/CssHelper.java#L102-L104
36,563
canoo/dolphin-platform
platform-extras/dolphin-platform-projector-client/src/main/java/com/canoo/dp/impl/platform/projector/client/css/CssHelper.java
CssHelper.createSkinMetaData
public static <S extends Control, V> SkinPropertyBasedCssMetaData<S, V> createSkinMetaData(String property, StyleConverter<?, V> converter, String propertyName, V defaultValue) { return new SkinPropertyBasedCssMetaData<S, V>(property, converter, propertyName, defaultValue); }
java
public static <S extends Control, V> SkinPropertyBasedCssMetaData<S, V> createSkinMetaData(String property, StyleConverter<?, V> converter, String propertyName, V defaultValue) { return new SkinPropertyBasedCssMetaData<S, V>(property, converter, propertyName, defaultValue); }
[ "public", "static", "<", "S", "extends", "Control", ",", "V", ">", "SkinPropertyBasedCssMetaData", "<", "S", ",", "V", ">", "createSkinMetaData", "(", "String", "property", ",", "StyleConverter", "<", "?", ",", "V", ">", "converter", ",", "String", "property...
Creates a CssMetaData instance that can be used in the Skin of a Control. @param property name of the CSS property @param converter the StyleConverter used to convert the CSS parsed value to a Java object. @param propertyName Name of the property field in the Skin class @param defaultValue The default value of the corresponding StyleableProperty @param <S> Type of the Control @param <V> Value type of the property @return the CssMetaData instance
[ "Creates", "a", "CssMetaData", "instance", "that", "can", "be", "used", "in", "the", "Skin", "of", "a", "Control", "." ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform-extras/dolphin-platform-projector-client/src/main/java/com/canoo/dp/impl/platform/projector/client/css/CssHelper.java#L117-L119
36,564
canoo/dolphin-platform
platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/mbean/DolphinContextMBeanRegistry.java
DolphinContextMBeanRegistry.registerDolphinContext
public Subscription registerDolphinContext(ClientSession session, GarbageCollector garbageCollector) { Assert.requireNonNull(session, "session"); Assert.requireNonNull(garbageCollector, "garbageCollector"); DolphinSessionInfoMBean mBean = new DolphinSessionInfo(session, garbageCollector); return MBeanRegistry.getInstance().register(mBean, new MBeanDescription("com.canoo.dolphin", "DolphinSession", "session")); }
java
public Subscription registerDolphinContext(ClientSession session, GarbageCollector garbageCollector) { Assert.requireNonNull(session, "session"); Assert.requireNonNull(garbageCollector, "garbageCollector"); DolphinSessionInfoMBean mBean = new DolphinSessionInfo(session, garbageCollector); return MBeanRegistry.getInstance().register(mBean, new MBeanDescription("com.canoo.dolphin", "DolphinSession", "session")); }
[ "public", "Subscription", "registerDolphinContext", "(", "ClientSession", "session", ",", "GarbageCollector", "garbageCollector", ")", "{", "Assert", ".", "requireNonNull", "(", "session", ",", "\"session\"", ")", ";", "Assert", ".", "requireNonNull", "(", "garbageCol...
Register a new dolphin session as a MBean @param session the session @return the subscription for deregistration
[ "Register", "a", "new", "dolphin", "session", "as", "a", "MBean" ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/mbean/DolphinContextMBeanRegistry.java#L48-L53
36,565
canoo/dolphin-platform
platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/mbean/DolphinContextMBeanRegistry.java
DolphinContextMBeanRegistry.registerController
public Subscription registerController(Class<?> controllerClass, String controllerId, ModelProvider modelProvider) { Assert.requireNonNull(controllerClass, "controllerClass"); Assert.requireNonBlank(controllerId, "controllerId"); Assert.requireNonNull(modelProvider, "modelProvider"); DolphinControllerInfoMBean mBean = new DolphinControllerInfo(dolphinContextId, controllerClass, controllerId, modelProvider); return MBeanRegistry.getInstance().register(mBean, new MBeanDescription("com.canoo.dolphin", controllerClass.getSimpleName(), "controller")); }
java
public Subscription registerController(Class<?> controllerClass, String controllerId, ModelProvider modelProvider) { Assert.requireNonNull(controllerClass, "controllerClass"); Assert.requireNonBlank(controllerId, "controllerId"); Assert.requireNonNull(modelProvider, "modelProvider"); DolphinControllerInfoMBean mBean = new DolphinControllerInfo(dolphinContextId, controllerClass, controllerId, modelProvider); return MBeanRegistry.getInstance().register(mBean, new MBeanDescription("com.canoo.dolphin", controllerClass.getSimpleName(), "controller")); }
[ "public", "Subscription", "registerController", "(", "Class", "<", "?", ">", "controllerClass", ",", "String", "controllerId", ",", "ModelProvider", "modelProvider", ")", "{", "Assert", ".", "requireNonNull", "(", "controllerClass", ",", "\"controllerClass\"", ")", ...
Register a new Dolphin Platform controller as a MBean @param controllerClass the controller class @param controllerId the controller id @param modelProvider the model provider @return the subscription for deregistration
[ "Register", "a", "new", "Dolphin", "Platform", "controller", "as", "a", "MBean" ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/mbean/DolphinContextMBeanRegistry.java#L62-L68
36,566
canoo/dolphin-platform
platform/dolphin-platform-remoting-client-javafx/src/main/java/com/canoo/platform/remoting/client/javafx/DolphinPlatformApplication.java
DolphinPlatformApplication.init
@Override public final void init() throws Exception { FxToolkit.init(); applicationInit(); PlatformClient.getClientConfiguration().setUncaughtExceptionHandler((Thread thread, Throwable exception) -> { PlatformClient.getClientConfiguration().getUiExecutor().execute(() -> { Assert.requireNonNull(thread, "thread"); Assert.requireNonNull(exception, "exception"); if (connectInProgress.get()) { runtimeExceptionsAtInitialization.add(new DolphinRuntimeException(thread, "Unhandled error in Dolphin Platform background thread", exception)); } else { onRuntimeError(primaryStage, new DolphinRuntimeException(thread, "Unhandled error in Dolphin Platform background thread", exception)); } }); }); try { clientContext = createClientContext(); Assert.requireNonNull(clientContext, "clientContext"); connectInProgress.set(true); clientContext.connect().get(30_000, TimeUnit.MILLISECONDS); } catch (ClientInitializationException e) { initializationException = e; } catch (Exception e) { initializationException = new ClientInitializationException("Can not initialize Dolphin Platform Context", e); } finally { connectInProgress.set(false); } }
java
@Override public final void init() throws Exception { FxToolkit.init(); applicationInit(); PlatformClient.getClientConfiguration().setUncaughtExceptionHandler((Thread thread, Throwable exception) -> { PlatformClient.getClientConfiguration().getUiExecutor().execute(() -> { Assert.requireNonNull(thread, "thread"); Assert.requireNonNull(exception, "exception"); if (connectInProgress.get()) { runtimeExceptionsAtInitialization.add(new DolphinRuntimeException(thread, "Unhandled error in Dolphin Platform background thread", exception)); } else { onRuntimeError(primaryStage, new DolphinRuntimeException(thread, "Unhandled error in Dolphin Platform background thread", exception)); } }); }); try { clientContext = createClientContext(); Assert.requireNonNull(clientContext, "clientContext"); connectInProgress.set(true); clientContext.connect().get(30_000, TimeUnit.MILLISECONDS); } catch (ClientInitializationException e) { initializationException = e; } catch (Exception e) { initializationException = new ClientInitializationException("Can not initialize Dolphin Platform Context", e); } finally { connectInProgress.set(false); } }
[ "@", "Override", "public", "final", "void", "init", "(", ")", "throws", "Exception", "{", "FxToolkit", ".", "init", "(", ")", ";", "applicationInit", "(", ")", ";", "PlatformClient", ".", "getClientConfiguration", "(", ")", ".", "setUncaughtExceptionHandler", ...
Creates the connection to the Dolphin Platform server. If this method will be overridden always call the super method. @throws Exception a exception if the connection can't be created
[ "Creates", "the", "connection", "to", "the", "Dolphin", "Platform", "server", ".", "If", "this", "method", "will", "be", "overridden", "always", "call", "the", "super", "method", "." ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-client-javafx/src/main/java/com/canoo/platform/remoting/client/javafx/DolphinPlatformApplication.java#L100-L132
36,567
canoo/dolphin-platform
platform/dolphin-platform-remoting-client-javafx/src/main/java/com/canoo/platform/remoting/client/javafx/DolphinPlatformApplication.java
DolphinPlatformApplication.onRuntimeError
protected void onRuntimeError(final Stage primaryStage, final DolphinRuntimeException runtimeException) { Assert.requireNonNull(runtimeException, "runtimeException"); LOG.error("Dolphin Platform runtime error in thread " + runtimeException.getThread().getName(), runtimeException); Platform.exit(); }
java
protected void onRuntimeError(final Stage primaryStage, final DolphinRuntimeException runtimeException) { Assert.requireNonNull(runtimeException, "runtimeException"); LOG.error("Dolphin Platform runtime error in thread " + runtimeException.getThread().getName(), runtimeException); Platform.exit(); }
[ "protected", "void", "onRuntimeError", "(", "final", "Stage", "primaryStage", ",", "final", "DolphinRuntimeException", "runtimeException", ")", "{", "Assert", ".", "requireNonNull", "(", "runtimeException", ",", "\"runtimeException\"", ")", ";", "LOG", ".", "error", ...
This method is called if the connection to the Dolphin Platform server throws an exception at runtime. This can for example happen if the server is shut down while the client is still running or if the server responses with an error code. @param primaryStage the primary stage @param runtimeException the exception
[ "This", "method", "is", "called", "if", "the", "connection", "to", "the", "Dolphin", "Platform", "server", "throws", "an", "exception", "at", "runtime", ".", "This", "can", "for", "example", "happen", "if", "the", "server", "is", "shut", "down", "while", "...
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-client-javafx/src/main/java/com/canoo/platform/remoting/client/javafx/DolphinPlatformApplication.java#L255-L259
36,568
canoo/dolphin-platform
platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/gc/Instance.java
Instance.isReferencedByRoot
public boolean isReferencedByRoot() { if(rootBean) { return true; } for(Reference reference : references) { Instance parent = reference.getParent(); if(parent.isReferencedByRoot()) { return true; } } return false; }
java
public boolean isReferencedByRoot() { if(rootBean) { return true; } for(Reference reference : references) { Instance parent = reference.getParent(); if(parent.isReferencedByRoot()) { return true; } } return false; }
[ "public", "boolean", "isReferencedByRoot", "(", ")", "{", "if", "(", "rootBean", ")", "{", "return", "true", ";", "}", "for", "(", "Reference", "reference", ":", "references", ")", "{", "Instance", "parent", "=", "reference", ".", "getParent", "(", ")", ...
Return true if the dolphin bean instance is a root bean or is referenced by a root bean @return true if the dolphin bean instance is a root bean or is referenced by a root bean
[ "Return", "true", "if", "the", "dolphin", "bean", "instance", "is", "a", "root", "bean", "or", "is", "referenced", "by", "a", "root", "bean" ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/gc/Instance.java#L105-L116
36,569
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/SwitchBindings.java
SwitchBindings.switchBinding
public static <T, R> SwitchBuilder<T, R> switchBinding(ObservableValue<T> observable, Class<R> bindingType) { return new SwitchBuilder<>(observable); }
java
public static <T, R> SwitchBuilder<T, R> switchBinding(ObservableValue<T> observable, Class<R> bindingType) { return new SwitchBuilder<>(observable); }
[ "public", "static", "<", "T", ",", "R", ">", "SwitchBuilder", "<", "T", ",", "R", ">", "switchBinding", "(", "ObservableValue", "<", "T", ">", "observable", ",", "Class", "<", "R", ">", "bindingType", ")", "{", "return", "new", "SwitchBuilder", "<>", "...
Creates builder for a binding that works like a switch-case in java. Example: ```java IntegerProperty base = new SimpleIntegerProperty(); ObservableValue<String> result = switchBinding(base, String.class) .bindCase(3, i -> "three") .bindCase(10, i -> "ten") .bindCase(1, i -> "one") .bindDefault(() -> "nothing") .build(); ``` this is the equivalent without observables: ```java int base = ...; switch(base) { case 3 : return "three"; case 10: return "ten"; case 1: return "one"; default: return "nothing"; } ``` There are two differences between this switch binding and the switch statement in java: 1. In the java switch statement only a limited number of types can be used. This binding has no such limitation. You can use every type in the observable that has a properly overwritten {@link Object#equals(Object)} and {@link Object#hashCode()} method. 2. There is no "fall through" and therefore no "break" is needed. Only the callback for the matching case is executed. See [the switch documentation](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html) for more information. @param observable the base observable that is used in the switch statement @param bindingType the type of the created observable. @param <T> the generic type of the base observable. @param <R> the generic type of the returned observable. @return a builder that is used to create the switch binding.
[ "Creates", "builder", "for", "a", "binding", "that", "works", "like", "a", "switch", "-", "case", "in", "java", "." ]
054a5dde261c29f862b971765fa3da3704a13ab4
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/SwitchBindings.java#L154-L156
36,570
canoo/dolphin-platform
platform/dolphin-platform-remoting-client-javafx/src/main/java/com/canoo/platform/remoting/client/javafx/view/AbstractViewController.java
AbstractViewController.destroy
public CompletableFuture<Void> destroy() { CompletableFuture<Void> ret; if (controllerProxy != null) { ret = controllerProxy.destroy(); controllerProxy = null; } else { ret = new CompletableFuture<>(); ret.complete(null); } return ret; }
java
public CompletableFuture<Void> destroy() { CompletableFuture<Void> ret; if (controllerProxy != null) { ret = controllerProxy.destroy(); controllerProxy = null; } else { ret = new CompletableFuture<>(); ret.complete(null); } return ret; }
[ "public", "CompletableFuture", "<", "Void", ">", "destroy", "(", ")", "{", "CompletableFuture", "<", "Void", ">", "ret", ";", "if", "(", "controllerProxy", "!=", "null", ")", "{", "ret", "=", "controllerProxy", ".", "destroy", "(", ")", ";", "controllerPro...
By calling this method the MVC group will be destroyed. This means that the controller instance on the server will be removed and the model that is managed and synchronized between client and server will be detached. After this method is called the view should not be used anymore. It's important to call this method to removePresentationModel all the unneeded references on the server. @return a future can be used to react on the destroy
[ "By", "calling", "this", "method", "the", "MVC", "group", "will", "be", "destroyed", ".", "This", "means", "that", "the", "controller", "instance", "on", "the", "server", "will", "be", "removed", "and", "the", "model", "that", "is", "managed", "and", "sync...
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-client-javafx/src/main/java/com/canoo/platform/remoting/client/javafx/view/AbstractViewController.java#L92-L102
36,571
canoo/dolphin-platform
platform/dolphin-platform-remoting-client-javafx/src/main/java/com/canoo/platform/remoting/client/javafx/view/AbstractViewController.java
AbstractViewController.invoke
protected CompletableFuture<Void> invoke(String actionName, Param... params) { Assert.requireNonBlank(actionName, "actionName"); actionInProcess.set(true); return controllerProxy.invoke(actionName, params).whenComplete((v, e) -> { try { if (e != null) { onInvocationException(e); } } finally { actionInProcess.set(false); } }); }
java
protected CompletableFuture<Void> invoke(String actionName, Param... params) { Assert.requireNonBlank(actionName, "actionName"); actionInProcess.set(true); return controllerProxy.invoke(actionName, params).whenComplete((v, e) -> { try { if (e != null) { onInvocationException(e); } } finally { actionInProcess.set(false); } }); }
[ "protected", "CompletableFuture", "<", "Void", ">", "invoke", "(", "String", "actionName", ",", "Param", "...", "params", ")", "{", "Assert", ".", "requireNonBlank", "(", "actionName", ",", "\"actionName\"", ")", ";", "actionInProcess", ".", "set", "(", "true"...
This invokes a action on the server side controller. For more information how an action can be defined in the controller have a look at the RemotingAction annotation in the server module. This method don't block and can be called from the Platform thread. To check if an server @param actionName name of the action @param params any parameters that should be passed to the action @return a future can be used to check if the action invocation is still running
[ "This", "invokes", "a", "action", "on", "the", "server", "side", "controller", ".", "For", "more", "information", "how", "an", "action", "can", "be", "defined", "in", "the", "controller", "have", "a", "look", "at", "the", "RemotingAction", "annotation", "in"...
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-client-javafx/src/main/java/com/canoo/platform/remoting/client/javafx/view/AbstractViewController.java#L113-L125
36,572
canoo/dolphin-platform
platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerAttribute.java
ServerAttribute.silently
public void silently(final Runnable applyChange) { boolean temp = notifyClient; notifyClient = false; try { applyChange.run(); } finally { notifyClient = temp; } }
java
public void silently(final Runnable applyChange) { boolean temp = notifyClient; notifyClient = false; try { applyChange.run(); } finally { notifyClient = temp; } }
[ "public", "void", "silently", "(", "final", "Runnable", "applyChange", ")", "{", "boolean", "temp", "=", "notifyClient", ";", "notifyClient", "=", "false", ";", "try", "{", "applyChange", ".", "run", "(", ")", ";", "}", "finally", "{", "notifyClient", "=",...
Do the applyChange without creating commands that are sent to the client
[ "Do", "the", "applyChange", "without", "creating", "commands", "that", "are", "sent", "to", "the", "client" ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerAttribute.java#L95-L103
36,573
canoo/dolphin-platform
platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerAttribute.java
ServerAttribute.verbosely
protected void verbosely(final Runnable applyChange) { boolean temp = notifyClient; notifyClient = true; try { applyChange.run(); } finally { notifyClient = temp; } }
java
protected void verbosely(final Runnable applyChange) { boolean temp = notifyClient; notifyClient = true; try { applyChange.run(); } finally { notifyClient = temp; } }
[ "protected", "void", "verbosely", "(", "final", "Runnable", "applyChange", ")", "{", "boolean", "temp", "=", "notifyClient", ";", "notifyClient", "=", "true", ";", "try", "{", "applyChange", ".", "run", "(", ")", ";", "}", "finally", "{", "notifyClient", "...
Do the applyChange with enforced creation of commands that are sent to the client
[ "Do", "the", "applyChange", "with", "enforced", "creation", "of", "commands", "that", "are", "sent", "to", "the", "client" ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerAttribute.java#L108-L116
36,574
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/LogicBindings.java
LogicBindings.and
@SafeVarargs public static BooleanBinding and(ObservableValue<Boolean>...values) { return Bindings.createBooleanBinding( ()-> !Arrays.stream(values) .filter(observable -> !observable.getValue()) .findAny() .isPresent(), values); }
java
@SafeVarargs public static BooleanBinding and(ObservableValue<Boolean>...values) { return Bindings.createBooleanBinding( ()-> !Arrays.stream(values) .filter(observable -> !observable.getValue()) .findAny() .isPresent(), values); }
[ "@", "SafeVarargs", "public", "static", "BooleanBinding", "and", "(", "ObservableValue", "<", "Boolean", ">", "...", "values", ")", "{", "return", "Bindings", ".", "createBooleanBinding", "(", "(", ")", "->", "!", "Arrays", ".", "stream", "(", "values", ")",...
A boolean binding that is `true` only when all dependent observable boolean values are `true`. This can be useful in cases where the {@link Bindings#and(javafx.beans.value.ObservableBooleanValue, javafx.beans.value.ObservableBooleanValue)} with 2 arguments isn't enough. @param values variable number of observable boolean values that are used for the binding @return the boolean binding
[ "A", "boolean", "binding", "that", "is", "true", "only", "when", "all", "dependent", "observable", "boolean", "values", "are", "true", "." ]
054a5dde261c29f862b971765fa3da3704a13ab4
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/LogicBindings.java#L44-L51
36,575
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/CollectionBindings.java
CollectionBindings.sum
public static NumberBinding sum(final ObservableList<? extends Number> numbers) { return Bindings.createDoubleBinding(() -> numbers.stream().mapToDouble(Number::doubleValue).sum(), numbers); }
java
public static NumberBinding sum(final ObservableList<? extends Number> numbers) { return Bindings.createDoubleBinding(() -> numbers.stream().mapToDouble(Number::doubleValue).sum(), numbers); }
[ "public", "static", "NumberBinding", "sum", "(", "final", "ObservableList", "<", "?", "extends", "Number", ">", "numbers", ")", "{", "return", "Bindings", ".", "createDoubleBinding", "(", "(", ")", "->", "numbers", ".", "stream", "(", ")", ".", "mapToDouble"...
Creates a number binding that contains the sum of the numbers of the given observable list of numbers. @param numbers the observable list of numbers. @return a number binding.
[ "Creates", "a", "number", "binding", "that", "contains", "the", "sum", "of", "the", "numbers", "of", "the", "given", "observable", "list", "of", "numbers", "." ]
054a5dde261c29f862b971765fa3da3704a13ab4
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/CollectionBindings.java#L124-L126
36,576
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/CollectionBindings.java
CollectionBindings.join
public static StringBinding join(final ObservableList<?> items, final ObservableValue<String> delimiter) { return Bindings.createStringBinding(() -> items.stream().map(String::valueOf).collect(Collectors.joining(delimiter.getValue())), items, delimiter); }
java
public static StringBinding join(final ObservableList<?> items, final ObservableValue<String> delimiter) { return Bindings.createStringBinding(() -> items.stream().map(String::valueOf).collect(Collectors.joining(delimiter.getValue())), items, delimiter); }
[ "public", "static", "StringBinding", "join", "(", "final", "ObservableList", "<", "?", ">", "items", ",", "final", "ObservableValue", "<", "String", ">", "delimiter", ")", "{", "return", "Bindings", ".", "createStringBinding", "(", "(", ")", "->", "items", "...
Creates a string binding that constructs a sequence of characters separated by a delimiter. @param items the observable list of items. @param delimiter the sequence of characters to be used between each element. @return a string binding.
[ "Creates", "a", "string", "binding", "that", "constructs", "a", "sequence", "of", "characters", "separated", "by", "a", "delimiter", "." ]
054a5dde261c29f862b971765fa3da3704a13ab4
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/CollectionBindings.java#L136-L138
36,577
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/CollectionBindings.java
CollectionBindings.concat
@SafeVarargs public static <T> ObservableList<T> concat(ObservableList<T>... lists) { ObservableList<T> result = FXCollections.observableArrayList(); // todo: think about a smarter solution for (ObservableList<T> list : lists) { list.addListener((Observable observable) -> { result.clear(); for (ObservableList<T> ts : lists) { result.addAll(ts); } }); } return result; }
java
@SafeVarargs public static <T> ObservableList<T> concat(ObservableList<T>... lists) { ObservableList<T> result = FXCollections.observableArrayList(); // todo: think about a smarter solution for (ObservableList<T> list : lists) { list.addListener((Observable observable) -> { result.clear(); for (ObservableList<T> ts : lists) { result.addAll(ts); } }); } return result; }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "ObservableList", "<", "T", ">", "concat", "(", "ObservableList", "<", "T", ">", "...", "lists", ")", "{", "ObservableList", "<", "T", ">", "result", "=", "FXCollections", ".", "observableArrayList", "...
Creates an observable list that represents the concatenated source lists. All elements from the all source lists will be contained in the new list. If there is a change in any of the source lists this change will also be done in the concatenated list. The order of elements will be maintained. All elements of the first source list will be located before all elements of the second list and so on. So if an element is added to the first list, this element will be located between the old elements of the first list and the second list's elements. **Hint:** *At the moment this observable list is implemented with {@link javafx.beans.InvalidationListener}s on the source lists and by clearing and recreating the concatenated list on every change. This should be kept in mind when using a {@link javafx.collections.ListChangeListener} on the concatenated list as it will react multiple times when a change is done to one of the source lists. This behaviour will likely be changed in the future as it means a performance limitation too. @param lists a var-args array of observable lists. @param <T> the generic type of the lists. @return a new observable list representing the concatenation of the source lists.
[ "Creates", "an", "observable", "list", "that", "represents", "the", "concatenated", "source", "lists", ".", "All", "elements", "from", "the", "all", "source", "lists", "will", "be", "contained", "in", "the", "new", "list", ".", "If", "there", "is", "a", "c...
054a5dde261c29f862b971765fa3da3704a13ab4
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/CollectionBindings.java#L216-L232
36,578
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/StringBindings.java
StringBindings.matches
public static BooleanBinding matches(final ObservableValue<String> text, final String pattern) { return Bindings.createBooleanBinding(() -> { final String textToVerify = text.getValue(); return textToVerify != null && textToVerify.matches(pattern); }, text); }
java
public static BooleanBinding matches(final ObservableValue<String> text, final String pattern) { return Bindings.createBooleanBinding(() -> { final String textToVerify = text.getValue(); return textToVerify != null && textToVerify.matches(pattern); }, text); }
[ "public", "static", "BooleanBinding", "matches", "(", "final", "ObservableValue", "<", "String", ">", "text", ",", "final", "String", "pattern", ")", "{", "return", "Bindings", ".", "createBooleanBinding", "(", "(", ")", "->", "{", "final", "String", "textToVe...
Creates a boolean binding that is `true` when the given observable string matches the given RegExp pattern. @param text the observable string that is verified. @param pattern the RegExp pattern that is used. @return a boolean binding instance.
[ "Creates", "a", "boolean", "binding", "that", "is", "true", "when", "the", "given", "observable", "string", "matches", "the", "given", "RegExp", "pattern", "." ]
054a5dde261c29f862b971765fa3da3704a13ab4
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/StringBindings.java#L50-L55
36,579
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/StringBindings.java
StringBindings.transforming
public static StringBinding transforming(ObservableValue<String> text, Function<String, String> transformer) { return Bindings.createStringBinding(() -> { Function<String, String> func = transformer == null ? Function.identity() : transformer; return text.getValue() == null ? "" : func.apply(text.getValue()); }, text); }
java
public static StringBinding transforming(ObservableValue<String> text, Function<String, String> transformer) { return Bindings.createStringBinding(() -> { Function<String, String> func = transformer == null ? Function.identity() : transformer; return text.getValue() == null ? "" : func.apply(text.getValue()); }, text); }
[ "public", "static", "StringBinding", "transforming", "(", "ObservableValue", "<", "String", ">", "text", ",", "Function", "<", "String", ",", "String", ">", "transformer", ")", "{", "return", "Bindings", ".", "createStringBinding", "(", "(", ")", "->", "{", ...
Creates a string binding that contains the value of the given observable string transformed using the supplied function. If the given observable string has a value of `null` the created binding will contain an empty string. If the given function has a value of `null` {@link Function#identity()} will be used instead. @param text the source string that will used for the conversion. @param transformer a non-interfering, stateless function to apply to the source string. @return a binding containing the transformed string.
[ "Creates", "a", "string", "binding", "that", "contains", "the", "value", "of", "the", "given", "observable", "string", "transformed", "using", "the", "supplied", "function", "." ]
054a5dde261c29f862b971765fa3da3704a13ab4
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/StringBindings.java#L220-L226
36,580
canoo/dolphin-platform
platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerModelStore.java
ServerModelStore.remove
public boolean remove(final ServerPresentationModel pm) { boolean deleted = super.remove(pm); if (!deleted) { throw new IllegalStateException("Model " + pm + " not found on the server!"); } deleteCommand(getCurrentResponse(), pm.getId()); return deleted; }
java
public boolean remove(final ServerPresentationModel pm) { boolean deleted = super.remove(pm); if (!deleted) { throw new IllegalStateException("Model " + pm + " not found on the server!"); } deleteCommand(getCurrentResponse(), pm.getId()); return deleted; }
[ "public", "boolean", "remove", "(", "final", "ServerPresentationModel", "pm", ")", "{", "boolean", "deleted", "=", "super", ".", "remove", "(", "pm", ")", ";", "if", "(", "!", "deleted", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Model \"", ...
Convenience method to let Dolphin removePresentationModel a presentation model directly on the server and notify the client.
[ "Convenience", "method", "to", "let", "Dolphin", "removePresentationModel", "a", "presentation", "model", "directly", "on", "the", "server", "and", "notify", "the", "client", "." ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerModelStore.java#L122-L129
36,581
canoo/dolphin-platform
platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerModelStore.java
ServerModelStore.deleteCommand
@Deprecated public static void deleteCommand(final List<Command> response, final String pmId) { if (response == null || Assert.isBlank(pmId)) { return; } response.add(new DeletePresentationModelCommand(pmId)); }
java
@Deprecated public static void deleteCommand(final List<Command> response, final String pmId) { if (response == null || Assert.isBlank(pmId)) { return; } response.add(new DeletePresentationModelCommand(pmId)); }
[ "@", "Deprecated", "public", "static", "void", "deleteCommand", "(", "final", "List", "<", "Command", ">", "response", ",", "final", "String", "pmId", ")", "{", "if", "(", "response", "==", "null", "||", "Assert", ".", "isBlank", "(", "pmId", ")", ")", ...
Convenience method to let Dolphin delete a presentation model on the client side
[ "Convenience", "method", "to", "let", "Dolphin", "delete", "a", "presentation", "model", "on", "the", "client", "side" ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerModelStore.java#L144-L150
36,582
canoo/dolphin-platform
platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerModelStore.java
ServerModelStore.changeValueCommand
@Deprecated public static void changeValueCommand(final List<Command> response, final ServerAttribute attribute, final Object value) { if (response == null) { return; } if (attribute == null) { LOG.error("Cannot change value on a null attribute to '{}'", value); return; } forceChangeValue(value, response, attribute); }
java
@Deprecated public static void changeValueCommand(final List<Command> response, final ServerAttribute attribute, final Object value) { if (response == null) { return; } if (attribute == null) { LOG.error("Cannot change value on a null attribute to '{}'", value); return; } forceChangeValue(value, response, attribute); }
[ "@", "Deprecated", "public", "static", "void", "changeValueCommand", "(", "final", "List", "<", "Command", ">", "response", ",", "final", "ServerAttribute", "attribute", ",", "final", "Object", "value", ")", "{", "if", "(", "response", "==", "null", ")", "{"...
Convenience method to change an attribute value on the server side. @param response must not be null or the method silently ignores the call @param attribute must not be null
[ "Convenience", "method", "to", "change", "an", "attribute", "value", "on", "the", "server", "side", "." ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerModelStore.java#L158-L168
36,583
canoo/dolphin-platform
platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerModelStore.java
ServerModelStore.presentationModel
public ServerPresentationModel presentationModel(final String id, final String presentationModelType, final DTO dto) { List<ServerAttribute> attributes = new ArrayList<ServerAttribute>(); for (final Slot slot : dto.getSlots()) { final ServerAttribute result = new ServerAttribute(slot.getPropertyName(), slot.getValue(), slot.getQualifier()); result.silently(new Runnable() { @Override public void run() { result.setValue(slot.getValue()); } }); attributes.add(result); } ServerPresentationModel model = new ServerPresentationModel(id, attributes, this); model.setPresentationModelType(presentationModelType); add(model); return model; }
java
public ServerPresentationModel presentationModel(final String id, final String presentationModelType, final DTO dto) { List<ServerAttribute> attributes = new ArrayList<ServerAttribute>(); for (final Slot slot : dto.getSlots()) { final ServerAttribute result = new ServerAttribute(slot.getPropertyName(), slot.getValue(), slot.getQualifier()); result.silently(new Runnable() { @Override public void run() { result.setValue(slot.getValue()); } }); attributes.add(result); } ServerPresentationModel model = new ServerPresentationModel(id, attributes, this); model.setPresentationModelType(presentationModelType); add(model); return model; }
[ "public", "ServerPresentationModel", "presentationModel", "(", "final", "String", "id", ",", "final", "String", "presentationModelType", ",", "final", "DTO", "dto", ")", "{", "List", "<", "ServerAttribute", ">", "attributes", "=", "new", "ArrayList", "<", "ServerA...
Create a presentation model on the server side, add it to the model store, and withContent a command to the client, advising him to do the same. @throws IllegalArgumentException if a presentation model for this id already exists. No commands are sent in this case.
[ "Create", "a", "presentation", "model", "on", "the", "server", "side", "add", "it", "to", "the", "model", "store", "and", "withContent", "a", "command", "to", "the", "client", "advising", "him", "to", "do", "the", "same", "." ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerModelStore.java#L205-L222
36,584
canoo/dolphin-platform
platform/dolphin-platform-server/src/main/java/com/canoo/dp/impl/server/mbean/MBeanRegistry.java
MBeanRegistry.register
public Subscription register(final Object mBean, final MBeanDescription description) { Assert.requireNonNull(description, "description"); return register(mBean, description.getMBeanName(getNextId())); }
java
public Subscription register(final Object mBean, final MBeanDescription description) { Assert.requireNonNull(description, "description"); return register(mBean, description.getMBeanName(getNextId())); }
[ "public", "Subscription", "register", "(", "final", "Object", "mBean", ",", "final", "MBeanDescription", "description", ")", "{", "Assert", ".", "requireNonNull", "(", "description", ",", "\"description\"", ")", ";", "return", "register", "(", "mBean", ",", "des...
Register the given MBean based on the given description @param mBean the bean @param description the description @return the subscription that can be used to unregister the bean
[ "Register", "the", "given", "MBean", "based", "on", "the", "given", "description" ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-server/src/main/java/com/canoo/dp/impl/server/mbean/MBeanRegistry.java#L55-L58
36,585
canoo/dolphin-platform
platform/dolphin-platform-server/src/main/java/com/canoo/dp/impl/server/mbean/MBeanRegistry.java
MBeanRegistry.register
public Subscription register(final Object mBean, final String name){ try { if (mbeanSupport.get()) { final ObjectName objectName = new ObjectName(name); server.registerMBean(mBean, objectName); return new Subscription() { @Override public void unsubscribe() { try { server.unregisterMBean(objectName); } catch (JMException e) { throw new RuntimeException("Can not unsubscribe!", e); } } }; } else { return new Subscription() { @Override public void unsubscribe() { } }; } } catch (Exception e) { throw new RuntimeException("Can not register MBean!", e); } }
java
public Subscription register(final Object mBean, final String name){ try { if (mbeanSupport.get()) { final ObjectName objectName = new ObjectName(name); server.registerMBean(mBean, objectName); return new Subscription() { @Override public void unsubscribe() { try { server.unregisterMBean(objectName); } catch (JMException e) { throw new RuntimeException("Can not unsubscribe!", e); } } }; } else { return new Subscription() { @Override public void unsubscribe() { } }; } } catch (Exception e) { throw new RuntimeException("Can not register MBean!", e); } }
[ "public", "Subscription", "register", "(", "final", "Object", "mBean", ",", "final", "String", "name", ")", "{", "try", "{", "if", "(", "mbeanSupport", ".", "get", "(", ")", ")", "{", "final", "ObjectName", "objectName", "=", "new", "ObjectName", "(", "n...
Register the given MBean based on the given name @param mBean the bean @param name the name @return the subscription that can be used to unregister the bean
[ "Register", "the", "given", "MBean", "based", "on", "the", "given", "name" ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-server/src/main/java/com/canoo/dp/impl/server/mbean/MBeanRegistry.java#L66-L91
36,586
canoo/dolphin-platform
platform/dolphin-platform-remoting-client/src/main/java/com/canoo/dp/impl/client/legacy/ClientDolphin.java
ClientDolphin.sync
@Deprecated public void sync(final Runnable runnable) { clientConnector.send(new EmptyCommand(), new OnFinishedHandler() { public void onFinished() { runnable.run(); } }); }
java
@Deprecated public void sync(final Runnable runnable) { clientConnector.send(new EmptyCommand(), new OnFinishedHandler() { public void onFinished() { runnable.run(); } }); }
[ "@", "Deprecated", "public", "void", "sync", "(", "final", "Runnable", "runnable", ")", "{", "clientConnector", ".", "send", "(", "new", "EmptyCommand", "(", ")", ",", "new", "OnFinishedHandler", "(", ")", "{", "public", "void", "onFinished", "(", ")", "{"...
both java- and groovy-friendly convenience method to withContent an empty command, which will have no presentation models nor data in the callback
[ "both", "java", "-", "and", "groovy", "-", "friendly", "convenience", "method", "to", "withContent", "an", "empty", "command", "which", "will", "have", "no", "presentation", "models", "nor", "data", "in", "the", "callback" ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-client/src/main/java/com/canoo/dp/impl/client/legacy/ClientDolphin.java#L53-L61
36,587
canoo/dolphin-platform
platform/dolphin-platform-server/src/main/java/com/canoo/dp/impl/server/scanner/DefaultClasspathScanner.java
DefaultClasspathScanner.getTypesAnnotatedWith
public synchronized Set<Class<?>> getTypesAnnotatedWith(final Class<? extends Annotation> annotation) { Assert.requireNonNull(annotation, "annotation"); return reflections.getTypesAnnotatedWith(annotation); }
java
public synchronized Set<Class<?>> getTypesAnnotatedWith(final Class<? extends Annotation> annotation) { Assert.requireNonNull(annotation, "annotation"); return reflections.getTypesAnnotatedWith(annotation); }
[ "public", "synchronized", "Set", "<", "Class", "<", "?", ">", ">", "getTypesAnnotatedWith", "(", "final", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ")", "{", "Assert", ".", "requireNonNull", "(", "annotation", ",", "\"annotation\"", ")", ...
Returns a set that contains all classes in the classpath that are annotated with the given annotation @param annotation the annotation @return the set of annotated classes
[ "Returns", "a", "set", "that", "contains", "all", "classes", "in", "the", "classpath", "that", "are", "annotated", "with", "the", "given", "annotation" ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-server/src/main/java/com/canoo/dp/impl/server/scanner/DefaultClasspathScanner.java#L100-L103
36,588
canoo/dolphin-platform
platform-extras/dolphin-platform-bean-validation/src/main/java/com/canoo/dp/impl/validation/PatternPropertyValidator.java
PatternPropertyValidator.combineFlags
private int combineFlags(final Pattern.Flag[] flags) { int combined = 0; for (Pattern.Flag f : flags) { combined |= f.getValue(); } return combined; }
java
private int combineFlags(final Pattern.Flag[] flags) { int combined = 0; for (Pattern.Flag f : flags) { combined |= f.getValue(); } return combined; }
[ "private", "int", "combineFlags", "(", "final", "Pattern", ".", "Flag", "[", "]", "flags", ")", "{", "int", "combined", "=", "0", ";", "for", "(", "Pattern", ".", "Flag", "f", ":", "flags", ")", "{", "combined", "|=", "f", ".", "getValue", "(", ")"...
Combines a given set of javax.validation.constraints.Pattern.Flag instances into one bitmask suitable for java.util.regex.Pattern consumption. @param flags - list of javax.validation.constraints.Pattern.Flag instances to combine @return combined bitmask for regex flags
[ "Combines", "a", "given", "set", "of", "javax", ".", "validation", ".", "constraints", ".", "Pattern", ".", "Flag", "instances", "into", "one", "bitmask", "suitable", "for", "java", ".", "util", ".", "regex", ".", "Pattern", "consumption", "." ]
fb99c1fab24df80d2fa094d8688b546140146874
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform-extras/dolphin-platform-bean-validation/src/main/java/com/canoo/dp/impl/validation/PatternPropertyValidator.java#L57-L63
36,589
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/ObjectBindings.java
ObjectBindings.map
public static <S, R> ObjectBinding<R> map(ObservableValue<S> source, Function<? super S, ? extends R> function) { return map(source, function, null); }
java
public static <S, R> ObjectBinding<R> map(ObservableValue<S> source, Function<? super S, ? extends R> function) { return map(source, function, null); }
[ "public", "static", "<", "S", ",", "R", ">", "ObjectBinding", "<", "R", ">", "map", "(", "ObservableValue", "<", "S", ">", "source", ",", "Function", "<", "?", "super", "S", ",", "?", "extends", "R", ">", "function", ")", "{", "return", "map", "(",...
A Binding that holds a value that is determined by the given function applied to the value of the observable source. This binding is null safe: When the given observable has a value of `null` the created binding will also contain `null` but will **not** throw a {@link java.lang.NullPointerException}. (Hint: if you like to specify another default value look at {@link #map(javafx.beans.value.ObservableValue, java.util.function.Function, Object)}). If the given observable's value is **not** `null` the function will be applied to the value and the return value of the function is used as the value of the created binding. A common use case for this binding is when you are interested in a property of the object of an observable value. See the following example: ```java class Person { private String name; ... public String getName(){ return name; } } ObjectProperty<Person> personProperty = ... ObjectBinding<String> name = ObjectBindings.map(personProperty, Person::getName); ``` The "name" binding in the example always contains the name of the Person that the "personProperty" is holding. As you can see this is a good use case for method references introduced by Java 8. The binding from the example will **not** throw a @see java.lang.NullPointerException even if the personProperty holds `null` as value: ```java personProperty.set(null); assertThat(name.get()).isNull(); ``` Your mapping function will only be called when the observable value is not null. This means that you don't need to check for `null` param in you mapping function. @param source the observable value that is the source for this binding. @param function a function that maps the value of the source to the target binding. @param <S> the generic type of the source observable. @param <R> the generic type of the resulting binding. @return the created binding.
[ "A", "Binding", "that", "holds", "a", "value", "that", "is", "determined", "by", "the", "given", "function", "applied", "to", "the", "value", "of", "the", "observable", "source", "." ]
054a5dde261c29f862b971765fa3da3704a13ab4
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/ObjectBindings.java#L86-L88
36,590
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/ObjectBindings.java
ObjectBindings.map
public static <S, R> ObjectBinding<R> map(ObservableValue<S> source, Function<? super S, ? extends R> function, R defaultValue){ return Bindings.createObjectBinding(()->{ S sourceValue = source.getValue(); if(sourceValue == null){ return defaultValue; }else{ return function.apply(sourceValue); } }, source); }
java
public static <S, R> ObjectBinding<R> map(ObservableValue<S> source, Function<? super S, ? extends R> function, R defaultValue){ return Bindings.createObjectBinding(()->{ S sourceValue = source.getValue(); if(sourceValue == null){ return defaultValue; }else{ return function.apply(sourceValue); } }, source); }
[ "public", "static", "<", "S", ",", "R", ">", "ObjectBinding", "<", "R", ">", "map", "(", "ObservableValue", "<", "S", ">", "source", ",", "Function", "<", "?", "super", "S", ",", "?", "extends", "R", ">", "function", ",", "R", "defaultValue", ")", ...
A null safe binding that holds the return value of the given function when applied to the value of the given observable. If the observable has a value of `null` the given default value (third param) will be used as value for the binding instead. The given function will never get `null` as param so you don't need to check for this. See {@link #map(javafx.beans.value.ObservableValue, java.util.function.Function, Object)} for a detailed explanation of the binding. @param source the observable value that is the source for this binding. @param function a function that maps the value of the source to the target binding. @param defaultValue the default value that is used when the source observable has a value of `null`. @param <S> the generic type of the source observable. @param <R> the generic type of the resulting binding. @return the created binding.
[ "A", "null", "safe", "binding", "that", "holds", "the", "return", "value", "of", "the", "given", "function", "when", "applied", "to", "the", "value", "of", "the", "given", "observable", "." ]
054a5dde261c29f862b971765fa3da3704a13ab4
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/ObjectBindings.java#L107-L117
36,591
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/ObjectBindings.java
ObjectBindings.cast
public static <T, S extends T> ObjectBinding<T> cast(final ObservableValue<S> source) { return Bindings.createObjectBinding(source::getValue, source); }
java
public static <T, S extends T> ObjectBinding<T> cast(final ObservableValue<S> source) { return Bindings.createObjectBinding(source::getValue, source); }
[ "public", "static", "<", "T", ",", "S", "extends", "T", ">", "ObjectBinding", "<", "T", ">", "cast", "(", "final", "ObservableValue", "<", "S", ">", "source", ")", "{", "return", "Bindings", ".", "createObjectBinding", "(", "source", "::", "getValue", ",...
Creates a binding that contains the same value as the source observable but casted to a type that is higher in class hierarchy. Example: ```java public class Person { } public class Student extends Person { } ObjectProperty<Student> student = new SimpleObjectProperty<>(); ObjectBinding<Person> person = ObjectBindings.cast(student); ``` This can be useful for cases when a method needs an observable value of the base type as argument but you have only an observable of a more specific type. The reason is that there is no implicit type conversion. See another example: ```java public void calculate(ObservableValue<Number> value) { ... } ... ChoiceBox<Integer> choiceBox = new ChoiceBox<>(); choiceBox.setItems(FXCollections.observableArrayList(1, 2, 3, 4)); ObjectProperty<Integer> value = choiceBox.valueProperty(); calculate(value) // compile error calculate(ObjectBindings.cast(value)); // this works ``` While `Integer` can be implicitly casted to `Number` the same isn't possible from `ObservableValue<Integer>` to `ObservableValue<Number>`. For such use cases you can use this method. @param source the observable value that will be used as source. @param <T> the generic type of target binding. @param <S> the generic type of the source binding. @return an ObjectBinding that will contain the same value of the source but casted to another type.
[ "Creates", "a", "binding", "that", "contains", "the", "same", "value", "as", "the", "source", "observable", "but", "casted", "to", "a", "type", "that", "is", "higher", "in", "class", "hierarchy", "." ]
054a5dde261c29f862b971765fa3da3704a13ab4
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/ObjectBindings.java#L170-L172
36,592
astefanutti/camel-cdi
impl/src/main/java/org/apache/camel/cdi/CdiSpiHelper.java
CdiSpiHelper.createAnnotationCollectionId
private static String createAnnotationCollectionId(Collection<Annotation> annotations) { if (annotations.isEmpty()) return ""; return annotations.stream() .sorted(comparing(a -> a.annotationType().getName())) .map(CdiSpiHelper::createAnnotationId) .collect(joining(",", "[", "]")); }
java
private static String createAnnotationCollectionId(Collection<Annotation> annotations) { if (annotations.isEmpty()) return ""; return annotations.stream() .sorted(comparing(a -> a.annotationType().getName())) .map(CdiSpiHelper::createAnnotationId) .collect(joining(",", "[", "]")); }
[ "private", "static", "String", "createAnnotationCollectionId", "(", "Collection", "<", "Annotation", ">", "annotations", ")", "{", "if", "(", "annotations", ".", "isEmpty", "(", ")", ")", "return", "\"\"", ";", "return", "annotations", ".", "stream", "(", ")",...
Generates a unique signature for a collection of annotations.
[ "Generates", "a", "unique", "signature", "for", "a", "collection", "of", "annotations", "." ]
686c7f5fe3a706f47378e0c49c323040795ddff8
https://github.com/astefanutti/camel-cdi/blob/686c7f5fe3a706f47378e0c49c323040795ddff8/impl/src/main/java/org/apache/camel/cdi/CdiSpiHelper.java#L132-L140
36,593
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/util/OgnlUtil.java
OgnlUtil.getValue
public static Object getValue(Object exp, Object root) { return getValue(exp, root, null, 0); }
java
public static Object getValue(Object exp, Object root) { return getValue(exp, root, null, 0); }
[ "public", "static", "Object", "getValue", "(", "Object", "exp", ",", "Object", "root", ")", "{", "return", "getValue", "(", "exp", ",", "root", ",", "null", ",", "0", ")", ";", "}" ]
Returns the value using the OGNL expression and the root object. @param exp the OGNL expression @param root the root object @return the value @see #getValue(Object, Map, Object, String, int)
[ "Returns", "the", "value", "using", "the", "OGNL", "expression", "and", "the", "root", "object", "." ]
29a44b7ad267b5a48bc250cd0ef7d74813d46889
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/util/OgnlUtil.java#L48-L50
36,594
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/util/OgnlUtil.java
OgnlUtil.getValue
public static Object getValue(Object exp, Map ctx, Object root) { return getValue(exp, ctx, root, null, 0); }
java
public static Object getValue(Object exp, Map ctx, Object root) { return getValue(exp, ctx, root, null, 0); }
[ "public", "static", "Object", "getValue", "(", "Object", "exp", ",", "Map", "ctx", ",", "Object", "root", ")", "{", "return", "getValue", "(", "exp", ",", "ctx", ",", "root", ",", "null", ",", "0", ")", ";", "}" ]
Returns the value using the OGNL expression, the root object and a context map. @param exp the OGNL expression @param ctx the context map @param root the root object @return the value @see #getValue(Object, Map, Object, String, int)
[ "Returns", "the", "value", "using", "the", "OGNL", "expression", "the", "root", "object", "and", "a", "context", "map", "." ]
29a44b7ad267b5a48bc250cd0ef7d74813d46889
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/util/OgnlUtil.java#L79-L81
36,595
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/util/OgnlUtil.java
OgnlUtil.getValue
public static Object getValue(Object exp, Map ctx, Object root, String path, int lineNumber) { try { OgnlContext context = new OgnlContext(null, null, new DefaultMemberAccess(true)); return Ognl.getValue(exp, context, root); } catch (OgnlException ex) { throw new OgnlRuntimeException(ex.getReason() == null ? ex : ex .getReason(), path, lineNumber); } catch (Exception ex) { throw new OgnlRuntimeException(ex, path, lineNumber); } }
java
public static Object getValue(Object exp, Map ctx, Object root, String path, int lineNumber) { try { OgnlContext context = new OgnlContext(null, null, new DefaultMemberAccess(true)); return Ognl.getValue(exp, context, root); } catch (OgnlException ex) { throw new OgnlRuntimeException(ex.getReason() == null ? ex : ex .getReason(), path, lineNumber); } catch (Exception ex) { throw new OgnlRuntimeException(ex, path, lineNumber); } }
[ "public", "static", "Object", "getValue", "(", "Object", "exp", ",", "Map", "ctx", ",", "Object", "root", ",", "String", "path", ",", "int", "lineNumber", ")", "{", "try", "{", "OgnlContext", "context", "=", "new", "OgnlContext", "(", "null", ",", "null"...
Returns the value using the OGNL expression, the root object, a context mpa, a path and a line number. @param exp the OGNL expression @param ctx the context map @param root the root object @param path the path @param lineNumber the line number @return the value @throws OgnlRuntimeException when a {@link ognl.OgnlException} occurs
[ "Returns", "the", "value", "using", "the", "OGNL", "expression", "the", "root", "object", "a", "context", "mpa", "a", "path", "and", "a", "line", "number", "." ]
29a44b7ad267b5a48bc250cd0ef7d74813d46889
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/util/OgnlUtil.java#L96-L106
36,596
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/util/OgnlUtil.java
OgnlUtil.parseExpression
public static Object parseExpression(String expression, String path, int lineNumber) { try { return Ognl.parseExpression(expression); } catch (Exception ex) { throw new OgnlRuntimeException(ex, path, lineNumber); } }
java
public static Object parseExpression(String expression, String path, int lineNumber) { try { return Ognl.parseExpression(expression); } catch (Exception ex) { throw new OgnlRuntimeException(ex, path, lineNumber); } }
[ "public", "static", "Object", "parseExpression", "(", "String", "expression", ",", "String", "path", ",", "int", "lineNumber", ")", "{", "try", "{", "return", "Ognl", ".", "parseExpression", "(", "expression", ")", ";", "}", "catch", "(", "Exception", "ex", ...
Parses an OGNL expression. @param expression the expression @param path the path @param lineNumber the line number @return a tree representation of the OGNL expression @throws OgnlRuntimeException when a {@link ognl.OgnlException} occurs
[ "Parses", "an", "OGNL", "expression", "." ]
29a44b7ad267b5a48bc250cd0ef7d74813d46889
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/util/OgnlUtil.java#L132-L138
36,597
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/SqlExecutor.java
SqlExecutor.getSingleResult
public <T> T getSingleResult(Class<T> clazz, String sql, Object[] params) { PreparedStatement stmt = null; ResultSet rs = null; try { stmt = connectionProvider.getConnection().prepareStatement(sql); setParameters(stmt, params); if (logger.isDebugEnabled()) { printSql(sql); printParameters(params); } rs = stmt.executeQuery(); ResultSetMetaData meta = rs.getMetaData(); int columnCount = meta.getColumnCount(); BeanDesc beanDesc = beanDescFactory.getBeanDesc(clazz); if(rs.next()){ T entity = entityOperator.createEntity(clazz, rs, meta, columnCount, beanDesc, dialect, valueTypes, nameConverter); return entity; } return null; } catch (SQLException ex) { throw new SQLRuntimeException(ex); } finally { JdbcUtil.close(rs); JdbcUtil.close(stmt); } }
java
public <T> T getSingleResult(Class<T> clazz, String sql, Object[] params) { PreparedStatement stmt = null; ResultSet rs = null; try { stmt = connectionProvider.getConnection().prepareStatement(sql); setParameters(stmt, params); if (logger.isDebugEnabled()) { printSql(sql); printParameters(params); } rs = stmt.executeQuery(); ResultSetMetaData meta = rs.getMetaData(); int columnCount = meta.getColumnCount(); BeanDesc beanDesc = beanDescFactory.getBeanDesc(clazz); if(rs.next()){ T entity = entityOperator.createEntity(clazz, rs, meta, columnCount, beanDesc, dialect, valueTypes, nameConverter); return entity; } return null; } catch (SQLException ex) { throw new SQLRuntimeException(ex); } finally { JdbcUtil.close(rs); JdbcUtil.close(stmt); } }
[ "public", "<", "T", ">", "T", "getSingleResult", "(", "Class", "<", "T", ">", "clazz", ",", "String", "sql", ",", "Object", "[", "]", "params", ")", "{", "PreparedStatement", "stmt", "=", "null", ";", "ResultSet", "rs", "=", "null", ";", "try", "{", ...
Returns a single entity from the first row of an SQL. @param <T> the entity type @param clazz the class of the entity @param sql the SQL to execute @param params the parameters to execute the SQL @return the entity from the result set. @throws SQLRuntimeException if a database access error occurs
[ "Returns", "a", "single", "entity", "from", "the", "first", "row", "of", "an", "SQL", "." ]
29a44b7ad267b5a48bc250cd0ef7d74813d46889
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/SqlExecutor.java#L228-L261
36,598
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/SqlExecutor.java
SqlExecutor.executeUpdateSql
public int executeUpdateSql(String sql, PropertyDesc[] propDescs, Object entity){ PreparedStatement stmt = null; ResultSet rs = null; try { Connection conn = connectionProvider.getConnection(); if (logger.isDebugEnabled()) { printSql(sql); printParameters(propDescs); } if(entity != null && dialect.supportsGenerationType(GenerationType.IDENTITY)){ stmt = conn.prepareStatement(sql, PreparedStatement.RETURN_GENERATED_KEYS); } else { stmt = conn.prepareStatement(sql); } setParameters(stmt, propDescs, entity); int result = stmt.executeUpdate(); // Sets GenerationType.IDENTITY properties value. if(entity != null && dialect.supportsGenerationType(GenerationType.IDENTITY)){ rs = stmt.getGeneratedKeys(); fillIdentityPrimaryKeys(entity, rs); } return result; } catch(SQLException ex){ throw new SQLRuntimeException(ex); } finally { JdbcUtil.close(rs); JdbcUtil.close(stmt); } }
java
public int executeUpdateSql(String sql, PropertyDesc[] propDescs, Object entity){ PreparedStatement stmt = null; ResultSet rs = null; try { Connection conn = connectionProvider.getConnection(); if (logger.isDebugEnabled()) { printSql(sql); printParameters(propDescs); } if(entity != null && dialect.supportsGenerationType(GenerationType.IDENTITY)){ stmt = conn.prepareStatement(sql, PreparedStatement.RETURN_GENERATED_KEYS); } else { stmt = conn.prepareStatement(sql); } setParameters(stmt, propDescs, entity); int result = stmt.executeUpdate(); // Sets GenerationType.IDENTITY properties value. if(entity != null && dialect.supportsGenerationType(GenerationType.IDENTITY)){ rs = stmt.getGeneratedKeys(); fillIdentityPrimaryKeys(entity, rs); } return result; } catch(SQLException ex){ throw new SQLRuntimeException(ex); } finally { JdbcUtil.close(rs); JdbcUtil.close(stmt); } }
[ "public", "int", "executeUpdateSql", "(", "String", "sql", ",", "PropertyDesc", "[", "]", "propDescs", ",", "Object", "entity", ")", "{", "PreparedStatement", "stmt", "=", "null", ";", "ResultSet", "rs", "=", "null", ";", "try", "{", "Connection", "conn", ...
Executes an update SQL. @param sql the update SQL to execute @param propDescs the array of parameters @param entity the entity object in insertion, otherwise null @return the number of updated rows @throws SQLRuntimeException if a database access error occurs
[ "Executes", "an", "update", "SQL", "." ]
29a44b7ad267b5a48bc250cd0ef7d74813d46889
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/SqlExecutor.java#L274-L309
36,599
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/SqlExecutor.java
SqlExecutor.executeBatchUpdateSql
public int executeBatchUpdateSql(String sql, List<PropertyDesc[]> propDescsList, Object[] entities) { PreparedStatement stmt = null; ResultSet rs = null; try { Connection conn = connectionProvider.getConnection(); if (logger.isDebugEnabled()) { printSql(sql); for(int i=0; i < propDescsList.size(); i++){ PropertyDesc[] propDescs = propDescsList.get(i); logger.debug("[" + i + "]"); printParameters(propDescs, entities[i]); } } if(entities != null && dialect.supportsGenerationType(GenerationType.IDENTITY)){ stmt = conn.prepareStatement(sql, PreparedStatement.RETURN_GENERATED_KEYS); } else { stmt = conn.prepareStatement(sql); } if(entities != null) { for (int i = 0; i < propDescsList.size(); i++) { PropertyDesc[] propDescs = propDescsList.get(i); setParameters(stmt, propDescs, entities[i]); stmt.addBatch(); } } else { for(PropertyDesc[] propDescs: propDescsList){ setParameters(stmt, propDescs, null); stmt.addBatch(); } } int[] results = stmt.executeBatch(); int updateRows = 0; for(int result: results){ updateRows += result; } // Sets GenerationType.IDENTITY properties value. if(entities != null && dialect.supportsGenerationType(GenerationType.IDENTITY)){ rs = stmt.getGeneratedKeys(); for(Object entity: entities){ fillIdentityPrimaryKeys(entity, rs); } } return updateRows; } catch(SQLException ex){ throw new SQLRuntimeException(ex); } finally { JdbcUtil.close(rs); JdbcUtil.close(stmt); } }
java
public int executeBatchUpdateSql(String sql, List<PropertyDesc[]> propDescsList, Object[] entities) { PreparedStatement stmt = null; ResultSet rs = null; try { Connection conn = connectionProvider.getConnection(); if (logger.isDebugEnabled()) { printSql(sql); for(int i=0; i < propDescsList.size(); i++){ PropertyDesc[] propDescs = propDescsList.get(i); logger.debug("[" + i + "]"); printParameters(propDescs, entities[i]); } } if(entities != null && dialect.supportsGenerationType(GenerationType.IDENTITY)){ stmt = conn.prepareStatement(sql, PreparedStatement.RETURN_GENERATED_KEYS); } else { stmt = conn.prepareStatement(sql); } if(entities != null) { for (int i = 0; i < propDescsList.size(); i++) { PropertyDesc[] propDescs = propDescsList.get(i); setParameters(stmt, propDescs, entities[i]); stmt.addBatch(); } } else { for(PropertyDesc[] propDescs: propDescsList){ setParameters(stmt, propDescs, null); stmt.addBatch(); } } int[] results = stmt.executeBatch(); int updateRows = 0; for(int result: results){ updateRows += result; } // Sets GenerationType.IDENTITY properties value. if(entities != null && dialect.supportsGenerationType(GenerationType.IDENTITY)){ rs = stmt.getGeneratedKeys(); for(Object entity: entities){ fillIdentityPrimaryKeys(entity, rs); } } return updateRows; } catch(SQLException ex){ throw new SQLRuntimeException(ex); } finally { JdbcUtil.close(rs); JdbcUtil.close(stmt); } }
[ "public", "int", "executeBatchUpdateSql", "(", "String", "sql", ",", "List", "<", "PropertyDesc", "[", "]", ">", "propDescsList", ",", "Object", "[", "]", "entities", ")", "{", "PreparedStatement", "stmt", "=", "null", ";", "ResultSet", "rs", "=", "null", ...
Executes the update SQL. @param sql the update SQL to execute @param propDescsList the list of parameter arrays. @param entities the entities object in insertion, otherwise null @return the number of updated rows @throws SQLRuntimeException if a database access error occurs
[ "Executes", "the", "update", "SQL", "." ]
29a44b7ad267b5a48bc250cd0ef7d74813d46889
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/SqlExecutor.java#L370-L427