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
160,100
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/notes/NotesInterface.java
NotesInterface.edit
public void edit(Note note) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT); parameters.put("note_id", note.getId()); Rectangle bounds = note.getBounds(); if (bounds != null) { parameters.put("note_x", String.valueOf(bounds.x)); parameters.put("note_y", String.valueOf(bounds.y)); parameters.put("note_w", String.valueOf(bounds.width)); parameters.put("note_h", String.valueOf(bounds.height)); } String text = note.getText(); if (text != null) { parameters.put("note_text", text); } Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void edit(Note note) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT); parameters.put("note_id", note.getId()); Rectangle bounds = note.getBounds(); if (bounds != null) { parameters.put("note_x", String.valueOf(bounds.x)); parameters.put("note_y", String.valueOf(bounds.y)); parameters.put("note_w", String.valueOf(bounds.width)); parameters.put("note_h", String.valueOf(bounds.height)); } String text = note.getText(); if (text != null) { parameters.put("note_text", text); } Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "edit", "(", "Note", "note", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_EDIT", ")", ";", "parameters", ".", "put", "(", "\"note_id\"", ",", "note", ".", "getId", "(", ")", ")", ";", "Rectangle", "bounds", "=", "note", ".", "getBounds", "(", ")", ";", "if", "(", "bounds", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"note_x\"", ",", "String", ".", "valueOf", "(", "bounds", ".", "x", ")", ")", ";", "parameters", ".", "put", "(", "\"note_y\"", ",", "String", ".", "valueOf", "(", "bounds", ".", "y", ")", ")", ";", "parameters", ".", "put", "(", "\"note_w\"", ",", "String", ".", "valueOf", "(", "bounds", ".", "width", ")", ")", ";", "parameters", ".", "put", "(", "\"note_h\"", ",", "String", ".", "valueOf", "(", "bounds", ".", "height", ")", ")", ";", "}", "String", "text", "=", "note", ".", "getText", "(", ")", ";", "if", "(", "text", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"note_text\"", ",", "text", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "post", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Update a note. @param note The Note to update @throws FlickrException
[ "Update", "a", "note", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/notes/NotesInterface.java#L101-L122
160,101
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/licenses/LicensesInterface.java
LicensesInterface.getInfo
public Collection<License> getInfo() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INFO); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } List<License> licenses = new ArrayList<License>(); Element licensesElement = response.getPayload(); NodeList licenseElements = licensesElement.getElementsByTagName("license"); for (int i = 0; i < licenseElements.getLength(); i++) { Element licenseElement = (Element) licenseElements.item(i); License license = new License(); license.setId(licenseElement.getAttribute("id")); license.setName(licenseElement.getAttribute("name")); license.setUrl(licenseElement.getAttribute("url")); licenses.add(license); } return licenses; }
java
public Collection<License> getInfo() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INFO); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } List<License> licenses = new ArrayList<License>(); Element licensesElement = response.getPayload(); NodeList licenseElements = licensesElement.getElementsByTagName("license"); for (int i = 0; i < licenseElements.getLength(); i++) { Element licenseElement = (Element) licenseElements.item(i); License license = new License(); license.setId(licenseElement.getAttribute("id")); license.setName(licenseElement.getAttribute("name")); license.setUrl(licenseElement.getAttribute("url")); licenses.add(license); } return licenses; }
[ "public", "Collection", "<", "License", ">", "getInfo", "(", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_INFO", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "List", "<", "License", ">", "licenses", "=", "new", "ArrayList", "<", "License", ">", "(", ")", ";", "Element", "licensesElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "licenseElements", "=", "licensesElement", ".", "getElementsByTagName", "(", "\"license\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "licenseElements", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "licenseElement", "=", "(", "Element", ")", "licenseElements", ".", "item", "(", "i", ")", ";", "License", "license", "=", "new", "License", "(", ")", ";", "license", ".", "setId", "(", "licenseElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "license", ".", "setName", "(", "licenseElement", ".", "getAttribute", "(", "\"name\"", ")", ")", ";", "license", ".", "setUrl", "(", "licenseElement", ".", "getAttribute", "(", "\"url\"", ")", ")", ";", "licenses", ".", "add", "(", "license", ")", ";", "}", "return", "licenses", ";", "}" ]
Fetches a list of available photo licenses for Flickr. This method does not require authentication. @return A collection of License objects @throws FlickrException
[ "Fetches", "a", "list", "of", "available", "photo", "licenses", "for", "Flickr", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/licenses/LicensesInterface.java#L49-L69
160,102
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/licenses/LicensesInterface.java
LicensesInterface.setLicense
public void setLicense(String photoId, int licenseId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_LICENSE); parameters.put("photo_id", photoId); parameters.put("license_id", Integer.toString(licenseId)); // Note: This method requires an HTTP POST request. Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } // This method has no specific response - It returns an empty sucess response if it completes without error. }
java
public void setLicense(String photoId, int licenseId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_LICENSE); parameters.put("photo_id", photoId); parameters.put("license_id", Integer.toString(licenseId)); // Note: This method requires an HTTP POST request. Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } // This method has no specific response - It returns an empty sucess response if it completes without error. }
[ "public", "void", "setLicense", "(", "String", "photoId", ",", "int", "licenseId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_SET_LICENSE", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "parameters", ".", "put", "(", "\"license_id\"", ",", "Integer", ".", "toString", "(", "licenseId", ")", ")", ";", "// Note: This method requires an HTTP POST request.\r", "Response", "response", "=", "transportAPI", ".", "post", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "// This method has no specific response - It returns an empty sucess response if it completes without error.\r", "}" ]
Sets the license for a photo. This method requires authentication with 'write' permission. @param photoId The photo to update the license for. @param licenseId The license to apply, or 0 (zero) to remove the current license. @throws FlickrException
[ "Sets", "the", "license", "for", "a", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/licenses/LicensesInterface.java#L82-L95
160,103
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/tags/TagsInterface.java
TagsInterface.getClusterPhotos
public PhotoList<Photo> getClusterPhotos(String tag, String clusterId) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_CLUSTER_PHOTOS); parameters.put("tag", tag); parameters.put("cluster_id", clusterId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); NodeList photoNodes = photosElement.getElementsByTagName("photo"); photos.setPage("1"); photos.setPages("1"); photos.setPerPage("" + photoNodes.getLength()); photos.setTotal("" + photoNodes.getLength()); for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
java
public PhotoList<Photo> getClusterPhotos(String tag, String clusterId) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_CLUSTER_PHOTOS); parameters.put("tag", tag); parameters.put("cluster_id", clusterId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); NodeList photoNodes = photosElement.getElementsByTagName("photo"); photos.setPage("1"); photos.setPages("1"); photos.setPerPage("" + photoNodes.getLength()); photos.setTotal("" + photoNodes.getLength()); for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
[ "public", "PhotoList", "<", "Photo", ">", "getClusterPhotos", "(", "String", "tag", ",", "String", "clusterId", ")", "throws", "FlickrException", "{", "PhotoList", "<", "Photo", ">", "photos", "=", "new", "PhotoList", "<", "Photo", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_CLUSTER_PHOTOS", ")", ";", "parameters", ".", "put", "(", "\"tag\"", ",", "tag", ")", ";", "parameters", ".", "put", "(", "\"cluster_id\"", ",", "clusterId", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photosElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "photoNodes", "=", "photosElement", ".", "getElementsByTagName", "(", "\"photo\"", ")", ";", "photos", ".", "setPage", "(", "\"1\"", ")", ";", "photos", ".", "setPages", "(", "\"1\"", ")", ";", "photos", ".", "setPerPage", "(", "\"\"", "+", "photoNodes", ".", "getLength", "(", ")", ")", ";", "photos", ".", "setTotal", "(", "\"\"", "+", "photoNodes", ".", "getLength", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "photoNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "photoElement", "=", "(", "Element", ")", "photoNodes", ".", "item", "(", "i", ")", ";", "photos", ".", "add", "(", "PhotoUtils", ".", "createPhoto", "(", "photoElement", ")", ")", ";", "}", "return", "photos", ";", "}" ]
Returns the first 24 photos for a given tag cluster. <p> This method does not require authentication. </p> @param tag @param clusterId @return PhotoList @throws FlickrException
[ "Returns", "the", "first", "24", "photos", "for", "a", "given", "tag", "cluster", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/tags/TagsInterface.java#L122-L147
160,104
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/tags/TagsInterface.java
TagsInterface.getListPhoto
public Photo getListPhoto(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST_PHOTO); parameters.put("photo_id", photoId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photoElement = response.getPayload(); Photo photo = new Photo(); photo.setId(photoElement.getAttribute("id")); List<Tag> tags = new ArrayList<Tag>(); Element tagsElement = (Element) photoElement.getElementsByTagName("tags").item(0); NodeList tagElements = tagsElement.getElementsByTagName("tag"); for (int i = 0; i < tagElements.getLength(); i++) { Element tagElement = (Element) tagElements.item(i); Tag tag = new Tag(); tag.setId(tagElement.getAttribute("id")); tag.setAuthor(tagElement.getAttribute("author")); tag.setAuthorName(tagElement.getAttribute("authorname")); tag.setRaw(tagElement.getAttribute("raw")); tag.setValue(((Text) tagElement.getFirstChild()).getData()); tags.add(tag); } photo.setTags(tags); return photo; }
java
public Photo getListPhoto(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST_PHOTO); parameters.put("photo_id", photoId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photoElement = response.getPayload(); Photo photo = new Photo(); photo.setId(photoElement.getAttribute("id")); List<Tag> tags = new ArrayList<Tag>(); Element tagsElement = (Element) photoElement.getElementsByTagName("tags").item(0); NodeList tagElements = tagsElement.getElementsByTagName("tag"); for (int i = 0; i < tagElements.getLength(); i++) { Element tagElement = (Element) tagElements.item(i); Tag tag = new Tag(); tag.setId(tagElement.getAttribute("id")); tag.setAuthor(tagElement.getAttribute("author")); tag.setAuthorName(tagElement.getAttribute("authorname")); tag.setRaw(tagElement.getAttribute("raw")); tag.setValue(((Text) tagElement.getFirstChild()).getData()); tags.add(tag); } photo.setTags(tags); return photo; }
[ "public", "Photo", "getListPhoto", "(", "String", "photoId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_LIST_PHOTO", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photoElement", "=", "response", ".", "getPayload", "(", ")", ";", "Photo", "photo", "=", "new", "Photo", "(", ")", ";", "photo", ".", "setId", "(", "photoElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "List", "<", "Tag", ">", "tags", "=", "new", "ArrayList", "<", "Tag", ">", "(", ")", ";", "Element", "tagsElement", "=", "(", "Element", ")", "photoElement", ".", "getElementsByTagName", "(", "\"tags\"", ")", ".", "item", "(", "0", ")", ";", "NodeList", "tagElements", "=", "tagsElement", ".", "getElementsByTagName", "(", "\"tag\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "tagElements", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "tagElement", "=", "(", "Element", ")", "tagElements", ".", "item", "(", "i", ")", ";", "Tag", "tag", "=", "new", "Tag", "(", ")", ";", "tag", ".", "setId", "(", "tagElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "tag", ".", "setAuthor", "(", "tagElement", ".", "getAttribute", "(", "\"author\"", ")", ")", ";", "tag", ".", "setAuthorName", "(", "tagElement", ".", "getAttribute", "(", "\"authorname\"", ")", ")", ";", "tag", ".", "setRaw", "(", "tagElement", ".", "getAttribute", "(", "\"raw\"", ")", ")", ";", "tag", ".", "setValue", "(", "(", "(", "Text", ")", "tagElement", ".", "getFirstChild", "(", ")", ")", ".", "getData", "(", ")", ")", ";", "tags", ".", "add", "(", "tag", ")", ";", "}", "photo", ".", "setTags", "(", "tags", ")", ";", "return", "photo", ";", "}" ]
Get a list of tags for the specified photo. <p> This method does not require authentication. </p> @param photoId The photo ID @return The collection of Tag objects
[ "Get", "a", "list", "of", "tags", "for", "the", "specified", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/tags/TagsInterface.java#L200-L231
160,105
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/tags/TagsInterface.java
TagsInterface.getListUser
public Collection<Tag> getListUser(String userId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST_USER); parameters.put("user_id", userId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element whoElement = response.getPayload(); List<Tag> tags = new ArrayList<Tag>(); Element tagsElement = (Element) whoElement.getElementsByTagName("tags").item(0); NodeList tagElements = tagsElement.getElementsByTagName("tag"); for (int i = 0; i < tagElements.getLength(); i++) { Element tagElement = (Element) tagElements.item(i); Tag tag = new Tag(); tag.setValue(((Text) tagElement.getFirstChild()).getData()); tags.add(tag); } return tags; }
java
public Collection<Tag> getListUser(String userId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST_USER); parameters.put("user_id", userId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element whoElement = response.getPayload(); List<Tag> tags = new ArrayList<Tag>(); Element tagsElement = (Element) whoElement.getElementsByTagName("tags").item(0); NodeList tagElements = tagsElement.getElementsByTagName("tag"); for (int i = 0; i < tagElements.getLength(); i++) { Element tagElement = (Element) tagElements.item(i); Tag tag = new Tag(); tag.setValue(((Text) tagElement.getFirstChild()).getData()); tags.add(tag); } return tags; }
[ "public", "Collection", "<", "Tag", ">", "getListUser", "(", "String", "userId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_LIST_USER", ")", ";", "parameters", ".", "put", "(", "\"user_id\"", ",", "userId", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "whoElement", "=", "response", ".", "getPayload", "(", ")", ";", "List", "<", "Tag", ">", "tags", "=", "new", "ArrayList", "<", "Tag", ">", "(", ")", ";", "Element", "tagsElement", "=", "(", "Element", ")", "whoElement", ".", "getElementsByTagName", "(", "\"tags\"", ")", ".", "item", "(", "0", ")", ";", "NodeList", "tagElements", "=", "tagsElement", ".", "getElementsByTagName", "(", "\"tag\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "tagElements", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "tagElement", "=", "(", "Element", ")", "tagElements", ".", "item", "(", "i", ")", ";", "Tag", "tag", "=", "new", "Tag", "(", ")", ";", "tag", ".", "setValue", "(", "(", "(", "Text", ")", "tagElement", ".", "getFirstChild", "(", ")", ")", ".", "getData", "(", ")", ")", ";", "tags", ".", "add", "(", "tag", ")", ";", "}", "return", "tags", ";", "}" ]
Get a collection of tags used by the specified user. <p> This method does not require authentication. </p> @param userId The User ID @return The User object @throws FlickrException
[ "Get", "a", "collection", "of", "tags", "used", "by", "the", "specified", "user", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/tags/TagsInterface.java#L245-L269
160,106
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/tags/TagsInterface.java
TagsInterface.getRelated
public RelatedTagsList getRelated(String tag) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_RELATED); parameters.put("tag", tag); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element tagsElement = response.getPayload(); RelatedTagsList tags = new RelatedTagsList(); tags.setSource(tagsElement.getAttribute("source")); NodeList tagElements = tagsElement.getElementsByTagName("tag"); for (int i = 0; i < tagElements.getLength(); i++) { Element tagElement = (Element) tagElements.item(i); Tag t = new Tag(); t.setValue(XMLUtilities.getValue(tagElement)); tags.add(t); } return tags; }
java
public RelatedTagsList getRelated(String tag) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_RELATED); parameters.put("tag", tag); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element tagsElement = response.getPayload(); RelatedTagsList tags = new RelatedTagsList(); tags.setSource(tagsElement.getAttribute("source")); NodeList tagElements = tagsElement.getElementsByTagName("tag"); for (int i = 0; i < tagElements.getLength(); i++) { Element tagElement = (Element) tagElements.item(i); Tag t = new Tag(); t.setValue(XMLUtilities.getValue(tagElement)); tags.add(t); } return tags; }
[ "public", "RelatedTagsList", "getRelated", "(", "String", "tag", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_RELATED", ")", ";", "parameters", ".", "put", "(", "\"tag\"", ",", "tag", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "tagsElement", "=", "response", ".", "getPayload", "(", ")", ";", "RelatedTagsList", "tags", "=", "new", "RelatedTagsList", "(", ")", ";", "tags", ".", "setSource", "(", "tagsElement", ".", "getAttribute", "(", "\"source\"", ")", ")", ";", "NodeList", "tagElements", "=", "tagsElement", ".", "getElementsByTagName", "(", "\"tag\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "tagElements", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "tagElement", "=", "(", "Element", ")", "tagElements", ".", "item", "(", "i", ")", ";", "Tag", "t", "=", "new", "Tag", "(", ")", ";", "t", ".", "setValue", "(", "XMLUtilities", ".", "getValue", "(", "tagElement", ")", ")", ";", "tags", ".", "add", "(", "t", ")", ";", "}", "return", "tags", ";", "}" ]
Get the related tags. <p> This method does not require authentication. </p> @param tag The source tag @return A RelatedTagsList object @throws FlickrException
[ "Get", "the", "related", "tags", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/tags/TagsInterface.java#L383-L407
160,107
j256/ormlite-core
src/main/java/com/j256/ormlite/misc/IOUtils.java
IOUtils.closeThrowSqlException
public static void closeThrowSqlException(Closeable closeable, String label) throws SQLException { if (closeable != null) { try { closeable.close(); } catch (IOException e) { throw SqlExceptionUtil.create("could not close " + label, e); } } }
java
public static void closeThrowSqlException(Closeable closeable, String label) throws SQLException { if (closeable != null) { try { closeable.close(); } catch (IOException e) { throw SqlExceptionUtil.create("could not close " + label, e); } } }
[ "public", "static", "void", "closeThrowSqlException", "(", "Closeable", "closeable", ",", "String", "label", ")", "throws", "SQLException", "{", "if", "(", "closeable", "!=", "null", ")", "{", "try", "{", "closeable", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "SqlExceptionUtil", ".", "create", "(", "\"could not close \"", "+", "label", ",", "e", ")", ";", "}", "}", "}" ]
Close it and ignore any exceptions.
[ "Close", "it", "and", "ignore", "any", "exceptions", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/misc/IOUtils.java#L30-L38
160,108
j256/ormlite-core
src/main/java/com/j256/ormlite/logger/LoggerFactory.java
LoggerFactory.getLogger
public static Logger getLogger(String className) { if (logType == null) { logType = findLogType(); } return new Logger(logType.createLog(className)); }
java
public static Logger getLogger(String className) { if (logType == null) { logType = findLogType(); } return new Logger(logType.createLog(className)); }
[ "public", "static", "Logger", "getLogger", "(", "String", "className", ")", "{", "if", "(", "logType", "==", "null", ")", "{", "logType", "=", "findLogType", "(", ")", ";", "}", "return", "new", "Logger", "(", "logType", ".", "createLog", "(", "className", ")", ")", ";", "}" ]
Return a logger associated with a particular class name.
[ "Return", "a", "logger", "associated", "with", "a", "particular", "class", "name", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/LoggerFactory.java#L38-L43
160,109
j256/ormlite-core
src/main/java/com/j256/ormlite/logger/LoggerFactory.java
LoggerFactory.getSimpleClassName
public static String getSimpleClassName(String className) { // get the last part of the class name String[] parts = className.split("\\."); if (parts.length <= 1) { return className; } else { return parts[parts.length - 1]; } }
java
public static String getSimpleClassName(String className) { // get the last part of the class name String[] parts = className.split("\\."); if (parts.length <= 1) { return className; } else { return parts[parts.length - 1]; } }
[ "public", "static", "String", "getSimpleClassName", "(", "String", "className", ")", "{", "// get the last part of the class name", "String", "[", "]", "parts", "=", "className", ".", "split", "(", "\"\\\\.\"", ")", ";", "if", "(", "parts", ".", "length", "<=", "1", ")", "{", "return", "className", ";", "}", "else", "{", "return", "parts", "[", "parts", ".", "length", "-", "1", "]", ";", "}", "}" ]
Return the single class name from a class-name string.
[ "Return", "the", "single", "class", "name", "from", "a", "class", "-", "name", "string", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/LoggerFactory.java#L48-L56
160,110
j256/ormlite-core
src/main/java/com/j256/ormlite/logger/LoggerFactory.java
LoggerFactory.findLogType
private static LogType findLogType() { // see if the log-type was specified as a system property String logTypeString = System.getProperty(LOG_TYPE_SYSTEM_PROPERTY); if (logTypeString != null) { try { return LogType.valueOf(logTypeString); } catch (IllegalArgumentException e) { Log log = new LocalLog(LoggerFactory.class.getName()); log.log(Level.WARNING, "Could not find valid log-type from system property '" + LOG_TYPE_SYSTEM_PROPERTY + "', value '" + logTypeString + "'"); } } for (LogType logType : LogType.values()) { if (logType.isAvailable()) { return logType; } } // fall back is always LOCAL, never reached return LogType.LOCAL; }
java
private static LogType findLogType() { // see if the log-type was specified as a system property String logTypeString = System.getProperty(LOG_TYPE_SYSTEM_PROPERTY); if (logTypeString != null) { try { return LogType.valueOf(logTypeString); } catch (IllegalArgumentException e) { Log log = new LocalLog(LoggerFactory.class.getName()); log.log(Level.WARNING, "Could not find valid log-type from system property '" + LOG_TYPE_SYSTEM_PROPERTY + "', value '" + logTypeString + "'"); } } for (LogType logType : LogType.values()) { if (logType.isAvailable()) { return logType; } } // fall back is always LOCAL, never reached return LogType.LOCAL; }
[ "private", "static", "LogType", "findLogType", "(", ")", "{", "// see if the log-type was specified as a system property", "String", "logTypeString", "=", "System", ".", "getProperty", "(", "LOG_TYPE_SYSTEM_PROPERTY", ")", ";", "if", "(", "logTypeString", "!=", "null", ")", "{", "try", "{", "return", "LogType", ".", "valueOf", "(", "logTypeString", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "Log", "log", "=", "new", "LocalLog", "(", "LoggerFactory", ".", "class", ".", "getName", "(", ")", ")", ";", "log", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Could not find valid log-type from system property '\"", "+", "LOG_TYPE_SYSTEM_PROPERTY", "+", "\"', value '\"", "+", "logTypeString", "+", "\"'\"", ")", ";", "}", "}", "for", "(", "LogType", "logType", ":", "LogType", ".", "values", "(", ")", ")", "{", "if", "(", "logType", ".", "isAvailable", "(", ")", ")", "{", "return", "logType", ";", "}", "}", "// fall back is always LOCAL, never reached", "return", "LogType", ".", "LOCAL", ";", "}" ]
Return the most appropriate log type. This should _never_ return null.
[ "Return", "the", "most", "appropriate", "log", "type", ".", "This", "should", "_never_", "return", "null", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/LoggerFactory.java#L61-L82
160,111
j256/ormlite-core
src/main/java/com/j256/ormlite/logger/Logger.java
Logger.trace
public void trace(String msg) { logIfEnabled(Level.TRACE, null, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, null); }
java
public void trace(String msg) { logIfEnabled(Level.TRACE, null, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, null); }
[ "public", "void", "trace", "(", "String", "msg", ")", "{", "logIfEnabled", "(", "Level", ".", "TRACE", ",", "null", ",", "msg", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "null", ")", ";", "}" ]
Log a trace message.
[ "Log", "a", "trace", "message", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L53-L55
160,112
j256/ormlite-core
src/main/java/com/j256/ormlite/logger/Logger.java
Logger.trace
public void trace(Throwable throwable, String msg, Object[] argArray) { logIfEnabled(Level.TRACE, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray); }
java
public void trace(Throwable throwable, String msg, Object[] argArray) { logIfEnabled(Level.TRACE, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray); }
[ "public", "void", "trace", "(", "Throwable", "throwable", ",", "String", "msg", ",", "Object", "[", "]", "argArray", ")", "{", "logIfEnabled", "(", "Level", ".", "TRACE", ",", "throwable", ",", "msg", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "argArray", ")", ";", "}" ]
Log a trace message with a throwable.
[ "Log", "a", "trace", "message", "with", "a", "throwable", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L116-L118
160,113
j256/ormlite-core
src/main/java/com/j256/ormlite/logger/Logger.java
Logger.info
public void info(Throwable throwable, String msg, Object[] argArray) { logIfEnabled(Level.INFO, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray); }
java
public void info(Throwable throwable, String msg, Object[] argArray) { logIfEnabled(Level.INFO, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray); }
[ "public", "void", "info", "(", "Throwable", "throwable", ",", "String", "msg", ",", "Object", "[", "]", "argArray", ")", "{", "logIfEnabled", "(", "Level", ".", "INFO", ",", "throwable", ",", "msg", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "argArray", ")", ";", "}" ]
Log a info message with a throwable.
[ "Log", "a", "info", "message", "with", "a", "throwable", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L256-L258
160,114
j256/ormlite-core
src/main/java/com/j256/ormlite/logger/Logger.java
Logger.warn
public void warn(Throwable throwable, String msg, Object[] argArray) { logIfEnabled(Level.WARNING, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray); }
java
public void warn(Throwable throwable, String msg, Object[] argArray) { logIfEnabled(Level.WARNING, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray); }
[ "public", "void", "warn", "(", "Throwable", "throwable", ",", "String", "msg", ",", "Object", "[", "]", "argArray", ")", "{", "logIfEnabled", "(", "Level", ".", "WARNING", ",", "throwable", ",", "msg", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "argArray", ")", ";", "}" ]
Log a warning message with a throwable.
[ "Log", "a", "warning", "message", "with", "a", "throwable", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L326-L328
160,115
j256/ormlite-core
src/main/java/com/j256/ormlite/logger/Logger.java
Logger.fatal
public void fatal(String msg) { logIfEnabled(Level.FATAL, null, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, null); }
java
public void fatal(String msg) { logIfEnabled(Level.FATAL, null, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, null); }
[ "public", "void", "fatal", "(", "String", "msg", ")", "{", "logIfEnabled", "(", "Level", ".", "FATAL", ",", "null", ",", "msg", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "null", ")", ";", "}" ]
Log a fatal message.
[ "Log", "a", "fatal", "message", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L403-L405
160,116
j256/ormlite-core
src/main/java/com/j256/ormlite/logger/Logger.java
Logger.fatal
public void fatal(Throwable throwable, String msg, Object[] argArray) { logIfEnabled(Level.FATAL, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray); }
java
public void fatal(Throwable throwable, String msg, Object[] argArray) { logIfEnabled(Level.FATAL, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray); }
[ "public", "void", "fatal", "(", "Throwable", "throwable", ",", "String", "msg", ",", "Object", "[", "]", "argArray", ")", "{", "logIfEnabled", "(", "Level", ".", "FATAL", ",", "throwable", ",", "msg", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "argArray", ")", ";", "}" ]
Log a fatal message with a throwable.
[ "Log", "a", "fatal", "message", "with", "a", "throwable", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L466-L468
160,117
j256/ormlite-core
src/main/java/com/j256/ormlite/logger/Logger.java
Logger.log
public void log(Level level, String msg) { logIfEnabled(level, null, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, null); }
java
public void log(Level level, String msg) { logIfEnabled(level, null, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, null); }
[ "public", "void", "log", "(", "Level", "level", ",", "String", "msg", ")", "{", "logIfEnabled", "(", "level", ",", "null", ",", "msg", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "null", ")", ";", "}" ]
Log a message at the provided level.
[ "Log", "a", "message", "at", "the", "provided", "level", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L473-L475
160,118
j256/ormlite-core
src/main/java/com/j256/ormlite/logger/Logger.java
Logger.log
public void log(Level level, Throwable throwable, String msg, Object[] argArray) { logIfEnabled(level, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray); }
java
public void log(Level level, Throwable throwable, String msg, Object[] argArray) { logIfEnabled(level, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray); }
[ "public", "void", "log", "(", "Level", "level", ",", "Throwable", "throwable", ",", "String", "msg", ",", "Object", "[", "]", "argArray", ")", "{", "logIfEnabled", "(", "level", ",", "throwable", ",", "msg", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "UNKNOWN_ARG", ",", "argArray", ")", ";", "}" ]
Log a message with a throwable at the provided level.
[ "Log", "a", "message", "with", "a", "throwable", "at", "the", "provided", "level", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L536-L538
160,119
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/DaoManager.java
DaoManager.lookupDao
public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, clazz); Dao<?, ?> dao = lookupDao(key); @SuppressWarnings("unchecked") D castDao = (D) dao; return castDao; }
java
public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, clazz); Dao<?, ?> dao = lookupDao(key); @SuppressWarnings("unchecked") D castDao = (D) dao; return castDao; }
[ "public", "synchronized", "static", "<", "D", "extends", "Dao", "<", "T", ",", "?", ">", ",", "T", ">", "D", "lookupDao", "(", "ConnectionSource", "connectionSource", ",", "Class", "<", "T", ">", "clazz", ")", "{", "if", "(", "connectionSource", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"connectionSource argument cannot be null\"", ")", ";", "}", "ClassConnectionSource", "key", "=", "new", "ClassConnectionSource", "(", "connectionSource", ",", "clazz", ")", ";", "Dao", "<", "?", ",", "?", ">", "dao", "=", "lookupDao", "(", "key", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "D", "castDao", "=", "(", "D", ")", "dao", ";", "return", "castDao", ";", "}" ]
Helper method to lookup a DAO if it has already been associated with the class. Otherwise this returns null.
[ "Helper", "method", "to", "lookup", "a", "DAO", "if", "it", "has", "already", "been", "associated", "with", "the", "class", ".", "Otherwise", "this", "returns", "null", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L109-L118
160,120
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/DaoManager.java
DaoManager.lookupDao
public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } TableConfigConnectionSource key = new TableConfigConnectionSource(connectionSource, tableConfig); Dao<?, ?> dao = lookupDao(key); if (dao == null) { return null; } else { @SuppressWarnings("unchecked") D castDao = (D) dao; return castDao; } }
java
public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } TableConfigConnectionSource key = new TableConfigConnectionSource(connectionSource, tableConfig); Dao<?, ?> dao = lookupDao(key); if (dao == null) { return null; } else { @SuppressWarnings("unchecked") D castDao = (D) dao; return castDao; } }
[ "public", "synchronized", "static", "<", "D", "extends", "Dao", "<", "T", ",", "?", ">", ",", "T", ">", "D", "lookupDao", "(", "ConnectionSource", "connectionSource", ",", "DatabaseTableConfig", "<", "T", ">", "tableConfig", ")", "{", "if", "(", "connectionSource", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"connectionSource argument cannot be null\"", ")", ";", "}", "TableConfigConnectionSource", "key", "=", "new", "TableConfigConnectionSource", "(", "connectionSource", ",", "tableConfig", ")", ";", "Dao", "<", "?", ",", "?", ">", "dao", "=", "lookupDao", "(", "key", ")", ";", "if", "(", "dao", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "D", "castDao", "=", "(", "D", ")", "dao", ";", "return", "castDao", ";", "}", "}" ]
Helper method to lookup a DAO if it has already been associated with the table-config. Otherwise this returns null.
[ "Helper", "method", "to", "lookup", "a", "DAO", "if", "it", "has", "already", "been", "associated", "with", "the", "table", "-", "config", ".", "Otherwise", "this", "returns", "null", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L137-L151
160,121
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/DaoManager.java
DaoManager.registerDao
public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao); }
java
public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao); }
[ "public", "static", "synchronized", "void", "registerDao", "(", "ConnectionSource", "connectionSource", ",", "Dao", "<", "?", ",", "?", ">", "dao", ")", "{", "if", "(", "connectionSource", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"connectionSource argument cannot be null\"", ")", ";", "}", "addDaoToClassMap", "(", "new", "ClassConnectionSource", "(", "connectionSource", ",", "dao", ".", "getDataClass", "(", ")", ")", ",", "dao", ")", ";", "}" ]
Register the DAO with the cache. This will allow folks to build a DAO externally and then register so it can be used internally as necessary. <p> <b>NOTE:</b> By default this registers the DAO to be associated with the class that it uses. If you need to register multiple dao's that use different {@link DatabaseTableConfig}s then you should use {@link #registerDaoWithTableConfig(ConnectionSource, Dao)}. </p> <p> <b>NOTE:</b> You should maybe use the {@link DatabaseTable#daoClass()} and have the DaoManager construct the DAO if possible. </p>
[ "Register", "the", "DAO", "with", "the", "cache", ".", "This", "will", "allow", "folks", "to", "build", "a", "DAO", "externally", "and", "then", "register", "so", "it", "can", "be", "used", "internally", "as", "necessary", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L168-L173
160,122
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/DaoManager.java
DaoManager.unregisterDao
public static synchronized void unregisterDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } removeDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass())); }
java
public static synchronized void unregisterDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } removeDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass())); }
[ "public", "static", "synchronized", "void", "unregisterDao", "(", "ConnectionSource", "connectionSource", ",", "Dao", "<", "?", ",", "?", ">", "dao", ")", "{", "if", "(", "connectionSource", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"connectionSource argument cannot be null\"", ")", ";", "}", "removeDaoToClassMap", "(", "new", "ClassConnectionSource", "(", "connectionSource", ",", "dao", ".", "getDataClass", "(", ")", ")", ")", ";", "}" ]
Remove a DAO from the cache. This is necessary if we've registered it already but it throws an exception during configuration.
[ "Remove", "a", "DAO", "from", "the", "cache", ".", "This", "is", "necessary", "if", "we", "ve", "registered", "it", "already", "but", "it", "throws", "an", "exception", "during", "configuration", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L179-L184
160,123
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/DaoManager.java
DaoManager.clearDaoCache
public static synchronized void clearDaoCache() { if (classMap != null) { classMap.clear(); classMap = null; } if (tableConfigMap != null) { tableConfigMap.clear(); tableConfigMap = null; } }
java
public static synchronized void clearDaoCache() { if (classMap != null) { classMap.clear(); classMap = null; } if (tableConfigMap != null) { tableConfigMap.clear(); tableConfigMap = null; } }
[ "public", "static", "synchronized", "void", "clearDaoCache", "(", ")", "{", "if", "(", "classMap", "!=", "null", ")", "{", "classMap", ".", "clear", "(", ")", ";", "classMap", "=", "null", ";", "}", "if", "(", "tableConfigMap", "!=", "null", ")", "{", "tableConfigMap", ".", "clear", "(", ")", ";", "tableConfigMap", "=", "null", ";", "}", "}" ]
Clear out our DAO caches.
[ "Clear", "out", "our", "DAO", "caches", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L228-L237
160,124
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/DaoManager.java
DaoManager.addCachedDatabaseConfigs
public static synchronized void addCachedDatabaseConfigs(Collection<DatabaseTableConfig<?>> configs) { Map<Class<?>, DatabaseTableConfig<?>> newMap; if (configMap == null) { newMap = new HashMap<Class<?>, DatabaseTableConfig<?>>(); } else { newMap = new HashMap<Class<?>, DatabaseTableConfig<?>>(configMap); } for (DatabaseTableConfig<?> config : configs) { newMap.put(config.getDataClass(), config); logger.info("Loaded configuration for {}", config.getDataClass()); } configMap = newMap; }
java
public static synchronized void addCachedDatabaseConfigs(Collection<DatabaseTableConfig<?>> configs) { Map<Class<?>, DatabaseTableConfig<?>> newMap; if (configMap == null) { newMap = new HashMap<Class<?>, DatabaseTableConfig<?>>(); } else { newMap = new HashMap<Class<?>, DatabaseTableConfig<?>>(configMap); } for (DatabaseTableConfig<?> config : configs) { newMap.put(config.getDataClass(), config); logger.info("Loaded configuration for {}", config.getDataClass()); } configMap = newMap; }
[ "public", "static", "synchronized", "void", "addCachedDatabaseConfigs", "(", "Collection", "<", "DatabaseTableConfig", "<", "?", ">", ">", "configs", ")", "{", "Map", "<", "Class", "<", "?", ">", ",", "DatabaseTableConfig", "<", "?", ">", ">", "newMap", ";", "if", "(", "configMap", "==", "null", ")", "{", "newMap", "=", "new", "HashMap", "<", "Class", "<", "?", ">", ",", "DatabaseTableConfig", "<", "?", ">", ">", "(", ")", ";", "}", "else", "{", "newMap", "=", "new", "HashMap", "<", "Class", "<", "?", ">", ",", "DatabaseTableConfig", "<", "?", ">", ">", "(", "configMap", ")", ";", "}", "for", "(", "DatabaseTableConfig", "<", "?", ">", "config", ":", "configs", ")", "{", "newMap", ".", "put", "(", "config", ".", "getDataClass", "(", ")", ",", "config", ")", ";", "logger", ".", "info", "(", "\"Loaded configuration for {}\"", ",", "config", ".", "getDataClass", "(", ")", ")", ";", "}", "configMap", "=", "newMap", ";", "}" ]
This adds database table configurations to the internal cache which can be used to speed up DAO construction. This is especially true of Android and other mobile platforms.
[ "This", "adds", "database", "table", "configurations", "to", "the", "internal", "cache", "which", "can", "be", "used", "to", "speed", "up", "DAO", "construction", ".", "This", "is", "especially", "true", "of", "Android", "and", "other", "mobile", "platforms", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L243-L255
160,125
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/DaoManager.java
DaoManager.createDaoFromConfig
private static <D, T> D createDaoFromConfig(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { // no loaded configs if (configMap == null) { return null; } @SuppressWarnings("unchecked") DatabaseTableConfig<T> config = (DatabaseTableConfig<T>) configMap.get(clazz); // if we don't config information cached return null if (config == null) { return null; } // else create a DAO using configuration Dao<T, ?> configedDao = doCreateDao(connectionSource, config); @SuppressWarnings("unchecked") D castDao = (D) configedDao; return castDao; }
java
private static <D, T> D createDaoFromConfig(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { // no loaded configs if (configMap == null) { return null; } @SuppressWarnings("unchecked") DatabaseTableConfig<T> config = (DatabaseTableConfig<T>) configMap.get(clazz); // if we don't config information cached return null if (config == null) { return null; } // else create a DAO using configuration Dao<T, ?> configedDao = doCreateDao(connectionSource, config); @SuppressWarnings("unchecked") D castDao = (D) configedDao; return castDao; }
[ "private", "static", "<", "D", ",", "T", ">", "D", "createDaoFromConfig", "(", "ConnectionSource", "connectionSource", ",", "Class", "<", "T", ">", "clazz", ")", "throws", "SQLException", "{", "// no loaded configs", "if", "(", "configMap", "==", "null", ")", "{", "return", "null", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "DatabaseTableConfig", "<", "T", ">", "config", "=", "(", "DatabaseTableConfig", "<", "T", ">", ")", "configMap", ".", "get", "(", "clazz", ")", ";", "// if we don't config information cached return null", "if", "(", "config", "==", "null", ")", "{", "return", "null", ";", "}", "// else create a DAO using configuration", "Dao", "<", "T", ",", "?", ">", "configedDao", "=", "doCreateDao", "(", "connectionSource", ",", "config", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "D", "castDao", "=", "(", "D", ")", "configedDao", ";", "return", "castDao", ";", "}" ]
Creates the DAO if we have config information cached and caches the DAO.
[ "Creates", "the", "DAO", "if", "we", "have", "config", "information", "cached", "and", "caches", "the", "DAO", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L334-L352
160,126
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/ReferenceObjectCache.java
ReferenceObjectCache.cleanNullReferences
public <T> void cleanNullReferences(Class<T> clazz) { Map<Object, Reference<Object>> objectMap = getMapForClass(clazz); if (objectMap != null) { cleanMap(objectMap); } }
java
public <T> void cleanNullReferences(Class<T> clazz) { Map<Object, Reference<Object>> objectMap = getMapForClass(clazz); if (objectMap != null) { cleanMap(objectMap); } }
[ "public", "<", "T", ">", "void", "cleanNullReferences", "(", "Class", "<", "T", ">", "clazz", ")", "{", "Map", "<", "Object", ",", "Reference", "<", "Object", ">", ">", "objectMap", "=", "getMapForClass", "(", "clazz", ")", ";", "if", "(", "objectMap", "!=", "null", ")", "{", "cleanMap", "(", "objectMap", ")", ";", "}", "}" ]
Run through the map and remove any references that have been null'd out by the GC.
[ "Run", "through", "the", "map", "and", "remove", "any", "references", "that", "have", "been", "null", "d", "out", "by", "the", "GC", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/ReferenceObjectCache.java#L150-L155
160,127
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/ReferenceObjectCache.java
ReferenceObjectCache.cleanNullReferencesAll
public <T> void cleanNullReferencesAll() { for (Map<Object, Reference<Object>> objectMap : classMaps.values()) { cleanMap(objectMap); } }
java
public <T> void cleanNullReferencesAll() { for (Map<Object, Reference<Object>> objectMap : classMaps.values()) { cleanMap(objectMap); } }
[ "public", "<", "T", ">", "void", "cleanNullReferencesAll", "(", ")", "{", "for", "(", "Map", "<", "Object", ",", "Reference", "<", "Object", ">", ">", "objectMap", ":", "classMaps", ".", "values", "(", ")", ")", "{", "cleanMap", "(", "objectMap", ")", ";", "}", "}" ]
Run through all maps and remove any references that have been null'd out by the GC.
[ "Run", "through", "all", "maps", "and", "remove", "any", "references", "that", "have", "been", "null", "d", "out", "by", "the", "GC", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/ReferenceObjectCache.java#L160-L164
160,128
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/BaseForeignCollection.java
BaseForeignCollection.addAll
@Override public boolean addAll(Collection<? extends T> collection) { boolean changed = false; for (T data : collection) { try { if (addElement(data)) { changed = true; } } catch (SQLException e) { throw new IllegalStateException("Could not create data elements in dao", e); } } return changed; }
java
@Override public boolean addAll(Collection<? extends T> collection) { boolean changed = false; for (T data : collection) { try { if (addElement(data)) { changed = true; } } catch (SQLException e) { throw new IllegalStateException("Could not create data elements in dao", e); } } return changed; }
[ "@", "Override", "public", "boolean", "addAll", "(", "Collection", "<", "?", "extends", "T", ">", "collection", ")", "{", "boolean", "changed", "=", "false", ";", "for", "(", "T", "data", ":", "collection", ")", "{", "try", "{", "if", "(", "addElement", "(", "data", ")", ")", "{", "changed", "=", "true", ";", "}", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Could not create data elements in dao\"", ",", "e", ")", ";", "}", "}", "return", "changed", ";", "}" ]
Add the collection of elements to this collection. This will also them to the associated database table. @return Returns true if any of the items did not already exist in the collection otherwise false.
[ "Add", "the", "collection", "of", "elements", "to", "this", "collection", ".", "This", "will", "also", "them", "to", "the", "associated", "database", "table", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/BaseForeignCollection.java#L62-L75
160,129
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/BaseForeignCollection.java
BaseForeignCollection.retainAll
@Override public boolean retainAll(Collection<?> collection) { if (dao == null) { return false; } boolean changed = false; CloseableIterator<T> iterator = closeableIterator(); try { while (iterator.hasNext()) { T data = iterator.next(); if (!collection.contains(data)) { iterator.remove(); changed = true; } } return changed; } finally { IOUtils.closeQuietly(iterator); } }
java
@Override public boolean retainAll(Collection<?> collection) { if (dao == null) { return false; } boolean changed = false; CloseableIterator<T> iterator = closeableIterator(); try { while (iterator.hasNext()) { T data = iterator.next(); if (!collection.contains(data)) { iterator.remove(); changed = true; } } return changed; } finally { IOUtils.closeQuietly(iterator); } }
[ "@", "Override", "public", "boolean", "retainAll", "(", "Collection", "<", "?", ">", "collection", ")", "{", "if", "(", "dao", "==", "null", ")", "{", "return", "false", ";", "}", "boolean", "changed", "=", "false", ";", "CloseableIterator", "<", "T", ">", "iterator", "=", "closeableIterator", "(", ")", ";", "try", "{", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "T", "data", "=", "iterator", ".", "next", "(", ")", ";", "if", "(", "!", "collection", ".", "contains", "(", "data", ")", ")", "{", "iterator", ".", "remove", "(", ")", ";", "changed", "=", "true", ";", "}", "}", "return", "changed", ";", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "iterator", ")", ";", "}", "}" ]
Uses the iterator to run through the dao and retain only the items that are in the passed in collection. This will remove the items from the associated database table as well. @return Returns true of the collection was changed at all otherwise false.
[ "Uses", "the", "iterator", "to", "run", "through", "the", "dao", "and", "retain", "only", "the", "items", "that", "are", "in", "the", "passed", "in", "collection", ".", "This", "will", "remove", "the", "items", "from", "the", "associated", "database", "table", "as", "well", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/BaseForeignCollection.java#L103-L122
160,130
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/BaseForeignCollection.java
BaseForeignCollection.clear
@Override public void clear() { if (dao == null) { return; } CloseableIterator<T> iterator = closeableIterator(); try { while (iterator.hasNext()) { iterator.next(); iterator.remove(); } } finally { IOUtils.closeQuietly(iterator); } }
java
@Override public void clear() { if (dao == null) { return; } CloseableIterator<T> iterator = closeableIterator(); try { while (iterator.hasNext()) { iterator.next(); iterator.remove(); } } finally { IOUtils.closeQuietly(iterator); } }
[ "@", "Override", "public", "void", "clear", "(", ")", "{", "if", "(", "dao", "==", "null", ")", "{", "return", ";", "}", "CloseableIterator", "<", "T", ">", "iterator", "=", "closeableIterator", "(", ")", ";", "try", "{", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "iterator", ".", "next", "(", ")", ";", "iterator", ".", "remove", "(", ")", ";", "}", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "iterator", ")", ";", "}", "}" ]
Clears the collection and uses the iterator to run through the dao and delete all of the items in the collection from the associated database table. This is different from removing all of the elements in the table since this iterator is across just one item's foreign objects.
[ "Clears", "the", "collection", "and", "uses", "the", "iterator", "to", "run", "through", "the", "dao", "and", "delete", "all", "of", "the", "items", "in", "the", "collection", "from", "the", "associated", "database", "table", ".", "This", "is", "different", "from", "removing", "all", "of", "the", "elements", "in", "the", "table", "since", "this", "iterator", "is", "across", "just", "one", "item", "s", "foreign", "objects", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/BaseForeignCollection.java#L129-L143
160,131
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.and
public Where<T, ID> and() { ManyClause clause = new ManyClause(pop("AND"), ManyClause.AND_OPERATION); push(clause); addNeedsFuture(clause); return this; }
java
public Where<T, ID> and() { ManyClause clause = new ManyClause(pop("AND"), ManyClause.AND_OPERATION); push(clause); addNeedsFuture(clause); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "and", "(", ")", "{", "ManyClause", "clause", "=", "new", "ManyClause", "(", "pop", "(", "\"AND\"", ")", ",", "ManyClause", ".", "AND_OPERATION", ")", ";", "push", "(", "clause", ")", ";", "addNeedsFuture", "(", "clause", ")", ";", "return", "this", ";", "}" ]
AND operation which takes the previous clause and the next clause and AND's them together.
[ "AND", "operation", "which", "takes", "the", "previous", "clause", "and", "the", "next", "clause", "and", "AND", "s", "them", "together", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L129-L134
160,132
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.between
public Where<T, ID> between(String columnName, Object low, Object high) throws SQLException { addClause(new Between(columnName, findColumnFieldType(columnName), low, high)); return this; }
java
public Where<T, ID> between(String columnName, Object low, Object high) throws SQLException { addClause(new Between(columnName, findColumnFieldType(columnName), low, high)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "between", "(", "String", "columnName", ",", "Object", "low", ",", "Object", "high", ")", "throws", "SQLException", "{", "addClause", "(", "new", "Between", "(", "columnName", ",", "findColumnFieldType", "(", "columnName", ")", ",", "low", ",", "high", ")", ")", ";", "return", "this", ";", "}" ]
Add a BETWEEN clause so the column must be between the low and high parameters.
[ "Add", "a", "BETWEEN", "clause", "so", "the", "column", "must", "be", "between", "the", "low", "and", "high", "parameters", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L183-L186
160,133
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.eq
public Where<T, ID> eq(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.EQUAL_TO_OPERATION)); return this; }
java
public Where<T, ID> eq(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.EQUAL_TO_OPERATION)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "eq", "(", "String", "columnName", ",", "Object", "value", ")", "throws", "SQLException", "{", "addClause", "(", "new", "SimpleComparison", "(", "columnName", ",", "findColumnFieldType", "(", "columnName", ")", ",", "value", ",", "SimpleComparison", ".", "EQUAL_TO_OPERATION", ")", ")", ";", "return", "this", ";", "}" ]
Add a '=' clause so the column must be equal to the value.
[ "Add", "a", "=", "clause", "so", "the", "column", "must", "be", "equal", "to", "the", "value", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L191-L195
160,134
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.ge
public Where<T, ID> ge(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.GREATER_THAN_EQUAL_TO_OPERATION)); return this; }
java
public Where<T, ID> ge(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.GREATER_THAN_EQUAL_TO_OPERATION)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "ge", "(", "String", "columnName", ",", "Object", "value", ")", "throws", "SQLException", "{", "addClause", "(", "new", "SimpleComparison", "(", "columnName", ",", "findColumnFieldType", "(", "columnName", ")", ",", "value", ",", "SimpleComparison", ".", "GREATER_THAN_EQUAL_TO_OPERATION", ")", ")", ";", "return", "this", ";", "}" ]
Add a '&gt;=' clause so the column must be greater-than or equals-to the value.
[ "Add", "a", "&gt", ";", "=", "clause", "so", "the", "column", "must", "be", "greater", "-", "than", "or", "equals", "-", "to", "the", "value", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L200-L204
160,135
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.gt
public Where<T, ID> gt(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.GREATER_THAN_OPERATION)); return this; }
java
public Where<T, ID> gt(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.GREATER_THAN_OPERATION)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "gt", "(", "String", "columnName", ",", "Object", "value", ")", "throws", "SQLException", "{", "addClause", "(", "new", "SimpleComparison", "(", "columnName", ",", "findColumnFieldType", "(", "columnName", ")", ",", "value", ",", "SimpleComparison", ".", "GREATER_THAN_OPERATION", ")", ")", ";", "return", "this", ";", "}" ]
Add a '&gt;' clause so the column must be greater-than the value.
[ "Add", "a", "&gt", ";", "clause", "so", "the", "column", "must", "be", "greater", "-", "than", "the", "value", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L209-L213
160,136
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.in
public Where<T, ID> in(String columnName, Iterable<?> objects) throws SQLException { addClause(new In(columnName, findColumnFieldType(columnName), objects, true)); return this; }
java
public Where<T, ID> in(String columnName, Iterable<?> objects) throws SQLException { addClause(new In(columnName, findColumnFieldType(columnName), objects, true)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "in", "(", "String", "columnName", ",", "Iterable", "<", "?", ">", "objects", ")", "throws", "SQLException", "{", "addClause", "(", "new", "In", "(", "columnName", ",", "findColumnFieldType", "(", "columnName", ")", ",", "objects", ",", "true", ")", ")", ";", "return", "this", ";", "}" ]
Add a IN clause so the column must be equal-to one of the objects from the list passed in.
[ "Add", "a", "IN", "clause", "so", "the", "column", "must", "be", "equal", "-", "to", "one", "of", "the", "objects", "from", "the", "list", "passed", "in", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L218-L221
160,137
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.in
public Where<T, ID> in(String columnName, Object... objects) throws SQLException { return in(true, columnName, objects); }
java
public Where<T, ID> in(String columnName, Object... objects) throws SQLException { return in(true, columnName, objects); }
[ "public", "Where", "<", "T", ",", "ID", ">", "in", "(", "String", "columnName", ",", "Object", "...", "objects", ")", "throws", "SQLException", "{", "return", "in", "(", "true", ",", "columnName", ",", "objects", ")", ";", "}" ]
Add a IN clause so the column must be equal-to one of the objects passed in.
[ "Add", "a", "IN", "clause", "so", "the", "column", "must", "be", "equal", "-", "to", "one", "of", "the", "objects", "passed", "in", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L234-L236
160,138
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.exists
public Where<T, ID> exists(QueryBuilder<?, ?> subQueryBuilder) { // we do this to turn off the automatic addition of the ID column in the select column list subQueryBuilder.enableInnerQuery(); addClause(new Exists(new InternalQueryBuilderWrapper(subQueryBuilder))); return this; }
java
public Where<T, ID> exists(QueryBuilder<?, ?> subQueryBuilder) { // we do this to turn off the automatic addition of the ID column in the select column list subQueryBuilder.enableInnerQuery(); addClause(new Exists(new InternalQueryBuilderWrapper(subQueryBuilder))); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "exists", "(", "QueryBuilder", "<", "?", ",", "?", ">", "subQueryBuilder", ")", "{", "// we do this to turn off the automatic addition of the ID column in the select column list", "subQueryBuilder", ".", "enableInnerQuery", "(", ")", ";", "addClause", "(", "new", "Exists", "(", "new", "InternalQueryBuilderWrapper", "(", "subQueryBuilder", ")", ")", ")", ";", "return", "this", ";", "}" ]
Add a EXISTS clause with a sub-query inside of parenthesis. <p> <b>NOTE:</b> The sub-query will be prepared at the same time that the outside query is. </p>
[ "Add", "a", "EXISTS", "clause", "with", "a", "sub", "-", "query", "inside", "of", "parenthesis", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L273-L278
160,139
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.isNull
public Where<T, ID> isNull(String columnName) throws SQLException { addClause(new IsNull(columnName, findColumnFieldType(columnName))); return this; }
java
public Where<T, ID> isNull(String columnName) throws SQLException { addClause(new IsNull(columnName, findColumnFieldType(columnName))); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "isNull", "(", "String", "columnName", ")", "throws", "SQLException", "{", "addClause", "(", "new", "IsNull", "(", "columnName", ",", "findColumnFieldType", "(", "columnName", ")", ")", ")", ";", "return", "this", ";", "}" ]
Add a 'IS NULL' clause so the column must be null. '=' NULL does not work.
[ "Add", "a", "IS", "NULL", "clause", "so", "the", "column", "must", "be", "null", ".", "=", "NULL", "does", "not", "work", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L283-L286
160,140
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.isNotNull
public Where<T, ID> isNotNull(String columnName) throws SQLException { addClause(new IsNotNull(columnName, findColumnFieldType(columnName))); return this; }
java
public Where<T, ID> isNotNull(String columnName) throws SQLException { addClause(new IsNotNull(columnName, findColumnFieldType(columnName))); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "isNotNull", "(", "String", "columnName", ")", "throws", "SQLException", "{", "addClause", "(", "new", "IsNotNull", "(", "columnName", ",", "findColumnFieldType", "(", "columnName", ")", ")", ")", ";", "return", "this", ";", "}" ]
Add a 'IS NOT NULL' clause so the column must not be null. '&lt;&gt;' NULL does not work.
[ "Add", "a", "IS", "NOT", "NULL", "clause", "so", "the", "column", "must", "not", "be", "null", ".", "&lt", ";", "&gt", ";", "NULL", "does", "not", "work", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L291-L294
160,141
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.le
public Where<T, ID> le(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.LESS_THAN_EQUAL_TO_OPERATION)); return this; }
java
public Where<T, ID> le(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.LESS_THAN_EQUAL_TO_OPERATION)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "le", "(", "String", "columnName", ",", "Object", "value", ")", "throws", "SQLException", "{", "addClause", "(", "new", "SimpleComparison", "(", "columnName", ",", "findColumnFieldType", "(", "columnName", ")", ",", "value", ",", "SimpleComparison", ".", "LESS_THAN_EQUAL_TO_OPERATION", ")", ")", ";", "return", "this", ";", "}" ]
Add a '&lt;=' clause so the column must be less-than or equals-to the value.
[ "Add", "a", "&lt", ";", "=", "clause", "so", "the", "column", "must", "be", "less", "-", "than", "or", "equals", "-", "to", "the", "value", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L299-L303
160,142
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.lt
public Where<T, ID> lt(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.LESS_THAN_OPERATION)); return this; }
java
public Where<T, ID> lt(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.LESS_THAN_OPERATION)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "lt", "(", "String", "columnName", ",", "Object", "value", ")", "throws", "SQLException", "{", "addClause", "(", "new", "SimpleComparison", "(", "columnName", ",", "findColumnFieldType", "(", "columnName", ")", ",", "value", ",", "SimpleComparison", ".", "LESS_THAN_OPERATION", ")", ")", ";", "return", "this", ";", "}" ]
Add a '&lt;' clause so the column must be less-than the value.
[ "Add", "a", "&lt", ";", "clause", "so", "the", "column", "must", "be", "less", "-", "than", "the", "value", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L308-L312
160,143
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.like
public Where<T, ID> like(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.LIKE_OPERATION)); return this; }
java
public Where<T, ID> like(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.LIKE_OPERATION)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "like", "(", "String", "columnName", ",", "Object", "value", ")", "throws", "SQLException", "{", "addClause", "(", "new", "SimpleComparison", "(", "columnName", ",", "findColumnFieldType", "(", "columnName", ")", ",", "value", ",", "SimpleComparison", ".", "LIKE_OPERATION", ")", ")", ";", "return", "this", ";", "}" ]
Add a LIKE clause so the column must mach the value using '%' patterns.
[ "Add", "a", "LIKE", "clause", "so", "the", "column", "must", "mach", "the", "value", "using", "%", "patterns", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L317-L321
160,144
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.ne
public Where<T, ID> ne(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.NOT_EQUAL_TO_OPERATION)); return this; }
java
public Where<T, ID> ne(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.NOT_EQUAL_TO_OPERATION)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "ne", "(", "String", "columnName", ",", "Object", "value", ")", "throws", "SQLException", "{", "addClause", "(", "new", "SimpleComparison", "(", "columnName", ",", "findColumnFieldType", "(", "columnName", ")", ",", "value", ",", "SimpleComparison", ".", "NOT_EQUAL_TO_OPERATION", ")", ")", ";", "return", "this", ";", "}" ]
Add a '&lt;&gt;' clause so the column must be not-equal-to the value.
[ "Add", "a", "&lt", ";", "&gt", ";", "clause", "so", "the", "column", "must", "be", "not", "-", "equal", "-", "to", "the", "value", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L326-L330
160,145
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.not
public Where<T, ID> not() { /* * Special circumstance here when we have a needs future with a not. Something like and().not().like(...). In * this case we satisfy the and()'s future as the not() but the not() becomes the new needs-future. */ Not not = new Not(); addClause(not); addNeedsFuture(not); return this; }
java
public Where<T, ID> not() { /* * Special circumstance here when we have a needs future with a not. Something like and().not().like(...). In * this case we satisfy the and()'s future as the not() but the not() becomes the new needs-future. */ Not not = new Not(); addClause(not); addNeedsFuture(not); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "not", "(", ")", "{", "/*\n\t\t * Special circumstance here when we have a needs future with a not. Something like and().not().like(...). In\n\t\t * this case we satisfy the and()'s future as the not() but the not() becomes the new needs-future.\n\t\t */", "Not", "not", "=", "new", "Not", "(", ")", ";", "addClause", "(", "not", ")", ";", "addNeedsFuture", "(", "not", ")", ";", "return", "this", ";", "}" ]
Used to NOT the next clause specified.
[ "Used", "to", "NOT", "the", "next", "clause", "specified", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L335-L344
160,146
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.not
public Where<T, ID> not(Where<T, ID> comparison) { addClause(new Not(pop("NOT"))); return this; }
java
public Where<T, ID> not(Where<T, ID> comparison) { addClause(new Not(pop("NOT"))); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "not", "(", "Where", "<", "T", ",", "ID", ">", "comparison", ")", "{", "addClause", "(", "new", "Not", "(", "pop", "(", "\"NOT\"", ")", ")", ")", ";", "return", "this", ";", "}" ]
Used to NOT the argument clause specified.
[ "Used", "to", "NOT", "the", "argument", "clause", "specified", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L349-L352
160,147
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.or
public Where<T, ID> or() { ManyClause clause = new ManyClause(pop("OR"), ManyClause.OR_OPERATION); push(clause); addNeedsFuture(clause); return this; }
java
public Where<T, ID> or() { ManyClause clause = new ManyClause(pop("OR"), ManyClause.OR_OPERATION); push(clause); addNeedsFuture(clause); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "or", "(", ")", "{", "ManyClause", "clause", "=", "new", "ManyClause", "(", "pop", "(", "\"OR\"", ")", ",", "ManyClause", ".", "OR_OPERATION", ")", ";", "push", "(", "clause", ")", ";", "addNeedsFuture", "(", "clause", ")", ";", "return", "this", ";", "}" ]
OR operation which takes the previous clause and the next clause and OR's them together.
[ "OR", "operation", "which", "takes", "the", "previous", "clause", "and", "the", "next", "clause", "and", "OR", "s", "them", "together", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L357-L362
160,148
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.or
public Where<T, ID> or(Where<T, ID> left, Where<T, ID> right, Where<T, ID>... others) { Clause[] clauses = buildClauseArray(others, "OR"); Clause secondClause = pop("OR"); Clause firstClause = pop("OR"); addClause(new ManyClause(firstClause, secondClause, clauses, ManyClause.OR_OPERATION)); return this; }
java
public Where<T, ID> or(Where<T, ID> left, Where<T, ID> right, Where<T, ID>... others) { Clause[] clauses = buildClauseArray(others, "OR"); Clause secondClause = pop("OR"); Clause firstClause = pop("OR"); addClause(new ManyClause(firstClause, secondClause, clauses, ManyClause.OR_OPERATION)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "or", "(", "Where", "<", "T", ",", "ID", ">", "left", ",", "Where", "<", "T", ",", "ID", ">", "right", ",", "Where", "<", "T", ",", "ID", ">", "...", "others", ")", "{", "Clause", "[", "]", "clauses", "=", "buildClauseArray", "(", "others", ",", "\"OR\"", ")", ";", "Clause", "secondClause", "=", "pop", "(", "\"OR\"", ")", ";", "Clause", "firstClause", "=", "pop", "(", "\"OR\"", ")", ";", "addClause", "(", "new", "ManyClause", "(", "firstClause", ",", "secondClause", ",", "clauses", ",", "ManyClause", ".", "OR_OPERATION", ")", ")", ";", "return", "this", ";", "}" ]
OR operation which takes 2 arguments and OR's them together. <p> <b>NOTE:</b> There is no guarantee of the order of the clauses that are generated in the final query. </p> <p> <b>NOTE:</b> I can't remove the generics code warning that can be associated with this method. You can instead use the {@link #or(int)} method. </p>
[ "OR", "operation", "which", "takes", "2", "arguments", "and", "OR", "s", "them", "together", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L375-L381
160,149
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.idEq
public Where<T, ID> idEq(ID id) throws SQLException { if (idColumnName == null) { throw new SQLException("Object has no id column specified"); } addClause(new SimpleComparison(idColumnName, idFieldType, id, SimpleComparison.EQUAL_TO_OPERATION)); return this; }
java
public Where<T, ID> idEq(ID id) throws SQLException { if (idColumnName == null) { throw new SQLException("Object has no id column specified"); } addClause(new SimpleComparison(idColumnName, idFieldType, id, SimpleComparison.EQUAL_TO_OPERATION)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "idEq", "(", "ID", "id", ")", "throws", "SQLException", "{", "if", "(", "idColumnName", "==", "null", ")", "{", "throw", "new", "SQLException", "(", "\"Object has no id column specified\"", ")", ";", "}", "addClause", "(", "new", "SimpleComparison", "(", "idColumnName", ",", "idFieldType", ",", "id", ",", "SimpleComparison", ".", "EQUAL_TO_OPERATION", ")", ")", ";", "return", "this", ";", "}" ]
Add a clause where the ID is equal to the argument.
[ "Add", "a", "clause", "where", "the", "ID", "is", "equal", "to", "the", "argument", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L411-L417
160,150
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.idEq
public <OD> Where<T, ID> idEq(Dao<OD, ?> dataDao, OD data) throws SQLException { if (idColumnName == null) { throw new SQLException("Object has no id column specified"); } addClause(new SimpleComparison(idColumnName, idFieldType, dataDao.extractId(data), SimpleComparison.EQUAL_TO_OPERATION)); return this; }
java
public <OD> Where<T, ID> idEq(Dao<OD, ?> dataDao, OD data) throws SQLException { if (idColumnName == null) { throw new SQLException("Object has no id column specified"); } addClause(new SimpleComparison(idColumnName, idFieldType, dataDao.extractId(data), SimpleComparison.EQUAL_TO_OPERATION)); return this; }
[ "public", "<", "OD", ">", "Where", "<", "T", ",", "ID", ">", "idEq", "(", "Dao", "<", "OD", ",", "?", ">", "dataDao", ",", "OD", "data", ")", "throws", "SQLException", "{", "if", "(", "idColumnName", "==", "null", ")", "{", "throw", "new", "SQLException", "(", "\"Object has no id column specified\"", ")", ";", "}", "addClause", "(", "new", "SimpleComparison", "(", "idColumnName", ",", "idFieldType", ",", "dataDao", ".", "extractId", "(", "data", ")", ",", "SimpleComparison", ".", "EQUAL_TO_OPERATION", ")", ")", ";", "return", "this", ";", "}" ]
Add a clause where the ID is from an existing object.
[ "Add", "a", "clause", "where", "the", "ID", "is", "from", "an", "existing", "object", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L422-L429
160,151
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.raw
public Where<T, ID> raw(String rawStatement, ArgumentHolder... args) { for (ArgumentHolder arg : args) { String columnName = arg.getColumnName(); if (columnName == null) { if (arg.getSqlType() == null) { throw new IllegalArgumentException("Either the column name or SqlType must be set on each argument"); } } else { arg.setMetaInfo(findColumnFieldType(columnName)); } } addClause(new Raw(rawStatement, args)); return this; }
java
public Where<T, ID> raw(String rawStatement, ArgumentHolder... args) { for (ArgumentHolder arg : args) { String columnName = arg.getColumnName(); if (columnName == null) { if (arg.getSqlType() == null) { throw new IllegalArgumentException("Either the column name or SqlType must be set on each argument"); } } else { arg.setMetaInfo(findColumnFieldType(columnName)); } } addClause(new Raw(rawStatement, args)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "raw", "(", "String", "rawStatement", ",", "ArgumentHolder", "...", "args", ")", "{", "for", "(", "ArgumentHolder", "arg", ":", "args", ")", "{", "String", "columnName", "=", "arg", ".", "getColumnName", "(", ")", ";", "if", "(", "columnName", "==", "null", ")", "{", "if", "(", "arg", ".", "getSqlType", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Either the column name or SqlType must be set on each argument\"", ")", ";", "}", "}", "else", "{", "arg", ".", "setMetaInfo", "(", "findColumnFieldType", "(", "columnName", ")", ")", ";", "}", "}", "addClause", "(", "new", "Raw", "(", "rawStatement", ",", "args", ")", ")", ";", "return", "this", ";", "}" ]
Add a raw statement as part of the where that can be anything that the database supports. Using more structured methods is recommended but this gives more control over the query and allows you to utilize database specific features. @param rawStatement The statement that we should insert into the WHERE. @param args Optional arguments that correspond to any ? specified in the rawStatement. Each of the arguments must have either the corresponding columnName or the sql-type set. <b>WARNING,</b> you cannot use the {@code SelectArg("columnName")} constructor since that sets the _value_, not the name. Use {@code new SelectArg("column-name", null);}.
[ "Add", "a", "raw", "statement", "as", "part", "of", "the", "where", "that", "can", "be", "anything", "that", "the", "database", "supports", ".", "Using", "more", "structured", "methods", "is", "recommended", "but", "this", "gives", "more", "control", "over", "the", "query", "and", "allows", "you", "to", "utilize", "database", "specific", "features", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L445-L458
160,152
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.rawComparison
public Where<T, ID> rawComparison(String columnName, String rawOperator, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, rawOperator)); return this; }
java
public Where<T, ID> rawComparison(String columnName, String rawOperator, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, rawOperator)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "rawComparison", "(", "String", "columnName", ",", "String", "rawOperator", ",", "Object", "value", ")", "throws", "SQLException", "{", "addClause", "(", "new", "SimpleComparison", "(", "columnName", ",", "findColumnFieldType", "(", "columnName", ")", ",", "value", ",", "rawOperator", ")", ")", ";", "return", "this", ";", "}" ]
Make a comparison where the operator is specified by the caller. It is up to the caller to specify an appropriate operator for the database and that it be formatted correctly.
[ "Make", "a", "comparison", "where", "the", "operator", "is", "specified", "by", "the", "caller", ".", "It", "is", "up", "to", "the", "caller", "to", "specify", "an", "appropriate", "operator", "for", "the", "database", "and", "that", "it", "be", "formatted", "correctly", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L464-L467
160,153
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.reset
public Where<T, ID> reset() { for (int i = 0; i < clauseStackLevel; i++) { // help with gc clauseStack[i] = null; } clauseStackLevel = 0; return this; }
java
public Where<T, ID> reset() { for (int i = 0; i < clauseStackLevel; i++) { // help with gc clauseStack[i] = null; } clauseStackLevel = 0; return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "reset", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "clauseStackLevel", ";", "i", "++", ")", "{", "// help with gc", "clauseStack", "[", "i", "]", "=", "null", ";", "}", "clauseStackLevel", "=", "0", ";", "return", "this", ";", "}" ]
Reset the Where object so it can be re-used.
[ "Reset", "the", "Where", "object", "so", "it", "can", "be", "re", "-", "used", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L521-L528
160,154
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.getStatement
public String getStatement() throws SQLException { StringBuilder sb = new StringBuilder(); appendSql(null, sb, new ArrayList<ArgumentHolder>()); return sb.toString(); }
java
public String getStatement() throws SQLException { StringBuilder sb = new StringBuilder(); appendSql(null, sb, new ArrayList<ArgumentHolder>()); return sb.toString(); }
[ "public", "String", "getStatement", "(", ")", "throws", "SQLException", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "appendSql", "(", "null", ",", "sb", ",", "new", "ArrayList", "<", "ArgumentHolder", ">", "(", ")", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns the associated SQL WHERE statement.
[ "Returns", "the", "associated", "SQL", "WHERE", "statement", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L533-L537
160,155
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/mapped/MappedUpdateId.java
MappedUpdateId.execute
public int execute(DatabaseConnection databaseConnection, T data, ID newId, ObjectCache objectCache) throws SQLException { try { // the arguments are the new-id and old-id Object[] args = new Object[] { convertIdToFieldObject(newId), extractIdToFieldObject(data) }; int rowC = databaseConnection.update(statement, args, argFieldTypes); if (rowC > 0) { if (objectCache != null) { Object oldId = idField.extractJavaFieldValue(data); T obj = objectCache.updateId(clazz, oldId, newId); if (obj != null && obj != data) { // if our cached value is not the data that will be updated then we need to update it specially idField.assignField(connectionSource, obj, newId, false, objectCache); } } // adjust the object to assign the new id idField.assignField(connectionSource, data, newId, false, objectCache); } logger.debug("updating-id with statement '{}' and {} args, changed {} rows", statement, args.length, rowC); if (args.length > 0) { // need to do the cast otherwise we only print the first object in args logger.trace("updating-id arguments: {}", (Object) args); } return rowC; } catch (SQLException e) { throw SqlExceptionUtil.create("Unable to run update-id stmt on object " + data + ": " + statement, e); } }
java
public int execute(DatabaseConnection databaseConnection, T data, ID newId, ObjectCache objectCache) throws SQLException { try { // the arguments are the new-id and old-id Object[] args = new Object[] { convertIdToFieldObject(newId), extractIdToFieldObject(data) }; int rowC = databaseConnection.update(statement, args, argFieldTypes); if (rowC > 0) { if (objectCache != null) { Object oldId = idField.extractJavaFieldValue(data); T obj = objectCache.updateId(clazz, oldId, newId); if (obj != null && obj != data) { // if our cached value is not the data that will be updated then we need to update it specially idField.assignField(connectionSource, obj, newId, false, objectCache); } } // adjust the object to assign the new id idField.assignField(connectionSource, data, newId, false, objectCache); } logger.debug("updating-id with statement '{}' and {} args, changed {} rows", statement, args.length, rowC); if (args.length > 0) { // need to do the cast otherwise we only print the first object in args logger.trace("updating-id arguments: {}", (Object) args); } return rowC; } catch (SQLException e) { throw SqlExceptionUtil.create("Unable to run update-id stmt on object " + data + ": " + statement, e); } }
[ "public", "int", "execute", "(", "DatabaseConnection", "databaseConnection", ",", "T", "data", ",", "ID", "newId", ",", "ObjectCache", "objectCache", ")", "throws", "SQLException", "{", "try", "{", "// the arguments are the new-id and old-id", "Object", "[", "]", "args", "=", "new", "Object", "[", "]", "{", "convertIdToFieldObject", "(", "newId", ")", ",", "extractIdToFieldObject", "(", "data", ")", "}", ";", "int", "rowC", "=", "databaseConnection", ".", "update", "(", "statement", ",", "args", ",", "argFieldTypes", ")", ";", "if", "(", "rowC", ">", "0", ")", "{", "if", "(", "objectCache", "!=", "null", ")", "{", "Object", "oldId", "=", "idField", ".", "extractJavaFieldValue", "(", "data", ")", ";", "T", "obj", "=", "objectCache", ".", "updateId", "(", "clazz", ",", "oldId", ",", "newId", ")", ";", "if", "(", "obj", "!=", "null", "&&", "obj", "!=", "data", ")", "{", "// if our cached value is not the data that will be updated then we need to update it specially", "idField", ".", "assignField", "(", "connectionSource", ",", "obj", ",", "newId", ",", "false", ",", "objectCache", ")", ";", "}", "}", "// adjust the object to assign the new id", "idField", ".", "assignField", "(", "connectionSource", ",", "data", ",", "newId", ",", "false", ",", "objectCache", ")", ";", "}", "logger", ".", "debug", "(", "\"updating-id with statement '{}' and {} args, changed {} rows\"", ",", "statement", ",", "args", ".", "length", ",", "rowC", ")", ";", "if", "(", "args", ".", "length", ">", "0", ")", "{", "// need to do the cast otherwise we only print the first object in args", "logger", ".", "trace", "(", "\"updating-id arguments: {}\"", ",", "(", "Object", ")", "args", ")", ";", "}", "return", "rowC", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "SqlExceptionUtil", ".", "create", "(", "\"Unable to run update-id stmt on object \"", "+", "data", "+", "\": \"", "+", "statement", ",", "e", ")", ";", "}", "}" ]
Update the id field of the object in the database.
[ "Update", "the", "id", "field", "of", "the", "object", "in", "the", "database", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/mapped/MappedUpdateId.java#L27-L54
160,156
j256/ormlite-core
src/main/java/com/j256/ormlite/field/DatabaseFieldConfigLoader.java
DatabaseFieldConfigLoader.fromReader
public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Could not read DatabaseFieldConfig from stream", e); } if (line == null) { break; } // we do this so we can support multiple class configs per file if (line.equals(CONFIG_FILE_END_MARKER)) { break; } // skip empty lines or comments if (line.length() == 0 || line.startsWith("#") || line.equals(CONFIG_FILE_START_MARKER)) { continue; } String[] parts = line.split("=", -2); if (parts.length != 2) { throw new SQLException("DatabaseFieldConfig reading from stream cannot parse line: " + line); } readField(config, parts[0], parts[1]); anything = true; } // if we got any config lines then we return the config if (anything) { return config; } else { // otherwise we return null for none return null; } }
java
public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Could not read DatabaseFieldConfig from stream", e); } if (line == null) { break; } // we do this so we can support multiple class configs per file if (line.equals(CONFIG_FILE_END_MARKER)) { break; } // skip empty lines or comments if (line.length() == 0 || line.startsWith("#") || line.equals(CONFIG_FILE_START_MARKER)) { continue; } String[] parts = line.split("=", -2); if (parts.length != 2) { throw new SQLException("DatabaseFieldConfig reading from stream cannot parse line: " + line); } readField(config, parts[0], parts[1]); anything = true; } // if we got any config lines then we return the config if (anything) { return config; } else { // otherwise we return null for none return null; } }
[ "public", "static", "DatabaseFieldConfig", "fromReader", "(", "BufferedReader", "reader", ")", "throws", "SQLException", "{", "DatabaseFieldConfig", "config", "=", "new", "DatabaseFieldConfig", "(", ")", ";", "boolean", "anything", "=", "false", ";", "while", "(", "true", ")", "{", "String", "line", ";", "try", "{", "line", "=", "reader", ".", "readLine", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "SqlExceptionUtil", ".", "create", "(", "\"Could not read DatabaseFieldConfig from stream\"", ",", "e", ")", ";", "}", "if", "(", "line", "==", "null", ")", "{", "break", ";", "}", "// we do this so we can support multiple class configs per file", "if", "(", "line", ".", "equals", "(", "CONFIG_FILE_END_MARKER", ")", ")", "{", "break", ";", "}", "// skip empty lines or comments", "if", "(", "line", ".", "length", "(", ")", "==", "0", "||", "line", ".", "startsWith", "(", "\"#\"", ")", "||", "line", ".", "equals", "(", "CONFIG_FILE_START_MARKER", ")", ")", "{", "continue", ";", "}", "String", "[", "]", "parts", "=", "line", ".", "split", "(", "\"=\"", ",", "-", "2", ")", ";", "if", "(", "parts", ".", "length", "!=", "2", ")", "{", "throw", "new", "SQLException", "(", "\"DatabaseFieldConfig reading from stream cannot parse line: \"", "+", "line", ")", ";", "}", "readField", "(", "config", ",", "parts", "[", "0", "]", ",", "parts", "[", "1", "]", ")", ";", "anything", "=", "true", ";", "}", "// if we got any config lines then we return the config", "if", "(", "anything", ")", "{", "return", "config", ";", "}", "else", "{", "// otherwise we return null for none", "return", "null", ";", "}", "}" ]
Load a configuration in from a text file. @return A config if any of the fields were set otherwise null on EOF.
[ "Load", "a", "configuration", "in", "from", "a", "text", "file", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/field/DatabaseFieldConfigLoader.java#L30-L65
160,157
j256/ormlite-core
src/main/java/com/j256/ormlite/field/DatabaseFieldConfigLoader.java
DatabaseFieldConfigLoader.write
public static void write(BufferedWriter writer, DatabaseFieldConfig config, String tableName) throws SQLException { try { writeConfig(writer, config, tableName); } catch (IOException e) { throw SqlExceptionUtil.create("Could not write config to writer", e); } }
java
public static void write(BufferedWriter writer, DatabaseFieldConfig config, String tableName) throws SQLException { try { writeConfig(writer, config, tableName); } catch (IOException e) { throw SqlExceptionUtil.create("Could not write config to writer", e); } }
[ "public", "static", "void", "write", "(", "BufferedWriter", "writer", ",", "DatabaseFieldConfig", "config", ",", "String", "tableName", ")", "throws", "SQLException", "{", "try", "{", "writeConfig", "(", "writer", ",", "config", ",", "tableName", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "SqlExceptionUtil", ".", "create", "(", "\"Could not write config to writer\"", ",", "e", ")", ";", "}", "}" ]
Write the configuration to a buffered writer.
[ "Write", "the", "configuration", "to", "a", "buffered", "writer", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/field/DatabaseFieldConfigLoader.java#L70-L76
160,158
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/UpdateBuilder.java
UpdateBuilder.updateColumnValue
public UpdateBuilder<T, ID> updateColumnValue(String columnName, Object value) throws SQLException { FieldType fieldType = verifyColumnName(columnName); if (fieldType.isForeignCollection()) { throw new SQLException("Can't update foreign colletion field: " + columnName); } addUpdateColumnToList(columnName, new SetValue(columnName, fieldType, value)); return this; }
java
public UpdateBuilder<T, ID> updateColumnValue(String columnName, Object value) throws SQLException { FieldType fieldType = verifyColumnName(columnName); if (fieldType.isForeignCollection()) { throw new SQLException("Can't update foreign colletion field: " + columnName); } addUpdateColumnToList(columnName, new SetValue(columnName, fieldType, value)); return this; }
[ "public", "UpdateBuilder", "<", "T", ",", "ID", ">", "updateColumnValue", "(", "String", "columnName", ",", "Object", "value", ")", "throws", "SQLException", "{", "FieldType", "fieldType", "=", "verifyColumnName", "(", "columnName", ")", ";", "if", "(", "fieldType", ".", "isForeignCollection", "(", ")", ")", "{", "throw", "new", "SQLException", "(", "\"Can't update foreign colletion field: \"", "+", "columnName", ")", ";", "}", "addUpdateColumnToList", "(", "columnName", ",", "new", "SetValue", "(", "columnName", ",", "fieldType", ",", "value", ")", ")", ";", "return", "this", ";", "}" ]
Add a column to be set to a value for UPDATE statements. This will generate something like columnName = 'value' with the value escaped if necessary.
[ "Add", "a", "column", "to", "be", "set", "to", "a", "value", "for", "UPDATE", "statements", ".", "This", "will", "generate", "something", "like", "columnName", "=", "value", "with", "the", "value", "escaped", "if", "necessary", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/UpdateBuilder.java#L46-L53
160,159
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/UpdateBuilder.java
UpdateBuilder.updateColumnExpression
public UpdateBuilder<T, ID> updateColumnExpression(String columnName, String expression) throws SQLException { FieldType fieldType = verifyColumnName(columnName); if (fieldType.isForeignCollection()) { throw new SQLException("Can't update foreign colletion field: " + columnName); } addUpdateColumnToList(columnName, new SetExpression(columnName, fieldType, expression)); return this; }
java
public UpdateBuilder<T, ID> updateColumnExpression(String columnName, String expression) throws SQLException { FieldType fieldType = verifyColumnName(columnName); if (fieldType.isForeignCollection()) { throw new SQLException("Can't update foreign colletion field: " + columnName); } addUpdateColumnToList(columnName, new SetExpression(columnName, fieldType, expression)); return this; }
[ "public", "UpdateBuilder", "<", "T", ",", "ID", ">", "updateColumnExpression", "(", "String", "columnName", ",", "String", "expression", ")", "throws", "SQLException", "{", "FieldType", "fieldType", "=", "verifyColumnName", "(", "columnName", ")", ";", "if", "(", "fieldType", ".", "isForeignCollection", "(", ")", ")", "{", "throw", "new", "SQLException", "(", "\"Can't update foreign colletion field: \"", "+", "columnName", ")", ";", "}", "addUpdateColumnToList", "(", "columnName", ",", "new", "SetExpression", "(", "columnName", ",", "fieldType", ",", "expression", ")", ")", ";", "return", "this", ";", "}" ]
Add a column to be set to a value for UPDATE statements. This will generate something like 'columnName = expression' where the expression is built by the caller. <p> The expression should have any strings escaped using the {@link #escapeValue(String)} or {@link #escapeValue(StringBuilder, String)} methods and should have any column names escaped using the {@link #escapeColumnName(String)} or {@link #escapeColumnName(StringBuilder, String)} methods. </p>
[ "Add", "a", "column", "to", "be", "set", "to", "a", "value", "for", "UPDATE", "statements", ".", "This", "will", "generate", "something", "like", "columnName", "=", "expression", "where", "the", "expression", "is", "built", "by", "the", "caller", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/UpdateBuilder.java#L65-L72
160,160
j256/ormlite-core
src/main/java/com/j256/ormlite/table/DatabaseTableConfig.java
DatabaseTableConfig.initialize
public void initialize() { if (dataClass == null) { throw new IllegalStateException("dataClass was never set on " + getClass().getSimpleName()); } if (tableName == null) { tableName = extractTableName(databaseType, dataClass); } }
java
public void initialize() { if (dataClass == null) { throw new IllegalStateException("dataClass was never set on " + getClass().getSimpleName()); } if (tableName == null) { tableName = extractTableName(databaseType, dataClass); } }
[ "public", "void", "initialize", "(", ")", "{", "if", "(", "dataClass", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"dataClass was never set on \"", "+", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "}", "if", "(", "tableName", "==", "null", ")", "{", "tableName", "=", "extractTableName", "(", "databaseType", ",", "dataClass", ")", ";", "}", "}" ]
Initialize the class if this is being called with Spring.
[ "Initialize", "the", "class", "if", "this", "is", "being", "called", "with", "Spring", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/table/DatabaseTableConfig.java#L80-L87
160,161
j256/ormlite-core
src/main/java/com/j256/ormlite/table/DatabaseTableConfig.java
DatabaseTableConfig.extractFieldTypes
public void extractFieldTypes(DatabaseType databaseType) throws SQLException { if (fieldTypes == null) { if (fieldConfigs == null) { fieldTypes = extractFieldTypes(databaseType, dataClass, tableName); } else { fieldTypes = convertFieldConfigs(databaseType, tableName, fieldConfigs); } } }
java
public void extractFieldTypes(DatabaseType databaseType) throws SQLException { if (fieldTypes == null) { if (fieldConfigs == null) { fieldTypes = extractFieldTypes(databaseType, dataClass, tableName); } else { fieldTypes = convertFieldConfigs(databaseType, tableName, fieldConfigs); } } }
[ "public", "void", "extractFieldTypes", "(", "DatabaseType", "databaseType", ")", "throws", "SQLException", "{", "if", "(", "fieldTypes", "==", "null", ")", "{", "if", "(", "fieldConfigs", "==", "null", ")", "{", "fieldTypes", "=", "extractFieldTypes", "(", "databaseType", ",", "dataClass", ",", "tableName", ")", ";", "}", "else", "{", "fieldTypes", "=", "convertFieldConfigs", "(", "databaseType", ",", "tableName", ",", "fieldConfigs", ")", ";", "}", "}", "}" ]
Extract the field types from the fieldConfigs if they have not already been configured.
[ "Extract", "the", "field", "types", "from", "the", "fieldConfigs", "if", "they", "have", "not", "already", "been", "configured", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/table/DatabaseTableConfig.java#L123-L131
160,162
j256/ormlite-core
src/main/java/com/j256/ormlite/table/DatabaseTableConfig.java
DatabaseTableConfig.fromClass
public static <T> DatabaseTableConfig<T> fromClass(DatabaseType databaseType, Class<T> clazz) throws SQLException { String tableName = extractTableName(databaseType, clazz); if (databaseType.isEntityNamesMustBeUpCase()) { tableName = databaseType.upCaseEntityName(tableName); } return new DatabaseTableConfig<T>(databaseType, clazz, tableName, extractFieldTypes(databaseType, clazz, tableName)); }
java
public static <T> DatabaseTableConfig<T> fromClass(DatabaseType databaseType, Class<T> clazz) throws SQLException { String tableName = extractTableName(databaseType, clazz); if (databaseType.isEntityNamesMustBeUpCase()) { tableName = databaseType.upCaseEntityName(tableName); } return new DatabaseTableConfig<T>(databaseType, clazz, tableName, extractFieldTypes(databaseType, clazz, tableName)); }
[ "public", "static", "<", "T", ">", "DatabaseTableConfig", "<", "T", ">", "fromClass", "(", "DatabaseType", "databaseType", ",", "Class", "<", "T", ">", "clazz", ")", "throws", "SQLException", "{", "String", "tableName", "=", "extractTableName", "(", "databaseType", ",", "clazz", ")", ";", "if", "(", "databaseType", ".", "isEntityNamesMustBeUpCase", "(", ")", ")", "{", "tableName", "=", "databaseType", ".", "upCaseEntityName", "(", "tableName", ")", ";", "}", "return", "new", "DatabaseTableConfig", "<", "T", ">", "(", "databaseType", ",", "clazz", ",", "tableName", ",", "extractFieldTypes", "(", "databaseType", ",", "clazz", ",", "tableName", ")", ")", ";", "}" ]
Extract the DatabaseTableConfig for a particular class by looking for class and field annotations. This is used by internal classes to configure a class.
[ "Extract", "the", "DatabaseTableConfig", "for", "a", "particular", "class", "by", "looking", "for", "class", "and", "field", "annotations", ".", "This", "is", "used", "by", "internal", "classes", "to", "configure", "a", "class", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/table/DatabaseTableConfig.java#L167-L174
160,163
j256/ormlite-core
src/main/java/com/j256/ormlite/table/DatabaseTableConfig.java
DatabaseTableConfig.extractTableName
public static <T> String extractTableName(DatabaseType databaseType, Class<T> clazz) { DatabaseTable databaseTable = clazz.getAnnotation(DatabaseTable.class); String name = null; if (databaseTable != null && databaseTable.tableName() != null && databaseTable.tableName().length() > 0) { name = databaseTable.tableName(); } if (name == null && javaxPersistenceConfigurer != null) { name = javaxPersistenceConfigurer.getEntityName(clazz); } if (name == null) { // if the name isn't specified, it is the class name lowercased if (databaseType == null) { // database-type is optional so if it is not specified we just use english name = clazz.getSimpleName().toLowerCase(Locale.ENGLISH); } else { name = databaseType.downCaseString(clazz.getSimpleName(), true); } } return name; }
java
public static <T> String extractTableName(DatabaseType databaseType, Class<T> clazz) { DatabaseTable databaseTable = clazz.getAnnotation(DatabaseTable.class); String name = null; if (databaseTable != null && databaseTable.tableName() != null && databaseTable.tableName().length() > 0) { name = databaseTable.tableName(); } if (name == null && javaxPersistenceConfigurer != null) { name = javaxPersistenceConfigurer.getEntityName(clazz); } if (name == null) { // if the name isn't specified, it is the class name lowercased if (databaseType == null) { // database-type is optional so if it is not specified we just use english name = clazz.getSimpleName().toLowerCase(Locale.ENGLISH); } else { name = databaseType.downCaseString(clazz.getSimpleName(), true); } } return name; }
[ "public", "static", "<", "T", ">", "String", "extractTableName", "(", "DatabaseType", "databaseType", ",", "Class", "<", "T", ">", "clazz", ")", "{", "DatabaseTable", "databaseTable", "=", "clazz", ".", "getAnnotation", "(", "DatabaseTable", ".", "class", ")", ";", "String", "name", "=", "null", ";", "if", "(", "databaseTable", "!=", "null", "&&", "databaseTable", ".", "tableName", "(", ")", "!=", "null", "&&", "databaseTable", ".", "tableName", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "name", "=", "databaseTable", ".", "tableName", "(", ")", ";", "}", "if", "(", "name", "==", "null", "&&", "javaxPersistenceConfigurer", "!=", "null", ")", "{", "name", "=", "javaxPersistenceConfigurer", ".", "getEntityName", "(", "clazz", ")", ";", "}", "if", "(", "name", "==", "null", ")", "{", "// if the name isn't specified, it is the class name lowercased", "if", "(", "databaseType", "==", "null", ")", "{", "// database-type is optional so if it is not specified we just use english", "name", "=", "clazz", ".", "getSimpleName", "(", ")", ".", "toLowerCase", "(", "Locale", ".", "ENGLISH", ")", ";", "}", "else", "{", "name", "=", "databaseType", ".", "downCaseString", "(", "clazz", ".", "getSimpleName", "(", ")", ",", "true", ")", ";", "}", "}", "return", "name", ";", "}" ]
Extract and return the table name for a class.
[ "Extract", "and", "return", "the", "table", "name", "for", "a", "class", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/table/DatabaseTableConfig.java#L179-L198
160,164
j256/ormlite-core
src/main/java/com/j256/ormlite/logger/LocalLog.java
LocalLog.openLogFile
public static void openLogFile(String logPath) { if (logPath == null) { printStream = System.out; } else { try { printStream = new PrintStream(new File(logPath)); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Log file " + logPath + " was not found", e); } } }
java
public static void openLogFile(String logPath) { if (logPath == null) { printStream = System.out; } else { try { printStream = new PrintStream(new File(logPath)); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Log file " + logPath + " was not found", e); } } }
[ "public", "static", "void", "openLogFile", "(", "String", "logPath", ")", "{", "if", "(", "logPath", "==", "null", ")", "{", "printStream", "=", "System", ".", "out", ";", "}", "else", "{", "try", "{", "printStream", "=", "new", "PrintStream", "(", "new", "File", "(", "logPath", ")", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Log file \"", "+", "logPath", "+", "\" was not found\"", ",", "e", ")", ";", "}", "}", "}" ]
Reopen the associated static logging stream. Set to null to redirect to System.out.
[ "Reopen", "the", "associated", "static", "logging", "stream", ".", "Set", "to", "null", "to", "redirect", "to", "System", ".", "out", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/LocalLog.java#L120-L130
160,165
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementExecutor.java
StatementExecutor.queryForCountStar
public long queryForCountStar(DatabaseConnection databaseConnection) throws SQLException { if (countStarQuery == null) { StringBuilder sb = new StringBuilder(64); sb.append("SELECT COUNT(*) FROM "); databaseType.appendEscapedEntityName(sb, tableInfo.getTableName()); countStarQuery = sb.toString(); } long count = databaseConnection.queryForLong(countStarQuery); logger.debug("query of '{}' returned {}", countStarQuery, count); return count; }
java
public long queryForCountStar(DatabaseConnection databaseConnection) throws SQLException { if (countStarQuery == null) { StringBuilder sb = new StringBuilder(64); sb.append("SELECT COUNT(*) FROM "); databaseType.appendEscapedEntityName(sb, tableInfo.getTableName()); countStarQuery = sb.toString(); } long count = databaseConnection.queryForLong(countStarQuery); logger.debug("query of '{}' returned {}", countStarQuery, count); return count; }
[ "public", "long", "queryForCountStar", "(", "DatabaseConnection", "databaseConnection", ")", "throws", "SQLException", "{", "if", "(", "countStarQuery", "==", "null", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "64", ")", ";", "sb", ".", "append", "(", "\"SELECT COUNT(*) FROM \"", ")", ";", "databaseType", ".", "appendEscapedEntityName", "(", "sb", ",", "tableInfo", ".", "getTableName", "(", ")", ")", ";", "countStarQuery", "=", "sb", ".", "toString", "(", ")", ";", "}", "long", "count", "=", "databaseConnection", ".", "queryForLong", "(", "countStarQuery", ")", ";", "logger", ".", "debug", "(", "\"query of '{}' returned {}\"", ",", "countStarQuery", ",", "count", ")", ";", "return", "count", ";", "}" ]
Return a long value which is the number of rows in the table.
[ "Return", "a", "long", "value", "which", "is", "the", "number", "of", "rows", "in", "the", "table", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L132-L142
160,166
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementExecutor.java
StatementExecutor.queryForLong
public long queryForLong(DatabaseConnection databaseConnection, PreparedStmt<T> preparedStmt) throws SQLException { CompiledStatement compiledStatement = preparedStmt.compile(databaseConnection, StatementType.SELECT_LONG); DatabaseResults results = null; try { results = compiledStatement.runQuery(null); if (results.first()) { return results.getLong(0); } else { throw new SQLException("No result found in queryForLong: " + preparedStmt.getStatement()); } } finally { IOUtils.closeThrowSqlException(results, "results"); IOUtils.closeThrowSqlException(compiledStatement, "compiled statement"); } }
java
public long queryForLong(DatabaseConnection databaseConnection, PreparedStmt<T> preparedStmt) throws SQLException { CompiledStatement compiledStatement = preparedStmt.compile(databaseConnection, StatementType.SELECT_LONG); DatabaseResults results = null; try { results = compiledStatement.runQuery(null); if (results.first()) { return results.getLong(0); } else { throw new SQLException("No result found in queryForLong: " + preparedStmt.getStatement()); } } finally { IOUtils.closeThrowSqlException(results, "results"); IOUtils.closeThrowSqlException(compiledStatement, "compiled statement"); } }
[ "public", "long", "queryForLong", "(", "DatabaseConnection", "databaseConnection", ",", "PreparedStmt", "<", "T", ">", "preparedStmt", ")", "throws", "SQLException", "{", "CompiledStatement", "compiledStatement", "=", "preparedStmt", ".", "compile", "(", "databaseConnection", ",", "StatementType", ".", "SELECT_LONG", ")", ";", "DatabaseResults", "results", "=", "null", ";", "try", "{", "results", "=", "compiledStatement", ".", "runQuery", "(", "null", ")", ";", "if", "(", "results", ".", "first", "(", ")", ")", "{", "return", "results", ".", "getLong", "(", "0", ")", ";", "}", "else", "{", "throw", "new", "SQLException", "(", "\"No result found in queryForLong: \"", "+", "preparedStmt", ".", "getStatement", "(", ")", ")", ";", "}", "}", "finally", "{", "IOUtils", ".", "closeThrowSqlException", "(", "results", ",", "\"results\"", ")", ";", "IOUtils", ".", "closeThrowSqlException", "(", "compiledStatement", ",", "\"compiled statement\"", ")", ";", "}", "}" ]
Return a long value from a prepared query.
[ "Return", "a", "long", "value", "from", "a", "prepared", "query", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L147-L161
160,167
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementExecutor.java
StatementExecutor.buildIterator
public SelectIterator<T, ID> buildIterator(BaseDaoImpl<T, ID> classDao, ConnectionSource connectionSource, int resultFlags, ObjectCache objectCache) throws SQLException { prepareQueryForAll(); return buildIterator(classDao, connectionSource, preparedQueryForAll, objectCache, resultFlags); }
java
public SelectIterator<T, ID> buildIterator(BaseDaoImpl<T, ID> classDao, ConnectionSource connectionSource, int resultFlags, ObjectCache objectCache) throws SQLException { prepareQueryForAll(); return buildIterator(classDao, connectionSource, preparedQueryForAll, objectCache, resultFlags); }
[ "public", "SelectIterator", "<", "T", ",", "ID", ">", "buildIterator", "(", "BaseDaoImpl", "<", "T", ",", "ID", ">", "classDao", ",", "ConnectionSource", "connectionSource", ",", "int", "resultFlags", ",", "ObjectCache", "objectCache", ")", "throws", "SQLException", "{", "prepareQueryForAll", "(", ")", ";", "return", "buildIterator", "(", "classDao", ",", "connectionSource", ",", "preparedQueryForAll", ",", "objectCache", ",", "resultFlags", ")", ";", "}" ]
Create and return a SelectIterator for the class using the default mapped query for all statement.
[ "Create", "and", "return", "a", "SelectIterator", "for", "the", "class", "using", "the", "default", "mapped", "query", "for", "all", "statement", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L214-L218
160,168
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementExecutor.java
StatementExecutor.updateRaw
public int updateRaw(DatabaseConnection connection, String statement, String[] arguments) throws SQLException { logger.debug("running raw update statement: {}", statement); if (arguments.length > 0) { // need to do the (Object) cast to force args to be a single object logger.trace("update arguments: {}", (Object) arguments); } CompiledStatement compiledStatement = connection.compileStatement(statement, StatementType.UPDATE, noFieldTypes, DatabaseConnection.DEFAULT_RESULT_FLAGS, false); try { assignStatementArguments(compiledStatement, arguments); return compiledStatement.runUpdate(); } finally { IOUtils.closeThrowSqlException(compiledStatement, "compiled statement"); } }
java
public int updateRaw(DatabaseConnection connection, String statement, String[] arguments) throws SQLException { logger.debug("running raw update statement: {}", statement); if (arguments.length > 0) { // need to do the (Object) cast to force args to be a single object logger.trace("update arguments: {}", (Object) arguments); } CompiledStatement compiledStatement = connection.compileStatement(statement, StatementType.UPDATE, noFieldTypes, DatabaseConnection.DEFAULT_RESULT_FLAGS, false); try { assignStatementArguments(compiledStatement, arguments); return compiledStatement.runUpdate(); } finally { IOUtils.closeThrowSqlException(compiledStatement, "compiled statement"); } }
[ "public", "int", "updateRaw", "(", "DatabaseConnection", "connection", ",", "String", "statement", ",", "String", "[", "]", "arguments", ")", "throws", "SQLException", "{", "logger", ".", "debug", "(", "\"running raw update statement: {}\"", ",", "statement", ")", ";", "if", "(", "arguments", ".", "length", ">", "0", ")", "{", "// need to do the (Object) cast to force args to be a single object", "logger", ".", "trace", "(", "\"update arguments: {}\"", ",", "(", "Object", ")", "arguments", ")", ";", "}", "CompiledStatement", "compiledStatement", "=", "connection", ".", "compileStatement", "(", "statement", ",", "StatementType", ".", "UPDATE", ",", "noFieldTypes", ",", "DatabaseConnection", ".", "DEFAULT_RESULT_FLAGS", ",", "false", ")", ";", "try", "{", "assignStatementArguments", "(", "compiledStatement", ",", "arguments", ")", ";", "return", "compiledStatement", ".", "runUpdate", "(", ")", ";", "}", "finally", "{", "IOUtils", ".", "closeThrowSqlException", "(", "compiledStatement", ",", "\"compiled statement\"", ")", ";", "}", "}" ]
Return the number of rows affected.
[ "Return", "the", "number", "of", "rows", "affected", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L408-L422
160,169
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementExecutor.java
StatementExecutor.create
public int create(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException { if (mappedInsert == null) { mappedInsert = MappedCreate.build(dao, tableInfo); } int result = mappedInsert.insert(databaseType, databaseConnection, data, objectCache); if (dao != null && !localIsInBatchMode.get()) { dao.notifyChanges(); } return result; }
java
public int create(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException { if (mappedInsert == null) { mappedInsert = MappedCreate.build(dao, tableInfo); } int result = mappedInsert.insert(databaseType, databaseConnection, data, objectCache); if (dao != null && !localIsInBatchMode.get()) { dao.notifyChanges(); } return result; }
[ "public", "int", "create", "(", "DatabaseConnection", "databaseConnection", ",", "T", "data", ",", "ObjectCache", "objectCache", ")", "throws", "SQLException", "{", "if", "(", "mappedInsert", "==", "null", ")", "{", "mappedInsert", "=", "MappedCreate", ".", "build", "(", "dao", ",", "tableInfo", ")", ";", "}", "int", "result", "=", "mappedInsert", ".", "insert", "(", "databaseType", ",", "databaseConnection", ",", "data", ",", "objectCache", ")", ";", "if", "(", "dao", "!=", "null", "&&", "!", "localIsInBatchMode", ".", "get", "(", ")", ")", "{", "dao", ".", "notifyChanges", "(", ")", ";", "}", "return", "result", ";", "}" ]
Create a new entry in the database from an object.
[ "Create", "a", "new", "entry", "in", "the", "database", "from", "an", "object", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L454-L463
160,170
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementExecutor.java
StatementExecutor.updateId
public int updateId(DatabaseConnection databaseConnection, T data, ID newId, ObjectCache objectCache) throws SQLException { if (mappedUpdateId == null) { mappedUpdateId = MappedUpdateId.build(dao, tableInfo); } int result = mappedUpdateId.execute(databaseConnection, data, newId, objectCache); if (dao != null && !localIsInBatchMode.get()) { dao.notifyChanges(); } return result; }
java
public int updateId(DatabaseConnection databaseConnection, T data, ID newId, ObjectCache objectCache) throws SQLException { if (mappedUpdateId == null) { mappedUpdateId = MappedUpdateId.build(dao, tableInfo); } int result = mappedUpdateId.execute(databaseConnection, data, newId, objectCache); if (dao != null && !localIsInBatchMode.get()) { dao.notifyChanges(); } return result; }
[ "public", "int", "updateId", "(", "DatabaseConnection", "databaseConnection", ",", "T", "data", ",", "ID", "newId", ",", "ObjectCache", "objectCache", ")", "throws", "SQLException", "{", "if", "(", "mappedUpdateId", "==", "null", ")", "{", "mappedUpdateId", "=", "MappedUpdateId", ".", "build", "(", "dao", ",", "tableInfo", ")", ";", "}", "int", "result", "=", "mappedUpdateId", ".", "execute", "(", "databaseConnection", ",", "data", ",", "newId", ",", "objectCache", ")", ";", "if", "(", "dao", "!=", "null", "&&", "!", "localIsInBatchMode", ".", "get", "(", ")", ")", "{", "dao", ".", "notifyChanges", "(", ")", ";", "}", "return", "result", ";", "}" ]
Update an object in the database to change its id to the newId parameter.
[ "Update", "an", "object", "in", "the", "database", "to", "change", "its", "id", "to", "the", "newId", "parameter", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L482-L492
160,171
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementExecutor.java
StatementExecutor.update
public int update(DatabaseConnection databaseConnection, PreparedUpdate<T> preparedUpdate) throws SQLException { CompiledStatement compiledStatement = preparedUpdate.compile(databaseConnection, StatementType.UPDATE); try { int result = compiledStatement.runUpdate(); if (dao != null && !localIsInBatchMode.get()) { dao.notifyChanges(); } return result; } finally { IOUtils.closeThrowSqlException(compiledStatement, "compiled statement"); } }
java
public int update(DatabaseConnection databaseConnection, PreparedUpdate<T> preparedUpdate) throws SQLException { CompiledStatement compiledStatement = preparedUpdate.compile(databaseConnection, StatementType.UPDATE); try { int result = compiledStatement.runUpdate(); if (dao != null && !localIsInBatchMode.get()) { dao.notifyChanges(); } return result; } finally { IOUtils.closeThrowSqlException(compiledStatement, "compiled statement"); } }
[ "public", "int", "update", "(", "DatabaseConnection", "databaseConnection", ",", "PreparedUpdate", "<", "T", ">", "preparedUpdate", ")", "throws", "SQLException", "{", "CompiledStatement", "compiledStatement", "=", "preparedUpdate", ".", "compile", "(", "databaseConnection", ",", "StatementType", ".", "UPDATE", ")", ";", "try", "{", "int", "result", "=", "compiledStatement", ".", "runUpdate", "(", ")", ";", "if", "(", "dao", "!=", "null", "&&", "!", "localIsInBatchMode", ".", "get", "(", ")", ")", "{", "dao", ".", "notifyChanges", "(", ")", ";", "}", "return", "result", ";", "}", "finally", "{", "IOUtils", ".", "closeThrowSqlException", "(", "compiledStatement", ",", "\"compiled statement\"", ")", ";", "}", "}" ]
Update rows in the database.
[ "Update", "rows", "in", "the", "database", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L497-L508
160,172
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementExecutor.java
StatementExecutor.refresh
public int refresh(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException { if (mappedRefresh == null) { mappedRefresh = MappedRefresh.build(dao, tableInfo); } return mappedRefresh.executeRefresh(databaseConnection, data, objectCache); }
java
public int refresh(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException { if (mappedRefresh == null) { mappedRefresh = MappedRefresh.build(dao, tableInfo); } return mappedRefresh.executeRefresh(databaseConnection, data, objectCache); }
[ "public", "int", "refresh", "(", "DatabaseConnection", "databaseConnection", ",", "T", "data", ",", "ObjectCache", "objectCache", ")", "throws", "SQLException", "{", "if", "(", "mappedRefresh", "==", "null", ")", "{", "mappedRefresh", "=", "MappedRefresh", ".", "build", "(", "dao", ",", "tableInfo", ")", ";", "}", "return", "mappedRefresh", ".", "executeRefresh", "(", "databaseConnection", ",", "data", ",", "objectCache", ")", ";", "}" ]
Does a query for the object's Id and copies in each of the field values from the database to refresh the data parameter.
[ "Does", "a", "query", "for", "the", "object", "s", "Id", "and", "copies", "in", "each", "of", "the", "field", "values", "from", "the", "database", "to", "refresh", "the", "data", "parameter", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L514-L519
160,173
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementExecutor.java
StatementExecutor.delete
public int delete(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException { if (mappedDelete == null) { mappedDelete = MappedDelete.build(dao, tableInfo); } int result = mappedDelete.delete(databaseConnection, data, objectCache); if (dao != null && !localIsInBatchMode.get()) { dao.notifyChanges(); } return result; }
java
public int delete(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException { if (mappedDelete == null) { mappedDelete = MappedDelete.build(dao, tableInfo); } int result = mappedDelete.delete(databaseConnection, data, objectCache); if (dao != null && !localIsInBatchMode.get()) { dao.notifyChanges(); } return result; }
[ "public", "int", "delete", "(", "DatabaseConnection", "databaseConnection", ",", "T", "data", ",", "ObjectCache", "objectCache", ")", "throws", "SQLException", "{", "if", "(", "mappedDelete", "==", "null", ")", "{", "mappedDelete", "=", "MappedDelete", ".", "build", "(", "dao", ",", "tableInfo", ")", ";", "}", "int", "result", "=", "mappedDelete", ".", "delete", "(", "databaseConnection", ",", "data", ",", "objectCache", ")", ";", "if", "(", "dao", "!=", "null", "&&", "!", "localIsInBatchMode", ".", "get", "(", ")", ")", "{", "dao", ".", "notifyChanges", "(", ")", ";", "}", "return", "result", ";", "}" ]
Delete an object from the database.
[ "Delete", "an", "object", "from", "the", "database", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L524-L533
160,174
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementExecutor.java
StatementExecutor.deleteById
public int deleteById(DatabaseConnection databaseConnection, ID id, ObjectCache objectCache) throws SQLException { if (mappedDelete == null) { mappedDelete = MappedDelete.build(dao, tableInfo); } int result = mappedDelete.deleteById(databaseConnection, id, objectCache); if (dao != null && !localIsInBatchMode.get()) { dao.notifyChanges(); } return result; }
java
public int deleteById(DatabaseConnection databaseConnection, ID id, ObjectCache objectCache) throws SQLException { if (mappedDelete == null) { mappedDelete = MappedDelete.build(dao, tableInfo); } int result = mappedDelete.deleteById(databaseConnection, id, objectCache); if (dao != null && !localIsInBatchMode.get()) { dao.notifyChanges(); } return result; }
[ "public", "int", "deleteById", "(", "DatabaseConnection", "databaseConnection", ",", "ID", "id", ",", "ObjectCache", "objectCache", ")", "throws", "SQLException", "{", "if", "(", "mappedDelete", "==", "null", ")", "{", "mappedDelete", "=", "MappedDelete", ".", "build", "(", "dao", ",", "tableInfo", ")", ";", "}", "int", "result", "=", "mappedDelete", ".", "deleteById", "(", "databaseConnection", ",", "id", ",", "objectCache", ")", ";", "if", "(", "dao", "!=", "null", "&&", "!", "localIsInBatchMode", ".", "get", "(", ")", ")", "{", "dao", ".", "notifyChanges", "(", ")", ";", "}", "return", "result", ";", "}" ]
Delete an object from the database by id.
[ "Delete", "an", "object", "from", "the", "database", "by", "id", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L538-L547
160,175
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementExecutor.java
StatementExecutor.delete
public int delete(DatabaseConnection databaseConnection, PreparedDelete<T> preparedDelete) throws SQLException { CompiledStatement compiledStatement = preparedDelete.compile(databaseConnection, StatementType.DELETE); try { int result = compiledStatement.runUpdate(); if (dao != null && !localIsInBatchMode.get()) { dao.notifyChanges(); } return result; } finally { IOUtils.closeThrowSqlException(compiledStatement, "compiled statement"); } }
java
public int delete(DatabaseConnection databaseConnection, PreparedDelete<T> preparedDelete) throws SQLException { CompiledStatement compiledStatement = preparedDelete.compile(databaseConnection, StatementType.DELETE); try { int result = compiledStatement.runUpdate(); if (dao != null && !localIsInBatchMode.get()) { dao.notifyChanges(); } return result; } finally { IOUtils.closeThrowSqlException(compiledStatement, "compiled statement"); } }
[ "public", "int", "delete", "(", "DatabaseConnection", "databaseConnection", ",", "PreparedDelete", "<", "T", ">", "preparedDelete", ")", "throws", "SQLException", "{", "CompiledStatement", "compiledStatement", "=", "preparedDelete", ".", "compile", "(", "databaseConnection", ",", "StatementType", ".", "DELETE", ")", ";", "try", "{", "int", "result", "=", "compiledStatement", ".", "runUpdate", "(", ")", ";", "if", "(", "dao", "!=", "null", "&&", "!", "localIsInBatchMode", ".", "get", "(", ")", ")", "{", "dao", ".", "notifyChanges", "(", ")", ";", "}", "return", "result", ";", "}", "finally", "{", "IOUtils", ".", "closeThrowSqlException", "(", "compiledStatement", ",", "\"compiled statement\"", ")", ";", "}", "}" ]
Delete rows that match the prepared statement.
[ "Delete", "rows", "that", "match", "the", "prepared", "statement", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L578-L589
160,176
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementExecutor.java
StatementExecutor.callBatchTasks
public <CT> CT callBatchTasks(ConnectionSource connectionSource, Callable<CT> callable) throws SQLException { if (connectionSource.isSingleConnection(tableInfo.getTableName())) { synchronized (this) { return doCallBatchTasks(connectionSource, callable); } } else { return doCallBatchTasks(connectionSource, callable); } }
java
public <CT> CT callBatchTasks(ConnectionSource connectionSource, Callable<CT> callable) throws SQLException { if (connectionSource.isSingleConnection(tableInfo.getTableName())) { synchronized (this) { return doCallBatchTasks(connectionSource, callable); } } else { return doCallBatchTasks(connectionSource, callable); } }
[ "public", "<", "CT", ">", "CT", "callBatchTasks", "(", "ConnectionSource", "connectionSource", ",", "Callable", "<", "CT", ">", "callable", ")", "throws", "SQLException", "{", "if", "(", "connectionSource", ".", "isSingleConnection", "(", "tableInfo", ".", "getTableName", "(", ")", ")", ")", "{", "synchronized", "(", "this", ")", "{", "return", "doCallBatchTasks", "(", "connectionSource", ",", "callable", ")", ";", "}", "}", "else", "{", "return", "doCallBatchTasks", "(", "connectionSource", ",", "callable", ")", ";", "}", "}" ]
Call batch tasks inside of a connection which may, or may not, have been "saved".
[ "Call", "batch", "tasks", "inside", "of", "a", "connection", "which", "may", "or", "may", "not", "have", "been", "saved", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L594-L602
160,177
j256/ormlite-core
src/main/java/com/j256/ormlite/misc/SqlExceptionUtil.java
SqlExceptionUtil.create
public static SQLException create(String message, Throwable cause) { SQLException sqlException; if (cause instanceof SQLException) { // if the cause is another SQLException, pass alot of the SQL state sqlException = new SQLException(message, ((SQLException) cause).getSQLState()); } else { sqlException = new SQLException(message); } sqlException.initCause(cause); return sqlException; }
java
public static SQLException create(String message, Throwable cause) { SQLException sqlException; if (cause instanceof SQLException) { // if the cause is another SQLException, pass alot of the SQL state sqlException = new SQLException(message, ((SQLException) cause).getSQLState()); } else { sqlException = new SQLException(message); } sqlException.initCause(cause); return sqlException; }
[ "public", "static", "SQLException", "create", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "SQLException", "sqlException", ";", "if", "(", "cause", "instanceof", "SQLException", ")", "{", "// if the cause is another SQLException, pass alot of the SQL state", "sqlException", "=", "new", "SQLException", "(", "message", ",", "(", "(", "SQLException", ")", "cause", ")", ".", "getSQLState", "(", ")", ")", ";", "}", "else", "{", "sqlException", "=", "new", "SQLException", "(", "message", ")", ";", "}", "sqlException", ".", "initCause", "(", "cause", ")", ";", "return", "sqlException", ";", "}" ]
Convenience method to allow a cause. Grrrr.
[ "Convenience", "method", "to", "allow", "a", "cause", ".", "Grrrr", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/misc/SqlExceptionUtil.java#L21-L31
160,178
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/BaseDaoImpl.java
BaseDaoImpl.initialize
public void initialize() throws SQLException { if (initialized) { // just skip it if already initialized return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == null) { throw new IllegalStateException( "connectionSource is getting a null DatabaseType in " + getClass().getSimpleName()); } if (tableConfig == null) { tableInfo = new TableInfo<T, ID>(databaseType, dataClass); } else { tableConfig.extractFieldTypes(databaseType); tableInfo = new TableInfo<T, ID>(databaseType, tableConfig); } statementExecutor = new StatementExecutor<T, ID>(databaseType, tableInfo, this); /* * This is a bit complex. Initially, when we were configuring the field types, external DAO information would be * configured for auto-refresh, foreign BaseDaoEnabled classes, and foreign-collections. This would cause the * system to go recursive and for class loops, a stack overflow. * * Then we fixed this by putting a level counter in the FieldType constructor that would stop the configurations * when we reach some recursion level. But this created some bad problems because we were using the DaoManager * to cache the created DAOs that had been constructed already limited by the level. * * What we do now is have a 2 phase initialization. The constructor initializes most of the fields but then we * go back and call FieldType.configDaoInformation() after we are done. So for every DAO that is initialized * here, we have to see if it is the top DAO. If not we save it for dao configuration later. */ List<BaseDaoImpl<?, ?>> daoConfigList = daoConfigLevelLocal.get(); daoConfigList.add(this); if (daoConfigList.size() > 1) { // if we have recursed then just save the dao for later configuration return; } try { /* * WARNING: We do _not_ use an iterator here because we may be adding to the list as we process it and we'll * get exceptions otherwise. This is an ArrayList so the get(i) should be efficient. * * Also, do _not_ get a copy of daoConfigLevel.doArray because that array may be replaced by another, larger * one during the recursion. */ for (int i = 0; i < daoConfigList.size(); i++) { BaseDaoImpl<?, ?> dao = daoConfigList.get(i); /* * Here's another complex bit. The first DAO that is being constructed as part of a DAO chain is not yet * in the DaoManager cache. If we continue onward we might come back around and try to configure this * DAO again. Forcing it into the cache here makes sure it won't be configured twice. This will cause it * to be stuck in twice when it returns out to the DaoManager but that's a small price to pay. This also * applies to self-referencing classes. */ DaoManager.registerDao(connectionSource, dao); try { // config our fields which may go recursive for (FieldType fieldType : dao.getTableInfo().getFieldTypes()) { fieldType.configDaoInformation(connectionSource, dao.getDataClass()); } } catch (SQLException e) { // unregister the DAO we just pre-registered DaoManager.unregisterDao(connectionSource, dao); throw e; } // it's now been fully initialized dao.initialized = true; } } finally { // if we throw we want to clear our class hierarchy here daoConfigList.clear(); daoConfigLevelLocal.remove(); } }
java
public void initialize() throws SQLException { if (initialized) { // just skip it if already initialized return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == null) { throw new IllegalStateException( "connectionSource is getting a null DatabaseType in " + getClass().getSimpleName()); } if (tableConfig == null) { tableInfo = new TableInfo<T, ID>(databaseType, dataClass); } else { tableConfig.extractFieldTypes(databaseType); tableInfo = new TableInfo<T, ID>(databaseType, tableConfig); } statementExecutor = new StatementExecutor<T, ID>(databaseType, tableInfo, this); /* * This is a bit complex. Initially, when we were configuring the field types, external DAO information would be * configured for auto-refresh, foreign BaseDaoEnabled classes, and foreign-collections. This would cause the * system to go recursive and for class loops, a stack overflow. * * Then we fixed this by putting a level counter in the FieldType constructor that would stop the configurations * when we reach some recursion level. But this created some bad problems because we were using the DaoManager * to cache the created DAOs that had been constructed already limited by the level. * * What we do now is have a 2 phase initialization. The constructor initializes most of the fields but then we * go back and call FieldType.configDaoInformation() after we are done. So for every DAO that is initialized * here, we have to see if it is the top DAO. If not we save it for dao configuration later. */ List<BaseDaoImpl<?, ?>> daoConfigList = daoConfigLevelLocal.get(); daoConfigList.add(this); if (daoConfigList.size() > 1) { // if we have recursed then just save the dao for later configuration return; } try { /* * WARNING: We do _not_ use an iterator here because we may be adding to the list as we process it and we'll * get exceptions otherwise. This is an ArrayList so the get(i) should be efficient. * * Also, do _not_ get a copy of daoConfigLevel.doArray because that array may be replaced by another, larger * one during the recursion. */ for (int i = 0; i < daoConfigList.size(); i++) { BaseDaoImpl<?, ?> dao = daoConfigList.get(i); /* * Here's another complex bit. The first DAO that is being constructed as part of a DAO chain is not yet * in the DaoManager cache. If we continue onward we might come back around and try to configure this * DAO again. Forcing it into the cache here makes sure it won't be configured twice. This will cause it * to be stuck in twice when it returns out to the DaoManager but that's a small price to pay. This also * applies to self-referencing classes. */ DaoManager.registerDao(connectionSource, dao); try { // config our fields which may go recursive for (FieldType fieldType : dao.getTableInfo().getFieldTypes()) { fieldType.configDaoInformation(connectionSource, dao.getDataClass()); } } catch (SQLException e) { // unregister the DAO we just pre-registered DaoManager.unregisterDao(connectionSource, dao); throw e; } // it's now been fully initialized dao.initialized = true; } } finally { // if we throw we want to clear our class hierarchy here daoConfigList.clear(); daoConfigLevelLocal.remove(); } }
[ "public", "void", "initialize", "(", ")", "throws", "SQLException", "{", "if", "(", "initialized", ")", "{", "// just skip it if already initialized", "return", ";", "}", "if", "(", "connectionSource", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"connectionSource was never set on \"", "+", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "}", "databaseType", "=", "connectionSource", ".", "getDatabaseType", "(", ")", ";", "if", "(", "databaseType", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"connectionSource is getting a null DatabaseType in \"", "+", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "}", "if", "(", "tableConfig", "==", "null", ")", "{", "tableInfo", "=", "new", "TableInfo", "<", "T", ",", "ID", ">", "(", "databaseType", ",", "dataClass", ")", ";", "}", "else", "{", "tableConfig", ".", "extractFieldTypes", "(", "databaseType", ")", ";", "tableInfo", "=", "new", "TableInfo", "<", "T", ",", "ID", ">", "(", "databaseType", ",", "tableConfig", ")", ";", "}", "statementExecutor", "=", "new", "StatementExecutor", "<", "T", ",", "ID", ">", "(", "databaseType", ",", "tableInfo", ",", "this", ")", ";", "/*\n\t\t * This is a bit complex. Initially, when we were configuring the field types, external DAO information would be\n\t\t * configured for auto-refresh, foreign BaseDaoEnabled classes, and foreign-collections. This would cause the\n\t\t * system to go recursive and for class loops, a stack overflow.\n\t\t * \n\t\t * Then we fixed this by putting a level counter in the FieldType constructor that would stop the configurations\n\t\t * when we reach some recursion level. But this created some bad problems because we were using the DaoManager\n\t\t * to cache the created DAOs that had been constructed already limited by the level.\n\t\t * \n\t\t * What we do now is have a 2 phase initialization. The constructor initializes most of the fields but then we\n\t\t * go back and call FieldType.configDaoInformation() after we are done. So for every DAO that is initialized\n\t\t * here, we have to see if it is the top DAO. If not we save it for dao configuration later.\n\t\t */", "List", "<", "BaseDaoImpl", "<", "?", ",", "?", ">", ">", "daoConfigList", "=", "daoConfigLevelLocal", ".", "get", "(", ")", ";", "daoConfigList", ".", "add", "(", "this", ")", ";", "if", "(", "daoConfigList", ".", "size", "(", ")", ">", "1", ")", "{", "// if we have recursed then just save the dao for later configuration", "return", ";", "}", "try", "{", "/*\n\t\t\t * WARNING: We do _not_ use an iterator here because we may be adding to the list as we process it and we'll\n\t\t\t * get exceptions otherwise. This is an ArrayList so the get(i) should be efficient.\n\t\t\t * \n\t\t\t * Also, do _not_ get a copy of daoConfigLevel.doArray because that array may be replaced by another, larger\n\t\t\t * one during the recursion.\n\t\t\t */", "for", "(", "int", "i", "=", "0", ";", "i", "<", "daoConfigList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "BaseDaoImpl", "<", "?", ",", "?", ">", "dao", "=", "daoConfigList", ".", "get", "(", "i", ")", ";", "/*\n\t\t\t\t * Here's another complex bit. The first DAO that is being constructed as part of a DAO chain is not yet\n\t\t\t\t * in the DaoManager cache. If we continue onward we might come back around and try to configure this\n\t\t\t\t * DAO again. Forcing it into the cache here makes sure it won't be configured twice. This will cause it\n\t\t\t\t * to be stuck in twice when it returns out to the DaoManager but that's a small price to pay. This also\n\t\t\t\t * applies to self-referencing classes.\n\t\t\t\t */", "DaoManager", ".", "registerDao", "(", "connectionSource", ",", "dao", ")", ";", "try", "{", "// config our fields which may go recursive", "for", "(", "FieldType", "fieldType", ":", "dao", ".", "getTableInfo", "(", ")", ".", "getFieldTypes", "(", ")", ")", "{", "fieldType", ".", "configDaoInformation", "(", "connectionSource", ",", "dao", ".", "getDataClass", "(", ")", ")", ";", "}", "}", "catch", "(", "SQLException", "e", ")", "{", "// unregister the DAO we just pre-registered", "DaoManager", ".", "unregisterDao", "(", "connectionSource", ",", "dao", ")", ";", "throw", "e", ";", "}", "// it's now been fully initialized", "dao", ".", "initialized", "=", "true", ";", "}", "}", "finally", "{", "// if we throw we want to clear our class hierarchy here", "daoConfigList", ".", "clear", "(", ")", ";", "daoConfigLevelLocal", ".", "remove", "(", ")", ";", "}", "}" ]
Initialize the various DAO configurations after the various setters have been called.
[ "Initialize", "the", "various", "DAO", "configurations", "after", "the", "various", "setters", "have", "been", "called", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/BaseDaoImpl.java#L143-L225
160,179
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/BaseDaoImpl.java
BaseDaoImpl.createDao
static <T, ID> Dao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { return new BaseDaoImpl<T, ID>(connectionSource, clazz) { }; }
java
static <T, ID> Dao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { return new BaseDaoImpl<T, ID>(connectionSource, clazz) { }; }
[ "static", "<", "T", ",", "ID", ">", "Dao", "<", "T", ",", "ID", ">", "createDao", "(", "ConnectionSource", "connectionSource", ",", "Class", "<", "T", ">", "clazz", ")", "throws", "SQLException", "{", "return", "new", "BaseDaoImpl", "<", "T", ",", "ID", ">", "(", "connectionSource", ",", "clazz", ")", "{", "}", ";", "}" ]
Helper method to create a Dao object without having to define a class. Dao classes are supposed to be convenient but if you have a lot of classes, they can seem to be a pain. <p> <b>NOTE:</b> You should use {@link DaoManager#createDao(ConnectionSource, DatabaseTableConfig)} instead of this method so you won't have to create the DAO multiple times. </p>
[ "Helper", "method", "to", "create", "a", "Dao", "object", "without", "having", "to", "define", "a", "class", ".", "Dao", "classes", "are", "supposed", "to", "be", "convenient", "but", "if", "you", "have", "a", "lot", "of", "classes", "they", "can", "seem", "to", "be", "a", "pain", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/BaseDaoImpl.java#L1059-L1062
160,180
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/BaseDaoImpl.java
BaseDaoImpl.findNoArgConstructor
private Constructor<T> findNoArgConstructor(Class<T> dataClass) { Constructor<T>[] constructors; try { @SuppressWarnings("unchecked") Constructor<T>[] consts = (Constructor<T>[]) dataClass.getDeclaredConstructors(); // i do this [grossness] to be able to move the Suppress inside the method constructors = consts; } catch (Exception e) { throw new IllegalArgumentException("Can't lookup declared constructors for " + dataClass, e); } for (Constructor<T> con : constructors) { if (con.getParameterTypes().length == 0) { if (!con.isAccessible()) { try { con.setAccessible(true); } catch (SecurityException e) { throw new IllegalArgumentException("Could not open access to constructor for " + dataClass); } } return con; } } if (dataClass.getEnclosingClass() == null) { throw new IllegalArgumentException("Can't find a no-arg constructor for " + dataClass); } else { throw new IllegalArgumentException( "Can't find a no-arg constructor for " + dataClass + ". Missing static on inner class?"); } }
java
private Constructor<T> findNoArgConstructor(Class<T> dataClass) { Constructor<T>[] constructors; try { @SuppressWarnings("unchecked") Constructor<T>[] consts = (Constructor<T>[]) dataClass.getDeclaredConstructors(); // i do this [grossness] to be able to move the Suppress inside the method constructors = consts; } catch (Exception e) { throw new IllegalArgumentException("Can't lookup declared constructors for " + dataClass, e); } for (Constructor<T> con : constructors) { if (con.getParameterTypes().length == 0) { if (!con.isAccessible()) { try { con.setAccessible(true); } catch (SecurityException e) { throw new IllegalArgumentException("Could not open access to constructor for " + dataClass); } } return con; } } if (dataClass.getEnclosingClass() == null) { throw new IllegalArgumentException("Can't find a no-arg constructor for " + dataClass); } else { throw new IllegalArgumentException( "Can't find a no-arg constructor for " + dataClass + ". Missing static on inner class?"); } }
[ "private", "Constructor", "<", "T", ">", "findNoArgConstructor", "(", "Class", "<", "T", ">", "dataClass", ")", "{", "Constructor", "<", "T", ">", "[", "]", "constructors", ";", "try", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Constructor", "<", "T", ">", "[", "]", "consts", "=", "(", "Constructor", "<", "T", ">", "[", "]", ")", "dataClass", ".", "getDeclaredConstructors", "(", ")", ";", "// i do this [grossness] to be able to move the Suppress inside the method", "constructors", "=", "consts", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Can't lookup declared constructors for \"", "+", "dataClass", ",", "e", ")", ";", "}", "for", "(", "Constructor", "<", "T", ">", "con", ":", "constructors", ")", "{", "if", "(", "con", ".", "getParameterTypes", "(", ")", ".", "length", "==", "0", ")", "{", "if", "(", "!", "con", ".", "isAccessible", "(", ")", ")", "{", "try", "{", "con", ".", "setAccessible", "(", "true", ")", ";", "}", "catch", "(", "SecurityException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Could not open access to constructor for \"", "+", "dataClass", ")", ";", "}", "}", "return", "con", ";", "}", "}", "if", "(", "dataClass", ".", "getEnclosingClass", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Can't find a no-arg constructor for \"", "+", "dataClass", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Can't find a no-arg constructor for \"", "+", "dataClass", "+", "\". Missing static on inner class?\"", ")", ";", "}", "}" ]
Locate the no arg constructor for the class.
[ "Locate", "the", "no", "arg", "constructor", "for", "the", "class", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/BaseDaoImpl.java#L1176-L1204
160,181
j256/ormlite-core
src/main/java/com/j256/ormlite/field/DatabaseFieldConfig.java
DatabaseFieldConfig.findGetMethod
public static Method findGetMethod(Field field, DatabaseType databaseType, boolean throwExceptions) throws IllegalArgumentException { Method fieldGetMethod = findMethodFromNames(field, true, throwExceptions, methodFromField(field, "get", databaseType, true), methodFromField(field, "get", databaseType, false), methodFromField(field, "is", databaseType, true), methodFromField(field, "is", databaseType, false)); if (fieldGetMethod == null) { return null; } if (fieldGetMethod.getReturnType() != field.getType()) { if (throwExceptions) { throw new IllegalArgumentException("Return type of get method " + fieldGetMethod.getName() + " does not return " + field.getType()); } else { return null; } } return fieldGetMethod; }
java
public static Method findGetMethod(Field field, DatabaseType databaseType, boolean throwExceptions) throws IllegalArgumentException { Method fieldGetMethod = findMethodFromNames(field, true, throwExceptions, methodFromField(field, "get", databaseType, true), methodFromField(field, "get", databaseType, false), methodFromField(field, "is", databaseType, true), methodFromField(field, "is", databaseType, false)); if (fieldGetMethod == null) { return null; } if (fieldGetMethod.getReturnType() != field.getType()) { if (throwExceptions) { throw new IllegalArgumentException("Return type of get method " + fieldGetMethod.getName() + " does not return " + field.getType()); } else { return null; } } return fieldGetMethod; }
[ "public", "static", "Method", "findGetMethod", "(", "Field", "field", ",", "DatabaseType", "databaseType", ",", "boolean", "throwExceptions", ")", "throws", "IllegalArgumentException", "{", "Method", "fieldGetMethod", "=", "findMethodFromNames", "(", "field", ",", "true", ",", "throwExceptions", ",", "methodFromField", "(", "field", ",", "\"get\"", ",", "databaseType", ",", "true", ")", ",", "methodFromField", "(", "field", ",", "\"get\"", ",", "databaseType", ",", "false", ")", ",", "methodFromField", "(", "field", ",", "\"is\"", ",", "databaseType", ",", "true", ")", ",", "methodFromField", "(", "field", ",", "\"is\"", ",", "databaseType", ",", "false", ")", ")", ";", "if", "(", "fieldGetMethod", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "fieldGetMethod", ".", "getReturnType", "(", ")", "!=", "field", ".", "getType", "(", ")", ")", "{", "if", "(", "throwExceptions", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Return type of get method \"", "+", "fieldGetMethod", ".", "getName", "(", ")", "+", "\" does not return \"", "+", "field", ".", "getType", "(", ")", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}", "return", "fieldGetMethod", ";", "}" ]
Find and return the appropriate getter method for field. @return Get method or null (or throws IllegalArgumentException) if none found.
[ "Find", "and", "return", "the", "appropriate", "getter", "method", "for", "field", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/field/DatabaseFieldConfig.java#L546-L563
160,182
j256/ormlite-core
src/main/java/com/j256/ormlite/field/DatabaseFieldConfig.java
DatabaseFieldConfig.findSetMethod
public static Method findSetMethod(Field field, DatabaseType databaseType, boolean throwExceptions) throws IllegalArgumentException { Method fieldSetMethod = findMethodFromNames(field, false, throwExceptions, methodFromField(field, "set", databaseType, true), methodFromField(field, "set", databaseType, false)); if (fieldSetMethod == null) { return null; } if (fieldSetMethod.getReturnType() != void.class) { if (throwExceptions) { throw new IllegalArgumentException("Return type of set method " + fieldSetMethod.getName() + " returns " + fieldSetMethod.getReturnType() + " instead of void"); } else { return null; } } return fieldSetMethod; }
java
public static Method findSetMethod(Field field, DatabaseType databaseType, boolean throwExceptions) throws IllegalArgumentException { Method fieldSetMethod = findMethodFromNames(field, false, throwExceptions, methodFromField(field, "set", databaseType, true), methodFromField(field, "set", databaseType, false)); if (fieldSetMethod == null) { return null; } if (fieldSetMethod.getReturnType() != void.class) { if (throwExceptions) { throw new IllegalArgumentException("Return type of set method " + fieldSetMethod.getName() + " returns " + fieldSetMethod.getReturnType() + " instead of void"); } else { return null; } } return fieldSetMethod; }
[ "public", "static", "Method", "findSetMethod", "(", "Field", "field", ",", "DatabaseType", "databaseType", ",", "boolean", "throwExceptions", ")", "throws", "IllegalArgumentException", "{", "Method", "fieldSetMethod", "=", "findMethodFromNames", "(", "field", ",", "false", ",", "throwExceptions", ",", "methodFromField", "(", "field", ",", "\"set\"", ",", "databaseType", ",", "true", ")", ",", "methodFromField", "(", "field", ",", "\"set\"", ",", "databaseType", ",", "false", ")", ")", ";", "if", "(", "fieldSetMethod", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "fieldSetMethod", ".", "getReturnType", "(", ")", "!=", "void", ".", "class", ")", "{", "if", "(", "throwExceptions", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Return type of set method \"", "+", "fieldSetMethod", ".", "getName", "(", ")", "+", "\" returns \"", "+", "fieldSetMethod", ".", "getReturnType", "(", ")", "+", "\" instead of void\"", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}", "return", "fieldSetMethod", ";", "}" ]
Find and return the appropriate setter method for field. @return Set method or null (or throws IllegalArgumentException) if none found.
[ "Find", "and", "return", "the", "appropriate", "setter", "method", "for", "field", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/field/DatabaseFieldConfig.java#L570-L586
160,183
j256/ormlite-core
src/main/java/com/j256/ormlite/field/DatabaseFieldConfig.java
DatabaseFieldConfig.postProcess
public void postProcess() { if (foreignColumnName != null) { foreignAutoRefresh = true; } if (foreignAutoRefresh && maxForeignAutoRefreshLevel == NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED) { maxForeignAutoRefreshLevel = DatabaseField.DEFAULT_MAX_FOREIGN_AUTO_REFRESH_LEVEL; } }
java
public void postProcess() { if (foreignColumnName != null) { foreignAutoRefresh = true; } if (foreignAutoRefresh && maxForeignAutoRefreshLevel == NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED) { maxForeignAutoRefreshLevel = DatabaseField.DEFAULT_MAX_FOREIGN_AUTO_REFRESH_LEVEL; } }
[ "public", "void", "postProcess", "(", ")", "{", "if", "(", "foreignColumnName", "!=", "null", ")", "{", "foreignAutoRefresh", "=", "true", ";", "}", "if", "(", "foreignAutoRefresh", "&&", "maxForeignAutoRefreshLevel", "==", "NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED", ")", "{", "maxForeignAutoRefreshLevel", "=", "DatabaseField", ".", "DEFAULT_MAX_FOREIGN_AUTO_REFRESH_LEVEL", ";", "}", "}" ]
Process the settings when we are going to consume them.
[ "Process", "the", "settings", "when", "we", "are", "going", "to", "consume", "them", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/field/DatabaseFieldConfig.java#L642-L649
160,184
j256/ormlite-core
src/main/java/com/j256/ormlite/field/DatabaseFieldConfig.java
DatabaseFieldConfig.findMatchingEnumVal
public static Enum<?> findMatchingEnumVal(Field field, String unknownEnumName) { if (unknownEnumName == null || unknownEnumName.length() == 0) { return null; } for (Enum<?> enumVal : (Enum<?>[]) field.getType().getEnumConstants()) { if (enumVal.name().equals(unknownEnumName)) { return enumVal; } } throw new IllegalArgumentException("Unknwown enum unknown name " + unknownEnumName + " for field " + field); }
java
public static Enum<?> findMatchingEnumVal(Field field, String unknownEnumName) { if (unknownEnumName == null || unknownEnumName.length() == 0) { return null; } for (Enum<?> enumVal : (Enum<?>[]) field.getType().getEnumConstants()) { if (enumVal.name().equals(unknownEnumName)) { return enumVal; } } throw new IllegalArgumentException("Unknwown enum unknown name " + unknownEnumName + " for field " + field); }
[ "public", "static", "Enum", "<", "?", ">", "findMatchingEnumVal", "(", "Field", "field", ",", "String", "unknownEnumName", ")", "{", "if", "(", "unknownEnumName", "==", "null", "||", "unknownEnumName", ".", "length", "(", ")", "==", "0", ")", "{", "return", "null", ";", "}", "for", "(", "Enum", "<", "?", ">", "enumVal", ":", "(", "Enum", "<", "?", ">", "[", "]", ")", "field", ".", "getType", "(", ")", ".", "getEnumConstants", "(", ")", ")", "{", "if", "(", "enumVal", ".", "name", "(", ")", ".", "equals", "(", "unknownEnumName", ")", ")", "{", "return", "enumVal", ";", "}", "}", "throw", "new", "IllegalArgumentException", "(", "\"Unknwown enum unknown name \"", "+", "unknownEnumName", "+", "\" for field \"", "+", "field", ")", ";", "}" ]
Internal method that finds the matching enum for a configured field that has the name argument. @return The matching enum value or null if blank enum name. @throws IllegalArgumentException If the enum name is not known.
[ "Internal", "method", "that", "finds", "the", "matching", "enum", "for", "a", "configured", "field", "that", "has", "the", "name", "argument", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/field/DatabaseFieldConfig.java#L658-L668
160,185
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/mapped/MappedRefresh.java
MappedRefresh.executeRefresh
public int executeRefresh(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException { @SuppressWarnings("unchecked") ID id = (ID) idField.extractJavaFieldValue(data); // we don't care about the cache here T result = super.execute(databaseConnection, id, null); if (result == null) { return 0; } // copy each field from the result into the passed in object for (FieldType fieldType : resultsFieldTypes) { if (fieldType != idField) { fieldType.assignField(connectionSource, data, fieldType.extractJavaFieldValue(result), false, objectCache); } } return 1; }
java
public int executeRefresh(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException { @SuppressWarnings("unchecked") ID id = (ID) idField.extractJavaFieldValue(data); // we don't care about the cache here T result = super.execute(databaseConnection, id, null); if (result == null) { return 0; } // copy each field from the result into the passed in object for (FieldType fieldType : resultsFieldTypes) { if (fieldType != idField) { fieldType.assignField(connectionSource, data, fieldType.extractJavaFieldValue(result), false, objectCache); } } return 1; }
[ "public", "int", "executeRefresh", "(", "DatabaseConnection", "databaseConnection", ",", "T", "data", ",", "ObjectCache", "objectCache", ")", "throws", "SQLException", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "ID", "id", "=", "(", "ID", ")", "idField", ".", "extractJavaFieldValue", "(", "data", ")", ";", "// we don't care about the cache here", "T", "result", "=", "super", ".", "execute", "(", "databaseConnection", ",", "id", ",", "null", ")", ";", "if", "(", "result", "==", "null", ")", "{", "return", "0", ";", "}", "// copy each field from the result into the passed in object", "for", "(", "FieldType", "fieldType", ":", "resultsFieldTypes", ")", "{", "if", "(", "fieldType", "!=", "idField", ")", "{", "fieldType", ".", "assignField", "(", "connectionSource", ",", "data", ",", "fieldType", ".", "extractJavaFieldValue", "(", "result", ")", ",", "false", ",", "objectCache", ")", ";", "}", "}", "return", "1", ";", "}" ]
Execute our refresh query statement and then update all of the fields in data with the fields from the result. @return 1 if we found the object in the table by id or 0 if not.
[ "Execute", "our", "refresh", "query", "statement", "and", "then", "update", "all", "of", "the", "fields", "in", "data", "with", "the", "fields", "from", "the", "result", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/mapped/MappedRefresh.java#L29-L46
160,186
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/QueryBuilder.java
QueryBuilder.selectColumns
public QueryBuilder<T, ID> selectColumns(String... columns) { for (String column : columns) { addSelectColumnToList(column); } return this; }
java
public QueryBuilder<T, ID> selectColumns(String... columns) { for (String column : columns) { addSelectColumnToList(column); } return this; }
[ "public", "QueryBuilder", "<", "T", ",", "ID", ">", "selectColumns", "(", "String", "...", "columns", ")", "{", "for", "(", "String", "column", ":", "columns", ")", "{", "addSelectColumnToList", "(", "column", ")", ";", "}", "return", "this", ";", "}" ]
Add columns to be returned by the SELECT query. If no columns are selected then all columns are returned by default. For classes with id columns, the id column is added to the select list automagically. This can be called multiple times to add more columns to select. <p> <b>WARNING:</b> If you specify any columns to return, then any foreign-collection fields will be returned as null <i>unless</i> their {@link ForeignCollectionField#columnName()} is also in the list. </p>
[ "Add", "columns", "to", "be", "returned", "by", "the", "SELECT", "query", ".", "If", "no", "columns", "are", "selected", "then", "all", "columns", "are", "returned", "by", "default", ".", "For", "classes", "with", "id", "columns", "the", "id", "column", "is", "added", "to", "the", "select", "list", "automagically", ".", "This", "can", "be", "called", "multiple", "times", "to", "add", "more", "columns", "to", "select", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/QueryBuilder.java#L115-L120
160,187
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/QueryBuilder.java
QueryBuilder.groupBy
public QueryBuilder<T, ID> groupBy(String columnName) { FieldType fieldType = verifyColumnName(columnName); if (fieldType.isForeignCollection()) { throw new IllegalArgumentException("Can't groupBy foreign collection field: " + columnName); } addGroupBy(ColumnNameOrRawSql.withColumnName(columnName)); return this; }
java
public QueryBuilder<T, ID> groupBy(String columnName) { FieldType fieldType = verifyColumnName(columnName); if (fieldType.isForeignCollection()) { throw new IllegalArgumentException("Can't groupBy foreign collection field: " + columnName); } addGroupBy(ColumnNameOrRawSql.withColumnName(columnName)); return this; }
[ "public", "QueryBuilder", "<", "T", ",", "ID", ">", "groupBy", "(", "String", "columnName", ")", "{", "FieldType", "fieldType", "=", "verifyColumnName", "(", "columnName", ")", ";", "if", "(", "fieldType", ".", "isForeignCollection", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Can't groupBy foreign collection field: \"", "+", "columnName", ")", ";", "}", "addGroupBy", "(", "ColumnNameOrRawSql", ".", "withColumnName", "(", "columnName", ")", ")", ";", "return", "this", ";", "}" ]
Add "GROUP BY" clause to the SQL query statement. This can be called multiple times to add additional "GROUP BY" clauses. <p> NOTE: Use of this means that the resulting objects may not have a valid ID column value so cannot be deleted or updated. </p>
[ "Add", "GROUP", "BY", "clause", "to", "the", "SQL", "query", "statement", ".", "This", "can", "be", "called", "multiple", "times", "to", "add", "additional", "GROUP", "BY", "clauses", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/QueryBuilder.java#L154-L161
160,188
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/QueryBuilder.java
QueryBuilder.groupByRaw
public QueryBuilder<T, ID> groupByRaw(String rawSql) { addGroupBy(ColumnNameOrRawSql.withRawSql(rawSql)); return this; }
java
public QueryBuilder<T, ID> groupByRaw(String rawSql) { addGroupBy(ColumnNameOrRawSql.withRawSql(rawSql)); return this; }
[ "public", "QueryBuilder", "<", "T", ",", "ID", ">", "groupByRaw", "(", "String", "rawSql", ")", "{", "addGroupBy", "(", "ColumnNameOrRawSql", ".", "withRawSql", "(", "rawSql", ")", ")", ";", "return", "this", ";", "}" ]
Add a raw SQL "GROUP BY" clause to the SQL query statement. This should not include the "GROUP BY".
[ "Add", "a", "raw", "SQL", "GROUP", "BY", "clause", "to", "the", "SQL", "query", "statement", ".", "This", "should", "not", "include", "the", "GROUP", "BY", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/QueryBuilder.java#L166-L169
160,189
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/QueryBuilder.java
QueryBuilder.orderBy
public QueryBuilder<T, ID> orderBy(String columnName, boolean ascending) { FieldType fieldType = verifyColumnName(columnName); if (fieldType.isForeignCollection()) { throw new IllegalArgumentException("Can't orderBy foreign collection field: " + columnName); } addOrderBy(new OrderBy(columnName, ascending)); return this; }
java
public QueryBuilder<T, ID> orderBy(String columnName, boolean ascending) { FieldType fieldType = verifyColumnName(columnName); if (fieldType.isForeignCollection()) { throw new IllegalArgumentException("Can't orderBy foreign collection field: " + columnName); } addOrderBy(new OrderBy(columnName, ascending)); return this; }
[ "public", "QueryBuilder", "<", "T", ",", "ID", ">", "orderBy", "(", "String", "columnName", ",", "boolean", "ascending", ")", "{", "FieldType", "fieldType", "=", "verifyColumnName", "(", "columnName", ")", ";", "if", "(", "fieldType", ".", "isForeignCollection", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Can't orderBy foreign collection field: \"", "+", "columnName", ")", ";", "}", "addOrderBy", "(", "new", "OrderBy", "(", "columnName", ",", "ascending", ")", ")", ";", "return", "this", ";", "}" ]
Add "ORDER BY" clause to the SQL query statement. This can be called multiple times to add additional "ORDER BY" clauses. Ones earlier are applied first.
[ "Add", "ORDER", "BY", "clause", "to", "the", "SQL", "query", "statement", ".", "This", "can", "be", "called", "multiple", "times", "to", "add", "additional", "ORDER", "BY", "clauses", ".", "Ones", "earlier", "are", "applied", "first", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/QueryBuilder.java#L175-L182
160,190
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/QueryBuilder.java
QueryBuilder.orderByRaw
public QueryBuilder<T, ID> orderByRaw(String rawSql) { addOrderBy(new OrderBy(rawSql, (ArgumentHolder[]) null)); return this; }
java
public QueryBuilder<T, ID> orderByRaw(String rawSql) { addOrderBy(new OrderBy(rawSql, (ArgumentHolder[]) null)); return this; }
[ "public", "QueryBuilder", "<", "T", ",", "ID", ">", "orderByRaw", "(", "String", "rawSql", ")", "{", "addOrderBy", "(", "new", "OrderBy", "(", "rawSql", ",", "(", "ArgumentHolder", "[", "]", ")", "null", ")", ")", ";", "return", "this", ";", "}" ]
Add raw SQL "ORDER BY" clause to the SQL query statement. @param rawSql The raw SQL order by clause. This should not include the "ORDER BY".
[ "Add", "raw", "SQL", "ORDER", "BY", "clause", "to", "the", "SQL", "query", "statement", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/QueryBuilder.java#L190-L193
160,191
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/QueryBuilder.java
QueryBuilder.join
public QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder) throws SQLException { addJoinInfo(JoinType.INNER, null, null, joinedQueryBuilder, JoinWhereOperation.AND); return this; }
java
public QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder) throws SQLException { addJoinInfo(JoinType.INNER, null, null, joinedQueryBuilder, JoinWhereOperation.AND); return this; }
[ "public", "QueryBuilder", "<", "T", ",", "ID", ">", "join", "(", "QueryBuilder", "<", "?", ",", "?", ">", "joinedQueryBuilder", ")", "throws", "SQLException", "{", "addJoinInfo", "(", "JoinType", ".", "INNER", ",", "null", ",", "null", ",", "joinedQueryBuilder", ",", "JoinWhereOperation", ".", "AND", ")", ";", "return", "this", ";", "}" ]
Join with another query builder. This will add into the SQL something close to " INNER JOIN other-table ...". Either the object associated with the current QueryBuilder or the argument QueryBuilder must have a foreign field of the other one. An exception will be thrown otherwise. <p> <b>NOTE:</b> This will do combine the WHERE statement of the two query builders with a SQL "AND". See {@link #joinOr(QueryBuilder)}. </p>
[ "Join", "with", "another", "query", "builder", ".", "This", "will", "add", "into", "the", "SQL", "something", "close", "to", "INNER", "JOIN", "other", "-", "table", "...", ".", "Either", "the", "object", "associated", "with", "the", "current", "QueryBuilder", "or", "the", "argument", "QueryBuilder", "must", "have", "a", "foreign", "field", "of", "the", "other", "one", ".", "An", "exception", "will", "be", "thrown", "otherwise", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/QueryBuilder.java#L289-L292
160,192
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/QueryBuilder.java
QueryBuilder.addJoinInfo
private void addJoinInfo(JoinType type, String localColumnName, String joinedColumnName, QueryBuilder<?, ?> joinedQueryBuilder, JoinWhereOperation operation) throws SQLException { JoinInfo joinInfo = new JoinInfo(type, joinedQueryBuilder, operation); if (localColumnName == null) { matchJoinedFields(joinInfo, joinedQueryBuilder); } else { matchJoinedFieldsByName(joinInfo, localColumnName, joinedColumnName, joinedQueryBuilder); } if (joinList == null) { joinList = new ArrayList<JoinInfo>(); } joinList.add(joinInfo); }
java
private void addJoinInfo(JoinType type, String localColumnName, String joinedColumnName, QueryBuilder<?, ?> joinedQueryBuilder, JoinWhereOperation operation) throws SQLException { JoinInfo joinInfo = new JoinInfo(type, joinedQueryBuilder, operation); if (localColumnName == null) { matchJoinedFields(joinInfo, joinedQueryBuilder); } else { matchJoinedFieldsByName(joinInfo, localColumnName, joinedColumnName, joinedQueryBuilder); } if (joinList == null) { joinList = new ArrayList<JoinInfo>(); } joinList.add(joinInfo); }
[ "private", "void", "addJoinInfo", "(", "JoinType", "type", ",", "String", "localColumnName", ",", "String", "joinedColumnName", ",", "QueryBuilder", "<", "?", ",", "?", ">", "joinedQueryBuilder", ",", "JoinWhereOperation", "operation", ")", "throws", "SQLException", "{", "JoinInfo", "joinInfo", "=", "new", "JoinInfo", "(", "type", ",", "joinedQueryBuilder", ",", "operation", ")", ";", "if", "(", "localColumnName", "==", "null", ")", "{", "matchJoinedFields", "(", "joinInfo", ",", "joinedQueryBuilder", ")", ";", "}", "else", "{", "matchJoinedFieldsByName", "(", "joinInfo", ",", "localColumnName", ",", "joinedColumnName", ",", "joinedQueryBuilder", ")", ";", "}", "if", "(", "joinList", "==", "null", ")", "{", "joinList", "=", "new", "ArrayList", "<", "JoinInfo", ">", "(", ")", ";", "}", "joinList", ".", "add", "(", "joinInfo", ")", ";", "}" ]
Add join info to the query. This can be called multiple times to join with more than one table.
[ "Add", "join", "info", "to", "the", "query", ".", "This", "can", "be", "called", "multiple", "times", "to", "join", "with", "more", "than", "one", "table", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/QueryBuilder.java#L578-L590
160,193
j256/ormlite-core
src/main/java/com/j256/ormlite/table/TableInfo.java
TableInfo.objectToString
public String objectToString(T object) { StringBuilder sb = new StringBuilder(64); sb.append(object.getClass().getSimpleName()); for (FieldType fieldType : fieldTypes) { sb.append(' ').append(fieldType.getColumnName()).append('='); try { sb.append(fieldType.extractJavaFieldValue(object)); } catch (Exception e) { throw new IllegalStateException("Could not generate toString of field " + fieldType, e); } } return sb.toString(); }
java
public String objectToString(T object) { StringBuilder sb = new StringBuilder(64); sb.append(object.getClass().getSimpleName()); for (FieldType fieldType : fieldTypes) { sb.append(' ').append(fieldType.getColumnName()).append('='); try { sb.append(fieldType.extractJavaFieldValue(object)); } catch (Exception e) { throw new IllegalStateException("Could not generate toString of field " + fieldType, e); } } return sb.toString(); }
[ "public", "String", "objectToString", "(", "T", "object", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "64", ")", ";", "sb", ".", "append", "(", "object", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "for", "(", "FieldType", "fieldType", ":", "fieldTypes", ")", "{", "sb", ".", "append", "(", "'", "'", ")", ".", "append", "(", "fieldType", ".", "getColumnName", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "try", "{", "sb", ".", "append", "(", "fieldType", ".", "extractJavaFieldValue", "(", "object", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Could not generate toString of field \"", "+", "fieldType", ",", "e", ")", ";", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Return a string representation of the object.
[ "Return", "a", "string", "representation", "of", "the", "object", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/table/TableInfo.java#L175-L187
160,194
j256/ormlite-core
src/main/java/com/j256/ormlite/misc/VersionUtils.java
VersionUtils.logVersionWarnings
private static void logVersionWarnings(String label1, String version1, String label2, String version2) { if (version1 == null) { if (version2 != null) { warning(null, "Unknown version", " for {}, version for {} is '{}'", new Object[] { label1, label2, version2 }); } } else { if (version2 == null) { warning(null, "Unknown version", " for {}, version for {} is '{}'", new Object[] { label2, label1, version1 }); } else if (!version1.equals(version2)) { warning(null, "Mismatched versions", ": {} is '{}', while {} is '{}'", new Object[] { label1, version1, label2, version2 }); } } }
java
private static void logVersionWarnings(String label1, String version1, String label2, String version2) { if (version1 == null) { if (version2 != null) { warning(null, "Unknown version", " for {}, version for {} is '{}'", new Object[] { label1, label2, version2 }); } } else { if (version2 == null) { warning(null, "Unknown version", " for {}, version for {} is '{}'", new Object[] { label2, label1, version1 }); } else if (!version1.equals(version2)) { warning(null, "Mismatched versions", ": {} is '{}', while {} is '{}'", new Object[] { label1, version1, label2, version2 }); } } }
[ "private", "static", "void", "logVersionWarnings", "(", "String", "label1", ",", "String", "version1", ",", "String", "label2", ",", "String", "version2", ")", "{", "if", "(", "version1", "==", "null", ")", "{", "if", "(", "version2", "!=", "null", ")", "{", "warning", "(", "null", ",", "\"Unknown version\"", ",", "\" for {}, version for {} is '{}'\"", ",", "new", "Object", "[", "]", "{", "label1", ",", "label2", ",", "version2", "}", ")", ";", "}", "}", "else", "{", "if", "(", "version2", "==", "null", ")", "{", "warning", "(", "null", ",", "\"Unknown version\"", ",", "\" for {}, version for {} is '{}'\"", ",", "new", "Object", "[", "]", "{", "label2", ",", "label1", ",", "version1", "}", ")", ";", "}", "else", "if", "(", "!", "version1", ".", "equals", "(", "version2", ")", ")", "{", "warning", "(", "null", ",", "\"Mismatched versions\"", ",", "\": {} is '{}', while {} is '{}'\"", ",", "new", "Object", "[", "]", "{", "label1", ",", "version1", ",", "label2", ",", "version2", "}", ")", ";", "}", "}", "}" ]
Log error information
[ "Log", "error", "information" ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/misc/VersionUtils.java#L51-L66
160,195
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementBuilder.java
StatementBuilder.prepareStatement
protected MappedPreparedStmt<T, ID> prepareStatement(Long limit, boolean cacheStore) throws SQLException { List<ArgumentHolder> argList = new ArrayList<ArgumentHolder>(); String statement = buildStatementString(argList); ArgumentHolder[] selectArgs = argList.toArray(new ArgumentHolder[argList.size()]); FieldType[] resultFieldTypes = getResultFieldTypes(); FieldType[] argFieldTypes = new FieldType[argList.size()]; for (int selectC = 0; selectC < selectArgs.length; selectC++) { argFieldTypes[selectC] = selectArgs[selectC].getFieldType(); } if (!type.isOkForStatementBuilder()) { throw new IllegalStateException("Building a statement from a " + type + " statement is not allowed"); } return new MappedPreparedStmt<T, ID>(dao, tableInfo, statement, argFieldTypes, resultFieldTypes, selectArgs, (databaseType.isLimitSqlSupported() ? null : limit), type, cacheStore); }
java
protected MappedPreparedStmt<T, ID> prepareStatement(Long limit, boolean cacheStore) throws SQLException { List<ArgumentHolder> argList = new ArrayList<ArgumentHolder>(); String statement = buildStatementString(argList); ArgumentHolder[] selectArgs = argList.toArray(new ArgumentHolder[argList.size()]); FieldType[] resultFieldTypes = getResultFieldTypes(); FieldType[] argFieldTypes = new FieldType[argList.size()]; for (int selectC = 0; selectC < selectArgs.length; selectC++) { argFieldTypes[selectC] = selectArgs[selectC].getFieldType(); } if (!type.isOkForStatementBuilder()) { throw new IllegalStateException("Building a statement from a " + type + " statement is not allowed"); } return new MappedPreparedStmt<T, ID>(dao, tableInfo, statement, argFieldTypes, resultFieldTypes, selectArgs, (databaseType.isLimitSqlSupported() ? null : limit), type, cacheStore); }
[ "protected", "MappedPreparedStmt", "<", "T", ",", "ID", ">", "prepareStatement", "(", "Long", "limit", ",", "boolean", "cacheStore", ")", "throws", "SQLException", "{", "List", "<", "ArgumentHolder", ">", "argList", "=", "new", "ArrayList", "<", "ArgumentHolder", ">", "(", ")", ";", "String", "statement", "=", "buildStatementString", "(", "argList", ")", ";", "ArgumentHolder", "[", "]", "selectArgs", "=", "argList", ".", "toArray", "(", "new", "ArgumentHolder", "[", "argList", ".", "size", "(", ")", "]", ")", ";", "FieldType", "[", "]", "resultFieldTypes", "=", "getResultFieldTypes", "(", ")", ";", "FieldType", "[", "]", "argFieldTypes", "=", "new", "FieldType", "[", "argList", ".", "size", "(", ")", "]", ";", "for", "(", "int", "selectC", "=", "0", ";", "selectC", "<", "selectArgs", ".", "length", ";", "selectC", "++", ")", "{", "argFieldTypes", "[", "selectC", "]", "=", "selectArgs", "[", "selectC", "]", ".", "getFieldType", "(", ")", ";", "}", "if", "(", "!", "type", ".", "isOkForStatementBuilder", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Building a statement from a \"", "+", "type", "+", "\" statement is not allowed\"", ")", ";", "}", "return", "new", "MappedPreparedStmt", "<", "T", ",", "ID", ">", "(", "dao", ",", "tableInfo", ",", "statement", ",", "argFieldTypes", ",", "resultFieldTypes", ",", "selectArgs", ",", "(", "databaseType", ".", "isLimitSqlSupported", "(", ")", "?", "null", ":", "limit", ")", ",", "type", ",", "cacheStore", ")", ";", "}" ]
Prepare our statement for the subclasses. @param limit Limit for queries. Can be null if none.
[ "Prepare", "our", "statement", "for", "the", "subclasses", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementBuilder.java#L73-L87
160,196
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementBuilder.java
StatementBuilder.prepareStatementString
public String prepareStatementString() throws SQLException { List<ArgumentHolder> argList = new ArrayList<ArgumentHolder>(); return buildStatementString(argList); }
java
public String prepareStatementString() throws SQLException { List<ArgumentHolder> argList = new ArrayList<ArgumentHolder>(); return buildStatementString(argList); }
[ "public", "String", "prepareStatementString", "(", ")", "throws", "SQLException", "{", "List", "<", "ArgumentHolder", ">", "argList", "=", "new", "ArrayList", "<", "ArgumentHolder", ">", "(", ")", ";", "return", "buildStatementString", "(", "argList", ")", ";", "}" ]
Build and return a string version of the query. If you change the where or make other calls you will need to re-call this method to re-prepare the query for execution.
[ "Build", "and", "return", "a", "string", "version", "of", "the", "query", ".", "If", "you", "change", "the", "where", "or", "make", "other", "calls", "you", "will", "need", "to", "re", "-", "call", "this", "method", "to", "re", "-", "prepare", "the", "query", "for", "execution", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementBuilder.java#L93-L96
160,197
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementBuilder.java
StatementBuilder.appendWhereStatement
protected boolean appendWhereStatement(StringBuilder sb, List<ArgumentHolder> argList, WhereOperation operation) throws SQLException { if (where == null) { return operation == WhereOperation.FIRST; } operation.appendBefore(sb); where.appendSql((addTableName ? getTableName() : null), sb, argList); operation.appendAfter(sb); return false; }
java
protected boolean appendWhereStatement(StringBuilder sb, List<ArgumentHolder> argList, WhereOperation operation) throws SQLException { if (where == null) { return operation == WhereOperation.FIRST; } operation.appendBefore(sb); where.appendSql((addTableName ? getTableName() : null), sb, argList); operation.appendAfter(sb); return false; }
[ "protected", "boolean", "appendWhereStatement", "(", "StringBuilder", "sb", ",", "List", "<", "ArgumentHolder", ">", "argList", ",", "WhereOperation", "operation", ")", "throws", "SQLException", "{", "if", "(", "where", "==", "null", ")", "{", "return", "operation", "==", "WhereOperation", ".", "FIRST", ";", "}", "operation", ".", "appendBefore", "(", "sb", ")", ";", "where", ".", "appendSql", "(", "(", "addTableName", "?", "getTableName", "(", ")", ":", "null", ")", ",", "sb", ",", "argList", ")", ";", "operation", ".", "appendAfter", "(", "sb", ")", ";", "return", "false", ";", "}" ]
Append the WHERE part of the statement to the StringBuilder.
[ "Append", "the", "WHERE", "part", "of", "the", "statement", "to", "the", "StringBuilder", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementBuilder.java#L145-L154
160,198
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/mapped/MappedDeleteCollection.java
MappedDeleteCollection.build
private static <T, ID> MappedDeleteCollection<T, ID> build(Dao<T, ID> dao, TableInfo<T, ID> tableInfo, int dataSize) throws SQLException { FieldType idField = tableInfo.getIdField(); if (idField == null) { throw new SQLException( "Cannot delete " + tableInfo.getDataClass() + " because it doesn't have an id field defined"); } StringBuilder sb = new StringBuilder(128); DatabaseType databaseType = dao.getConnectionSource().getDatabaseType(); appendTableName(databaseType, sb, "DELETE FROM ", tableInfo.getTableName()); FieldType[] argFieldTypes = new FieldType[dataSize]; appendWhereIds(databaseType, idField, sb, dataSize, argFieldTypes); return new MappedDeleteCollection<T, ID>(dao, tableInfo, sb.toString(), argFieldTypes); }
java
private static <T, ID> MappedDeleteCollection<T, ID> build(Dao<T, ID> dao, TableInfo<T, ID> tableInfo, int dataSize) throws SQLException { FieldType idField = tableInfo.getIdField(); if (idField == null) { throw new SQLException( "Cannot delete " + tableInfo.getDataClass() + " because it doesn't have an id field defined"); } StringBuilder sb = new StringBuilder(128); DatabaseType databaseType = dao.getConnectionSource().getDatabaseType(); appendTableName(databaseType, sb, "DELETE FROM ", tableInfo.getTableName()); FieldType[] argFieldTypes = new FieldType[dataSize]; appendWhereIds(databaseType, idField, sb, dataSize, argFieldTypes); return new MappedDeleteCollection<T, ID>(dao, tableInfo, sb.toString(), argFieldTypes); }
[ "private", "static", "<", "T", ",", "ID", ">", "MappedDeleteCollection", "<", "T", ",", "ID", ">", "build", "(", "Dao", "<", "T", ",", "ID", ">", "dao", ",", "TableInfo", "<", "T", ",", "ID", ">", "tableInfo", ",", "int", "dataSize", ")", "throws", "SQLException", "{", "FieldType", "idField", "=", "tableInfo", ".", "getIdField", "(", ")", ";", "if", "(", "idField", "==", "null", ")", "{", "throw", "new", "SQLException", "(", "\"Cannot delete \"", "+", "tableInfo", ".", "getDataClass", "(", ")", "+", "\" because it doesn't have an id field defined\"", ")", ";", "}", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "128", ")", ";", "DatabaseType", "databaseType", "=", "dao", ".", "getConnectionSource", "(", ")", ".", "getDatabaseType", "(", ")", ";", "appendTableName", "(", "databaseType", ",", "sb", ",", "\"DELETE FROM \"", ",", "tableInfo", ".", "getTableName", "(", ")", ")", ";", "FieldType", "[", "]", "argFieldTypes", "=", "new", "FieldType", "[", "dataSize", "]", ";", "appendWhereIds", "(", "databaseType", ",", "idField", ",", "sb", ",", "dataSize", ",", "argFieldTypes", ")", ";", "return", "new", "MappedDeleteCollection", "<", "T", ",", "ID", ">", "(", "dao", ",", "tableInfo", ",", "sb", ".", "toString", "(", ")", ",", "argFieldTypes", ")", ";", "}" ]
This is private because the execute is the only method that should be called here.
[ "This", "is", "private", "because", "the", "execute", "is", "the", "only", "method", "that", "should", "be", "called", "here", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/mapped/MappedDeleteCollection.java#L63-L76
160,199
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/SelectIterator.java
SelectIterator.next
@Override public T next() { SQLException sqlException = null; try { T result = nextThrow(); if (result != null) { return result; } } catch (SQLException e) { sqlException = e; } // we have to throw if there is no next or on a SQLException last = null; closeQuietly(); throw new IllegalStateException("Could not get next result for " + dataClass, sqlException); }
java
@Override public T next() { SQLException sqlException = null; try { T result = nextThrow(); if (result != null) { return result; } } catch (SQLException e) { sqlException = e; } // we have to throw if there is no next or on a SQLException last = null; closeQuietly(); throw new IllegalStateException("Could not get next result for " + dataClass, sqlException); }
[ "@", "Override", "public", "T", "next", "(", ")", "{", "SQLException", "sqlException", "=", "null", ";", "try", "{", "T", "result", "=", "nextThrow", "(", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "return", "result", ";", "}", "}", "catch", "(", "SQLException", "e", ")", "{", "sqlException", "=", "e", ";", "}", "// we have to throw if there is no next or on a SQLException", "last", "=", "null", ";", "closeQuietly", "(", ")", ";", "throw", "new", "IllegalStateException", "(", "\"Could not get next result for \"", "+", "dataClass", ",", "sqlException", ")", ";", "}" ]
Returns the next object in the table. @throws IllegalStateException If there was a problem extracting the object from SQL.
[ "Returns", "the", "next", "object", "in", "the", "table", "." ]
154d85bbb9614a0ea65a012251257831fb4fba21
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/SelectIterator.java#L177-L192