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
149,500
javagl/Common
src/main/java/de/javagl/common/xml/XmlUtils.java
XmlUtils.readEnum
static <E extends Enum<E>> E readEnum(Node node, Class<E> enumClass) { if (node == null) { throw new XmlException( "Tried to read "+enumClass.getSimpleName()+ " value from null node"); } String value = node.getFirstChild().getNodeValue(); if (value == null) { throw new XmlException( "Tried to read "+enumClass.getSimpleName()+ " value from null value"); } try { return Enum.valueOf(enumClass, value); } catch (IllegalArgumentException e) { throw new XmlException( "No valid "+enumClass.getSimpleName()+ ": \""+value+"\""); } }
java
static <E extends Enum<E>> E readEnum(Node node, Class<E> enumClass) { if (node == null) { throw new XmlException( "Tried to read "+enumClass.getSimpleName()+ " value from null node"); } String value = node.getFirstChild().getNodeValue(); if (value == null) { throw new XmlException( "Tried to read "+enumClass.getSimpleName()+ " value from null value"); } try { return Enum.valueOf(enumClass, value); } catch (IllegalArgumentException e) { throw new XmlException( "No valid "+enumClass.getSimpleName()+ ": \""+value+"\""); } }
[ "static", "<", "E", "extends", "Enum", "<", "E", ">", ">", "E", "readEnum", "(", "Node", "node", ",", "Class", "<", "E", ">", "enumClass", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "XmlException", "(", "\"Tried to read \"", "+", "enumClass", ".", "getSimpleName", "(", ")", "+", "\" value from null node\"", ")", ";", "}", "String", "value", "=", "node", ".", "getFirstChild", "(", ")", ".", "getNodeValue", "(", ")", ";", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "XmlException", "(", "\"Tried to read \"", "+", "enumClass", ".", "getSimpleName", "(", ")", "+", "\" value from null value\"", ")", ";", "}", "try", "{", "return", "Enum", ".", "valueOf", "(", "enumClass", ",", "value", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "throw", "new", "XmlException", "(", "\"No valid \"", "+", "enumClass", ".", "getSimpleName", "(", ")", "+", "\": \\\"\"", "+", "value", "+", "\"\\\"\"", ")", ";", "}", "}" ]
Parse an enum value from the first child of the given node. @param <E> The enum type @param node The node @param enumClass The enum class @return The enum value @throws XmlException If the given node was <code>null</code>, or no enum value could be parsed
[ "Parse", "an", "enum", "value", "from", "the", "first", "child", "of", "the", "given", "node", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/xml/XmlUtils.java#L581-L606
149,501
javagl/Common
src/main/java/de/javagl/common/xml/XmlUtils.java
XmlUtils.readIntChild
public static int readIntChild( Node node, String childNodeName, int defaultValue) { if (node == null) { throw new XmlException( "Tried to read int value from child of null node"); } Node child = XmlUtils.getFirstChild(node, childNodeName); if (child == null) { return defaultValue; } return XmlUtils.readInt(child); }
java
public static int readIntChild( Node node, String childNodeName, int defaultValue) { if (node == null) { throw new XmlException( "Tried to read int value from child of null node"); } Node child = XmlUtils.getFirstChild(node, childNodeName); if (child == null) { return defaultValue; } return XmlUtils.readInt(child); }
[ "public", "static", "int", "readIntChild", "(", "Node", "node", ",", "String", "childNodeName", ",", "int", "defaultValue", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "XmlException", "(", "\"Tried to read int value from child of null node\"", ")", ";", "}", "Node", "child", "=", "XmlUtils", ".", "getFirstChild", "(", "node", ",", "childNodeName", ")", ";", "if", "(", "child", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "return", "XmlUtils", ".", "readInt", "(", "child", ")", ";", "}" ]
Read an int value from the first child of the given node with the given name. If no such child is found, then the default value will be returned. @param node The node @param childNodeName The child node name @param defaultValue The default value @return The int value @throws XmlException If the given node was <code>null</code>, or no int value could be parsed
[ "Read", "an", "int", "value", "from", "the", "first", "child", "of", "the", "given", "node", "with", "the", "given", "name", ".", "If", "no", "such", "child", "is", "found", "then", "the", "default", "value", "will", "be", "returned", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/xml/XmlUtils.java#L620-L634
149,502
javagl/Common
src/main/java/de/javagl/common/xml/XmlUtils.java
XmlUtils.readDoubleChild
static double readDoubleChild( Node node, String childNodeName, double defaultValue) { if (node == null) { throw new XmlException( "Tried to read double value from child of null node"); } Node child = XmlUtils.getFirstChild(node, childNodeName); if (child == null) { return defaultValue; } return XmlUtils.readDouble(child); }
java
static double readDoubleChild( Node node, String childNodeName, double defaultValue) { if (node == null) { throw new XmlException( "Tried to read double value from child of null node"); } Node child = XmlUtils.getFirstChild(node, childNodeName); if (child == null) { return defaultValue; } return XmlUtils.readDouble(child); }
[ "static", "double", "readDoubleChild", "(", "Node", "node", ",", "String", "childNodeName", ",", "double", "defaultValue", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "XmlException", "(", "\"Tried to read double value from child of null node\"", ")", ";", "}", "Node", "child", "=", "XmlUtils", ".", "getFirstChild", "(", "node", ",", "childNodeName", ")", ";", "if", "(", "child", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "return", "XmlUtils", ".", "readDouble", "(", "child", ")", ";", "}" ]
Read a double value from the first child of the given node with the given name. If no such child is found, then the default value will be returned. @param node The node @param childNodeName The child node name @param defaultValue The default value @return The double value @throws XmlException If the given node was <code>null</code>, or no double value could be parsed
[ "Read", "a", "double", "value", "from", "the", "first", "child", "of", "the", "given", "node", "with", "the", "given", "name", ".", "If", "no", "such", "child", "is", "found", "then", "the", "default", "value", "will", "be", "returned", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/xml/XmlUtils.java#L648-L662
149,503
javagl/Common
src/main/java/de/javagl/common/xml/XmlUtils.java
XmlUtils.readBooleanChild
public static boolean readBooleanChild( Node node, String childNodeName, boolean defaultValue) { if (node == null) { throw new XmlException( "Tried to read boolean value from child of null node"); } Node child = XmlUtils.getFirstChild(node, childNodeName); if (child == null) { return defaultValue; } return XmlUtils.readBoolean(child); }
java
public static boolean readBooleanChild( Node node, String childNodeName, boolean defaultValue) { if (node == null) { throw new XmlException( "Tried to read boolean value from child of null node"); } Node child = XmlUtils.getFirstChild(node, childNodeName); if (child == null) { return defaultValue; } return XmlUtils.readBoolean(child); }
[ "public", "static", "boolean", "readBooleanChild", "(", "Node", "node", ",", "String", "childNodeName", ",", "boolean", "defaultValue", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "XmlException", "(", "\"Tried to read boolean value from child of null node\"", ")", ";", "}", "Node", "child", "=", "XmlUtils", ".", "getFirstChild", "(", "node", ",", "childNodeName", ")", ";", "if", "(", "child", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "return", "XmlUtils", ".", "readBoolean", "(", "child", ")", ";", "}" ]
Read an boolean value from the first child of the given node with the given name. If no such child is found, then the default value will be returned. @param node The node @param childNodeName The child node name @param defaultValue The default value @return The boolean value @throws XmlException If the given node was <code>null</code>
[ "Read", "an", "boolean", "value", "from", "the", "first", "child", "of", "the", "given", "node", "with", "the", "given", "name", ".", "If", "no", "such", "child", "is", "found", "then", "the", "default", "value", "will", "be", "returned", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/xml/XmlUtils.java#L675-L689
149,504
javagl/Common
src/main/java/de/javagl/common/xml/XmlUtils.java
XmlUtils.readEnumChild
public static <E extends Enum<E>> E readEnumChild( Node node, Class<E> enumClass, String childNodeName) { if (node == null) { throw new XmlException( "Tried to read enum value from child of null node"); } Node child = XmlUtils.getFirstChild(node, childNodeName); return XmlUtils.readEnum(child, enumClass); }
java
public static <E extends Enum<E>> E readEnumChild( Node node, Class<E> enumClass, String childNodeName) { if (node == null) { throw new XmlException( "Tried to read enum value from child of null node"); } Node child = XmlUtils.getFirstChild(node, childNodeName); return XmlUtils.readEnum(child, enumClass); }
[ "public", "static", "<", "E", "extends", "Enum", "<", "E", ">", ">", "E", "readEnumChild", "(", "Node", "node", ",", "Class", "<", "E", ">", "enumClass", ",", "String", "childNodeName", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "XmlException", "(", "\"Tried to read enum value from child of null node\"", ")", ";", "}", "Node", "child", "=", "XmlUtils", ".", "getFirstChild", "(", "node", ",", "childNodeName", ")", ";", "return", "XmlUtils", ".", "readEnum", "(", "child", ",", "enumClass", ")", ";", "}" ]
Parse an enum value from the first child of the given node with the given name @param <E> The enum type @param node The node @param enumClass The enum class @param childNodeName The child node name @return The enum value @throws XmlException If the given node was <code>null</code>, or no enum value could be parsed
[ "Parse", "an", "enum", "value", "from", "the", "first", "child", "of", "the", "given", "node", "with", "the", "given", "name" ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/xml/XmlUtils.java#L704-L714
149,505
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/input/AbstractInputHandler.java
AbstractInputHandler.validateSqlString
protected void validateSqlString(String originalSql) { if (originalSql == null) { throw new IllegalArgumentException(ERROR_SQL_QUERY_NULL); } if (processor.hasUnnamedParameters(originalSql) == true) { throw new IllegalArgumentException(ERROR_FOUND_UNNAMED_PARAMETER); } }
java
protected void validateSqlString(String originalSql) { if (originalSql == null) { throw new IllegalArgumentException(ERROR_SQL_QUERY_NULL); } if (processor.hasUnnamedParameters(originalSql) == true) { throw new IllegalArgumentException(ERROR_FOUND_UNNAMED_PARAMETER); } }
[ "protected", "void", "validateSqlString", "(", "String", "originalSql", ")", "{", "if", "(", "originalSql", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "ERROR_SQL_QUERY_NULL", ")", ";", "}", "if", "(", "processor", ".", "hasUnnamedParameters", "(", "originalSql", ")", "==", "true", ")", "{", "throw", "new", "IllegalArgumentException", "(", "ERROR_FOUND_UNNAMED_PARAMETER", ")", ";", "}", "}" ]
Checks if original SQL string valid. If string contains some unnamed "?" parameters - it is considered unvalid @param originalSql Original SQL String
[ "Checks", "if", "original", "SQL", "string", "valid", ".", "If", "string", "contains", "some", "unnamed", "?", "parameters", "-", "it", "is", "considered", "unvalid" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/input/AbstractInputHandler.java#L88-L95
149,506
RogerParkinson/madura-workflows
madura-workflow/src/main/java/nz/co/senanque/workflow/WorkflowManagerImpl.java
WorkflowManagerImpl.lockProcessInstance
public ProcessInstance lockProcessInstance(final ProcessInstance processInstance, final boolean techSupport, final String userName) { List<Lock> locks = ContextUtils.getLocks(processInstance,getLockFactory(),"nz.co.senanque.workflow.WorkflowClient.lock(ProcessInstance)"); LockTemplate lockTemplate = new LockTemplate(locks, new LockAction() { public void doAction() { String taskId = ProcessInstanceUtils.getTaskId(processInstance); ProcessInstance pi = getWorkflowDAO().refreshProcessInstance(processInstance); // if (log.isDebugEnabled()) { // log.debug("taskId {} ProcessInstanceUtils.getTaskId(pi) {} {}",taskId,ProcessInstanceUtils.getTaskId(pi),(!taskId.equals(ProcessInstanceUtils.getTaskId(pi)))); // log.debug("pi.getStatus() {} techSupport {} {}",pi.getStatus(),techSupport,((pi.getStatus() != TaskStatus.WAIT) && !techSupport)); // log.debug("pi.getStatus() {} userName {} pi.getLockedBy() {} {}",pi.getStatus(),userName,pi.getLockedBy(),(pi.getStatus() == TaskStatus.BUSY) && !userName.equals(pi.getLockedBy()) && !techSupport); // } if (!techSupport) { if (!(taskId.equals(ProcessInstanceUtils.getTaskId(pi)) && ((pi.getStatus() == TaskStatus.WAIT) || ((pi.getStatus() == TaskStatus.BUSY) && userName.equals(pi.getLockedBy()))))) { // // In this case we did not actually fail to get the lock but // // the process is not in the state // // it was in when we saw it in the table because another // // user (probably) has updated it. // // Therefore it is dangerous to proceed (unless we are tech support) throw new RuntimeException("ProcessInstance is already busy"); } } pi.setStatus(TaskStatus.BUSY); pi.setLockedBy(userName); TaskBase task = getCurrentTask(pi); Audit audit = createAudit(pi, task); getWorkflowDAO().mergeProcessInstance(pi); } }); boolean weAreOkay = true; try { weAreOkay = lockTemplate.doAction(); } catch (Exception e) { weAreOkay = false; } if (!weAreOkay) { return null; } return getWorkflowDAO().refreshProcessInstance(processInstance); }
java
public ProcessInstance lockProcessInstance(final ProcessInstance processInstance, final boolean techSupport, final String userName) { List<Lock> locks = ContextUtils.getLocks(processInstance,getLockFactory(),"nz.co.senanque.workflow.WorkflowClient.lock(ProcessInstance)"); LockTemplate lockTemplate = new LockTemplate(locks, new LockAction() { public void doAction() { String taskId = ProcessInstanceUtils.getTaskId(processInstance); ProcessInstance pi = getWorkflowDAO().refreshProcessInstance(processInstance); // if (log.isDebugEnabled()) { // log.debug("taskId {} ProcessInstanceUtils.getTaskId(pi) {} {}",taskId,ProcessInstanceUtils.getTaskId(pi),(!taskId.equals(ProcessInstanceUtils.getTaskId(pi)))); // log.debug("pi.getStatus() {} techSupport {} {}",pi.getStatus(),techSupport,((pi.getStatus() != TaskStatus.WAIT) && !techSupport)); // log.debug("pi.getStatus() {} userName {} pi.getLockedBy() {} {}",pi.getStatus(),userName,pi.getLockedBy(),(pi.getStatus() == TaskStatus.BUSY) && !userName.equals(pi.getLockedBy()) && !techSupport); // } if (!techSupport) { if (!(taskId.equals(ProcessInstanceUtils.getTaskId(pi)) && ((pi.getStatus() == TaskStatus.WAIT) || ((pi.getStatus() == TaskStatus.BUSY) && userName.equals(pi.getLockedBy()))))) { // // In this case we did not actually fail to get the lock but // // the process is not in the state // // it was in when we saw it in the table because another // // user (probably) has updated it. // // Therefore it is dangerous to proceed (unless we are tech support) throw new RuntimeException("ProcessInstance is already busy"); } } pi.setStatus(TaskStatus.BUSY); pi.setLockedBy(userName); TaskBase task = getCurrentTask(pi); Audit audit = createAudit(pi, task); getWorkflowDAO().mergeProcessInstance(pi); } }); boolean weAreOkay = true; try { weAreOkay = lockTemplate.doAction(); } catch (Exception e) { weAreOkay = false; } if (!weAreOkay) { return null; } return getWorkflowDAO().refreshProcessInstance(processInstance); }
[ "public", "ProcessInstance", "lockProcessInstance", "(", "final", "ProcessInstance", "processInstance", ",", "final", "boolean", "techSupport", ",", "final", "String", "userName", ")", "{", "List", "<", "Lock", ">", "locks", "=", "ContextUtils", ".", "getLocks", "(", "processInstance", ",", "getLockFactory", "(", ")", ",", "\"nz.co.senanque.workflow.WorkflowClient.lock(ProcessInstance)\"", ")", ";", "LockTemplate", "lockTemplate", "=", "new", "LockTemplate", "(", "locks", ",", "new", "LockAction", "(", ")", "{", "public", "void", "doAction", "(", ")", "{", "String", "taskId", "=", "ProcessInstanceUtils", ".", "getTaskId", "(", "processInstance", ")", ";", "ProcessInstance", "pi", "=", "getWorkflowDAO", "(", ")", ".", "refreshProcessInstance", "(", "processInstance", ")", ";", "//\t\t\t\tif (log.isDebugEnabled()) {", "//\t\t\t\t\tlog.debug(\"taskId {} ProcessInstanceUtils.getTaskId(pi) {} {}\",taskId,ProcessInstanceUtils.getTaskId(pi),(!taskId.equals(ProcessInstanceUtils.getTaskId(pi))));", "//\t\t\t\t\tlog.debug(\"pi.getStatus() {} techSupport {} {}\",pi.getStatus(),techSupport,((pi.getStatus() != TaskStatus.WAIT) && !techSupport));", "//\t\t\t\t\tlog.debug(\"pi.getStatus() {} userName {} pi.getLockedBy() {} {}\",pi.getStatus(),userName,pi.getLockedBy(),(pi.getStatus() == TaskStatus.BUSY) && !userName.equals(pi.getLockedBy()) && !techSupport);", "//\t\t\t\t}", "if", "(", "!", "techSupport", ")", "{", "if", "(", "!", "(", "taskId", ".", "equals", "(", "ProcessInstanceUtils", ".", "getTaskId", "(", "pi", ")", ")", "&&", "(", "(", "pi", ".", "getStatus", "(", ")", "==", "TaskStatus", ".", "WAIT", ")", "||", "(", "(", "pi", ".", "getStatus", "(", ")", "==", "TaskStatus", ".", "BUSY", ")", "&&", "userName", ".", "equals", "(", "pi", ".", "getLockedBy", "(", ")", ")", ")", ")", ")", ")", "{", "//\t\t\t\t\t\t// In this case we did not actually fail to get the lock but", "//\t\t\t\t\t\t// the process is not in the state", "//\t\t\t\t\t\t// it was in when we saw it in the table because another", "//\t\t\t\t\t\t// user (probably) has updated it.", "//\t\t\t\t\t\t// Therefore it is dangerous to proceed (unless we are tech support)", "throw", "new", "RuntimeException", "(", "\"ProcessInstance is already busy\"", ")", ";", "}", "}", "pi", ".", "setStatus", "(", "TaskStatus", ".", "BUSY", ")", ";", "pi", ".", "setLockedBy", "(", "userName", ")", ";", "TaskBase", "task", "=", "getCurrentTask", "(", "pi", ")", ";", "Audit", "audit", "=", "createAudit", "(", "pi", ",", "task", ")", ";", "getWorkflowDAO", "(", ")", ".", "mergeProcessInstance", "(", "pi", ")", ";", "}", "}", ")", ";", "boolean", "weAreOkay", "=", "true", ";", "try", "{", "weAreOkay", "=", "lockTemplate", ".", "doAction", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "weAreOkay", "=", "false", ";", "}", "if", "(", "!", "weAreOkay", ")", "{", "return", "null", ";", "}", "return", "getWorkflowDAO", "(", ")", ".", "refreshProcessInstance", "(", "processInstance", ")", ";", "}" ]
This manages the transition of the process instance from Waiting to Busy with appropriate locking and unlocking. Once it is busy it is ours but we have to check that it was not changed since we last saw it. The situation we are protecting against is that although the process instance looked to be in wait state in the table we might have sat on that for a while and someone else may have updated it meanwhile. In that case we reject the request, unless we are TECHSUPPORT. Those guys can do anything. @param processInstance @param techSupport (boolean that indicates if we have TECHSUPPORT privs) @param userName @return updated processInstance or null if we failed to get the lock
[ "This", "manages", "the", "transition", "of", "the", "process", "instance", "from", "Waiting", "to", "Busy", "with", "appropriate", "locking", "and", "unlocking", ".", "Once", "it", "is", "busy", "it", "is", "ours", "but", "we", "have", "to", "check", "that", "it", "was", "not", "changed", "since", "we", "last", "saw", "it", ".", "The", "situation", "we", "are", "protecting", "against", "is", "that", "although", "the", "process", "instance", "looked", "to", "be", "in", "wait", "state", "in", "the", "table", "we", "might", "have", "sat", "on", "that", "for", "a", "while", "and", "someone", "else", "may", "have", "updated", "it", "meanwhile", ".", "In", "that", "case", "we", "reject", "the", "request", "unless", "we", "are", "TECHSUPPORT", ".", "Those", "guys", "can", "do", "anything", "." ]
3d26c322fc85a006ff0d0cbebacbc453aed8e492
https://github.com/RogerParkinson/madura-workflows/blob/3d26c322fc85a006ff0d0cbebacbc453aed8e492/madura-workflow/src/main/java/nz/co/senanque/workflow/WorkflowManagerImpl.java#L309-L351
149,507
RogerParkinson/madura-workflows
madura-workflow/src/main/java/nz/co/senanque/workflow/WorkflowManagerImpl.java
WorkflowManagerImpl.endOfProcessDetected
protected TaskBase endOfProcessDetected(ProcessInstance processInstance, Audit currentAudit) { TaskBase ret = null; TaskBase currentTask = getCurrentTask(processInstance); ProcessInstanceUtils.clearQueue(processInstance, TaskStatus.DONE); currentAudit.setStatus(TaskStatus.DONE); // End of process can mean just the end of a handler process. { List<Audit> audits = findHandlerTasks(processInstance); for (Audit audit : audits) { TaskBase taskBase = getTask(audit); audit.setHandler(false); if (taskBase instanceof TaskTry) { TaskTry taskTry = (TaskTry)taskBase; if (taskTry.getTimeoutValue() > -1) { // we ended a handler that had a timeout. // That means we need to cancel the timeout. getWorkflowDAO().removeDeferredEvent(processInstance,taskTry); } TaskBase nextTask = taskTry.getNextTask(processInstance); nextTask.loadTask(processInstance); } if (taskBase instanceof TaskIf) { TaskIf taskIf = (TaskIf)taskBase; TaskBase nextTask = taskIf.getNextTask(processInstance); nextTask.loadTask(processInstance); } ret = getCurrentTask(processInstance); break; } } // If this is a subprocess then tickle the parent. tickleParentProcess(processInstance,TaskStatus.DONE); if (ret == currentTask) { processInstance.setStatus(TaskStatus.DONE); } getWorkflowDAO().mergeProcessInstance(processInstance); getWorkflowDAO().flush(); getWorkflowDAO().refreshProcessInstance(processInstance); return ret; }
java
protected TaskBase endOfProcessDetected(ProcessInstance processInstance, Audit currentAudit) { TaskBase ret = null; TaskBase currentTask = getCurrentTask(processInstance); ProcessInstanceUtils.clearQueue(processInstance, TaskStatus.DONE); currentAudit.setStatus(TaskStatus.DONE); // End of process can mean just the end of a handler process. { List<Audit> audits = findHandlerTasks(processInstance); for (Audit audit : audits) { TaskBase taskBase = getTask(audit); audit.setHandler(false); if (taskBase instanceof TaskTry) { TaskTry taskTry = (TaskTry)taskBase; if (taskTry.getTimeoutValue() > -1) { // we ended a handler that had a timeout. // That means we need to cancel the timeout. getWorkflowDAO().removeDeferredEvent(processInstance,taskTry); } TaskBase nextTask = taskTry.getNextTask(processInstance); nextTask.loadTask(processInstance); } if (taskBase instanceof TaskIf) { TaskIf taskIf = (TaskIf)taskBase; TaskBase nextTask = taskIf.getNextTask(processInstance); nextTask.loadTask(processInstance); } ret = getCurrentTask(processInstance); break; } } // If this is a subprocess then tickle the parent. tickleParentProcess(processInstance,TaskStatus.DONE); if (ret == currentTask) { processInstance.setStatus(TaskStatus.DONE); } getWorkflowDAO().mergeProcessInstance(processInstance); getWorkflowDAO().flush(); getWorkflowDAO().refreshProcessInstance(processInstance); return ret; }
[ "protected", "TaskBase", "endOfProcessDetected", "(", "ProcessInstance", "processInstance", ",", "Audit", "currentAudit", ")", "{", "TaskBase", "ret", "=", "null", ";", "TaskBase", "currentTask", "=", "getCurrentTask", "(", "processInstance", ")", ";", "ProcessInstanceUtils", ".", "clearQueue", "(", "processInstance", ",", "TaskStatus", ".", "DONE", ")", ";", "currentAudit", ".", "setStatus", "(", "TaskStatus", ".", "DONE", ")", ";", "// End of process can mean just the end of a handler process.", "{", "List", "<", "Audit", ">", "audits", "=", "findHandlerTasks", "(", "processInstance", ")", ";", "for", "(", "Audit", "audit", ":", "audits", ")", "{", "TaskBase", "taskBase", "=", "getTask", "(", "audit", ")", ";", "audit", ".", "setHandler", "(", "false", ")", ";", "if", "(", "taskBase", "instanceof", "TaskTry", ")", "{", "TaskTry", "taskTry", "=", "(", "TaskTry", ")", "taskBase", ";", "if", "(", "taskTry", ".", "getTimeoutValue", "(", ")", ">", "-", "1", ")", "{", "// we ended a handler that had a timeout.", "// That means we need to cancel the timeout.", "getWorkflowDAO", "(", ")", ".", "removeDeferredEvent", "(", "processInstance", ",", "taskTry", ")", ";", "}", "TaskBase", "nextTask", "=", "taskTry", ".", "getNextTask", "(", "processInstance", ")", ";", "nextTask", ".", "loadTask", "(", "processInstance", ")", ";", "}", "if", "(", "taskBase", "instanceof", "TaskIf", ")", "{", "TaskIf", "taskIf", "=", "(", "TaskIf", ")", "taskBase", ";", "TaskBase", "nextTask", "=", "taskIf", ".", "getNextTask", "(", "processInstance", ")", ";", "nextTask", ".", "loadTask", "(", "processInstance", ")", ";", "}", "ret", "=", "getCurrentTask", "(", "processInstance", ")", ";", "break", ";", "}", "}", "// If this is a subprocess then tickle the parent.", "tickleParentProcess", "(", "processInstance", ",", "TaskStatus", ".", "DONE", ")", ";", "if", "(", "ret", "==", "currentTask", ")", "{", "processInstance", ".", "setStatus", "(", "TaskStatus", ".", "DONE", ")", ";", "}", "getWorkflowDAO", "(", ")", ".", "mergeProcessInstance", "(", "processInstance", ")", ";", "getWorkflowDAO", "(", ")", ".", "flush", "(", ")", ";", "getWorkflowDAO", "(", ")", ".", "refreshProcessInstance", "(", "processInstance", ")", ";", "return", "ret", ";", "}" ]
If this is just the end of the handler then return the next task after the handler If it is the end of the whole process then return null. @param processInstance @param currentAudit @return TaskBase
[ "If", "this", "is", "just", "the", "end", "of", "the", "handler", "then", "return", "the", "next", "task", "after", "the", "handler", "If", "it", "is", "the", "end", "of", "the", "whole", "process", "then", "return", "null", "." ]
3d26c322fc85a006ff0d0cbebacbc453aed8e492
https://github.com/RogerParkinson/madura-workflows/blob/3d26c322fc85a006ff0d0cbebacbc453aed8e492/madura-workflow/src/main/java/nz/co/senanque/workflow/WorkflowManagerImpl.java#L396-L436
149,508
RogerParkinson/madura-workflows
madura-workflow/src/main/java/nz/co/senanque/workflow/WorkflowManagerImpl.java
WorkflowManagerImpl.init
@PostConstruct public void init() { findBeans(); SAXBuilder builder = new SAXBuilder(); Document doc = null; try { doc = builder.build(getSchema().getInputStream()); SchemaParserImpl schemaParser = new SchemaParserImpl(); schemaParser.parse(doc); ParserSource parserSource = new InputStreamParserSource(getProcesses()); ProcessTextProvider textProvider = new ProcessTextProvider(parserSource,schemaParser,this); ParsePackage parsePackage = new ParsePackage(); parsePackage.parse(textProvider); } catch (Exception e) { throw new WorkflowException(e); } HashIdLogger.log(this,"postconstruct"); }
java
@PostConstruct public void init() { findBeans(); SAXBuilder builder = new SAXBuilder(); Document doc = null; try { doc = builder.build(getSchema().getInputStream()); SchemaParserImpl schemaParser = new SchemaParserImpl(); schemaParser.parse(doc); ParserSource parserSource = new InputStreamParserSource(getProcesses()); ProcessTextProvider textProvider = new ProcessTextProvider(parserSource,schemaParser,this); ParsePackage parsePackage = new ParsePackage(); parsePackage.parse(textProvider); } catch (Exception e) { throw new WorkflowException(e); } HashIdLogger.log(this,"postconstruct"); }
[ "@", "PostConstruct", "public", "void", "init", "(", ")", "{", "findBeans", "(", ")", ";", "SAXBuilder", "builder", "=", "new", "SAXBuilder", "(", ")", ";", "Document", "doc", "=", "null", ";", "try", "{", "doc", "=", "builder", ".", "build", "(", "getSchema", "(", ")", ".", "getInputStream", "(", ")", ")", ";", "SchemaParserImpl", "schemaParser", "=", "new", "SchemaParserImpl", "(", ")", ";", "schemaParser", ".", "parse", "(", "doc", ")", ";", "ParserSource", "parserSource", "=", "new", "InputStreamParserSource", "(", "getProcesses", "(", ")", ")", ";", "ProcessTextProvider", "textProvider", "=", "new", "ProcessTextProvider", "(", "parserSource", ",", "schemaParser", ",", "this", ")", ";", "ParsePackage", "parsePackage", "=", "new", "ParsePackage", "(", ")", ";", "parsePackage", ".", "parse", "(", "textProvider", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "WorkflowException", "(", "e", ")", ";", "}", "HashIdLogger", ".", "log", "(", "this", ",", "\"postconstruct\"", ")", ";", "}" ]
Scan resources for workflow files and message definitions
[ "Scan", "resources", "for", "workflow", "files", "and", "message", "definitions" ]
3d26c322fc85a006ff0d0cbebacbc453aed8e492
https://github.com/RogerParkinson/madura-workflows/blob/3d26c322fc85a006ff0d0cbebacbc453aed8e492/madura-workflow/src/main/java/nz/co/senanque/workflow/WorkflowManagerImpl.java#L441-L459
149,509
matthewhorridge/binaryowl
src/main/java/org/semanticweb/binaryowl/owlobject/serializer/OWLFacetRestrictionSerializer.java
OWLFacetRestrictionSerializer.getFacetMarker
public static int getFacetMarker(OWLFacet facet) { switch (facet) { case LENGTH: return 0; case MIN_LENGTH: return 1; case MAX_LENGTH: return 2; case PATTERN: return 3; case MIN_INCLUSIVE: return 4; case MIN_EXCLUSIVE: return 5; case MAX_INCLUSIVE: return 6; case MAX_EXCLUSIVE: return 7; case TOTAL_DIGITS: return 8; case FRACTION_DIGITS: return 9; case LANG_RANGE: return 10; default: throw new RuntimeException("Illegal state. Case not covered"); } }
java
public static int getFacetMarker(OWLFacet facet) { switch (facet) { case LENGTH: return 0; case MIN_LENGTH: return 1; case MAX_LENGTH: return 2; case PATTERN: return 3; case MIN_INCLUSIVE: return 4; case MIN_EXCLUSIVE: return 5; case MAX_INCLUSIVE: return 6; case MAX_EXCLUSIVE: return 7; case TOTAL_DIGITS: return 8; case FRACTION_DIGITS: return 9; case LANG_RANGE: return 10; default: throw new RuntimeException("Illegal state. Case not covered"); } }
[ "public", "static", "int", "getFacetMarker", "(", "OWLFacet", "facet", ")", "{", "switch", "(", "facet", ")", "{", "case", "LENGTH", ":", "return", "0", ";", "case", "MIN_LENGTH", ":", "return", "1", ";", "case", "MAX_LENGTH", ":", "return", "2", ";", "case", "PATTERN", ":", "return", "3", ";", "case", "MIN_INCLUSIVE", ":", "return", "4", ";", "case", "MIN_EXCLUSIVE", ":", "return", "5", ";", "case", "MAX_INCLUSIVE", ":", "return", "6", ";", "case", "MAX_EXCLUSIVE", ":", "return", "7", ";", "case", "TOTAL_DIGITS", ":", "return", "8", ";", "case", "FRACTION_DIGITS", ":", "return", "9", ";", "case", "LANG_RANGE", ":", "return", "10", ";", "default", ":", "throw", "new", "RuntimeException", "(", "\"Illegal state. Case not covered\"", ")", ";", "}", "}" ]
Gets the facet marker for a given facet. @param facet The facet. Not {@code null}. @return The marker for the facet.
[ "Gets", "the", "facet", "marker", "for", "a", "given", "facet", "." ]
7fccfe804120f86b38ca855ddbb569a81a042257
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/owlobject/serializer/OWLFacetRestrictionSerializer.java#L80-L107
149,510
Viascom/groundwork
service-result/src/main/java/ch/viascom/groundwork/serviceresult/util/ObjectHasher.java
ObjectHasher.hash
public static String hash(Serializable obj) { if (obj == null) { return ""; } StringBuilder hexString = new StringBuilder(); try { MessageDigest m = MessageDigest.getInstance("SHA1"); m.update(SerializationUtils.serialize(obj)); byte[] mdbytes = m.digest(); for (byte mdbyte : mdbytes) { hexString.append(Integer.toHexString(0xFF & mdbyte)); } } catch (NoSuchAlgorithmException e) { return ""; } return hexString.toString(); }
java
public static String hash(Serializable obj) { if (obj == null) { return ""; } StringBuilder hexString = new StringBuilder(); try { MessageDigest m = MessageDigest.getInstance("SHA1"); m.update(SerializationUtils.serialize(obj)); byte[] mdbytes = m.digest(); for (byte mdbyte : mdbytes) { hexString.append(Integer.toHexString(0xFF & mdbyte)); } } catch (NoSuchAlgorithmException e) { return ""; } return hexString.toString(); }
[ "public", "static", "String", "hash", "(", "Serializable", "obj", ")", "{", "if", "(", "obj", "==", "null", ")", "{", "return", "\"\"", ";", "}", "StringBuilder", "hexString", "=", "new", "StringBuilder", "(", ")", ";", "try", "{", "MessageDigest", "m", "=", "MessageDigest", ".", "getInstance", "(", "\"SHA1\"", ")", ";", "m", ".", "update", "(", "SerializationUtils", ".", "serialize", "(", "obj", ")", ")", ";", "byte", "[", "]", "mdbytes", "=", "m", ".", "digest", "(", ")", ";", "for", "(", "byte", "mdbyte", ":", "mdbytes", ")", "{", "hexString", ".", "append", "(", "Integer", ".", "toHexString", "(", "0xFF", "&", "mdbyte", ")", ")", ";", "}", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "return", "\"\"", ";", "}", "return", "hexString", ".", "toString", "(", ")", ";", "}" ]
Create a hash of a serializable object @param obj Serializable object @return Hash of the serializable object
[ "Create", "a", "hash", "of", "a", "serializable", "object" ]
d3f7d0df65e2e75861fc7db938090683f2cdf919
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/service-result/src/main/java/ch/viascom/groundwork/serviceresult/util/ObjectHasher.java#L20-L41
149,511
javagl/Common
src/main/java/de/javagl/common/iteration/Iterables.java
Iterables.toList
public static <T> List<T> toList(Iterable<T> iterable) { Objects.requireNonNull(iterable, "The iterable is null"); return Iterables.toCollection(iterable, new ArrayList<T>()); }
java
public static <T> List<T> toList(Iterable<T> iterable) { Objects.requireNonNull(iterable, "The iterable is null"); return Iterables.toCollection(iterable, new ArrayList<T>()); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "toList", "(", "Iterable", "<", "T", ">", "iterable", ")", "{", "Objects", ".", "requireNonNull", "(", "iterable", ",", "\"The iterable is null\"", ")", ";", "return", "Iterables", ".", "toCollection", "(", "iterable", ",", "new", "ArrayList", "<", "T", ">", "(", ")", ")", ";", "}" ]
Drains all elements that are provided by the iterator of the given iterable into a list @param <T> The element type @param iterable The iterable @return The list
[ "Drains", "all", "elements", "that", "are", "provided", "by", "the", "iterator", "of", "the", "given", "iterable", "into", "a", "list" ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/iteration/Iterables.java#L56-L60
149,512
javagl/Common
src/main/java/de/javagl/common/iteration/Iterables.java
Iterables.toSet
public static <T> Set<T> toSet(Iterable<T> iterable) { Objects.requireNonNull(iterable, "The iterable is null"); return Iterables.toCollection(iterable, new LinkedHashSet<T>()); }
java
public static <T> Set<T> toSet(Iterable<T> iterable) { Objects.requireNonNull(iterable, "The iterable is null"); return Iterables.toCollection(iterable, new LinkedHashSet<T>()); }
[ "public", "static", "<", "T", ">", "Set", "<", "T", ">", "toSet", "(", "Iterable", "<", "T", ">", "iterable", ")", "{", "Objects", ".", "requireNonNull", "(", "iterable", ",", "\"The iterable is null\"", ")", ";", "return", "Iterables", ".", "toCollection", "(", "iterable", ",", "new", "LinkedHashSet", "<", "T", ">", "(", ")", ")", ";", "}" ]
Drains all elements that are provided by the iterator of the given iterable into a set @param <T> The element type @param iterable The iterable @return The set
[ "Drains", "all", "elements", "that", "are", "provided", "by", "the", "iterator", "of", "the", "given", "iterable", "into", "a", "set" ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/iteration/Iterables.java#L70-L74
149,513
javagl/Common
src/main/java/de/javagl/common/iteration/Iterables.java
Iterables.toCollection
public static <T, C extends Collection<? super T>> C toCollection( Iterable<T> iterable, C collection) { Objects.requireNonNull(iterable, "The iterable is null"); Objects.requireNonNull(collection, "The collection is null"); return Iterators.toCollection(iterable.iterator(), collection); }
java
public static <T, C extends Collection<? super T>> C toCollection( Iterable<T> iterable, C collection) { Objects.requireNonNull(iterable, "The iterable is null"); Objects.requireNonNull(collection, "The collection is null"); return Iterators.toCollection(iterable.iterator(), collection); }
[ "public", "static", "<", "T", ",", "C", "extends", "Collection", "<", "?", "super", "T", ">", ">", "C", "toCollection", "(", "Iterable", "<", "T", ">", "iterable", ",", "C", "collection", ")", "{", "Objects", ".", "requireNonNull", "(", "iterable", ",", "\"The iterable is null\"", ")", ";", "Objects", ".", "requireNonNull", "(", "collection", ",", "\"The collection is null\"", ")", ";", "return", "Iterators", ".", "toCollection", "(", "iterable", ".", "iterator", "(", ")", ",", "collection", ")", ";", "}" ]
Drains all elements that are provided by the iterator of the given iterable into the given collection @param <T> The element type @param <C> The collection type @param iterable The iterable @param collection The target collection @return The given collection
[ "Drains", "all", "elements", "that", "are", "provided", "by", "the", "iterator", "of", "the", "given", "iterable", "into", "the", "given", "collection" ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/iteration/Iterables.java#L86-L92
149,514
javagl/Common
src/main/java/de/javagl/common/iteration/Iterables.java
Iterables.iterableOverIterables
public static <T> Iterable<T> iterableOverIterables( final Iterable<? extends Iterable<? extends T>> iterablesIterable) { Objects.requireNonNull(iterablesIterable, "The iterablesIterable is null"); return new Iterable<T>() { @Override public Iterator<T> iterator() { return Iterators.iteratorOverIterables( iterablesIterable.iterator()); } }; }
java
public static <T> Iterable<T> iterableOverIterables( final Iterable<? extends Iterable<? extends T>> iterablesIterable) { Objects.requireNonNull(iterablesIterable, "The iterablesIterable is null"); return new Iterable<T>() { @Override public Iterator<T> iterator() { return Iterators.iteratorOverIterables( iterablesIterable.iterator()); } }; }
[ "public", "static", "<", "T", ">", "Iterable", "<", "T", ">", "iterableOverIterables", "(", "final", "Iterable", "<", "?", "extends", "Iterable", "<", "?", "extends", "T", ">", ">", "iterablesIterable", ")", "{", "Objects", ".", "requireNonNull", "(", "iterablesIterable", ",", "\"The iterablesIterable is null\"", ")", ";", "return", "new", "Iterable", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "Iterator", "<", "T", ">", "iterator", "(", ")", "{", "return", "Iterators", ".", "iteratorOverIterables", "(", "iterablesIterable", ".", "iterator", "(", ")", ")", ";", "}", "}", ";", "}" ]
Returns an iterator that combines the iterators that are provided by the iterables that are provided by the iterator of the given iterable. Fancy stuff, he? @param <T> The element type @param iterablesIterable The iterable over the iterables. May not provide <code>null</code> iterables. @return The iterator
[ "Returns", "an", "iterator", "that", "combines", "the", "iterators", "that", "are", "provided", "by", "the", "iterables", "that", "are", "provided", "by", "the", "iterator", "of", "the", "given", "iterable", ".", "Fancy", "stuff", "he?" ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/iteration/Iterables.java#L104-L118
149,515
javagl/Common
src/main/java/de/javagl/common/iteration/Iterables.java
Iterables.transformingIterable
public static <S, T> Iterable<T> transformingIterable( final Iterable<? extends S> iterable, final Function<S, ? extends T> function) { Objects.requireNonNull(iterable, "The iterable is null"); Objects.requireNonNull(function, "The function is null"); return new Iterable<T>() { @Override public Iterator<T> iterator() { return new TransformingIterator<S, T>( iterable.iterator(), function); } }; }
java
public static <S, T> Iterable<T> transformingIterable( final Iterable<? extends S> iterable, final Function<S, ? extends T> function) { Objects.requireNonNull(iterable, "The iterable is null"); Objects.requireNonNull(function, "The function is null"); return new Iterable<T>() { @Override public Iterator<T> iterator() { return new TransformingIterator<S, T>( iterable.iterator(), function); } }; }
[ "public", "static", "<", "S", ",", "T", ">", "Iterable", "<", "T", ">", "transformingIterable", "(", "final", "Iterable", "<", "?", "extends", "S", ">", "iterable", ",", "final", "Function", "<", "S", ",", "?", "extends", "T", ">", "function", ")", "{", "Objects", ".", "requireNonNull", "(", "iterable", ",", "\"The iterable is null\"", ")", ";", "Objects", ".", "requireNonNull", "(", "function", ",", "\"The function is null\"", ")", ";", "return", "new", "Iterable", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "Iterator", "<", "T", ">", "iterator", "(", ")", "{", "return", "new", "TransformingIterator", "<", "S", ",", "T", ">", "(", "iterable", ".", "iterator", "(", ")", ",", "function", ")", ";", "}", "}", ";", "}" ]
Returns an iterable that provides iterators that are transforming the elements provided by the iterators of the given iterable using the given function @param <S> The element type @param <T> The value type @param iterable The delegate iterable @param function The function @return The iterator
[ "Returns", "an", "iterable", "that", "provides", "iterators", "that", "are", "transforming", "the", "elements", "provided", "by", "the", "iterators", "of", "the", "given", "iterable", "using", "the", "given", "function" ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/iteration/Iterables.java#L132-L147
149,516
javagl/Common
src/main/java/de/javagl/common/iteration/Iterables.java
Iterables.filteringIterable
public static <T> Iterable<T> filteringIterable( final Iterable<? extends T> iterable, final Predicate<? super T> predicate) { Objects.requireNonNull(iterable, "The iterable is null"); Objects.requireNonNull(predicate, "The predicate is null"); return new Iterable<T>() { @Override public Iterator<T> iterator() { return new FilteringIterator<T>( iterable.iterator(), predicate); } }; }
java
public static <T> Iterable<T> filteringIterable( final Iterable<? extends T> iterable, final Predicate<? super T> predicate) { Objects.requireNonNull(iterable, "The iterable is null"); Objects.requireNonNull(predicate, "The predicate is null"); return new Iterable<T>() { @Override public Iterator<T> iterator() { return new FilteringIterator<T>( iterable.iterator(), predicate); } }; }
[ "public", "static", "<", "T", ">", "Iterable", "<", "T", ">", "filteringIterable", "(", "final", "Iterable", "<", "?", "extends", "T", ">", "iterable", ",", "final", "Predicate", "<", "?", "super", "T", ">", "predicate", ")", "{", "Objects", ".", "requireNonNull", "(", "iterable", ",", "\"The iterable is null\"", ")", ";", "Objects", ".", "requireNonNull", "(", "predicate", ",", "\"The predicate is null\"", ")", ";", "return", "new", "Iterable", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "Iterator", "<", "T", ">", "iterator", "(", ")", "{", "return", "new", "FilteringIterator", "<", "T", ">", "(", "iterable", ".", "iterator", "(", ")", ",", "predicate", ")", ";", "}", "}", ";", "}" ]
Returns an iterable that provides an iterator that only returns the elements provided by the iterator of the given iterable to which the given predicate applies. @param <T> The element type @param iterable The delegate iterable @param predicate The predicate @return The iterator
[ "Returns", "an", "iterable", "that", "provides", "an", "iterator", "that", "only", "returns", "the", "elements", "provided", "by", "the", "iterator", "of", "the", "given", "iterable", "to", "which", "the", "given", "predicate", "applies", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/iteration/Iterables.java#L159-L174
149,517
realtime-framework/RealtimeStorage-Android
library/src/main/java/co/realtime/storage/ItemAttribute.java
ItemAttribute.get
@JsonValue @SuppressWarnings("unchecked") public <T> T get(){ return (T) (this.isString ? (String)this.value : (Number)this.value); }
java
@JsonValue @SuppressWarnings("unchecked") public <T> T get(){ return (T) (this.isString ? (String)this.value : (Number)this.value); }
[ "@", "JsonValue", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "get", "(", ")", "{", "return", "(", "T", ")", "(", "this", ".", "isString", "?", "(", "String", ")", "this", ".", "value", ":", "(", "Number", ")", "this", ".", "value", ")", ";", "}" ]
Returns the value of attribute @return the value
[ "Returns", "the", "value", "of", "attribute" ]
05816a6b7a6dcc83f9e7400ac3048494dadca302
https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/ItemAttribute.java#L29-L33
149,518
realtime-framework/RealtimeStorage-Android
library/src/main/java/co/realtime/storage/ItemRef.java
ItemRef.del
public void del(final OnItemSnapshot onItemSnapshot, final OnError onError){ TableMetadata tm = context.getTableMeta(this.table.name); if(tm == null){ this.table.meta(new OnTableMetadata(){ @Override public void run(TableMetadata tableMetadata) { _del(onItemSnapshot, onError); } }, onError); } else { this._del(onItemSnapshot, onError); } return; }
java
public void del(final OnItemSnapshot onItemSnapshot, final OnError onError){ TableMetadata tm = context.getTableMeta(this.table.name); if(tm == null){ this.table.meta(new OnTableMetadata(){ @Override public void run(TableMetadata tableMetadata) { _del(onItemSnapshot, onError); } }, onError); } else { this._del(onItemSnapshot, onError); } return; }
[ "public", "void", "del", "(", "final", "OnItemSnapshot", "onItemSnapshot", ",", "final", "OnError", "onError", ")", "{", "TableMetadata", "tm", "=", "context", ".", "getTableMeta", "(", "this", ".", "table", ".", "name", ")", ";", "if", "(", "tm", "==", "null", ")", "{", "this", ".", "table", ".", "meta", "(", "new", "OnTableMetadata", "(", ")", "{", "@", "Override", "public", "void", "run", "(", "TableMetadata", "tableMetadata", ")", "{", "_del", "(", "onItemSnapshot", ",", "onError", ")", ";", "}", "}", ",", "onError", ")", ";", "}", "else", "{", "this", ".", "_del", "(", "onItemSnapshot", ",", "onError", ")", ";", "}", "return", ";", "}" ]
Deletes an item specified by this reference <pre> StorageRef storage = new StorageRef("your_app_key", "your_token"); TableRef tableRef = storage.table("your_table"); ItemRef itemRef = tableRef.item(new ItemAttribute("your_primary_key_value"), new ItemAttribute("your_secondary_key_value")); itemRef.del(new OnItemSnapshot() { &#064;Override public void run(ItemSnapshot itemSnapshot) { if(itemSnapshot != null){ Log.d("ItemRef", "Item deleted: " + itemSnapshot.val()); } } }, new OnError() { &#064;Override public void run(Integer integer, String errorMessage) { Log.e("ItemRef", "Error deleting item: " + errorMessage); } }); </pre> @param onItemSnapshot The callback to call with the snapshot of affected item as an argument, when the operation is completed. @param onError The callback to call if an exception occurred
[ "Deletes", "an", "item", "specified", "by", "this", "reference" ]
05816a6b7a6dcc83f9e7400ac3048494dadca302
https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/ItemRef.java#L84-L97
149,519
realtime-framework/RealtimeStorage-Android
library/src/main/java/co/realtime/storage/ItemRef.java
ItemRef.get
public ItemRef get(final OnItemSnapshot onItemSnapshot, final OnError onError){ TableMetadata tm = context.getTableMeta(this.table.name); if(tm == null){ this.table.meta(new OnTableMetadata(){ @Override public void run(TableMetadata tableMetadata) { _get(onItemSnapshot, onError, false); } }, onError); } else { this._get(onItemSnapshot, onError, false); } return this; }
java
public ItemRef get(final OnItemSnapshot onItemSnapshot, final OnError onError){ TableMetadata tm = context.getTableMeta(this.table.name); if(tm == null){ this.table.meta(new OnTableMetadata(){ @Override public void run(TableMetadata tableMetadata) { _get(onItemSnapshot, onError, false); } }, onError); } else { this._get(onItemSnapshot, onError, false); } return this; }
[ "public", "ItemRef", "get", "(", "final", "OnItemSnapshot", "onItemSnapshot", ",", "final", "OnError", "onError", ")", "{", "TableMetadata", "tm", "=", "context", ".", "getTableMeta", "(", "this", ".", "table", ".", "name", ")", ";", "if", "(", "tm", "==", "null", ")", "{", "this", ".", "table", ".", "meta", "(", "new", "OnTableMetadata", "(", ")", "{", "@", "Override", "public", "void", "run", "(", "TableMetadata", "tableMetadata", ")", "{", "_get", "(", "onItemSnapshot", ",", "onError", ",", "false", ")", ";", "}", "}", ",", "onError", ")", ";", "}", "else", "{", "this", ".", "_get", "(", "onItemSnapshot", ",", "onError", ",", "false", ")", ";", "}", "return", "this", ";", "}" ]
Gets an item snapshot specified by this item reference. <pre> StorageRef storage = new StorageRef("your_app_key", "your_token"); TableRef tableRef = storage.table("your_table"); ItemRef itemRef = tableRef.item(new ItemAttribute("your_primary_key_value"), new ItemAttribute("your_secondary_key_value")); itemRef.get(new OnItemSnapshot() { &#064;Override public void run(ItemSnapshot itemSnapshot) { if(itemSnapshot != null){ Log.d("ItemRef", "Item retrieved: " + itemSnapshot.val()); } } },new OnError() { &#064;Override public void run(Integer integer, String errorMessage) { Log.e("ItemRef", "Error retrieving item: " + errorMessage); } }); </pre> @param onItemSnapshot The callback to call with the snapshot of affected item as an argument, when the operation is completed. @param onError The callback to call if an exception occurred @return Current item reference
[ "Gets", "an", "item", "snapshot", "specified", "by", "this", "item", "reference", "." ]
05816a6b7a6dcc83f9e7400ac3048494dadca302
https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/ItemRef.java#L150-L163
149,520
realtime-framework/RealtimeStorage-Android
library/src/main/java/co/realtime/storage/ItemRef.java
ItemRef.set
public ItemRef set(final LinkedHashMap<String, ItemAttribute> item, final OnItemSnapshot onItemSnapshot, final OnError onError){ TableMetadata tm = context.getTableMeta(this.table.name); if(tm == null){ this.table.meta(new OnTableMetadata(){ @Override public void run(TableMetadata tableMetadata) { _set(item, onItemSnapshot, onError); } }, onError); } else { this._set(item, onItemSnapshot, onError); } return this; }
java
public ItemRef set(final LinkedHashMap<String, ItemAttribute> item, final OnItemSnapshot onItemSnapshot, final OnError onError){ TableMetadata tm = context.getTableMeta(this.table.name); if(tm == null){ this.table.meta(new OnTableMetadata(){ @Override public void run(TableMetadata tableMetadata) { _set(item, onItemSnapshot, onError); } }, onError); } else { this._set(item, onItemSnapshot, onError); } return this; }
[ "public", "ItemRef", "set", "(", "final", "LinkedHashMap", "<", "String", ",", "ItemAttribute", ">", "item", ",", "final", "OnItemSnapshot", "onItemSnapshot", ",", "final", "OnError", "onError", ")", "{", "TableMetadata", "tm", "=", "context", ".", "getTableMeta", "(", "this", ".", "table", ".", "name", ")", ";", "if", "(", "tm", "==", "null", ")", "{", "this", ".", "table", ".", "meta", "(", "new", "OnTableMetadata", "(", ")", "{", "@", "Override", "public", "void", "run", "(", "TableMetadata", "tableMetadata", ")", "{", "_set", "(", "item", ",", "onItemSnapshot", ",", "onError", ")", ";", "}", "}", ",", "onError", ")", ";", "}", "else", "{", "this", ".", "_set", "(", "item", ",", "onItemSnapshot", ",", "onError", ")", ";", "}", "return", "this", ";", "}" ]
Updates the stored item specified by this item reference. <pre> StorageRef storage = new StorageRef("your_app_key", "your_token"); TableRef tableRef = storage.table("your_table"); ItemRef itemRef = tableRef.item(new ItemAttribute("your_primary_key_value"), new ItemAttribute("your_secondary_key_value")); LinkedHashMap lhm = new LinkedHashMap(); // Put elements to the map lhm.put("your_property","your_value"); itemRef.set(lhm,new OnItemSnapshot() { &#064;Override public void run(ItemSnapshot itemSnapshot) { if(itemSnapshot != null){ Log.d("ItemRef", "Item set: " + itemSnapshot.val()); } } }, new OnError() { &#064;Override public void run(Integer integer, String errorMessage) { Log.e("ItemRef", "Error setting item: " + errorMessage); } }); </pre> @param item The new properties of item to be updated. @param onItemSnapshot The callback to call with the snapshot of affected item as an argument, when the operation is completed. @param onError The callback to call if an exception occurred @return Current item reference
[ "Updates", "the", "stored", "item", "specified", "by", "this", "item", "reference", "." ]
05816a6b7a6dcc83f9e7400ac3048494dadca302
https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/ItemRef.java#L240-L253
149,521
realtime-framework/RealtimeStorage-Android
library/src/main/java/co/realtime/storage/ItemRef.java
ItemRef.once
public ItemRef once(StorageEvent eventType, final OnItemSnapshot onItemSnapshot) { return once(eventType, onItemSnapshot, null); }
java
public ItemRef once(StorageEvent eventType, final OnItemSnapshot onItemSnapshot) { return once(eventType, onItemSnapshot, null); }
[ "public", "ItemRef", "once", "(", "StorageEvent", "eventType", ",", "final", "OnItemSnapshot", "onItemSnapshot", ")", "{", "return", "once", "(", "eventType", ",", "onItemSnapshot", ",", "null", ")", ";", "}" ]
Attach a listener to run the callback only one the event type occurs for this item. <pre> StorageRef storage = new StorageRef("your_app_key", "your_token"); TableRef tableRef = storage.table("your_table"); ItemRef itemRef = tableRef.item(new ItemAttribute("your_primary_key_value"), new ItemAttribute("your_secondary_key_value")); itemRef.once(StorageRef.StorageEvent.UPDATE,new OnItemSnapshot() { &#064;Override public void run(ItemSnapshot itemSnapshot) { if(itemSnapshot != null){ Log.d("ItemRef", "Item updated: " + itemSnapshot.val()); } } }); </pre> @param eventType The type of the event to listen. Possible values: put, update, delete. @param onItemSnapshot The callback to run when the event occurs. The function is called with the snapshot of affected item as argument. @return Current item reference
[ "Attach", "a", "listener", "to", "run", "the", "callback", "only", "one", "the", "event", "type", "occurs", "for", "this", "item", "." ]
05816a6b7a6dcc83f9e7400ac3048494dadca302
https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/ItemRef.java#L410-L412
149,522
realtime-framework/RealtimeStorage-Android
library/src/main/java/co/realtime/storage/ItemRef.java
ItemRef.off
public ItemRef off(StorageEvent eventType, OnItemSnapshot onItemSnapshot){ Event ev = new Event(eventType, this.table.name, this.primaryKeyValue, this.secondaryKeyValue, false, false, false, onItemSnapshot); context.removeEvent(ev); return this; }
java
public ItemRef off(StorageEvent eventType, OnItemSnapshot onItemSnapshot){ Event ev = new Event(eventType, this.table.name, this.primaryKeyValue, this.secondaryKeyValue, false, false, false, onItemSnapshot); context.removeEvent(ev); return this; }
[ "public", "ItemRef", "off", "(", "StorageEvent", "eventType", ",", "OnItemSnapshot", "onItemSnapshot", ")", "{", "Event", "ev", "=", "new", "Event", "(", "eventType", ",", "this", ".", "table", ".", "name", ",", "this", ".", "primaryKeyValue", ",", "this", ".", "secondaryKeyValue", ",", "false", ",", "false", ",", "false", ",", "onItemSnapshot", ")", ";", "context", ".", "removeEvent", "(", "ev", ")", ";", "return", "this", ";", "}" ]
Remove an event listener <pre> StorageRef storage = new StorageRef("your_app_key", "your_token"); TableRef tableRef = storage.table("your_table"); ItemRef itemRef = tableRef.item(new ItemAttribute("your_primary_key_value"), new ItemAttribute("your_secondary_key_value")); final OnItemSnapshot itemSnapshot = new OnItemSnapshot() { &#064;Override public void run(ItemSnapshot itemSnapshot) { if (itemSnapshot != null) { Log.d("ItemRef", "Item : " + itemSnapshot.val()); } } }; itemRef.on(StorageRef.StorageEvent.UPDATE,itemSnapshot,new OnError() { &#064;Override public void run(Integer integer, String errorMessage) { Log.e("ItemRef", "Error adding an update event listener: " + errorMessage); } }); Handler handler=new Handler(); final Runnable r = new Runnable() { public void run() { itemRef.off(StorageRef.StorageEvent.UPDATE, itemSnapshot); } }; handler.postDelayed(r, 5000); </pre> @param eventType The type of the event to listen. Possible values: put, update, delete. @param onItemSnapshot The callback previously attached. @return Current item reference
[ "Remove", "an", "event", "listener" ]
05816a6b7a6dcc83f9e7400ac3048494dadca302
https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/ItemRef.java#L462-L466
149,523
realtime-framework/RealtimeStorage-Android
library/src/main/java/co/realtime/storage/ItemRef.java
ItemRef.incr
public ItemRef incr(final String property, final Number value, final OnItemSnapshot onItemSnapshot, final OnError onError){ TableMetadata tm = context.getTableMeta(this.table.name); if(tm == null){ this.table.meta(new OnTableMetadata(){ @Override public void run(TableMetadata tableMetadata) { _in_de_cr(property, value, true, onItemSnapshot, onError); } }, onError); } else { this._in_de_cr(property, value, true, onItemSnapshot, onError); } return this; }
java
public ItemRef incr(final String property, final Number value, final OnItemSnapshot onItemSnapshot, final OnError onError){ TableMetadata tm = context.getTableMeta(this.table.name); if(tm == null){ this.table.meta(new OnTableMetadata(){ @Override public void run(TableMetadata tableMetadata) { _in_de_cr(property, value, true, onItemSnapshot, onError); } }, onError); } else { this._in_de_cr(property, value, true, onItemSnapshot, onError); } return this; }
[ "public", "ItemRef", "incr", "(", "final", "String", "property", ",", "final", "Number", "value", ",", "final", "OnItemSnapshot", "onItemSnapshot", ",", "final", "OnError", "onError", ")", "{", "TableMetadata", "tm", "=", "context", ".", "getTableMeta", "(", "this", ".", "table", ".", "name", ")", ";", "if", "(", "tm", "==", "null", ")", "{", "this", ".", "table", ".", "meta", "(", "new", "OnTableMetadata", "(", ")", "{", "@", "Override", "public", "void", "run", "(", "TableMetadata", "tableMetadata", ")", "{", "_in_de_cr", "(", "property", ",", "value", ",", "true", ",", "onItemSnapshot", ",", "onError", ")", ";", "}", "}", ",", "onError", ")", ";", "}", "else", "{", "this", ".", "_in_de_cr", "(", "property", ",", "value", ",", "true", ",", "onItemSnapshot", ",", "onError", ")", ";", "}", "return", "this", ";", "}" ]
Increments a given attribute of an item. If the attribute doesn't exist, it is set to zero before the operation. <pre> StorageRef storage = new StorageRef("your_app_key", "your_token"); TableRef tableRef = storage.table("your_table"); ItemRef itemRef = tableRef.item(new ItemAttribute("your_primary_key_value"), new ItemAttribute("your_secondary_key_value")); itemRef.incr("your_property",10, new OnItemSnapshot() { &#064;Override public void run(ItemSnapshot itemSnapshot) { if(itemSnapshot != null){ Log.d("ItemRef", "Item incremented: " + itemSnapshot.val()); } } }, new OnError() { &#064;Override public void run(Integer integer, String errorMessage) { Log.e("ItemRef", "Error incrementing item: " + errorMessage); } }); </pre> @param property The name of the item attribute. @param value The number to add @param onItemSnapshot The callback invoked once the attribute has been incremented successfully. The callback is called with the snapshot of the item as argument. @param onError The callback invoked if an error occurred. Called with the error description. @return Current item reference
[ "Increments", "a", "given", "attribute", "of", "an", "item", ".", "If", "the", "attribute", "doesn", "t", "exist", "it", "is", "set", "to", "zero", "before", "the", "operation", "." ]
05816a6b7a6dcc83f9e7400ac3048494dadca302
https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/ItemRef.java#L520-L533
149,524
realtime-framework/RealtimeStorage-Android
library/src/main/java/co/realtime/storage/ItemRef.java
ItemRef.incr
public ItemRef incr(final String property, final OnItemSnapshot onItemSnapshot, final OnError onError){ return this.incr(property, null, onItemSnapshot, onError); }
java
public ItemRef incr(final String property, final OnItemSnapshot onItemSnapshot, final OnError onError){ return this.incr(property, null, onItemSnapshot, onError); }
[ "public", "ItemRef", "incr", "(", "final", "String", "property", ",", "final", "OnItemSnapshot", "onItemSnapshot", ",", "final", "OnError", "onError", ")", "{", "return", "this", ".", "incr", "(", "property", ",", "null", ",", "onItemSnapshot", ",", "onError", ")", ";", "}" ]
Increments by one a given attribute of an item. If the attribute doesn't exist, it is set to zero before the operation. <pre> StorageRef storage = new StorageRef("your_app_key", "your_token"); TableRef tableRef = storage.table("your_table"); ItemRef itemRef = tableRef.item(new ItemAttribute("your_primary_key_value"), new ItemAttribute("your_secondary_key_value")); itemRef.incr("your_property",new OnItemSnapshot() { &#064;Override public void run(ItemSnapshot itemSnapshot) { if(itemSnapshot != null){ Log.d("ItemRef", "Item incremented: " + itemSnapshot.val()); } } }, new OnError() { &#064;Override public void run(Integer integer, String errorMessage) { Log.e("ItemRef", "Error incrementing item: " + errorMessage); } }); </pre> @param property The name of the item attribute. @param onItemSnapshot The callback invoked once the attribute has been incremented successfully. The callback is called with the snapshot of the item as argument. @param onError The callback invoked if an error occurred. Called with the error description. @return Current item reference
[ "Increments", "by", "one", "a", "given", "attribute", "of", "an", "item", ".", "If", "the", "attribute", "doesn", "t", "exist", "it", "is", "set", "to", "zero", "before", "the", "operation", "." ]
05816a6b7a6dcc83f9e7400ac3048494dadca302
https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/ItemRef.java#L567-L569
149,525
realtime-framework/RealtimeStorage-Android
library/src/main/java/co/realtime/storage/ItemRef.java
ItemRef.disablePushNotifications
public ItemRef disablePushNotifications(){ pushNotificationsEnabled = false; Event ev = new Event(null, this.table.name, this.primaryKeyValue, this.secondaryKeyValue, false, false, pushNotificationsEnabled, null); ArrayList<String> channels = new ArrayList<String>(); channels.add(ev.getChannelName()); context.disablePushNotificationsForChannels(channels); return this; }
java
public ItemRef disablePushNotifications(){ pushNotificationsEnabled = false; Event ev = new Event(null, this.table.name, this.primaryKeyValue, this.secondaryKeyValue, false, false, pushNotificationsEnabled, null); ArrayList<String> channels = new ArrayList<String>(); channels.add(ev.getChannelName()); context.disablePushNotificationsForChannels(channels); return this; }
[ "public", "ItemRef", "disablePushNotifications", "(", ")", "{", "pushNotificationsEnabled", "=", "false", ";", "Event", "ev", "=", "new", "Event", "(", "null", ",", "this", ".", "table", ".", "name", ",", "this", ".", "primaryKeyValue", ",", "this", ".", "secondaryKeyValue", ",", "false", ",", "false", ",", "pushNotificationsEnabled", ",", "null", ")", ";", "ArrayList", "<", "String", ">", "channels", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "channels", ".", "add", "(", "ev", ".", "getChannelName", "(", ")", ")", ";", "context", ".", "disablePushNotificationsForChannels", "(", "channels", ")", ";", "return", "this", ";", "}" ]
Disables mobile push notifications for current item reference. @return Current item reference
[ "Disables", "mobile", "push", "notifications", "for", "current", "item", "reference", "." ]
05816a6b7a6dcc83f9e7400ac3048494dadca302
https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/ItemRef.java#L685-L693
149,526
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParametersLazyList.java
QueryParametersLazyList.subListCached
public List<QueryParameters> subListCached(int fromIndex, int toIndex) { ArrayList<QueryParameters> result = new ArrayList<QueryParameters>(); result.addAll(generatedCacheMap.values()); result.addAll(resultSetCacheMap.values()); return result.subList(fromIndex, toIndex); }
java
public List<QueryParameters> subListCached(int fromIndex, int toIndex) { ArrayList<QueryParameters> result = new ArrayList<QueryParameters>(); result.addAll(generatedCacheMap.values()); result.addAll(resultSetCacheMap.values()); return result.subList(fromIndex, toIndex); }
[ "public", "List", "<", "QueryParameters", ">", "subListCached", "(", "int", "fromIndex", ",", "int", "toIndex", ")", "{", "ArrayList", "<", "QueryParameters", ">", "result", "=", "new", "ArrayList", "<", "QueryParameters", ">", "(", ")", ";", "result", ".", "addAll", "(", "generatedCacheMap", ".", "values", "(", ")", ")", ";", "result", ".", "addAll", "(", "resultSetCacheMap", ".", "values", "(", ")", ")", ";", "return", "result", ".", "subList", "(", "fromIndex", ",", "toIndex", ")", ";", "}" ]
Returns sublist of cached elements. @param fromIndex low endpoint (inclusive) of the subList @param toIndex high endpoint (exclusive) of the subList @return a view of the specified range within this list
[ "Returns", "sublist", "of", "cached", "elements", "." ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParametersLazyList.java#L325-L332
149,527
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParametersLazyList.java
QueryParametersLazyList.iterator
public Iterator<QueryParameters> iterator() { final QueryParametersLazyList source = this; return new Iterator<QueryParameters>() { private LazyCacheIterator<QueryParameters> lazyCacheIterator = source.getLazyCacheIterator(-1); public boolean hasNext() { return lazyCacheIterator.hasNext(); } public QueryParameters next() { return lazyCacheIterator.getNext(); } public void remove() { source.remove(currentIndex); } }; }
java
public Iterator<QueryParameters> iterator() { final QueryParametersLazyList source = this; return new Iterator<QueryParameters>() { private LazyCacheIterator<QueryParameters> lazyCacheIterator = source.getLazyCacheIterator(-1); public boolean hasNext() { return lazyCacheIterator.hasNext(); } public QueryParameters next() { return lazyCacheIterator.getNext(); } public void remove() { source.remove(currentIndex); } }; }
[ "public", "Iterator", "<", "QueryParameters", ">", "iterator", "(", ")", "{", "final", "QueryParametersLazyList", "source", "=", "this", ";", "return", "new", "Iterator", "<", "QueryParameters", ">", "(", ")", "{", "private", "LazyCacheIterator", "<", "QueryParameters", ">", "lazyCacheIterator", "=", "source", ".", "getLazyCacheIterator", "(", "-", "1", ")", ";", "public", "boolean", "hasNext", "(", ")", "{", "return", "lazyCacheIterator", ".", "hasNext", "(", ")", ";", "}", "public", "QueryParameters", "next", "(", ")", "{", "return", "lazyCacheIterator", ".", "getNext", "(", ")", ";", "}", "public", "void", "remove", "(", ")", "{", "source", ".", "remove", "(", "currentIndex", ")", ";", "}", "}", ";", "}" ]
Returns iterator of this lazy query output list implementation. First element returned - is header. Actual values are returned only starting from second element. @return new {@link Iterator} instance
[ "Returns", "iterator", "of", "this", "lazy", "query", "output", "list", "implementation", ".", "First", "element", "returned", "-", "is", "header", ".", "Actual", "values", "are", "returned", "only", "starting", "from", "second", "element", "." ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParametersLazyList.java#L428-L446
149,528
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParametersLazyList.java
QueryParametersLazyList.set
public QueryParameters set(int index, QueryParameters element) { QueryParameters params = null; if (getMaxCacheSize() != -1) { throw new MjdbcRuntimeException(ERROR_NOT_ALLOWED + ". Cache update is allowed when Cache is not limited (used by Cached output handlers)"); } if (valueCached(index) == true) { params = readCachedValue(index); updateCache(index, element); } else { throw new MjdbcRuntimeException(ERROR_NOT_ALLOWED + ". Only cached(read) values can be replaced"); } return params; }
java
public QueryParameters set(int index, QueryParameters element) { QueryParameters params = null; if (getMaxCacheSize() != -1) { throw new MjdbcRuntimeException(ERROR_NOT_ALLOWED + ". Cache update is allowed when Cache is not limited (used by Cached output handlers)"); } if (valueCached(index) == true) { params = readCachedValue(index); updateCache(index, element); } else { throw new MjdbcRuntimeException(ERROR_NOT_ALLOWED + ". Only cached(read) values can be replaced"); } return params; }
[ "public", "QueryParameters", "set", "(", "int", "index", ",", "QueryParameters", "element", ")", "{", "QueryParameters", "params", "=", "null", ";", "if", "(", "getMaxCacheSize", "(", ")", "!=", "-", "1", ")", "{", "throw", "new", "MjdbcRuntimeException", "(", "ERROR_NOT_ALLOWED", "+", "\". Cache update is allowed when Cache is not limited (used by Cached output handlers)\"", ")", ";", "}", "if", "(", "valueCached", "(", "index", ")", "==", "true", ")", "{", "params", "=", "readCachedValue", "(", "index", ")", ";", "updateCache", "(", "index", ",", "element", ")", ";", "}", "else", "{", "throw", "new", "MjdbcRuntimeException", "(", "ERROR_NOT_ALLOWED", "+", "\". Only cached(read) values can be replaced\"", ")", ";", "}", "return", "params", ";", "}" ]
Sets value in cache. Please be aware that currently cache only is updated. No changes to Database are made @param index element number to replace @param element new element value @return previous element at that position @throws org.midao.jdbc.core.exception.MjdbcRuntimeException if value is not in cache
[ "Sets", "value", "in", "cache", ".", "Please", "be", "aware", "that", "currently", "cache", "only", "is", "updated", ".", "No", "changes", "to", "Database", "are", "made" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParametersLazyList.java#L457-L472
149,529
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParametersLazyList.java
QueryParametersLazyList.update
public QueryParameters update(int index, QueryParameters params) throws SQLException { AssertUtils.assertNotNull(params, "Element cannot be null, but values inside of it - can"); if (this.type == Type.READ_ONLY_FORWARD || this.type == Type.READ_ONLY_SCROLL) { throw new MjdbcSQLException("This Lazy query output cache is initialized as read-only - therefore cannot be updated."); } QueryParameters result = get(index); if (this.type == Type.UPDATE_FORWARD) { if (this.currentIndex == index) { updateResultSetCurrentLine(getCurrentResultSet(), params); } else if (this.currentIndex + 1 == index) { updateResultSetRow((index + 1) - generatedCacheMap.size(), params); } else { throw new MjdbcRuntimeException("Only current/next element can be updated!"); } getCurrentResultSet().updateRow(); this.currentIndex = index; } else if (this.type == Type.UPDATE_SCROLL) { updateResultSetRow((index + 1) - generatedCacheMap.size(), params); getCurrentResultSet().updateRow(); } else { throw new MjdbcSQLException("This Lazy query output cache was initialized with unknown type"); } return result; }
java
public QueryParameters update(int index, QueryParameters params) throws SQLException { AssertUtils.assertNotNull(params, "Element cannot be null, but values inside of it - can"); if (this.type == Type.READ_ONLY_FORWARD || this.type == Type.READ_ONLY_SCROLL) { throw new MjdbcSQLException("This Lazy query output cache is initialized as read-only - therefore cannot be updated."); } QueryParameters result = get(index); if (this.type == Type.UPDATE_FORWARD) { if (this.currentIndex == index) { updateResultSetCurrentLine(getCurrentResultSet(), params); } else if (this.currentIndex + 1 == index) { updateResultSetRow((index + 1) - generatedCacheMap.size(), params); } else { throw new MjdbcRuntimeException("Only current/next element can be updated!"); } getCurrentResultSet().updateRow(); this.currentIndex = index; } else if (this.type == Type.UPDATE_SCROLL) { updateResultSetRow((index + 1) - generatedCacheMap.size(), params); getCurrentResultSet().updateRow(); } else { throw new MjdbcSQLException("This Lazy query output cache was initialized with unknown type"); } return result; }
[ "public", "QueryParameters", "update", "(", "int", "index", ",", "QueryParameters", "params", ")", "throws", "SQLException", "{", "AssertUtils", ".", "assertNotNull", "(", "params", ",", "\"Element cannot be null, but values inside of it - can\"", ")", ";", "if", "(", "this", ".", "type", "==", "Type", ".", "READ_ONLY_FORWARD", "||", "this", ".", "type", "==", "Type", ".", "READ_ONLY_SCROLL", ")", "{", "throw", "new", "MjdbcSQLException", "(", "\"This Lazy query output cache is initialized as read-only - therefore cannot be updated.\"", ")", ";", "}", "QueryParameters", "result", "=", "get", "(", "index", ")", ";", "if", "(", "this", ".", "type", "==", "Type", ".", "UPDATE_FORWARD", ")", "{", "if", "(", "this", ".", "currentIndex", "==", "index", ")", "{", "updateResultSetCurrentLine", "(", "getCurrentResultSet", "(", ")", ",", "params", ")", ";", "}", "else", "if", "(", "this", ".", "currentIndex", "+", "1", "==", "index", ")", "{", "updateResultSetRow", "(", "(", "index", "+", "1", ")", "-", "generatedCacheMap", ".", "size", "(", ")", ",", "params", ")", ";", "}", "else", "{", "throw", "new", "MjdbcRuntimeException", "(", "\"Only current/next element can be updated!\"", ")", ";", "}", "getCurrentResultSet", "(", ")", ".", "updateRow", "(", ")", ";", "this", ".", "currentIndex", "=", "index", ";", "}", "else", "if", "(", "this", ".", "type", "==", "Type", ".", "UPDATE_SCROLL", ")", "{", "updateResultSetRow", "(", "(", "index", "+", "1", ")", "-", "generatedCacheMap", ".", "size", "(", ")", ",", "params", ")", ";", "getCurrentResultSet", "(", ")", ".", "updateRow", "(", ")", ";", "}", "else", "{", "throw", "new", "MjdbcSQLException", "(", "\"This Lazy query output cache was initialized with unknown type\"", ")", ";", "}", "return", "result", ";", "}" ]
Updates specified row in ResultSet @param index index of row which would be updated @param params source of values with which row would be updated @return value before update @throws SQLException
[ "Updates", "specified", "row", "in", "ResultSet" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParametersLazyList.java#L482-L512
149,530
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParametersLazyList.java
QueryParametersLazyList.insert
public void insert(QueryParameters params) throws SQLException { getCurrentResultSet().moveToInsertRow(); updateResultSetCurrentLine(getCurrentResultSet(), params); getCurrentResultSet().insertRow(); getCurrentResultSet().moveToCurrentRow(); }
java
public void insert(QueryParameters params) throws SQLException { getCurrentResultSet().moveToInsertRow(); updateResultSetCurrentLine(getCurrentResultSet(), params); getCurrentResultSet().insertRow(); getCurrentResultSet().moveToCurrentRow(); }
[ "public", "void", "insert", "(", "QueryParameters", "params", ")", "throws", "SQLException", "{", "getCurrentResultSet", "(", ")", ".", "moveToInsertRow", "(", ")", ";", "updateResultSetCurrentLine", "(", "getCurrentResultSet", "(", ")", ",", "params", ")", ";", "getCurrentResultSet", "(", ")", ".", "insertRow", "(", ")", ";", "getCurrentResultSet", "(", ")", ".", "moveToCurrentRow", "(", ")", ";", "}" ]
Inserts new row into returned ResultSet @param params values which would be used to fill newly inserted row @throws SQLException
[ "Inserts", "new", "row", "into", "returned", "ResultSet" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParametersLazyList.java#L520-L527
149,531
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParametersLazyList.java
QueryParametersLazyList.closeResultSet
private void closeResultSet(ResultSet rs) { if (closedResultSet.contains(rs) == false) { MjdbcUtils.closeQuietly(rs); closedResultSet.add(rs); } }
java
private void closeResultSet(ResultSet rs) { if (closedResultSet.contains(rs) == false) { MjdbcUtils.closeQuietly(rs); closedResultSet.add(rs); } }
[ "private", "void", "closeResultSet", "(", "ResultSet", "rs", ")", "{", "if", "(", "closedResultSet", ".", "contains", "(", "rs", ")", "==", "false", ")", "{", "MjdbcUtils", ".", "closeQuietly", "(", "rs", ")", ";", "closedResultSet", ".", "add", "(", "rs", ")", ";", "}", "}" ]
Silently closes supplied result set @param rs result set which should be closed
[ "Silently", "closes", "supplied", "result", "set" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParametersLazyList.java#L895-L900
149,532
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/AbstractQueryRunner.java
AbstractQueryRunner.getStatementHandler
private StatementHandler getStatementHandler(Class<? extends StatementHandler> statementHandlerClazz) { StatementHandler result = null; Constructor<? extends StatementHandler> constructor = null; Class<? extends StatementHandler> clazz = statementHandlerClazz; try { constructor = clazz.getConstructor(Overrider.class); result = constructor.newInstance(overrider); } catch (SecurityException e) { throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e); } catch (NoSuchMethodException e) { throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e); } catch (IllegalArgumentException e) { throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e); } catch (InstantiationException e) { throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e); } catch (IllegalAccessException e) { throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e); } catch (InvocationTargetException e) { throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e); } return result; }
java
private StatementHandler getStatementHandler(Class<? extends StatementHandler> statementHandlerClazz) { StatementHandler result = null; Constructor<? extends StatementHandler> constructor = null; Class<? extends StatementHandler> clazz = statementHandlerClazz; try { constructor = clazz.getConstructor(Overrider.class); result = constructor.newInstance(overrider); } catch (SecurityException e) { throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e); } catch (NoSuchMethodException e) { throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e); } catch (IllegalArgumentException e) { throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e); } catch (InstantiationException e) { throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e); } catch (IllegalAccessException e) { throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e); } catch (InvocationTargetException e) { throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e); } return result; }
[ "private", "StatementHandler", "getStatementHandler", "(", "Class", "<", "?", "extends", "StatementHandler", ">", "statementHandlerClazz", ")", "{", "StatementHandler", "result", "=", "null", ";", "Constructor", "<", "?", "extends", "StatementHandler", ">", "constructor", "=", "null", ";", "Class", "<", "?", "extends", "StatementHandler", ">", "clazz", "=", "statementHandlerClazz", ";", "try", "{", "constructor", "=", "clazz", ".", "getConstructor", "(", "Overrider", ".", "class", ")", ";", "result", "=", "constructor", ".", "newInstance", "(", "overrider", ")", ";", "}", "catch", "(", "SecurityException", "e", ")", "{", "throw", "new", "MjdbcRuntimeException", "(", "ERROR_SH_INIT_FAILED", ",", "e", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "throw", "new", "MjdbcRuntimeException", "(", "ERROR_SH_INIT_FAILED", ",", "e", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "throw", "new", "MjdbcRuntimeException", "(", "ERROR_SH_INIT_FAILED", ",", "e", ")", ";", "}", "catch", "(", "InstantiationException", "e", ")", "{", "throw", "new", "MjdbcRuntimeException", "(", "ERROR_SH_INIT_FAILED", ",", "e", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "MjdbcRuntimeException", "(", "ERROR_SH_INIT_FAILED", ",", "e", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "new", "MjdbcRuntimeException", "(", "ERROR_SH_INIT_FAILED", ",", "e", ")", ";", "}", "return", "result", ";", "}" ]
Creates new StatementHandler instance @param statementHandlerClazz StatementHandler implementation class @return new StatementHandler implementation instance
[ "Creates", "new", "StatementHandler", "instance" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/AbstractQueryRunner.java#L1132-L1156
149,533
lightblueseas/wicket-js-addons
wicket-js-addons-core/src/main/java/de/alpharogroup/wicket/js/addon/core/PercentNumberFormatTextValue.java
PercentNumberFormatTextValue.checkQuietly
private static Integer checkQuietly(final String name, final Integer value) { Integer val = 50; try { val = Args.withinRange(0, 100, value, name); } catch (final IllegalArgumentException e) { LOGGER.error(String.format( "Given argument '%s' must have a value within [%s,%s], but was %s. Default value 50% will be set.", name, 0, 100, value)); } return val; }
java
private static Integer checkQuietly(final String name, final Integer value) { Integer val = 50; try { val = Args.withinRange(0, 100, value, name); } catch (final IllegalArgumentException e) { LOGGER.error(String.format( "Given argument '%s' must have a value within [%s,%s], but was %s. Default value 50% will be set.", name, 0, 100, value)); } return val; }
[ "private", "static", "Integer", "checkQuietly", "(", "final", "String", "name", ",", "final", "Integer", "value", ")", "{", "Integer", "val", "=", "50", ";", "try", "{", "val", "=", "Args", ".", "withinRange", "(", "0", ",", "100", ",", "value", ",", "name", ")", ";", "}", "catch", "(", "final", "IllegalArgumentException", "e", ")", "{", "LOGGER", ".", "error", "(", "String", ".", "format", "(", "\"Given argument '%s' must have a value within [%s,%s], but was %s. Default value 50% will be set.\"", ",", "name", ",", "0", ",", "100", ",", "value", ")", ")", ";", "}", "return", "val", ";", "}" ]
Checks the given value if it is between 0 to 100 quietly. If not a default value from 50 will be set. @param name the name @param value the value @return the integer
[ "Checks", "the", "given", "value", "if", "it", "is", "between", "0", "to", "100", "quietly", ".", "If", "not", "a", "default", "value", "from", "50", "will", "be", "set", "." ]
b1c88c1abafd1e965f2e32ef13d66be0b28d76f6
https://github.com/lightblueseas/wicket-js-addons/blob/b1c88c1abafd1e965f2e32ef13d66be0b28d76f6/wicket-js-addons-core/src/main/java/de/alpharogroup/wicket/js/addon/core/PercentNumberFormatTextValue.java#L55-L70
149,534
lightblueseas/wicket-js-addons
wicket-js-addons-core/src/main/java/de/alpharogroup/wicket/js/addon/core/PercentNumberFormatTextValue.java
PercentNumberFormatTextValue.checkString
private Integer checkString(final String value) { Integer val = 50; if (value != null && !value.isEmpty()) { if (value.endsWith("%")) { final String sVal = value.substring(0, value.length() - 1); if (StringUtils.isNumeric(sVal)) { val = Integer.valueOf(sVal); } } else { if (StringUtils.isNumeric(value)) { val = Integer.valueOf(value); } } } return val; }
java
private Integer checkString(final String value) { Integer val = 50; if (value != null && !value.isEmpty()) { if (value.endsWith("%")) { final String sVal = value.substring(0, value.length() - 1); if (StringUtils.isNumeric(sVal)) { val = Integer.valueOf(sVal); } } else { if (StringUtils.isNumeric(value)) { val = Integer.valueOf(value); } } } return val; }
[ "private", "Integer", "checkString", "(", "final", "String", "value", ")", "{", "Integer", "val", "=", "50", ";", "if", "(", "value", "!=", "null", "&&", "!", "value", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "value", ".", "endsWith", "(", "\"%\"", ")", ")", "{", "final", "String", "sVal", "=", "value", ".", "substring", "(", "0", ",", "value", ".", "length", "(", ")", "-", "1", ")", ";", "if", "(", "StringUtils", ".", "isNumeric", "(", "sVal", ")", ")", "{", "val", "=", "Integer", ".", "valueOf", "(", "sVal", ")", ";", "}", "}", "else", "{", "if", "(", "StringUtils", ".", "isNumeric", "(", "value", ")", ")", "{", "val", "=", "Integer", ".", "valueOf", "(", "value", ")", ";", "}", "}", "}", "return", "val", ";", "}" ]
Check string. @param value the value @return the integer
[ "Check", "string", "." ]
b1c88c1abafd1e965f2e32ef13d66be0b28d76f6
https://github.com/lightblueseas/wicket-js-addons/blob/b1c88c1abafd1e965f2e32ef13d66be0b28d76f6/wicket-js-addons-core/src/main/java/de/alpharogroup/wicket/js/addon/core/PercentNumberFormatTextValue.java#L105-L128
149,535
lightblueseas/wicket-js-addons
wicket-js-addons-core/src/main/java/de/alpharogroup/wicket/js/addon/core/PercentNumberFormatTextValue.java
PercentNumberFormatTextValue.getPercentFormatted
private String getPercentFormatted(final Integer value) { final Integer val = checkQuietly(getName(), value); return NumberFormat.getPercentInstance().format((double)val / 100); }
java
private String getPercentFormatted(final Integer value) { final Integer val = checkQuietly(getName(), value); return NumberFormat.getPercentInstance().format((double)val / 100); }
[ "private", "String", "getPercentFormatted", "(", "final", "Integer", "value", ")", "{", "final", "Integer", "val", "=", "checkQuietly", "(", "getName", "(", ")", ",", "value", ")", ";", "return", "NumberFormat", ".", "getPercentInstance", "(", ")", ".", "format", "(", "(", "double", ")", "val", "/", "100", ")", ";", "}" ]
Gets the percent formatted. @param value the value @return the percent formatted
[ "Gets", "the", "percent", "formatted", "." ]
b1c88c1abafd1e965f2e32ef13d66be0b28d76f6
https://github.com/lightblueseas/wicket-js-addons/blob/b1c88c1abafd1e965f2e32ef13d66be0b28d76f6/wicket-js-addons-core/src/main/java/de/alpharogroup/wicket/js/addon/core/PercentNumberFormatTextValue.java#L137-L141
149,536
javagl/Common
src/main/java/de/javagl/common/beans/FullPersistenceDelegate.java
FullPersistenceDelegate.initializeProperties
private void initializeProperties( Class<?> type, Object oldInstance, Encoder encoder) { BeanInfo info = null; try { info = Introspector.getBeanInfo(type); } catch (IntrospectionException ie) { encoder.getExceptionListener().exceptionThrown(ie); return; } PropertyDescriptor[] pds = info.getPropertyDescriptors(); for (int i = 0; i < pds.length; ++i) { try { initializeProperty(type, pds[i], oldInstance, encoder); } catch (Exception e) { encoder.getExceptionListener().exceptionThrown(e); } } }
java
private void initializeProperties( Class<?> type, Object oldInstance, Encoder encoder) { BeanInfo info = null; try { info = Introspector.getBeanInfo(type); } catch (IntrospectionException ie) { encoder.getExceptionListener().exceptionThrown(ie); return; } PropertyDescriptor[] pds = info.getPropertyDescriptors(); for (int i = 0; i < pds.length; ++i) { try { initializeProperty(type, pds[i], oldInstance, encoder); } catch (Exception e) { encoder.getExceptionListener().exceptionThrown(e); } } }
[ "private", "void", "initializeProperties", "(", "Class", "<", "?", ">", "type", ",", "Object", "oldInstance", ",", "Encoder", "encoder", ")", "{", "BeanInfo", "info", "=", "null", ";", "try", "{", "info", "=", "Introspector", ".", "getBeanInfo", "(", "type", ")", ";", "}", "catch", "(", "IntrospectionException", "ie", ")", "{", "encoder", ".", "getExceptionListener", "(", ")", ".", "exceptionThrown", "(", "ie", ")", ";", "return", ";", "}", "PropertyDescriptor", "[", "]", "pds", "=", "info", ".", "getPropertyDescriptors", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pds", ".", "length", ";", "++", "i", ")", "{", "try", "{", "initializeProperty", "(", "type", ",", "pds", "[", "i", "]", ",", "oldInstance", ",", "encoder", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "encoder", ".", "getExceptionListener", "(", ")", ".", "exceptionThrown", "(", "e", ")", ";", "}", "}", "}" ]
Write all statements to initialize the properties of the given Java Bean Type, based on the given instance, using the given encoder @param type The Java Bean Type @param oldInstance The base instance @param encoder The encoder
[ "Write", "all", "statements", "to", "initialize", "the", "properties", "of", "the", "given", "Java", "Bean", "Type", "based", "on", "the", "given", "instance", "using", "the", "given", "encoder" ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/beans/FullPersistenceDelegate.java#L86-L111
149,537
javagl/Common
src/main/java/de/javagl/common/beans/FullPersistenceDelegate.java
FullPersistenceDelegate.initializeProperty
private void initializeProperty( Class<?> type, PropertyDescriptor pd, Object oldInstance, Encoder encoder) throws Exception { Method getter = pd.getReadMethod(); Method setter = pd.getWriteMethod(); if (getter != null && setter != null) { Expression oldGetExpression = new Expression(oldInstance, getter.getName(), new Object[] {}); Object oldValue = oldGetExpression.getValue(); Statement setStatement = new Statement(oldInstance, setter.getName(), new Object[] { oldValue }); encoder.writeStatement(setStatement); } }
java
private void initializeProperty( Class<?> type, PropertyDescriptor pd, Object oldInstance, Encoder encoder) throws Exception { Method getter = pd.getReadMethod(); Method setter = pd.getWriteMethod(); if (getter != null && setter != null) { Expression oldGetExpression = new Expression(oldInstance, getter.getName(), new Object[] {}); Object oldValue = oldGetExpression.getValue(); Statement setStatement = new Statement(oldInstance, setter.getName(), new Object[] { oldValue }); encoder.writeStatement(setStatement); } }
[ "private", "void", "initializeProperty", "(", "Class", "<", "?", ">", "type", ",", "PropertyDescriptor", "pd", ",", "Object", "oldInstance", ",", "Encoder", "encoder", ")", "throws", "Exception", "{", "Method", "getter", "=", "pd", ".", "getReadMethod", "(", ")", ";", "Method", "setter", "=", "pd", ".", "getWriteMethod", "(", ")", ";", "if", "(", "getter", "!=", "null", "&&", "setter", "!=", "null", ")", "{", "Expression", "oldGetExpression", "=", "new", "Expression", "(", "oldInstance", ",", "getter", ".", "getName", "(", ")", ",", "new", "Object", "[", "]", "{", "}", ")", ";", "Object", "oldValue", "=", "oldGetExpression", ".", "getValue", "(", ")", ";", "Statement", "setStatement", "=", "new", "Statement", "(", "oldInstance", ",", "setter", ".", "getName", "(", ")", ",", "new", "Object", "[", "]", "{", "oldValue", "}", ")", ";", "encoder", ".", "writeStatement", "(", "setStatement", ")", ";", "}", "}" ]
Write the statement to initialize the specified property of the given Java Bean Type, based on the given instance, using the given encoder @param type The Java Bean Type @param pd The property descriptor @param oldInstance The base instance @param encoder The encoder @throws Exception If the value can not be obtained
[ "Write", "the", "statement", "to", "initialize", "the", "specified", "property", "of", "the", "given", "Java", "Bean", "Type", "based", "on", "the", "given", "instance", "using", "the", "given", "encoder" ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/beans/FullPersistenceDelegate.java#L124-L140
149,538
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java
RottenTomatoesApi.getInTheaters
public List<RTMovie> getInTheaters(String country) throws RottenTomatoesException { return getInTheaters(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT); }
java
public List<RTMovie> getInTheaters(String country) throws RottenTomatoesException { return getInTheaters(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT); }
[ "public", "List", "<", "RTMovie", ">", "getInTheaters", "(", "String", "country", ")", "throws", "RottenTomatoesException", "{", "return", "getInTheaters", "(", "country", ",", "DEFAULT_PAGE", ",", "DEFAULT_PAGE_LIMIT", ")", ";", "}" ]
Retrieves movies currently in theaters @param country Provides localized data for the selected country @return @throws RottenTomatoesException
[ "Retrieves", "movies", "currently", "in", "theaters" ]
abaf1833acafc6ada593d52b14ff1bacb4e441ee
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L218-L220
149,539
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java
RottenTomatoesApi.getUpcomingMovies
public List<RTMovie> getUpcomingMovies(String country) throws RottenTomatoesException { return getUpcomingMovies(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT); }
java
public List<RTMovie> getUpcomingMovies(String country) throws RottenTomatoesException { return getUpcomingMovies(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT); }
[ "public", "List", "<", "RTMovie", ">", "getUpcomingMovies", "(", "String", "country", ")", "throws", "RottenTomatoesException", "{", "return", "getUpcomingMovies", "(", "country", ",", "DEFAULT_PAGE", ",", "DEFAULT_PAGE_LIMIT", ")", ";", "}" ]
Retrieves upcoming movies @param country Provides localized data for the selected country @return @throws RottenTomatoesException
[ "Retrieves", "upcoming", "movies" ]
abaf1833acafc6ada593d52b14ff1bacb4e441ee
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L306-L308
149,540
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java
RottenTomatoesApi.getTopRentals
public List<RTMovie> getTopRentals(String country, int limit) throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_URL, URL_TOP_RENTALS); properties.put(ApiBuilder.PROPERTY_LIMIT, ApiBuilder.validateLimit(limit)); properties.put(ApiBuilder.PROPERTY_COUNTRY, ApiBuilder.validateCountry(country)); WrapperLists wrapper = response.getResponse(WrapperLists.class, properties); if (wrapper != null && wrapper.getMovies() != null) { return wrapper.getMovies(); } else { return Collections.emptyList(); } }
java
public List<RTMovie> getTopRentals(String country, int limit) throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_URL, URL_TOP_RENTALS); properties.put(ApiBuilder.PROPERTY_LIMIT, ApiBuilder.validateLimit(limit)); properties.put(ApiBuilder.PROPERTY_COUNTRY, ApiBuilder.validateCountry(country)); WrapperLists wrapper = response.getResponse(WrapperLists.class, properties); if (wrapper != null && wrapper.getMovies() != null) { return wrapper.getMovies(); } else { return Collections.emptyList(); } }
[ "public", "List", "<", "RTMovie", ">", "getTopRentals", "(", "String", "country", ",", "int", "limit", ")", "throws", "RottenTomatoesException", "{", "properties", ".", "clear", "(", ")", ";", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_URL", ",", "URL_TOP_RENTALS", ")", ";", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_LIMIT", ",", "ApiBuilder", ".", "validateLimit", "(", "limit", ")", ")", ";", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_COUNTRY", ",", "ApiBuilder", ".", "validateCountry", "(", "country", ")", ")", ";", "WrapperLists", "wrapper", "=", "response", ".", "getResponse", "(", "WrapperLists", ".", "class", ",", "properties", ")", ";", "if", "(", "wrapper", "!=", "null", "&&", "wrapper", ".", "getMovies", "(", ")", "!=", "null", ")", "{", "return", "wrapper", ".", "getMovies", "(", ")", ";", "}", "else", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "}" ]
Retrieves the current top DVD rentals @param country Provides localized data for the selected country @param limit Limits the number of opening movies returned @return @throws RottenTomatoesException
[ "Retrieves", "the", "current", "top", "DVD", "rentals" ]
abaf1833acafc6ada593d52b14ff1bacb4e441ee
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L328-L340
149,541
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java
RottenTomatoesApi.getNewReleaseDvds
public List<RTMovie> getNewReleaseDvds(String country) throws RottenTomatoesException { return getNewReleaseDvds(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT); }
java
public List<RTMovie> getNewReleaseDvds(String country) throws RottenTomatoesException { return getNewReleaseDvds(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT); }
[ "public", "List", "<", "RTMovie", ">", "getNewReleaseDvds", "(", "String", "country", ")", "throws", "RottenTomatoesException", "{", "return", "getNewReleaseDvds", "(", "country", ",", "DEFAULT_PAGE", ",", "DEFAULT_PAGE_LIMIT", ")", ";", "}" ]
Retrieves new release DVDs @param country Provides localized data for the selected country @return @throws RottenTomatoesException
[ "Retrieves", "new", "release", "DVDs" ]
abaf1833acafc6ada593d52b14ff1bacb4e441ee
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L439-L441
149,542
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java
RottenTomatoesApi.getDetailedInfo
public RTMovie getDetailedInfo(int movieId) throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_ID, String.valueOf(movieId)); properties.put(ApiBuilder.PROPERTY_URL, URL_MOVIES_INFO); return response.getResponse(RTMovie.class, properties); }
java
public RTMovie getDetailedInfo(int movieId) throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_ID, String.valueOf(movieId)); properties.put(ApiBuilder.PROPERTY_URL, URL_MOVIES_INFO); return response.getResponse(RTMovie.class, properties); }
[ "public", "RTMovie", "getDetailedInfo", "(", "int", "movieId", ")", "throws", "RottenTomatoesException", "{", "properties", ".", "clear", "(", ")", ";", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_ID", ",", "String", ".", "valueOf", "(", "movieId", ")", ")", ";", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_URL", ",", "URL_MOVIES_INFO", ")", ";", "return", "response", ".", "getResponse", "(", "RTMovie", ".", "class", ",", "properties", ")", ";", "}" ]
Detailed information on a specific movie specified by Id. @param movieId RT Movie ID to locate @return @throws RottenTomatoesException
[ "Detailed", "information", "on", "a", "specific", "movie", "specified", "by", "Id", "." ]
abaf1833acafc6ada593d52b14ff1bacb4e441ee
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L505-L511
149,543
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java
RottenTomatoesApi.getCastInfo
public List<RTCast> getCastInfo(int movieId) throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_ID, String.valueOf(movieId)); properties.put(ApiBuilder.PROPERTY_URL, URL_CAST_INFO); WrapperLists wrapper = response.getResponse(WrapperLists.class, properties); if (wrapper != null && wrapper.getCast() != null) { return wrapper.getCast(); } else { return Collections.emptyList(); } }
java
public List<RTCast> getCastInfo(int movieId) throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_ID, String.valueOf(movieId)); properties.put(ApiBuilder.PROPERTY_URL, URL_CAST_INFO); WrapperLists wrapper = response.getResponse(WrapperLists.class, properties); if (wrapper != null && wrapper.getCast() != null) { return wrapper.getCast(); } else { return Collections.emptyList(); } }
[ "public", "List", "<", "RTCast", ">", "getCastInfo", "(", "int", "movieId", ")", "throws", "RottenTomatoesException", "{", "properties", ".", "clear", "(", ")", ";", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_ID", ",", "String", ".", "valueOf", "(", "movieId", ")", ")", ";", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_URL", ",", "URL_CAST_INFO", ")", ";", "WrapperLists", "wrapper", "=", "response", ".", "getResponse", "(", "WrapperLists", ".", "class", ",", "properties", ")", ";", "if", "(", "wrapper", "!=", "null", "&&", "wrapper", ".", "getCast", "(", ")", "!=", "null", ")", "{", "return", "wrapper", ".", "getCast", "(", ")", ";", "}", "else", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "}" ]
Pulls the complete movie cast for a movie @param movieId RT Movie ID @return @throws RottenTomatoesException
[ "Pulls", "the", "complete", "movie", "cast", "for", "a", "movie" ]
abaf1833acafc6ada593d52b14ff1bacb4e441ee
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L520-L531
149,544
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java
RottenTomatoesApi.getMovieClips
public List<RTClip> getMovieClips(int movieId) throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_ID, String.valueOf(movieId)); properties.put(ApiBuilder.PROPERTY_URL, URL_MOVIE_CLIPS); WrapperLists wrapper = response.getResponse(WrapperLists.class, properties); if (wrapper != null && wrapper.getClass() != null) { return wrapper.getClips(); } else { return Collections.emptyList(); } }
java
public List<RTClip> getMovieClips(int movieId) throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_ID, String.valueOf(movieId)); properties.put(ApiBuilder.PROPERTY_URL, URL_MOVIE_CLIPS); WrapperLists wrapper = response.getResponse(WrapperLists.class, properties); if (wrapper != null && wrapper.getClass() != null) { return wrapper.getClips(); } else { return Collections.emptyList(); } }
[ "public", "List", "<", "RTClip", ">", "getMovieClips", "(", "int", "movieId", ")", "throws", "RottenTomatoesException", "{", "properties", ".", "clear", "(", ")", ";", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_ID", ",", "String", ".", "valueOf", "(", "movieId", ")", ")", ";", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_URL", ",", "URL_MOVIE_CLIPS", ")", ";", "WrapperLists", "wrapper", "=", "response", ".", "getResponse", "(", "WrapperLists", ".", "class", ",", "properties", ")", ";", "if", "(", "wrapper", "!=", "null", "&&", "wrapper", ".", "getClass", "(", ")", "!=", "null", ")", "{", "return", "wrapper", ".", "getClips", "(", ")", ";", "}", "else", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "}" ]
Related movie clips and trailers for a movie @param movieId RT Movie ID @return @throws RottenTomatoesException
[ "Related", "movie", "clips", "and", "trailers", "for", "a", "movie" ]
abaf1833acafc6ada593d52b14ff1bacb4e441ee
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L540-L551
149,545
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java
RottenTomatoesApi.getMoviesSimilar
public List<RTMovie> getMoviesSimilar(int movieId, int limit) throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_ID, String.valueOf(movieId)); properties.put(ApiBuilder.PROPERTY_URL, URL_MOVIES_SIMILAR); properties.put(ApiBuilder.PROPERTY_LIMIT, ApiBuilder.validateLimit(limit)); WrapperLists wrapper = response.getResponse(WrapperLists.class, properties); if (wrapper != null && wrapper.getMovies() != null) { return wrapper.getMovies(); } else { return Collections.emptyList(); } }
java
public List<RTMovie> getMoviesSimilar(int movieId, int limit) throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_ID, String.valueOf(movieId)); properties.put(ApiBuilder.PROPERTY_URL, URL_MOVIES_SIMILAR); properties.put(ApiBuilder.PROPERTY_LIMIT, ApiBuilder.validateLimit(limit)); WrapperLists wrapper = response.getResponse(WrapperLists.class, properties); if (wrapper != null && wrapper.getMovies() != null) { return wrapper.getMovies(); } else { return Collections.emptyList(); } }
[ "public", "List", "<", "RTMovie", ">", "getMoviesSimilar", "(", "int", "movieId", ",", "int", "limit", ")", "throws", "RottenTomatoesException", "{", "properties", ".", "clear", "(", ")", ";", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_ID", ",", "String", ".", "valueOf", "(", "movieId", ")", ")", ";", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_URL", ",", "URL_MOVIES_SIMILAR", ")", ";", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_LIMIT", ",", "ApiBuilder", ".", "validateLimit", "(", "limit", ")", ")", ";", "WrapperLists", "wrapper", "=", "response", ".", "getResponse", "(", "WrapperLists", ".", "class", ",", "properties", ")", ";", "if", "(", "wrapper", "!=", "null", "&&", "wrapper", ".", "getMovies", "(", ")", "!=", "null", ")", "{", "return", "wrapper", ".", "getMovies", "(", ")", ";", "}", "else", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "}" ]
Returns similar movies to a movie @param movieId RT Movie ID @param limit Limit number of returned movies @return @throws RottenTomatoesException
[ "Returns", "similar", "movies", "to", "a", "movie" ]
abaf1833acafc6ada593d52b14ff1bacb4e441ee
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L625-L637
149,546
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java
RottenTomatoesApi.getMoviesAlias
public RTMovie getMoviesAlias(String altMovieId, String type) throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_URL, URL_MOVIES_ALIAS); // remove the "tt" from the start of the ID if it's imdb if ("imdb".equalsIgnoreCase(type) && altMovieId.toLowerCase().startsWith("tt")) { properties.put(ApiBuilder.PROPERTY_ID, altMovieId.substring(LENGTH_OF_IMDB_PREFIX)); } else { properties.put(ApiBuilder.PROPERTY_ID, altMovieId); } properties.put(ApiBuilder.PROPERTY_TYPE, type); return response.getResponse(RTMovie.class, properties); }
java
public RTMovie getMoviesAlias(String altMovieId, String type) throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_URL, URL_MOVIES_ALIAS); // remove the "tt" from the start of the ID if it's imdb if ("imdb".equalsIgnoreCase(type) && altMovieId.toLowerCase().startsWith("tt")) { properties.put(ApiBuilder.PROPERTY_ID, altMovieId.substring(LENGTH_OF_IMDB_PREFIX)); } else { properties.put(ApiBuilder.PROPERTY_ID, altMovieId); } properties.put(ApiBuilder.PROPERTY_TYPE, type); return response.getResponse(RTMovie.class, properties); }
[ "public", "RTMovie", "getMoviesAlias", "(", "String", "altMovieId", ",", "String", "type", ")", "throws", "RottenTomatoesException", "{", "properties", ".", "clear", "(", ")", ";", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_URL", ",", "URL_MOVIES_ALIAS", ")", ";", "// remove the \"tt\" from the start of the ID if it's imdb", "if", "(", "\"imdb\"", ".", "equalsIgnoreCase", "(", "type", ")", "&&", "altMovieId", ".", "toLowerCase", "(", ")", ".", "startsWith", "(", "\"tt\"", ")", ")", "{", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_ID", ",", "altMovieId", ".", "substring", "(", "LENGTH_OF_IMDB_PREFIX", ")", ")", ";", "}", "else", "{", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_ID", ",", "altMovieId", ")", ";", "}", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_TYPE", ",", "type", ")", ";", "return", "response", ".", "getResponse", "(", "RTMovie", ".", "class", ",", "properties", ")", ";", "}" ]
Provides a movie lookup by an id from a different vendor @param altMovieId @param type @return @throws RottenTomatoesException
[ "Provides", "a", "movie", "lookup", "by", "an", "id", "from", "a", "different", "vendor" ]
abaf1833acafc6ada593d52b14ff1bacb4e441ee
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L658-L670
149,547
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java
RottenTomatoesApi.getListsDirectory
public Map<String, String> getListsDirectory() throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_URL, URL_LISTS_DIRECTORY); WrapperLists wrapper = response.getResponse(WrapperLists.class, properties); if (wrapper != null && wrapper.getLinks() != null) { return wrapper.getLinks(); } else { return Collections.emptyMap(); } }
java
public Map<String, String> getListsDirectory() throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_URL, URL_LISTS_DIRECTORY); WrapperLists wrapper = response.getResponse(WrapperLists.class, properties); if (wrapper != null && wrapper.getLinks() != null) { return wrapper.getLinks(); } else { return Collections.emptyMap(); } }
[ "public", "Map", "<", "String", ",", "String", ">", "getListsDirectory", "(", ")", "throws", "RottenTomatoesException", "{", "properties", ".", "clear", "(", ")", ";", "properties", ".", "put", "(", "ApiBuilder", ".", "PROPERTY_URL", ",", "URL_LISTS_DIRECTORY", ")", ";", "WrapperLists", "wrapper", "=", "response", ".", "getResponse", "(", "WrapperLists", ".", "class", ",", "properties", ")", ";", "if", "(", "wrapper", "!=", "null", "&&", "wrapper", ".", "getLinks", "(", ")", "!=", "null", ")", "{", "return", "wrapper", ".", "getLinks", "(", ")", ";", "}", "else", "{", "return", "Collections", ".", "emptyMap", "(", ")", ";", "}", "}" ]
Displays the top level lists available in the API @return @throws RottenTomatoesException
[ "Displays", "the", "top", "level", "lists", "available", "in", "the", "API" ]
abaf1833acafc6ada593d52b14ff1bacb4e441ee
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L720-L730
149,548
realtime-framework/RealtimeStorage-Android
library/src/main/java/co/realtime/storage/Rest.java
Rest.resolveUrl
void resolveUrl() throws IOException, StorageException, KeyManagementException, NoSuchAlgorithmException{ String tempUrl; if(context.isCluster){ if(this.context.lastBalancerResponse!=null){ tempUrl = this.context.lastBalancerResponse; } else { //System.out.println("[-] Balancer resolve! " + this.context); String urlString = context.url + "?appkey=" + context.applicationKey; URL url = new URL(urlString); String balancerResponse = urlString.startsWith("https:") ? secureBalancerRequest(url) : unsecureBalancerRequest(url); if(balancerResponse == null){ throw new StorageException("Cannot get response from balancer!"); } JSONObject obj = (JSONObject) JSONValue.parse(balancerResponse); tempUrl = (String)obj.get("url"); this.context.lastBalancerResponse = tempUrl; } } else { tempUrl = context.url; } //tempUrl = "https://storage-ssl-prd-useast1-s0002.realtime.co:443/"; //this.requestUrl += this.requestUrl.substring(this.requestUrl.length() - 1).equals("/") ? this.type.toString() : "/"+this.type.toString(); tempUrl += tempUrl.substring(tempUrl.length() - 1).equals("/") ? this.type.toString() : "/"+this.type.toString(); //path += path.substring(path.length(), 1).equals("/") ? this.type.toString() : "/"+this.type.toString(); this.requestUrl = new URL(tempUrl); //System.out.println(String.format("Rest url: %s",this.requestUrl)); }
java
void resolveUrl() throws IOException, StorageException, KeyManagementException, NoSuchAlgorithmException{ String tempUrl; if(context.isCluster){ if(this.context.lastBalancerResponse!=null){ tempUrl = this.context.lastBalancerResponse; } else { //System.out.println("[-] Balancer resolve! " + this.context); String urlString = context.url + "?appkey=" + context.applicationKey; URL url = new URL(urlString); String balancerResponse = urlString.startsWith("https:") ? secureBalancerRequest(url) : unsecureBalancerRequest(url); if(balancerResponse == null){ throw new StorageException("Cannot get response from balancer!"); } JSONObject obj = (JSONObject) JSONValue.parse(balancerResponse); tempUrl = (String)obj.get("url"); this.context.lastBalancerResponse = tempUrl; } } else { tempUrl = context.url; } //tempUrl = "https://storage-ssl-prd-useast1-s0002.realtime.co:443/"; //this.requestUrl += this.requestUrl.substring(this.requestUrl.length() - 1).equals("/") ? this.type.toString() : "/"+this.type.toString(); tempUrl += tempUrl.substring(tempUrl.length() - 1).equals("/") ? this.type.toString() : "/"+this.type.toString(); //path += path.substring(path.length(), 1).equals("/") ? this.type.toString() : "/"+this.type.toString(); this.requestUrl = new URL(tempUrl); //System.out.println(String.format("Rest url: %s",this.requestUrl)); }
[ "void", "resolveUrl", "(", ")", "throws", "IOException", ",", "StorageException", ",", "KeyManagementException", ",", "NoSuchAlgorithmException", "{", "String", "tempUrl", ";", "if", "(", "context", ".", "isCluster", ")", "{", "if", "(", "this", ".", "context", ".", "lastBalancerResponse", "!=", "null", ")", "{", "tempUrl", "=", "this", ".", "context", ".", "lastBalancerResponse", ";", "}", "else", "{", "//System.out.println(\"[-] Balancer resolve! \" + this.context);", "String", "urlString", "=", "context", ".", "url", "+", "\"?appkey=\"", "+", "context", ".", "applicationKey", ";", "URL", "url", "=", "new", "URL", "(", "urlString", ")", ";", "String", "balancerResponse", "=", "urlString", ".", "startsWith", "(", "\"https:\"", ")", "?", "secureBalancerRequest", "(", "url", ")", ":", "unsecureBalancerRequest", "(", "url", ")", ";", "if", "(", "balancerResponse", "==", "null", ")", "{", "throw", "new", "StorageException", "(", "\"Cannot get response from balancer!\"", ")", ";", "}", "JSONObject", "obj", "=", "(", "JSONObject", ")", "JSONValue", ".", "parse", "(", "balancerResponse", ")", ";", "tempUrl", "=", "(", "String", ")", "obj", ".", "get", "(", "\"url\"", ")", ";", "this", ".", "context", ".", "lastBalancerResponse", "=", "tempUrl", ";", "}", "}", "else", "{", "tempUrl", "=", "context", ".", "url", ";", "}", "//tempUrl = \"https://storage-ssl-prd-useast1-s0002.realtime.co:443/\";", "//this.requestUrl += this.requestUrl.substring(this.requestUrl.length() - 1).equals(\"/\") ? this.type.toString() : \"/\"+this.type.toString();", "tempUrl", "+=", "tempUrl", ".", "substring", "(", "tempUrl", ".", "length", "(", ")", "-", "1", ")", ".", "equals", "(", "\"/\"", ")", "?", "this", ".", "type", ".", "toString", "(", ")", ":", "\"/\"", "+", "this", ".", "type", ".", "toString", "(", ")", ";", "//path += path.substring(path.length(), 1).equals(\"/\") ? this.type.toString() : \"/\"+this.type.toString();", "this", ".", "requestUrl", "=", "new", "URL", "(", "tempUrl", ")", ";", "//System.out.println(String.format(\"Rest url: %s\",this.requestUrl));", "}" ]
will put the server url with rest path to this.requestUrl
[ "will", "put", "the", "server", "url", "with", "rest", "path", "to", "this", ".", "requestUrl" ]
05816a6b7a6dcc83f9e7400ac3048494dadca302
https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/Rest.java#L235-L261
149,549
greese/dasein-util
src/main/java/org/dasein/util/Jiterator.java
Jiterator.complete
public synchronized void complete() { if( logger.isInfoEnabled() ) { logger.info("[" + this + "] Marking complete"); } if( loaded ) { return; } loaded = true; lastTouch = System.currentTimeMillis(); if( waiting != null && waiting.isEmpty() ) { waiting = null; } notifyAll(); }
java
public synchronized void complete() { if( logger.isInfoEnabled() ) { logger.info("[" + this + "] Marking complete"); } if( loaded ) { return; } loaded = true; lastTouch = System.currentTimeMillis(); if( waiting != null && waiting.isEmpty() ) { waiting = null; } notifyAll(); }
[ "public", "synchronized", "void", "complete", "(", ")", "{", "if", "(", "logger", ".", "isInfoEnabled", "(", ")", ")", "{", "logger", ".", "info", "(", "\"[\"", "+", "this", "+", "\"] Marking complete\"", ")", ";", "}", "if", "(", "loaded", ")", "{", "return", ";", "}", "loaded", "=", "true", ";", "lastTouch", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "if", "(", "waiting", "!=", "null", "&&", "waiting", ".", "isEmpty", "(", ")", ")", "{", "waiting", "=", "null", ";", "}", "notifyAll", "(", ")", ";", "}" ]
Marks the jiterator as complete. Once you call this method, you cannot add any more items into the jiterator. If you fail to call this method, any threads reading from this jiterator will ultimately hang until you call this method.
[ "Marks", "the", "jiterator", "as", "complete", ".", "Once", "you", "call", "this", "method", "you", "cannot", "add", "any", "more", "items", "into", "the", "jiterator", ".", "If", "you", "fail", "to", "call", "this", "method", "any", "threads", "reading", "from", "this", "jiterator", "will", "ultimately", "hang", "until", "you", "call", "this", "method", "." ]
648606dcb4bd382e3287a6c897a32e65d553dc47
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/Jiterator.java#L160-L173
149,550
greese/dasein-util
src/main/java/org/dasein/util/Jiterator.java
Jiterator.hasNext
public synchronized boolean hasNext() { while( nexting ) { if( logger.isInfoEnabled() ) { logger.info("[" + this + "] Waiting for another thread to pull item..."); } try { wait(150L); } catch( InterruptedException e ) { /* ignore */ } } if( loadException != null ) { throw new JiteratorLoadException(loadException); } nexting = true; try { if( waiting == null ) { return false; } if( !waiting.isEmpty() ) { return true; } waitForPush(); if( loadException != null ) { throw new JiteratorLoadException(loadException); } return (waiting != null && !waiting.isEmpty()); } finally { nexting = false; notifyAll(); } }
java
public synchronized boolean hasNext() { while( nexting ) { if( logger.isInfoEnabled() ) { logger.info("[" + this + "] Waiting for another thread to pull item..."); } try { wait(150L); } catch( InterruptedException e ) { /* ignore */ } } if( loadException != null ) { throw new JiteratorLoadException(loadException); } nexting = true; try { if( waiting == null ) { return false; } if( !waiting.isEmpty() ) { return true; } waitForPush(); if( loadException != null ) { throw new JiteratorLoadException(loadException); } return (waiting != null && !waiting.isEmpty()); } finally { nexting = false; notifyAll(); } }
[ "public", "synchronized", "boolean", "hasNext", "(", ")", "{", "while", "(", "nexting", ")", "{", "if", "(", "logger", ".", "isInfoEnabled", "(", ")", ")", "{", "logger", ".", "info", "(", "\"[\"", "+", "this", "+", "\"] Waiting for another thread to pull item...\"", ")", ";", "}", "try", "{", "wait", "(", "150L", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "/* ignore */", "}", "}", "if", "(", "loadException", "!=", "null", ")", "{", "throw", "new", "JiteratorLoadException", "(", "loadException", ")", ";", "}", "nexting", "=", "true", ";", "try", "{", "if", "(", "waiting", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "!", "waiting", ".", "isEmpty", "(", ")", ")", "{", "return", "true", ";", "}", "waitForPush", "(", ")", ";", "if", "(", "loadException", "!=", "null", ")", "{", "throw", "new", "JiteratorLoadException", "(", "loadException", ")", ";", "}", "return", "(", "waiting", "!=", "null", "&&", "!", "waiting", ".", "isEmpty", "(", ")", ")", ";", "}", "finally", "{", "nexting", "=", "false", ";", "notifyAll", "(", ")", ";", "}", "}" ]
Checks to see if there are more elements to be processed in the jiterator. If this method is called prior to the jiterator being loaded with an item, it will hang until either an item is added into the jiterator or the jiterator is marked as complete. @return true if there are more elements to be processed @throws JiteratorLoadException an error occurred during the load of the jiterator
[ "Checks", "to", "see", "if", "there", "are", "more", "elements", "to", "be", "processed", "in", "the", "jiterator", ".", "If", "this", "method", "is", "called", "prior", "to", "the", "jiterator", "being", "loaded", "with", "an", "item", "it", "will", "hang", "until", "either", "an", "item", "is", "added", "into", "the", "jiterator", "or", "the", "jiterator", "is", "marked", "as", "complete", "." ]
648606dcb4bd382e3287a6c897a32e65d553dc47
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/Jiterator.java#L197-L226
149,551
greese/dasein-util
src/main/java/org/dasein/util/Jiterator.java
Jiterator.next
public synchronized @Nullable T next() throws JiteratorLoadException { while( nexting ) { if( logger.isInfoEnabled() ) { logger.info("[" + this + "] Waiting for another thread to pull item..."); } try { wait(150L); } catch( InterruptedException e ) { /* ignore */ } } if( loadException != null ) { throw new JiteratorLoadException(loadException); } nexting = true; try { T t; if( waiting == null ) { throw new NoSuchElementException("Invalid attempt to get another element from empty iterator."); } if( !waiting.isEmpty() ) { t = waiting.get(0); waiting.remove(0); if( waiting.isEmpty() && loaded ) { waiting = null; } return t; } waitForPush(); if( loadException != null ) { throw new JiteratorLoadException(loadException); } if( waiting == null || waiting.isEmpty() ) { throw new NoSuchElementException("Invalid attempt to get another element from empty iterator."); } t = waiting.get(0); waiting.remove(0); if( waiting.isEmpty() && loaded ) { waiting = null; } return t; } finally { nexting = false; notifyAll(); } }
java
public synchronized @Nullable T next() throws JiteratorLoadException { while( nexting ) { if( logger.isInfoEnabled() ) { logger.info("[" + this + "] Waiting for another thread to pull item..."); } try { wait(150L); } catch( InterruptedException e ) { /* ignore */ } } if( loadException != null ) { throw new JiteratorLoadException(loadException); } nexting = true; try { T t; if( waiting == null ) { throw new NoSuchElementException("Invalid attempt to get another element from empty iterator."); } if( !waiting.isEmpty() ) { t = waiting.get(0); waiting.remove(0); if( waiting.isEmpty() && loaded ) { waiting = null; } return t; } waitForPush(); if( loadException != null ) { throw new JiteratorLoadException(loadException); } if( waiting == null || waiting.isEmpty() ) { throw new NoSuchElementException("Invalid attempt to get another element from empty iterator."); } t = waiting.get(0); waiting.remove(0); if( waiting.isEmpty() && loaded ) { waiting = null; } return t; } finally { nexting = false; notifyAll(); } }
[ "public", "synchronized", "@", "Nullable", "T", "next", "(", ")", "throws", "JiteratorLoadException", "{", "while", "(", "nexting", ")", "{", "if", "(", "logger", ".", "isInfoEnabled", "(", ")", ")", "{", "logger", ".", "info", "(", "\"[\"", "+", "this", "+", "\"] Waiting for another thread to pull item...\"", ")", ";", "}", "try", "{", "wait", "(", "150L", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "/* ignore */", "}", "}", "if", "(", "loadException", "!=", "null", ")", "{", "throw", "new", "JiteratorLoadException", "(", "loadException", ")", ";", "}", "nexting", "=", "true", ";", "try", "{", "T", "t", ";", "if", "(", "waiting", "==", "null", ")", "{", "throw", "new", "NoSuchElementException", "(", "\"Invalid attempt to get another element from empty iterator.\"", ")", ";", "}", "if", "(", "!", "waiting", ".", "isEmpty", "(", ")", ")", "{", "t", "=", "waiting", ".", "get", "(", "0", ")", ";", "waiting", ".", "remove", "(", "0", ")", ";", "if", "(", "waiting", ".", "isEmpty", "(", ")", "&&", "loaded", ")", "{", "waiting", "=", "null", ";", "}", "return", "t", ";", "}", "waitForPush", "(", ")", ";", "if", "(", "loadException", "!=", "null", ")", "{", "throw", "new", "JiteratorLoadException", "(", "loadException", ")", ";", "}", "if", "(", "waiting", "==", "null", "||", "waiting", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "NoSuchElementException", "(", "\"Invalid attempt to get another element from empty iterator.\"", ")", ";", "}", "t", "=", "waiting", ".", "get", "(", "0", ")", ";", "waiting", ".", "remove", "(", "0", ")", ";", "if", "(", "waiting", ".", "isEmpty", "(", ")", "&&", "loaded", ")", "{", "waiting", "=", "null", ";", "}", "return", "t", ";", "}", "finally", "{", "nexting", "=", "false", ";", "notifyAll", "(", ")", ";", "}", "}" ]
Provides the next element in the jiterator. If this method is called prior to the jiterator being loaded with an item, it will hang until either an item is added into the jiterator or the jiterator is marked as complete. @return true if there are more elements to be processed @throws NoSuchElementException an attempt was made to read beyond the last item in the jiterator
[ "Provides", "the", "next", "element", "in", "the", "jiterator", ".", "If", "this", "method", "is", "called", "prior", "to", "the", "jiterator", "being", "loaded", "with", "an", "item", "it", "will", "hang", "until", "either", "an", "item", "is", "added", "into", "the", "jiterator", "or", "the", "jiterator", "is", "marked", "as", "complete", "." ]
648606dcb4bd382e3287a6c897a32e65d553dc47
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/Jiterator.java#L261-L305
149,552
greese/dasein-util
src/main/java/org/dasein/util/Jiterator.java
Jiterator.waitForPush
private synchronized void waitForPush() { long waitStart = -1L; while( waiting != null && waiting.isEmpty() && !loaded ) { long untouched = System.currentTimeMillis() - lastTouch; if( untouched > timeout.longValue() ) { logger.error("[" + this + "] Jiterator timeout for " + getName()); setLoadException(new TimeoutException("Jiterator " + getName() + " timed out while loading")); } if( waitStart == -1L ) { waitStart = System.currentTimeMillis(); } else { if( (System.currentTimeMillis() - waitStart) > CalendarWrapper.MINUTE ) { if( (System.currentTimeMillis() - scream) > CalendarWrapper.MINUTE ) { scream = System.currentTimeMillis(); logger.warn("[" + this + "] " + ((System.currentTimeMillis()-lastTouch)/1000) + " seconds since last touch."); } } } long multiplier = (untouched/(15 * CalendarWrapper.SECOND)) + 1; try { wait(150L * multiplier); } catch( InterruptedException ignore ) { } } }
java
private synchronized void waitForPush() { long waitStart = -1L; while( waiting != null && waiting.isEmpty() && !loaded ) { long untouched = System.currentTimeMillis() - lastTouch; if( untouched > timeout.longValue() ) { logger.error("[" + this + "] Jiterator timeout for " + getName()); setLoadException(new TimeoutException("Jiterator " + getName() + " timed out while loading")); } if( waitStart == -1L ) { waitStart = System.currentTimeMillis(); } else { if( (System.currentTimeMillis() - waitStart) > CalendarWrapper.MINUTE ) { if( (System.currentTimeMillis() - scream) > CalendarWrapper.MINUTE ) { scream = System.currentTimeMillis(); logger.warn("[" + this + "] " + ((System.currentTimeMillis()-lastTouch)/1000) + " seconds since last touch."); } } } long multiplier = (untouched/(15 * CalendarWrapper.SECOND)) + 1; try { wait(150L * multiplier); } catch( InterruptedException ignore ) { } } }
[ "private", "synchronized", "void", "waitForPush", "(", ")", "{", "long", "waitStart", "=", "-", "1L", ";", "while", "(", "waiting", "!=", "null", "&&", "waiting", ".", "isEmpty", "(", ")", "&&", "!", "loaded", ")", "{", "long", "untouched", "=", "System", ".", "currentTimeMillis", "(", ")", "-", "lastTouch", ";", "if", "(", "untouched", ">", "timeout", ".", "longValue", "(", ")", ")", "{", "logger", ".", "error", "(", "\"[\"", "+", "this", "+", "\"] Jiterator timeout for \"", "+", "getName", "(", ")", ")", ";", "setLoadException", "(", "new", "TimeoutException", "(", "\"Jiterator \"", "+", "getName", "(", ")", "+", "\" timed out while loading\"", ")", ")", ";", "}", "if", "(", "waitStart", "==", "-", "1L", ")", "{", "waitStart", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "}", "else", "{", "if", "(", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "waitStart", ")", ">", "CalendarWrapper", ".", "MINUTE", ")", "{", "if", "(", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "scream", ")", ">", "CalendarWrapper", ".", "MINUTE", ")", "{", "scream", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "logger", ".", "warn", "(", "\"[\"", "+", "this", "+", "\"] \"", "+", "(", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "lastTouch", ")", "/", "1000", ")", "+", "\" seconds since last touch.\"", ")", ";", "}", "}", "}", "long", "multiplier", "=", "(", "untouched", "/", "(", "15", "*", "CalendarWrapper", ".", "SECOND", ")", ")", "+", "1", ";", "try", "{", "wait", "(", "150L", "*", "multiplier", ")", ";", "}", "catch", "(", "InterruptedException", "ignore", ")", "{", "}", "}", "}" ]
Waits for a new item to be put into the jiterator or for the jiterator to be marked empty.
[ "Waits", "for", "a", "new", "item", "to", "be", "put", "into", "the", "jiterator", "or", "for", "the", "jiterator", "to", "be", "marked", "empty", "." ]
648606dcb4bd382e3287a6c897a32e65d553dc47
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/Jiterator.java#L363-L389
149,553
mike10004/common-helper
ormlite-helper/src/main/java/com/github/mike10004/common/dbhelp/ConnectionParams.java
ConnectionParams.copy
public ConnectionParams copy() { ConnectionParams copy = new ConnectionParams(host, username, password, schema); return copy; }
java
public ConnectionParams copy() { ConnectionParams copy = new ConnectionParams(host, username, password, schema); return copy; }
[ "public", "ConnectionParams", "copy", "(", ")", "{", "ConnectionParams", "copy", "=", "new", "ConnectionParams", "(", "host", ",", "username", ",", "password", ",", "schema", ")", ";", "return", "copy", ";", "}" ]
Constructs a new object that copies the fields from this instance. @return the new object
[ "Constructs", "a", "new", "object", "that", "copies", "the", "fields", "from", "this", "instance", "." ]
744f82d9b0768a9ad9c63a57a37ab2c93bf408f4
https://github.com/mike10004/common-helper/blob/744f82d9b0768a9ad9c63a57a37ab2c93bf408f4/ormlite-helper/src/main/java/com/github/mike10004/common/dbhelp/ConnectionParams.java#L111-L114
149,554
greese/dasein-util
src/main/java/org/dasein/attributes/DataTypeFactory.java
DataTypeFactory.getInstance
static public DataTypeFactory<?> getInstance(String tname) { DataTypeFactory<?> factory = factories.get(tname); if( factory == null ) { throw new InvalidAttributeException("Unknown type name: " + tname); } return factory; }
java
static public DataTypeFactory<?> getInstance(String tname) { DataTypeFactory<?> factory = factories.get(tname); if( factory == null ) { throw new InvalidAttributeException("Unknown type name: " + tname); } return factory; }
[ "static", "public", "DataTypeFactory", "<", "?", ">", "getInstance", "(", "String", "tname", ")", "{", "DataTypeFactory", "<", "?", ">", "factory", "=", "factories", ".", "get", "(", "tname", ")", ";", "if", "(", "factory", "==", "null", ")", "{", "throw", "new", "InvalidAttributeException", "(", "\"Unknown type name: \"", "+", "tname", ")", ";", "}", "return", "factory", ";", "}" ]
Provides access to the data type factory associated with the specified type name. @param tname the name of the data type for the desired factory @return the factory representing the specified type name @throws InvalidAttributeException when an unknown type is sought out
[ "Provides", "access", "to", "the", "data", "type", "factory", "associated", "with", "the", "specified", "type", "name", "." ]
648606dcb4bd382e3287a6c897a32e65d553dc47
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/attributes/DataTypeFactory.java#L215-L222
149,555
greese/dasein-util
src/main/java/org/dasein/attributes/DataTypeFactory.java
DataTypeFactory.getTypes
static public Collection<DataTypeFactory<?>> getTypes() { ArrayList<DataTypeFactory<?>> list = new ArrayList<DataTypeFactory<?>>(); for( Map.Entry<String,DataTypeFactory<?>> entry : factories.entrySet() ) { list.add(entry.getValue()); } return list; }
java
static public Collection<DataTypeFactory<?>> getTypes() { ArrayList<DataTypeFactory<?>> list = new ArrayList<DataTypeFactory<?>>(); for( Map.Entry<String,DataTypeFactory<?>> entry : factories.entrySet() ) { list.add(entry.getValue()); } return list; }
[ "static", "public", "Collection", "<", "DataTypeFactory", "<", "?", ">", ">", "getTypes", "(", ")", "{", "ArrayList", "<", "DataTypeFactory", "<", "?", ">", ">", "list", "=", "new", "ArrayList", "<", "DataTypeFactory", "<", "?", ">", ">", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "DataTypeFactory", "<", "?", ">", ">", "entry", ":", "factories", ".", "entrySet", "(", ")", ")", "{", "list", ".", "add", "(", "entry", ".", "getValue", "(", ")", ")", ";", "}", "return", "list", ";", "}" ]
Lists all types known to the system. @return a collection of all type factories
[ "Lists", "all", "types", "known", "to", "the", "system", "." ]
648606dcb4bd382e3287a6c897a32e65d553dc47
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/attributes/DataTypeFactory.java#L228-L235
149,556
greese/dasein-util
src/main/java/org/dasein/attributes/DataTypeFactory.java
DataTypeFactory.getDisplayValue
public String getDisplayValue(Locale loc, Object ob) { if( ob == null ) { return ""; } if( ob instanceof Translator ) { @SuppressWarnings("rawtypes") Translation trans = ((Translator)ob).get(loc); if( trans == null ) { return null; } return getDisplayValue(trans.getData()); } else { return getDisplayValue(ob); } }
java
public String getDisplayValue(Locale loc, Object ob) { if( ob == null ) { return ""; } if( ob instanceof Translator ) { @SuppressWarnings("rawtypes") Translation trans = ((Translator)ob).get(loc); if( trans == null ) { return null; } return getDisplayValue(trans.getData()); } else { return getDisplayValue(ob); } }
[ "public", "String", "getDisplayValue", "(", "Locale", "loc", ",", "Object", "ob", ")", "{", "if", "(", "ob", "==", "null", ")", "{", "return", "\"\"", ";", "}", "if", "(", "ob", "instanceof", "Translator", ")", "{", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "Translation", "trans", "=", "(", "(", "Translator", ")", "ob", ")", ".", "get", "(", "loc", ")", ";", "if", "(", "trans", "==", "null", ")", "{", "return", "null", ";", "}", "return", "getDisplayValue", "(", "trans", ".", "getData", "(", ")", ")", ";", "}", "else", "{", "return", "getDisplayValue", "(", "ob", ")", ";", "}", "}" ]
Provides a display version of the specified value translated for the target locale. @param loc the locale for which the display should be translated @param ob the target value @return a display version of the specified value
[ "Provides", "a", "display", "version", "of", "the", "specified", "value", "translated", "for", "the", "target", "locale", "." ]
648606dcb4bd382e3287a6c897a32e65d553dc47
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/attributes/DataTypeFactory.java#L362-L377
149,557
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/processor/BasicQueryInputProcessor.java
BasicQueryInputProcessor.removeBlocks
private String removeBlocks(String originalSql) { StringBuilder cleanedSql = new StringBuilder(originalSql.length()); Pattern regexPattern = null; Matcher regexMatcher = null; regexPattern = Pattern.compile(getRegexSkipBlockSearch(), Pattern.CASE_INSENSITIVE); regexMatcher = regexPattern.matcher(originalSql + "\n"); int prevBlockEnd = 0; int blockStart = 0; int blockEnd = 0; String block = null; while (regexMatcher.find() == true) { blockStart = regexMatcher.start(); blockEnd = Math.min(originalSql.length(), regexMatcher.end()); block = originalSql.substring(blockStart, blockEnd); cleanedSql.append(originalSql.substring(prevBlockEnd, blockStart)); prevBlockEnd = blockEnd; cleanedSql.append(fill(FILL_SYMBOL, block.length())); } cleanedSql.append(originalSql.substring(prevBlockEnd, originalSql.length())); return cleanedSql.toString(); }
java
private String removeBlocks(String originalSql) { StringBuilder cleanedSql = new StringBuilder(originalSql.length()); Pattern regexPattern = null; Matcher regexMatcher = null; regexPattern = Pattern.compile(getRegexSkipBlockSearch(), Pattern.CASE_INSENSITIVE); regexMatcher = regexPattern.matcher(originalSql + "\n"); int prevBlockEnd = 0; int blockStart = 0; int blockEnd = 0; String block = null; while (regexMatcher.find() == true) { blockStart = regexMatcher.start(); blockEnd = Math.min(originalSql.length(), regexMatcher.end()); block = originalSql.substring(blockStart, blockEnd); cleanedSql.append(originalSql.substring(prevBlockEnd, blockStart)); prevBlockEnd = blockEnd; cleanedSql.append(fill(FILL_SYMBOL, block.length())); } cleanedSql.append(originalSql.substring(prevBlockEnd, originalSql.length())); return cleanedSql.toString(); }
[ "private", "String", "removeBlocks", "(", "String", "originalSql", ")", "{", "StringBuilder", "cleanedSql", "=", "new", "StringBuilder", "(", "originalSql", ".", "length", "(", ")", ")", ";", "Pattern", "regexPattern", "=", "null", ";", "Matcher", "regexMatcher", "=", "null", ";", "regexPattern", "=", "Pattern", ".", "compile", "(", "getRegexSkipBlockSearch", "(", ")", ",", "Pattern", ".", "CASE_INSENSITIVE", ")", ";", "regexMatcher", "=", "regexPattern", ".", "matcher", "(", "originalSql", "+", "\"\\n\"", ")", ";", "int", "prevBlockEnd", "=", "0", ";", "int", "blockStart", "=", "0", ";", "int", "blockEnd", "=", "0", ";", "String", "block", "=", "null", ";", "while", "(", "regexMatcher", ".", "find", "(", ")", "==", "true", ")", "{", "blockStart", "=", "regexMatcher", ".", "start", "(", ")", ";", "blockEnd", "=", "Math", ".", "min", "(", "originalSql", ".", "length", "(", ")", ",", "regexMatcher", ".", "end", "(", ")", ")", ";", "block", "=", "originalSql", ".", "substring", "(", "blockStart", ",", "blockEnd", ")", ";", "cleanedSql", ".", "append", "(", "originalSql", ".", "substring", "(", "prevBlockEnd", ",", "blockStart", ")", ")", ";", "prevBlockEnd", "=", "blockEnd", ";", "cleanedSql", ".", "append", "(", "fill", "(", "FILL_SYMBOL", ",", "block", ".", "length", "(", ")", ")", ")", ";", "}", "cleanedSql", ".", "append", "(", "originalSql", ".", "substring", "(", "prevBlockEnd", ",", "originalSql", ".", "length", "(", ")", ")", ")", ";", "return", "cleanedSql", ".", "toString", "(", ")", ";", "}" ]
Removes blocks - such as comments and other possible blocks @param originalSql original SQL @return SQL string with removed(they will be filled with {@link #FILL_SYMBOL} blocks
[ "Removes", "blocks", "-", "such", "as", "comments", "and", "other", "possible", "blocks" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/processor/BasicQueryInputProcessor.java#L198-L228
149,558
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/processor/BasicQueryInputProcessor.java
BasicQueryInputProcessor.fill
private String fill(char symbol, int times) { char[] result = new char[times]; for (int i = 0; i < times; i++) { result[i] = symbol; } return new String(result); }
java
private String fill(char symbol, int times) { char[] result = new char[times]; for (int i = 0; i < times; i++) { result[i] = symbol; } return new String(result); }
[ "private", "String", "fill", "(", "char", "symbol", ",", "int", "times", ")", "{", "char", "[", "]", "result", "=", "new", "char", "[", "times", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "times", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "symbol", ";", "}", "return", "new", "String", "(", "result", ")", ";", "}" ]
Returns string of specified length filled with specified symbol @param symbol character with which String would be filled @param times amount of times character would be copied @return filled String
[ "Returns", "string", "of", "specified", "length", "filled", "with", "specified", "symbol" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/processor/BasicQueryInputProcessor.java#L237-L246
149,559
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/processor/BasicQueryInputProcessor.java
BasicQueryInputProcessor.putProcessedInputToCache
private void putProcessedInputToCache(ProcessedInput processedInput) { if (MjdbcConfig.isQueryInputProcessorUseCache() == true) { ProcessedInput clonedProcessedInput = new ProcessedInput(processedInput); synchronized (this.processedInputCache) { // no need to keep parameters in the memory. removing just in case clonedProcessedInput.setSqlParameterValues(null); this.processedInputCache.put(processedInput.getOriginalSql(), clonedProcessedInput); } } }
java
private void putProcessedInputToCache(ProcessedInput processedInput) { if (MjdbcConfig.isQueryInputProcessorUseCache() == true) { ProcessedInput clonedProcessedInput = new ProcessedInput(processedInput); synchronized (this.processedInputCache) { // no need to keep parameters in the memory. removing just in case clonedProcessedInput.setSqlParameterValues(null); this.processedInputCache.put(processedInput.getOriginalSql(), clonedProcessedInput); } } }
[ "private", "void", "putProcessedInputToCache", "(", "ProcessedInput", "processedInput", ")", "{", "if", "(", "MjdbcConfig", ".", "isQueryInputProcessorUseCache", "(", ")", "==", "true", ")", "{", "ProcessedInput", "clonedProcessedInput", "=", "new", "ProcessedInput", "(", "processedInput", ")", ";", "synchronized", "(", "this", ".", "processedInputCache", ")", "{", "// no need to keep parameters in the memory. removing just in case\r", "clonedProcessedInput", ".", "setSqlParameterValues", "(", "null", ")", ";", "this", ".", "processedInputCache", ".", "put", "(", "processedInput", ".", "getOriginalSql", "(", ")", ",", "clonedProcessedInput", ")", ";", "}", "}", "}" ]
Puts ProcessedInput instance into Cache. Original SQL would be served as key @param processedInput ProcessedInput instance which would be cached
[ "Puts", "ProcessedInput", "instance", "into", "Cache", ".", "Original", "SQL", "would", "be", "served", "as", "key" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/processor/BasicQueryInputProcessor.java#L274-L285
149,560
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java
TypeHandlerUtils.convertArray
public static Object convertArray(Connection conn, Object[] array) throws SQLException { Object result = null; result = createArrayOf(conn, convertJavaClassToSqlType(array.getClass().getComponentType().getSimpleName()), array); return result; }
java
public static Object convertArray(Connection conn, Object[] array) throws SQLException { Object result = null; result = createArrayOf(conn, convertJavaClassToSqlType(array.getClass().getComponentType().getSimpleName()), array); return result; }
[ "public", "static", "Object", "convertArray", "(", "Connection", "conn", ",", "Object", "[", "]", "array", ")", "throws", "SQLException", "{", "Object", "result", "=", "null", ";", "result", "=", "createArrayOf", "(", "conn", ",", "convertJavaClassToSqlType", "(", "array", ".", "getClass", "(", ")", ".", "getComponentType", "(", ")", ".", "getSimpleName", "(", ")", ")", ",", "array", ")", ";", "return", "result", ";", "}" ]
Converts array of Object into sql.Array @param conn connection for which sql.Array object would be created @param array array of objects @return sql.Array from array of Object @throws SQLException
[ "Converts", "array", "of", "Object", "into", "sql", ".", "Array" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L51-L57
149,561
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java
TypeHandlerUtils.convertArray
public static Object convertArray(Connection conn, Collection<?> array) throws SQLException { return convertArray(conn, array.toArray()); }
java
public static Object convertArray(Connection conn, Collection<?> array) throws SQLException { return convertArray(conn, array.toArray()); }
[ "public", "static", "Object", "convertArray", "(", "Connection", "conn", ",", "Collection", "<", "?", ">", "array", ")", "throws", "SQLException", "{", "return", "convertArray", "(", "conn", ",", "array", ".", "toArray", "(", ")", ")", ";", "}" ]
Converts Collection into sql.Array @param conn connection for which sql.Array object would be created @param array Collection @return sql.Array from Collection @throws SQLException
[ "Converts", "Collection", "into", "sql", ".", "Array" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L67-L69
149,562
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java
TypeHandlerUtils.convertClob
public static Object convertClob(Object clob, String value) throws SQLException { return convertClob(clob, value.getBytes()); }
java
public static Object convertClob(Object clob, String value) throws SQLException { return convertClob(clob, value.getBytes()); }
[ "public", "static", "Object", "convertClob", "(", "Object", "clob", ",", "String", "value", ")", "throws", "SQLException", "{", "return", "convertClob", "(", "clob", ",", "value", ".", "getBytes", "(", ")", ")", ";", "}" ]
Transfers data from String into sql.Clob @param clob sql.Clob which would be filled @param value String @return sql.Clob from String @throws SQLException
[ "Transfers", "data", "from", "String", "into", "sql", ".", "Clob" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L246-L248
149,563
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java
TypeHandlerUtils.convertJavaClassToSqlType
public static String convertJavaClassToSqlType(String simpleClassName) throws SQLException { if ("String".equals(simpleClassName) == true) { return "VARCHAR"; } throw new SQLException(String.format("Could not convert java class %s", simpleClassName)); }
java
public static String convertJavaClassToSqlType(String simpleClassName) throws SQLException { if ("String".equals(simpleClassName) == true) { return "VARCHAR"; } throw new SQLException(String.format("Could not convert java class %s", simpleClassName)); }
[ "public", "static", "String", "convertJavaClassToSqlType", "(", "String", "simpleClassName", ")", "throws", "SQLException", "{", "if", "(", "\"String\"", ".", "equals", "(", "simpleClassName", ")", "==", "true", ")", "{", "return", "\"VARCHAR\"", ";", "}", "throw", "new", "SQLException", "(", "String", ".", "format", "(", "\"Could not convert java class %s\"", ",", "simpleClassName", ")", ")", ";", "}" ]
Converts Java Class name into SQL Type name @param simpleClassName Java Class name @return SQL Type name @throws SQLException
[ "Converts", "Java", "Class", "name", "into", "SQL", "Type", "name" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L272-L278
149,564
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java
TypeHandlerUtils.toByteArray
public static byte[] toByteArray(InputStream input) throws SQLException { byte[] result = null; ByteArrayOutputStream output = new ByteArrayOutputStream(); try { copy(input, output); result = output.toByteArray(); } catch (IOException ex) { throw new MjdbcSQLException(ex); } TypeHandlerUtils.closeQuietly(output); return result; }
java
public static byte[] toByteArray(InputStream input) throws SQLException { byte[] result = null; ByteArrayOutputStream output = new ByteArrayOutputStream(); try { copy(input, output); result = output.toByteArray(); } catch (IOException ex) { throw new MjdbcSQLException(ex); } TypeHandlerUtils.closeQuietly(output); return result; }
[ "public", "static", "byte", "[", "]", "toByteArray", "(", "InputStream", "input", ")", "throws", "SQLException", "{", "byte", "[", "]", "result", "=", "null", ";", "ByteArrayOutputStream", "output", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "try", "{", "copy", "(", "input", ",", "output", ")", ";", "result", "=", "output", ".", "toByteArray", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "MjdbcSQLException", "(", "ex", ")", ";", "}", "TypeHandlerUtils", ".", "closeQuietly", "(", "output", ")", ";", "return", "result", ";", "}" ]
Transfers data from InputStream into byte array @param input InputStream @return array of bytes from InputStream @throws SQLException
[ "Transfers", "data", "from", "InputStream", "into", "byte", "array" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L508-L522
149,565
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java
TypeHandlerUtils.isJDBC3
public static boolean isJDBC3(Overrider overrider) { boolean result = false; if (overrider.hasOverride(MjdbcConstants.OVERRIDE_INT_JDBC3) == true) { result = (Boolean) overrider.getOverride(MjdbcConstants.OVERRIDE_INT_JDBC3); } return result; }
java
public static boolean isJDBC3(Overrider overrider) { boolean result = false; if (overrider.hasOverride(MjdbcConstants.OVERRIDE_INT_JDBC3) == true) { result = (Boolean) overrider.getOverride(MjdbcConstants.OVERRIDE_INT_JDBC3); } return result; }
[ "public", "static", "boolean", "isJDBC3", "(", "Overrider", "overrider", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "overrider", ".", "hasOverride", "(", "MjdbcConstants", ".", "OVERRIDE_INT_JDBC3", ")", "==", "true", ")", "{", "result", "=", "(", "Boolean", ")", "overrider", ".", "getOverride", "(", "MjdbcConstants", ".", "OVERRIDE_INT_JDBC3", ")", ";", "}", "return", "result", ";", "}" ]
Returns if JDBC3 driver is used. Actual check is done during QueryRunner instance initialization. @return true if JDBC3 Driver is used
[ "Returns", "if", "JDBC3", "driver", "is", "used", ".", "Actual", "check", "is", "done", "during", "QueryRunner", "instance", "initialization", "." ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L689-L697
149,566
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java
TypeHandlerUtils.copy
private static long copy(Reader input, StringBuilder output, char[] buffer) throws IOException { long bytesTransferred = 0; int bytesRead = 0; while (EOF != (bytesRead = input.read(buffer))) { output.append(buffer, 0, bytesRead); bytesTransferred += bytesRead; } return bytesTransferred; }
java
private static long copy(Reader input, StringBuilder output, char[] buffer) throws IOException { long bytesTransferred = 0; int bytesRead = 0; while (EOF != (bytesRead = input.read(buffer))) { output.append(buffer, 0, bytesRead); bytesTransferred += bytesRead; } return bytesTransferred; }
[ "private", "static", "long", "copy", "(", "Reader", "input", ",", "StringBuilder", "output", ",", "char", "[", "]", "buffer", ")", "throws", "IOException", "{", "long", "bytesTransferred", "=", "0", ";", "int", "bytesRead", "=", "0", ";", "while", "(", "EOF", "!=", "(", "bytesRead", "=", "input", ".", "read", "(", "buffer", ")", ")", ")", "{", "output", ".", "append", "(", "buffer", ",", "0", ",", "bytesRead", ")", ";", "bytesTransferred", "+=", "bytesRead", ";", "}", "return", "bytesTransferred", ";", "}" ]
Transfers data from Reader into StringBuilder @param input Reader which would be read @param output StringBuilder which would be filled @param buffer buffer which is used for read/write operations @return amount of bytes transferred @throws IOException
[ "Transfers", "data", "from", "Reader", "into", "StringBuilder" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L728-L737
149,567
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/component/oauth2/OAuth2StoreBuilder.java
OAuth2StoreBuilder.addAdditionalParameter
public OAuth2StoreBuilder addAdditionalParameter(String key, String value) { oAuth2Store.getAdditionalParameters().put(key, value); return this; }
java
public OAuth2StoreBuilder addAdditionalParameter(String key, String value) { oAuth2Store.getAdditionalParameters().put(key, value); return this; }
[ "public", "OAuth2StoreBuilder", "addAdditionalParameter", "(", "String", "key", ",", "String", "value", ")", "{", "oAuth2Store", ".", "getAdditionalParameters", "(", ")", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Add an additional parameter which will be included in the token request @param key additional parameter key @param value additional parameter value @return OAuth2StoreBuilder (this)
[ "Add", "an", "additional", "parameter", "which", "will", "be", "included", "in", "the", "token", "request" ]
d3f7d0df65e2e75861fc7db938090683f2cdf919
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/component/oauth2/OAuth2StoreBuilder.java#L92-L95
149,568
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/spring/processor/SpringQueryInputProcessor.java
SpringQueryInputProcessor.getProcessedInputsFromCache
private ProcessedInput getProcessedInputsFromCache(String originalSql) { ProcessedInput processedInput = null; synchronized (this.processedInputCache) { processedInput = this.processedInputCache.get(originalSql); if (processedInput == null || MjdbcConfig.isQueryInputProcessorUseCache() == false) { processedInput = new ProcessedInput(originalSql); } else { processedInput = new ProcessedInput(processedInput); } return processedInput; } }
java
private ProcessedInput getProcessedInputsFromCache(String originalSql) { ProcessedInput processedInput = null; synchronized (this.processedInputCache) { processedInput = this.processedInputCache.get(originalSql); if (processedInput == null || MjdbcConfig.isQueryInputProcessorUseCache() == false) { processedInput = new ProcessedInput(originalSql); } else { processedInput = new ProcessedInput(processedInput); } return processedInput; } }
[ "private", "ProcessedInput", "getProcessedInputsFromCache", "(", "String", "originalSql", ")", "{", "ProcessedInput", "processedInput", "=", "null", ";", "synchronized", "(", "this", ".", "processedInputCache", ")", "{", "processedInput", "=", "this", ".", "processedInputCache", ".", "get", "(", "originalSql", ")", ";", "if", "(", "processedInput", "==", "null", "||", "MjdbcConfig", ".", "isQueryInputProcessorUseCache", "(", ")", "==", "false", ")", "{", "processedInput", "=", "new", "ProcessedInput", "(", "originalSql", ")", ";", "}", "else", "{", "processedInput", "=", "new", "ProcessedInput", "(", "processedInput", ")", ";", "}", "return", "processedInput", ";", "}", "}" ]
Searches cache by original SQL as key and returned cached ProcessedInput instance @param originalSql original SQL string @return cached ProcessedInput, null otherwise
[ "Searches", "cache", "by", "original", "SQL", "as", "key", "and", "returned", "cached", "ProcessedInput", "instance" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/spring/processor/SpringQueryInputProcessor.java#L334-L346
149,569
uniform-java/uniform
src/main/java/net/uniform/html/elements/Checkbox.java
Checkbox.setChecked
public Checkbox setChecked(boolean checked) { if (checked) { String valueEnabledString = this.getEnabledValueString(); this.setValue(valueEnabledString); } else { this.setValue(""); } return this; }
java
public Checkbox setChecked(boolean checked) { if (checked) { String valueEnabledString = this.getEnabledValueString(); this.setValue(valueEnabledString); } else { this.setValue(""); } return this; }
[ "public", "Checkbox", "setChecked", "(", "boolean", "checked", ")", "{", "if", "(", "checked", ")", "{", "String", "valueEnabledString", "=", "this", ".", "getEnabledValueString", "(", ")", ";", "this", ".", "setValue", "(", "valueEnabledString", ")", ";", "}", "else", "{", "this", ".", "setValue", "(", "\"\"", ")", ";", "}", "return", "this", ";", "}" ]
Checks or unchecks this checkbox element. @param checked True for checked, false for not checked @return This element
[ "Checks", "or", "unchecks", "this", "checkbox", "element", "." ]
0b84f0db562253165bc06c69f631e464dca0cb48
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/html/elements/Checkbox.java#L55-L64
149,570
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/tools/ResponseBuilder.java
ResponseBuilder.getResponse
public <T extends AbstractJsonMapping> T getResponse(Class<T> clazz, Map<String, String> properties) throws RottenTomatoesException { String url = ApiBuilder.create(properties); try { T wrapper = clazz.cast(MAPPER.readValue(getContent(url), clazz)); int retry = 1; while (!wrapper.isValid() && "Account Over Queries Per Second Limit".equalsIgnoreCase(wrapper.getError()) && retry <= retryLimit) { LOG.trace("Account over queries limit, waiting for {}ms.", retryDelay * retry); sleeper(retry++); wrapper = MAPPER.readValue(getContent(url), clazz); } if (wrapper.isValid()) { return wrapper; } else { throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, wrapper.getError(), url); } } catch (IOException ex) { throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, "Failed to map response", url, ex); } }
java
public <T extends AbstractJsonMapping> T getResponse(Class<T> clazz, Map<String, String> properties) throws RottenTomatoesException { String url = ApiBuilder.create(properties); try { T wrapper = clazz.cast(MAPPER.readValue(getContent(url), clazz)); int retry = 1; while (!wrapper.isValid() && "Account Over Queries Per Second Limit".equalsIgnoreCase(wrapper.getError()) && retry <= retryLimit) { LOG.trace("Account over queries limit, waiting for {}ms.", retryDelay * retry); sleeper(retry++); wrapper = MAPPER.readValue(getContent(url), clazz); } if (wrapper.isValid()) { return wrapper; } else { throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, wrapper.getError(), url); } } catch (IOException ex) { throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, "Failed to map response", url, ex); } }
[ "public", "<", "T", "extends", "AbstractJsonMapping", ">", "T", "getResponse", "(", "Class", "<", "T", ">", "clazz", ",", "Map", "<", "String", ",", "String", ">", "properties", ")", "throws", "RottenTomatoesException", "{", "String", "url", "=", "ApiBuilder", ".", "create", "(", "properties", ")", ";", "try", "{", "T", "wrapper", "=", "clazz", ".", "cast", "(", "MAPPER", ".", "readValue", "(", "getContent", "(", "url", ")", ",", "clazz", ")", ")", ";", "int", "retry", "=", "1", ";", "while", "(", "!", "wrapper", ".", "isValid", "(", ")", "&&", "\"Account Over Queries Per Second Limit\"", ".", "equalsIgnoreCase", "(", "wrapper", ".", "getError", "(", ")", ")", "&&", "retry", "<=", "retryLimit", ")", "{", "LOG", ".", "trace", "(", "\"Account over queries limit, waiting for {}ms.\"", ",", "retryDelay", "*", "retry", ")", ";", "sleeper", "(", "retry", "++", ")", ";", "wrapper", "=", "MAPPER", ".", "readValue", "(", "getContent", "(", "url", ")", ",", "clazz", ")", ";", "}", "if", "(", "wrapper", ".", "isValid", "(", ")", ")", "{", "return", "wrapper", ";", "}", "else", "{", "throw", "new", "RottenTomatoesException", "(", "ApiExceptionType", ".", "MAPPING_FAILED", ",", "wrapper", ".", "getError", "(", ")", ",", "url", ")", ";", "}", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "RottenTomatoesException", "(", "ApiExceptionType", ".", "MAPPING_FAILED", ",", "\"Failed to map response\"", ",", "url", ",", "ex", ")", ";", "}", "}" ]
Get the wrapper for the passed properties Will retry up to retry limit @param <T> @param clazz @param properties @return @throws RottenTomatoesException
[ "Get", "the", "wrapper", "for", "the", "passed", "properties" ]
abaf1833acafc6ada593d52b14ff1bacb4e441ee
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/tools/ResponseBuilder.java#L107-L127
149,571
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/tools/ResponseBuilder.java
ResponseBuilder.getContent
private String getContent(String url) throws RottenTomatoesException { LOG.trace("Requesting: {}", url); try { final HttpGet httpGet = new HttpGet(url); httpGet.addHeader("accept", "application/json"); final DigestedResponse response = DigestedResponseReader.requestContent(httpClient, httpGet, charset); if (response.getStatusCode() >= HTTP_STATUS_500) { throw new RottenTomatoesException(ApiExceptionType.HTTP_503_ERROR, response.getContent(), response.getStatusCode(), url); } else if (response.getStatusCode() >= HTTP_STATUS_300) { throw new RottenTomatoesException(ApiExceptionType.HTTP_404_ERROR, response.getContent(), response.getStatusCode(), url); } return response.getContent(); } catch (IOException ex) { throw new RottenTomatoesException(ApiExceptionType.CONNECTION_ERROR, "Error retrieving URL", url, ex); } }
java
private String getContent(String url) throws RottenTomatoesException { LOG.trace("Requesting: {}", url); try { final HttpGet httpGet = new HttpGet(url); httpGet.addHeader("accept", "application/json"); final DigestedResponse response = DigestedResponseReader.requestContent(httpClient, httpGet, charset); if (response.getStatusCode() >= HTTP_STATUS_500) { throw new RottenTomatoesException(ApiExceptionType.HTTP_503_ERROR, response.getContent(), response.getStatusCode(), url); } else if (response.getStatusCode() >= HTTP_STATUS_300) { throw new RottenTomatoesException(ApiExceptionType.HTTP_404_ERROR, response.getContent(), response.getStatusCode(), url); } return response.getContent(); } catch (IOException ex) { throw new RottenTomatoesException(ApiExceptionType.CONNECTION_ERROR, "Error retrieving URL", url, ex); } }
[ "private", "String", "getContent", "(", "String", "url", ")", "throws", "RottenTomatoesException", "{", "LOG", ".", "trace", "(", "\"Requesting: {}\"", ",", "url", ")", ";", "try", "{", "final", "HttpGet", "httpGet", "=", "new", "HttpGet", "(", "url", ")", ";", "httpGet", ".", "addHeader", "(", "\"accept\"", ",", "\"application/json\"", ")", ";", "final", "DigestedResponse", "response", "=", "DigestedResponseReader", ".", "requestContent", "(", "httpClient", ",", "httpGet", ",", "charset", ")", ";", "if", "(", "response", ".", "getStatusCode", "(", ")", ">=", "HTTP_STATUS_500", ")", "{", "throw", "new", "RottenTomatoesException", "(", "ApiExceptionType", ".", "HTTP_503_ERROR", ",", "response", ".", "getContent", "(", ")", ",", "response", ".", "getStatusCode", "(", ")", ",", "url", ")", ";", "}", "else", "if", "(", "response", ".", "getStatusCode", "(", ")", ">=", "HTTP_STATUS_300", ")", "{", "throw", "new", "RottenTomatoesException", "(", "ApiExceptionType", ".", "HTTP_404_ERROR", ",", "response", ".", "getContent", "(", ")", ",", "response", ".", "getStatusCode", "(", ")", ",", "url", ")", ";", "}", "return", "response", ".", "getContent", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "RottenTomatoesException", "(", "ApiExceptionType", ".", "CONNECTION_ERROR", ",", "\"Error retrieving URL\"", ",", "url", ",", "ex", ")", ";", "}", "}" ]
Get the content from a string, decoding it if it is in GZIP format @param urlString @return @throws RottenTomatoesException
[ "Get", "the", "content", "from", "a", "string", "decoding", "it", "if", "it", "is", "in", "GZIP", "format" ]
abaf1833acafc6ada593d52b14ff1bacb4e441ee
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/tools/ResponseBuilder.java#L136-L153
149,572
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/tools/ResponseBuilder.java
ResponseBuilder.sleeper
private void sleeper(int count) { try { Thread.sleep(retryDelay * (long) count); } catch (InterruptedException ex) { LOG.trace("Sleep interrupted", ex); } }
java
private void sleeper(int count) { try { Thread.sleep(retryDelay * (long) count); } catch (InterruptedException ex) { LOG.trace("Sleep interrupted", ex); } }
[ "private", "void", "sleeper", "(", "int", "count", ")", "{", "try", "{", "Thread", ".", "sleep", "(", "retryDelay", "*", "(", "long", ")", "count", ")", ";", "}", "catch", "(", "InterruptedException", "ex", ")", "{", "LOG", ".", "trace", "(", "\"Sleep interrupted\"", ",", "ex", ")", ";", "}", "}" ]
Sleep for a short period @param count
[ "Sleep", "for", "a", "short", "period" ]
abaf1833acafc6ada593d52b14ff1bacb4e441ee
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/tools/ResponseBuilder.java#L160-L166
149,573
kikinteractive/ice
ice/src/main/java/com/kik/config/ice/internal/OverrideModule.java
OverrideModule.override
public <T> DefaultOverride<T> override(final T proxiedMethodCall) { final MethodIdProxyFactory.MethodAndScope lastProxyMethodAndScope = MethodIdProxyFactory.getLastIdentifiedMethodAndScope(); if (lastProxyMethodAndScope == null) { throw new ConfigException("Failed to identify config method previous to calling overrideDefault"); } if (!lastProxyMethodAndScope.getScopeOpt().equals(scopeNameOpt)) { throw new ConfigException("Identified config method is not using proxy for the same scope name. Scope expected: {}, from last proxy call: {}", scopeNameOpt, lastProxyMethodAndScope.getScopeOpt()); } final ConfigDescriptor desc = ConfigSystem.descriptorFactory.buildDescriptor(lastProxyMethodAndScope.getMethod(), scopeNameOpt); final PropertyIdentifier propertyId = ConfigSystem.getIdentifier(desc); return value -> { // Override Binding of ConstantValuePropertyAccessor ConstantValuePropertyAccessor cvProp = ConstantValuePropertyAccessor.fromRawValue(value); OverrideModule.this.bind(ConstantValuePropertyAccessor.class).annotatedWith(propertyId).toInstance(cvProp); log.trace("Bound default override on method {}.{} scope {} to {}", lastProxyMethodAndScope.getMethod().getDeclaringClass().getName(), lastProxyMethodAndScope.getMethod().getName(), scopeNameOpt, value.toString()); }; }
java
public <T> DefaultOverride<T> override(final T proxiedMethodCall) { final MethodIdProxyFactory.MethodAndScope lastProxyMethodAndScope = MethodIdProxyFactory.getLastIdentifiedMethodAndScope(); if (lastProxyMethodAndScope == null) { throw new ConfigException("Failed to identify config method previous to calling overrideDefault"); } if (!lastProxyMethodAndScope.getScopeOpt().equals(scopeNameOpt)) { throw new ConfigException("Identified config method is not using proxy for the same scope name. Scope expected: {}, from last proxy call: {}", scopeNameOpt, lastProxyMethodAndScope.getScopeOpt()); } final ConfigDescriptor desc = ConfigSystem.descriptorFactory.buildDescriptor(lastProxyMethodAndScope.getMethod(), scopeNameOpt); final PropertyIdentifier propertyId = ConfigSystem.getIdentifier(desc); return value -> { // Override Binding of ConstantValuePropertyAccessor ConstantValuePropertyAccessor cvProp = ConstantValuePropertyAccessor.fromRawValue(value); OverrideModule.this.bind(ConstantValuePropertyAccessor.class).annotatedWith(propertyId).toInstance(cvProp); log.trace("Bound default override on method {}.{} scope {} to {}", lastProxyMethodAndScope.getMethod().getDeclaringClass().getName(), lastProxyMethodAndScope.getMethod().getName(), scopeNameOpt, value.toString()); }; }
[ "public", "<", "T", ">", "DefaultOverride", "<", "T", ">", "override", "(", "final", "T", "proxiedMethodCall", ")", "{", "final", "MethodIdProxyFactory", ".", "MethodAndScope", "lastProxyMethodAndScope", "=", "MethodIdProxyFactory", ".", "getLastIdentifiedMethodAndScope", "(", ")", ";", "if", "(", "lastProxyMethodAndScope", "==", "null", ")", "{", "throw", "new", "ConfigException", "(", "\"Failed to identify config method previous to calling overrideDefault\"", ")", ";", "}", "if", "(", "!", "lastProxyMethodAndScope", ".", "getScopeOpt", "(", ")", ".", "equals", "(", "scopeNameOpt", ")", ")", "{", "throw", "new", "ConfigException", "(", "\"Identified config method is not using proxy for the same scope name. Scope expected: {}, from last proxy call: {}\"", ",", "scopeNameOpt", ",", "lastProxyMethodAndScope", ".", "getScopeOpt", "(", ")", ")", ";", "}", "final", "ConfigDescriptor", "desc", "=", "ConfigSystem", ".", "descriptorFactory", ".", "buildDescriptor", "(", "lastProxyMethodAndScope", ".", "getMethod", "(", ")", ",", "scopeNameOpt", ")", ";", "final", "PropertyIdentifier", "propertyId", "=", "ConfigSystem", ".", "getIdentifier", "(", "desc", ")", ";", "return", "value", "->", "{", "// Override Binding of ConstantValuePropertyAccessor", "ConstantValuePropertyAccessor", "cvProp", "=", "ConstantValuePropertyAccessor", ".", "fromRawValue", "(", "value", ")", ";", "OverrideModule", ".", "this", ".", "bind", "(", "ConstantValuePropertyAccessor", ".", "class", ")", ".", "annotatedWith", "(", "propertyId", ")", ".", "toInstance", "(", "cvProp", ")", ";", "log", ".", "trace", "(", "\"Bound default override on method {}.{} scope {} to {}\"", ",", "lastProxyMethodAndScope", ".", "getMethod", "(", ")", ".", "getDeclaringClass", "(", ")", ".", "getName", "(", ")", ",", "lastProxyMethodAndScope", ".", "getMethod", "(", ")", ".", "getName", "(", ")", ",", "scopeNameOpt", ",", "value", ".", "toString", "(", ")", ")", ";", "}", ";", "}" ]
Setup an override binding builder for a configuration interface. @param <T> The type returned by the method being overridden. @param proxiedMethodCall technically the null or default value returned by the proxy used to identify the method call made. this parameter value is ignored. @return an anonymous implementation of {@link DefaultOverride} which will create the Guice bind when its appropriate method is called.
[ "Setup", "an", "override", "binding", "builder", "for", "a", "configuration", "interface", "." ]
0c58d7bf2d9f6504892d0768d6022fcfa6df7514
https://github.com/kikinteractive/ice/blob/0c58d7bf2d9f6504892d0768d6022fcfa6df7514/ice/src/main/java/com/kik/config/ice/internal/OverrideModule.java#L84-L109
149,574
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/placeholder/DefaultPlaceholderStrategy.java
DefaultPlaceholderStrategy.addPlaceholder
@Override public void addPlaceholder(String placeholder, String value) { placeholderMap.put(placeholder, value); }
java
@Override public void addPlaceholder(String placeholder, String value) { placeholderMap.put(placeholder, value); }
[ "@", "Override", "public", "void", "addPlaceholder", "(", "String", "placeholder", ",", "String", "value", ")", "{", "placeholderMap", ".", "put", "(", "placeholder", ",", "value", ")", ";", "}" ]
Add a placeholder to the strategy @param placeholder name of the placholder @param value value of the placeholder
[ "Add", "a", "placeholder", "to", "the", "strategy" ]
d3f7d0df65e2e75861fc7db938090683f2cdf919
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/placeholder/DefaultPlaceholderStrategy.java#L46-L49
149,575
javagl/Common
src/main/java/de/javagl/common/collections/Maps.java
Maps.incrementCount
public static <K> void incrementCount(Map<K, Integer> map, K k) { map.put(k, getCount(map, k)+1); }
java
public static <K> void incrementCount(Map<K, Integer> map, K k) { map.put(k, getCount(map, k)+1); }
[ "public", "static", "<", "K", ">", "void", "incrementCount", "(", "Map", "<", "K", ",", "Integer", ">", "map", ",", "K", "k", ")", "{", "map", ".", "put", "(", "k", ",", "getCount", "(", "map", ",", "k", ")", "+", "1", ")", ";", "}" ]
Increments the value that is stored for the given key in the given map by one, or sets it to 1 if there was no value stored for the given key. @param <K> The key type @param map The map @param k The key
[ "Increments", "the", "value", "that", "is", "stored", "for", "the", "given", "key", "in", "the", "given", "map", "by", "one", "or", "sets", "it", "to", "1", "if", "there", "was", "no", "value", "stored", "for", "the", "given", "key", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/collections/Maps.java#L52-L55
149,576
javagl/Common
src/main/java/de/javagl/common/collections/Maps.java
Maps.getCount
public static <K> Integer getCount(Map<K, Integer> map, K k) { Integer count = map.get(k); if (count == null) { count = 0; map.put(k, count); } return count; }
java
public static <K> Integer getCount(Map<K, Integer> map, K k) { Integer count = map.get(k); if (count == null) { count = 0; map.put(k, count); } return count; }
[ "public", "static", "<", "K", ">", "Integer", "getCount", "(", "Map", "<", "K", ",", "Integer", ">", "map", ",", "K", "k", ")", "{", "Integer", "count", "=", "map", ".", "get", "(", "k", ")", ";", "if", "(", "count", "==", "null", ")", "{", "count", "=", "0", ";", "map", ".", "put", "(", "k", ",", "count", ")", ";", "}", "return", "count", ";", "}" ]
Returns the value that is stored for the given key in the given map. If there is no value stored, then 0 will be inserted into the map and returned @param <K> The key type @param map The map @param k The key @return The value
[ "Returns", "the", "value", "that", "is", "stored", "for", "the", "given", "key", "in", "the", "given", "map", ".", "If", "there", "is", "no", "value", "stored", "then", "0", "will", "be", "inserted", "into", "the", "map", "and", "returned" ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/collections/Maps.java#L67-L76
149,577
javagl/Common
src/main/java/de/javagl/common/collections/Maps.java
Maps.getList
static <K, E> List<E> getList(Map<K, List<E>> map, K k) { List<E> list = map.get(k); if (list == null) { list = new ArrayList<E>(); map.put(k, list); } return list; }
java
static <K, E> List<E> getList(Map<K, List<E>> map, K k) { List<E> list = map.get(k); if (list == null) { list = new ArrayList<E>(); map.put(k, list); } return list; }
[ "static", "<", "K", ",", "E", ">", "List", "<", "E", ">", "getList", "(", "Map", "<", "K", ",", "List", "<", "E", ">", ">", "map", ",", "K", "k", ")", "{", "List", "<", "E", ">", "list", "=", "map", ".", "get", "(", "k", ")", ";", "if", "(", "list", "==", "null", ")", "{", "list", "=", "new", "ArrayList", "<", "E", ">", "(", ")", ";", "map", ".", "put", "(", "k", ",", "list", ")", ";", "}", "return", "list", ";", "}" ]
Returns the list that is stored under the given key in the given map. If there is no list stored, then a new list will be created, inserted and returned @param <K> The key type @param <E> The element type @param map The map @param k The key @return The list
[ "Returns", "the", "list", "that", "is", "stored", "under", "the", "given", "key", "in", "the", "given", "map", ".", "If", "there", "is", "no", "list", "stored", "then", "a", "new", "list", "will", "be", "created", "inserted", "and", "returned" ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/collections/Maps.java#L89-L98
149,578
javagl/Common
src/main/java/de/javagl/common/collections/Maps.java
Maps.addToList
public static <K, E> void addToList(Map<K, List<E>> map, K k, E e) { getList(map, k).add(e); }
java
public static <K, E> void addToList(Map<K, List<E>> map, K k, E e) { getList(map, k).add(e); }
[ "public", "static", "<", "K", ",", "E", ">", "void", "addToList", "(", "Map", "<", "K", ",", "List", "<", "E", ">", ">", "map", ",", "K", "k", ",", "E", "e", ")", "{", "getList", "(", "map", ",", "k", ")", ".", "add", "(", "e", ")", ";", "}" ]
Adds the given element to the list that is stored under the given key. If the list does not yet exist, it is created and inserted into the map. @param <K> The key type @param <E> The element type @param map The map @param k The key @param e The element
[ "Adds", "the", "given", "element", "to", "the", "list", "that", "is", "stored", "under", "the", "given", "key", ".", "If", "the", "list", "does", "not", "yet", "exist", "it", "is", "created", "and", "inserted", "into", "the", "map", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/collections/Maps.java#L112-L115
149,579
javagl/Common
src/main/java/de/javagl/common/collections/Maps.java
Maps.removeFromList
static <K, E> void removeFromList(Map<K, List<E>> map, K k, E e) { List<E> list = map.get(k); if (list != null) { list.remove(e); if (list.isEmpty()) { map.remove(k); } } }
java
static <K, E> void removeFromList(Map<K, List<E>> map, K k, E e) { List<E> list = map.get(k); if (list != null) { list.remove(e); if (list.isEmpty()) { map.remove(k); } } }
[ "static", "<", "K", ",", "E", ">", "void", "removeFromList", "(", "Map", "<", "K", ",", "List", "<", "E", ">", ">", "map", ",", "K", "k", ",", "E", "e", ")", "{", "List", "<", "E", ">", "list", "=", "map", ".", "get", "(", "k", ")", ";", "if", "(", "list", "!=", "null", ")", "{", "list", ".", "remove", "(", "e", ")", ";", "if", "(", "list", ".", "isEmpty", "(", ")", ")", "{", "map", ".", "remove", "(", "k", ")", ";", "}", "}", "}" ]
Removes the given element from the list that is stored under the given key. If the list becomes empty, it is removed from the map. @param <K> The key type @param <E> The element type @param map The map @param k The key @param e The element
[ "Removes", "the", "given", "element", "from", "the", "list", "that", "is", "stored", "under", "the", "given", "key", ".", "If", "the", "list", "becomes", "empty", "it", "is", "removed", "from", "the", "map", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/collections/Maps.java#L129-L140
149,580
javagl/Common
src/main/java/de/javagl/common/collections/Maps.java
Maps.fillValues
public static <K, V> void fillValues(Map<K, V> map, Iterable<? extends V> values) { Iterator<? extends V> iterator = values.iterator(); for (K k : map.keySet()) { if (!iterator.hasNext()) { break; } V value = iterator.next(); map.put(k, value); } }
java
public static <K, V> void fillValues(Map<K, V> map, Iterable<? extends V> values) { Iterator<? extends V> iterator = values.iterator(); for (K k : map.keySet()) { if (!iterator.hasNext()) { break; } V value = iterator.next(); map.put(k, value); } }
[ "public", "static", "<", "K", ",", "V", ">", "void", "fillValues", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "Iterable", "<", "?", "extends", "V", ">", "values", ")", "{", "Iterator", "<", "?", "extends", "V", ">", "iterator", "=", "values", ".", "iterator", "(", ")", ";", "for", "(", "K", "k", ":", "map", ".", "keySet", "(", ")", ")", "{", "if", "(", "!", "iterator", ".", "hasNext", "(", ")", ")", "{", "break", ";", "}", "V", "value", "=", "iterator", ".", "next", "(", ")", ";", "map", ".", "put", "(", "k", ",", "value", ")", ";", "}", "}" ]
Fill the given map sequentially with the values from the given sequence. This method will iterate over all keys of the given map, and put the corresponding value element into the map. If the map is larger than the sequence, then the remaining entries will remain unaffected. @param <K> The key type @param <V> The value type @param map The map to fill @param values The values
[ "Fill", "the", "given", "map", "sequentially", "with", "the", "values", "from", "the", "given", "sequence", ".", "This", "method", "will", "iterate", "over", "all", "keys", "of", "the", "given", "map", "and", "put", "the", "corresponding", "value", "element", "into", "the", "map", ".", "If", "the", "map", "is", "larger", "than", "the", "sequence", "then", "the", "remaining", "entries", "will", "remain", "unaffected", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/collections/Maps.java#L154-L167
149,581
javagl/Common
src/main/java/de/javagl/common/collections/Maps.java
Maps.fromElements
@SafeVarargs public static <T> Map<Integer, T> fromElements(T ... elements) { return fromIterable(Arrays.asList(elements)); }
java
@SafeVarargs public static <T> Map<Integer, T> fromElements(T ... elements) { return fromIterable(Arrays.asList(elements)); }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "Map", "<", "Integer", ",", "T", ">", "fromElements", "(", "T", "...", "elements", ")", "{", "return", "fromIterable", "(", "Arrays", ".", "asList", "(", "elements", ")", ")", ";", "}" ]
Creates a map that maps consecutive integer values to the corresponding elements in the given array. @param <T> The value type @param elements The elements @return The map
[ "Creates", "a", "map", "that", "maps", "consecutive", "integer", "values", "to", "the", "corresponding", "elements", "in", "the", "given", "array", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/collections/Maps.java#L199-L203
149,582
javagl/Common
src/main/java/de/javagl/common/collections/Maps.java
Maps.fromIterable
public static <T> Map<Integer, T> fromIterable( Iterable<? extends T> iterable) { Map<Integer, T> map = new LinkedHashMap<Integer, T>(); int i = 0; for (T t : iterable) { map.put(i, t); i++; } return map; }
java
public static <T> Map<Integer, T> fromIterable( Iterable<? extends T> iterable) { Map<Integer, T> map = new LinkedHashMap<Integer, T>(); int i = 0; for (T t : iterable) { map.put(i, t); i++; } return map; }
[ "public", "static", "<", "T", ">", "Map", "<", "Integer", ",", "T", ">", "fromIterable", "(", "Iterable", "<", "?", "extends", "T", ">", "iterable", ")", "{", "Map", "<", "Integer", ",", "T", ">", "map", "=", "new", "LinkedHashMap", "<", "Integer", ",", "T", ">", "(", ")", ";", "int", "i", "=", "0", ";", "for", "(", "T", "t", ":", "iterable", ")", "{", "map", ".", "put", "(", "i", ",", "t", ")", ";", "i", "++", ";", "}", "return", "map", ";", "}" ]
Creates a map that maps consecutive integer values to the elements in the given sequence, in the order in which they appear. @param <T> The value type @param iterable The sequence @return The map
[ "Creates", "a", "map", "that", "maps", "consecutive", "integer", "values", "to", "the", "elements", "in", "the", "given", "sequence", "in", "the", "order", "in", "which", "they", "appear", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/collections/Maps.java#L214-L225
149,583
javagl/Common
src/main/java/de/javagl/common/collections/Maps.java
Maps.fromIterables
public static <K, V> Map<K, V> fromIterables( Iterable<? extends K> iterable0, Iterable<? extends V> iterable1) { Map<K, V> map = new LinkedHashMap<K, V>(); Iterator<? extends K> i0 = iterable0.iterator(); Iterator<? extends V> i1 = iterable1.iterator(); while (i0.hasNext() && i1.hasNext()) { K k = i0.next(); V v = i1.next(); map.put(k, v); } return map; }
java
public static <K, V> Map<K, V> fromIterables( Iterable<? extends K> iterable0, Iterable<? extends V> iterable1) { Map<K, V> map = new LinkedHashMap<K, V>(); Iterator<? extends K> i0 = iterable0.iterator(); Iterator<? extends V> i1 = iterable1.iterator(); while (i0.hasNext() && i1.hasNext()) { K k = i0.next(); V v = i1.next(); map.put(k, v); } return map; }
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "fromIterables", "(", "Iterable", "<", "?", "extends", "K", ">", "iterable0", ",", "Iterable", "<", "?", "extends", "V", ">", "iterable1", ")", "{", "Map", "<", "K", ",", "V", ">", "map", "=", "new", "LinkedHashMap", "<", "K", ",", "V", ">", "(", ")", ";", "Iterator", "<", "?", "extends", "K", ">", "i0", "=", "iterable0", ".", "iterator", "(", ")", ";", "Iterator", "<", "?", "extends", "V", ">", "i1", "=", "iterable1", ".", "iterator", "(", ")", ";", "while", "(", "i0", ".", "hasNext", "(", ")", "&&", "i1", ".", "hasNext", "(", ")", ")", "{", "K", "k", "=", "i0", ".", "next", "(", ")", ";", "V", "v", "=", "i1", ".", "next", "(", ")", ";", "map", ".", "put", "(", "k", ",", "v", ")", ";", "}", "return", "map", ";", "}" ]
Creates a map that maps the elements of the first sequence to the corresponding elements in the second sequence. If the given sequences have different lengths, then only the elements of the shorter sequence will be contained in the map. @param <K> The key type @param <V> The value type @param iterable0 The first sequence @param iterable1 The second sequence @return The map
[ "Creates", "a", "map", "that", "maps", "the", "elements", "of", "the", "first", "sequence", "to", "the", "corresponding", "elements", "in", "the", "second", "sequence", ".", "If", "the", "given", "sequences", "have", "different", "lengths", "then", "only", "the", "elements", "of", "the", "shorter", "sequence", "will", "be", "contained", "in", "the", "map", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/collections/Maps.java#L239-L253
149,584
javagl/Common
src/main/java/de/javagl/common/collections/Maps.java
Maps.unmodifiableCopy
public static <K, V> Map<K, V> unmodifiableCopy( Map<? extends K, ? extends V> map) { return Collections.<K, V>unmodifiableMap( new LinkedHashMap<K, V>(map)); }
java
public static <K, V> Map<K, V> unmodifiableCopy( Map<? extends K, ? extends V> map) { return Collections.<K, V>unmodifiableMap( new LinkedHashMap<K, V>(map)); }
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "unmodifiableCopy", "(", "Map", "<", "?", "extends", "K", ",", "?", "extends", "V", ">", "map", ")", "{", "return", "Collections", ".", "<", "K", ",", "V", ">", "unmodifiableMap", "(", "new", "LinkedHashMap", "<", "K", ",", "V", ">", "(", "map", ")", ")", ";", "}" ]
Creates an unmodifiable copy of the given map @param <K> The key type @param <V> The value type @param map The input map @return The resulting map
[ "Creates", "an", "unmodifiable", "copy", "of", "the", "given", "map" ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/collections/Maps.java#L263-L268
149,585
matthewhorridge/binaryowl
src/main/java/org/semanticweb/binaryowl/BinaryOWLOntologyDocumentPreamble.java
BinaryOWLOntologyDocumentPreamble.write
public void write(DataOutputStream dos) throws IOException { dos.writeInt(MAGIC_NUMBER); dos.writeShort(fileFormatVersion.getVersion()); }
java
public void write(DataOutputStream dos) throws IOException { dos.writeInt(MAGIC_NUMBER); dos.writeShort(fileFormatVersion.getVersion()); }
[ "public", "void", "write", "(", "DataOutputStream", "dos", ")", "throws", "IOException", "{", "dos", ".", "writeInt", "(", "MAGIC_NUMBER", ")", ";", "dos", ".", "writeShort", "(", "fileFormatVersion", ".", "getVersion", "(", ")", ")", ";", "}" ]
Writes this preamble out to the specified output stream. @param dos The {@link DataOutputStream}. @throws IOException If there was a problem writing to the specified stream.
[ "Writes", "this", "preamble", "out", "to", "the", "specified", "output", "stream", "." ]
7fccfe804120f86b38ca855ddbb569a81a042257
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLOntologyDocumentPreamble.java#L99-L102
149,586
kikinteractive/ice
ice/src/main/java/com/kik/config/ice/internal/MethodIdProxyFactory.java
MethodIdProxyFactory.getLastIdentifiedMethodAndScope
public static MethodAndScope getLastIdentifiedMethodAndScope() { final MethodAndScope mas = lastIdentifiedMethodAndScope.get(); lastIdentifiedMethodAndScope.set(null); return mas; }
java
public static MethodAndScope getLastIdentifiedMethodAndScope() { final MethodAndScope mas = lastIdentifiedMethodAndScope.get(); lastIdentifiedMethodAndScope.set(null); return mas; }
[ "public", "static", "MethodAndScope", "getLastIdentifiedMethodAndScope", "(", ")", "{", "final", "MethodAndScope", "mas", "=", "lastIdentifiedMethodAndScope", ".", "get", "(", ")", ";", "lastIdentifiedMethodAndScope", ".", "set", "(", "null", ")", ";", "return", "mas", ";", "}" ]
Retrieves the most recently called method on any configuration impl proxy generated by this factory, along with the scope of the proxy. Note that the identified method is only returned once. Subsequent calls return null until another proxy method is called and identified.
[ "Retrieves", "the", "most", "recently", "called", "method", "on", "any", "configuration", "impl", "proxy", "generated", "by", "this", "factory", "along", "with", "the", "scope", "of", "the", "proxy", ".", "Note", "that", "the", "identified", "method", "is", "only", "returned", "once", ".", "Subsequent", "calls", "return", "null", "until", "another", "proxy", "method", "is", "called", "and", "identified", "." ]
0c58d7bf2d9f6504892d0768d6022fcfa6df7514
https://github.com/kikinteractive/ice/blob/0c58d7bf2d9f6504892d0768d6022fcfa6df7514/ice/src/main/java/com/kik/config/ice/internal/MethodIdProxyFactory.java#L71-L76
149,587
kikinteractive/ice
ice/src/main/java/com/kik/config/ice/internal/MethodIdProxyFactory.java
MethodIdProxyFactory.defaultForType
private static Object defaultForType(Class<?> type) { if (!type.isPrimitive()) { return null; } if (type.equals(boolean.class)) { return false; } if (type.equals(long.class)) { return (long) 0L; } if (type.equals(int.class)) { return (int) 0; } if (type.equals(short.class)) { return (short) 0; } if (type.equals(byte.class)) { return (byte) 0; } if (type.equals(char.class)) { return (char) '\u0000'; } if (type.equals(float.class)) { return (float) 0.0f; } if (type.equals(double.class)) { return (double) 0.0d; } // should never happen throw new IllegalStateException("Unknown primitive type: " + type.getName()); }
java
private static Object defaultForType(Class<?> type) { if (!type.isPrimitive()) { return null; } if (type.equals(boolean.class)) { return false; } if (type.equals(long.class)) { return (long) 0L; } if (type.equals(int.class)) { return (int) 0; } if (type.equals(short.class)) { return (short) 0; } if (type.equals(byte.class)) { return (byte) 0; } if (type.equals(char.class)) { return (char) '\u0000'; } if (type.equals(float.class)) { return (float) 0.0f; } if (type.equals(double.class)) { return (double) 0.0d; } // should never happen throw new IllegalStateException("Unknown primitive type: " + type.getName()); }
[ "private", "static", "Object", "defaultForType", "(", "Class", "<", "?", ">", "type", ")", "{", "if", "(", "!", "type", ".", "isPrimitive", "(", ")", ")", "{", "return", "null", ";", "}", "if", "(", "type", ".", "equals", "(", "boolean", ".", "class", ")", ")", "{", "return", "false", ";", "}", "if", "(", "type", ".", "equals", "(", "long", ".", "class", ")", ")", "{", "return", "(", "long", ")", "0L", ";", "}", "if", "(", "type", ".", "equals", "(", "int", ".", "class", ")", ")", "{", "return", "(", "int", ")", "0", ";", "}", "if", "(", "type", ".", "equals", "(", "short", ".", "class", ")", ")", "{", "return", "(", "short", ")", "0", ";", "}", "if", "(", "type", ".", "equals", "(", "byte", ".", "class", ")", ")", "{", "return", "(", "byte", ")", "0", ";", "}", "if", "(", "type", ".", "equals", "(", "char", ".", "class", ")", ")", "{", "return", "(", "char", ")", "'", "'", ";", "}", "if", "(", "type", ".", "equals", "(", "float", ".", "class", ")", ")", "{", "return", "(", "float", ")", "0.0f", ";", "}", "if", "(", "type", ".", "equals", "(", "double", ".", "class", ")", ")", "{", "return", "(", "double", ")", "0.0d", ";", "}", "// should never happen", "throw", "new", "IllegalStateException", "(", "\"Unknown primitive type: \"", "+", "type", ".", "getName", "(", ")", ")", ";", "}" ]
Provide the default value for any given type. @param type Type to get the default for @return default value - primitive value or null depending on the type.
[ "Provide", "the", "default", "value", "for", "any", "given", "type", "." ]
0c58d7bf2d9f6504892d0768d6022fcfa6df7514
https://github.com/kikinteractive/ice/blob/0c58d7bf2d9f6504892d0768d6022fcfa6df7514/ice/src/main/java/com/kik/config/ice/internal/MethodIdProxyFactory.java#L123-L154
149,588
greese/dasein-util
src/main/java/org/dasein/util/MapLoader.java
MapLoader.load
public T load(Object ... args) { try { T item = target.newInstance(); Map vals = (Map)args[0]; load(item, vals); return item; } catch( InstantiationException e ) { throw new CacheManagementException(e); } catch( IllegalAccessException e ) { throw new CacheManagementException(e); } }
java
public T load(Object ... args) { try { T item = target.newInstance(); Map vals = (Map)args[0]; load(item, vals); return item; } catch( InstantiationException e ) { throw new CacheManagementException(e); } catch( IllegalAccessException e ) { throw new CacheManagementException(e); } }
[ "public", "T", "load", "(", "Object", "...", "args", ")", "{", "try", "{", "T", "item", "=", "target", ".", "newInstance", "(", ")", ";", "Map", "vals", "=", "(", "Map", ")", "args", "[", "0", "]", ";", "load", "(", "item", ",", "vals", ")", ";", "return", "item", ";", "}", "catch", "(", "InstantiationException", "e", ")", "{", "throw", "new", "CacheManagementException", "(", "e", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "CacheManagementException", "(", "e", ")", ";", "}", "}" ]
Creates a new instance of the class this map loader is governing and loads it with values. @param args only one argument is expected, a {@link Map} with attribute names as keys and object values for those attributes as values
[ "Creates", "a", "new", "instance", "of", "the", "class", "this", "map", "loader", "is", "governing", "and", "loads", "it", "with", "values", "." ]
648606dcb4bd382e3287a6c897a32e65d553dc47
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/MapLoader.java#L60-L74
149,589
greese/dasein-util
src/main/java/org/dasein/util/MapLoader.java
MapLoader.load
public void load(T item, Map vals) { for( Object k : vals.keySet() ) { Class cls = item.getClass(); String key = (String)k; Object val = vals.get(key); Field f = null; int mod; while( f == null ) { try { f = cls.getDeclaredField(key); } catch( NoSuchFieldException e ) { // ignore } if( f == null ) { cls = cls.getSuperclass(); if( cls == null || cls.getName().equals(Object.class.getName()) ) { break; } } } if( f == null ) { continue; } mod = f.getModifiers(); if( Modifier.isTransient(mod) || Modifier.isStatic(mod) ) { continue; } try { f.setAccessible(true); f.set(item, val); } catch( IllegalAccessException e ) { String msg = "Error setting value for " + key + ":\n"; if( val == null ) { msg = msg + " (null)"; } else { msg = msg + " (" + val + ":" + val.getClass().getName() + ")"; } msg = msg + ":\n" + e.getClass().getName() + ":\n"; throw new CacheManagementException(msg + e.getMessage()); } catch( IllegalArgumentException e ) { String msg = "Error setting value for " + key; if( val == null ) { msg = msg + " (null)"; } else { msg = msg + " (" + val + ":" + val.getClass().getName() + ")"; } msg = msg + ":\n" + e.getClass().getName() + ":\n"; throw new CacheManagementException(msg + e.getMessage()); } } }
java
public void load(T item, Map vals) { for( Object k : vals.keySet() ) { Class cls = item.getClass(); String key = (String)k; Object val = vals.get(key); Field f = null; int mod; while( f == null ) { try { f = cls.getDeclaredField(key); } catch( NoSuchFieldException e ) { // ignore } if( f == null ) { cls = cls.getSuperclass(); if( cls == null || cls.getName().equals(Object.class.getName()) ) { break; } } } if( f == null ) { continue; } mod = f.getModifiers(); if( Modifier.isTransient(mod) || Modifier.isStatic(mod) ) { continue; } try { f.setAccessible(true); f.set(item, val); } catch( IllegalAccessException e ) { String msg = "Error setting value for " + key + ":\n"; if( val == null ) { msg = msg + " (null)"; } else { msg = msg + " (" + val + ":" + val.getClass().getName() + ")"; } msg = msg + ":\n" + e.getClass().getName() + ":\n"; throw new CacheManagementException(msg + e.getMessage()); } catch( IllegalArgumentException e ) { String msg = "Error setting value for " + key; if( val == null ) { msg = msg + " (null)"; } else { msg = msg + " (" + val + ":" + val.getClass().getName() + ")"; } msg = msg + ":\n" + e.getClass().getName() + ":\n"; throw new CacheManagementException(msg + e.getMessage()); } } }
[ "public", "void", "load", "(", "T", "item", ",", "Map", "vals", ")", "{", "for", "(", "Object", "k", ":", "vals", ".", "keySet", "(", ")", ")", "{", "Class", "cls", "=", "item", ".", "getClass", "(", ")", ";", "String", "key", "=", "(", "String", ")", "k", ";", "Object", "val", "=", "vals", ".", "get", "(", "key", ")", ";", "Field", "f", "=", "null", ";", "int", "mod", ";", "while", "(", "f", "==", "null", ")", "{", "try", "{", "f", "=", "cls", ".", "getDeclaredField", "(", "key", ")", ";", "}", "catch", "(", "NoSuchFieldException", "e", ")", "{", "// ignore", "}", "if", "(", "f", "==", "null", ")", "{", "cls", "=", "cls", ".", "getSuperclass", "(", ")", ";", "if", "(", "cls", "==", "null", "||", "cls", ".", "getName", "(", ")", ".", "equals", "(", "Object", ".", "class", ".", "getName", "(", ")", ")", ")", "{", "break", ";", "}", "}", "}", "if", "(", "f", "==", "null", ")", "{", "continue", ";", "}", "mod", "=", "f", ".", "getModifiers", "(", ")", ";", "if", "(", "Modifier", ".", "isTransient", "(", "mod", ")", "||", "Modifier", ".", "isStatic", "(", "mod", ")", ")", "{", "continue", ";", "}", "try", "{", "f", ".", "setAccessible", "(", "true", ")", ";", "f", ".", "set", "(", "item", ",", "val", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "String", "msg", "=", "\"Error setting value for \"", "+", "key", "+", "\":\\n\"", ";", "if", "(", "val", "==", "null", ")", "{", "msg", "=", "msg", "+", "\" (null)\"", ";", "}", "else", "{", "msg", "=", "msg", "+", "\" (\"", "+", "val", "+", "\":\"", "+", "val", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\")\"", ";", "}", "msg", "=", "msg", "+", "\":\\n\"", "+", "e", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\":\\n\"", ";", "throw", "new", "CacheManagementException", "(", "msg", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "String", "msg", "=", "\"Error setting value for \"", "+", "key", ";", "if", "(", "val", "==", "null", ")", "{", "msg", "=", "msg", "+", "\" (null)\"", ";", "}", "else", "{", "msg", "=", "msg", "+", "\" (\"", "+", "val", "+", "\":\"", "+", "val", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\")\"", ";", "}", "msg", "=", "msg", "+", "\":\\n\"", "+", "e", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\":\\n\"", ";", "throw", "new", "CacheManagementException", "(", "msg", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}" ]
Loads the specified values into the specified object instance. @param item the object into which values are being loaded @param vals the values to load into the object
[ "Loads", "the", "specified", "values", "into", "the", "specified", "object", "instance", "." ]
648606dcb4bd382e3287a6c897a32e65d553dc47
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/MapLoader.java#L81-L141
149,590
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/CallableUtils.java
CallableUtils.isFunctionCall
public static boolean isFunctionCall(String decodedSql) { Pattern regexPattern = null; Matcher regexMatcher = null; regexPattern = Pattern.compile(REGEX_IS_FUNCTION, Pattern.CASE_INSENSITIVE); regexMatcher = regexPattern.matcher(decodedSql); return regexMatcher.find(); }
java
public static boolean isFunctionCall(String decodedSql) { Pattern regexPattern = null; Matcher regexMatcher = null; regexPattern = Pattern.compile(REGEX_IS_FUNCTION, Pattern.CASE_INSENSITIVE); regexMatcher = regexPattern.matcher(decodedSql); return regexMatcher.find(); }
[ "public", "static", "boolean", "isFunctionCall", "(", "String", "decodedSql", ")", "{", "Pattern", "regexPattern", "=", "null", ";", "Matcher", "regexMatcher", "=", "null", ";", "regexPattern", "=", "Pattern", ".", "compile", "(", "REGEX_IS_FUNCTION", ",", "Pattern", ".", "CASE_INSENSITIVE", ")", ";", "regexMatcher", "=", "regexPattern", ".", "matcher", "(", "decodedSql", ")", ";", "return", "regexMatcher", ".", "find", "(", ")", ";", "}" ]
Checks if SQL String represents function call @param decodedSql SQL String which would be checked @return true/false
[ "Checks", "if", "SQL", "String", "represents", "function", "call" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/CallableUtils.java#L41-L50
149,591
RogerParkinson/madura-workflows
madura-workflow/src/main/java/nz/co/senanque/process/parser/ParsePackage.java
ParsePackage.getProcessName
private String getProcessName(ProcessTextProvider textProvider) { if (!quotedString('"',textProvider)) { return "P"+(textProvider.incrementProcessCount()); } if (textProvider.getLastToken().contains("_")) { throw new ParserException("Process names nust not include underbar: "+textProvider.getLastToken()); } return textProvider.getLastToken(); }
java
private String getProcessName(ProcessTextProvider textProvider) { if (!quotedString('"',textProvider)) { return "P"+(textProvider.incrementProcessCount()); } if (textProvider.getLastToken().contains("_")) { throw new ParserException("Process names nust not include underbar: "+textProvider.getLastToken()); } return textProvider.getLastToken(); }
[ "private", "String", "getProcessName", "(", "ProcessTextProvider", "textProvider", ")", "{", "if", "(", "!", "quotedString", "(", "'", "'", ",", "textProvider", ")", ")", "{", "return", "\"P\"", "+", "(", "textProvider", ".", "incrementProcessCount", "(", ")", ")", ";", "}", "if", "(", "textProvider", ".", "getLastToken", "(", ")", ".", "contains", "(", "\"_\"", ")", ")", "{", "throw", "new", "ParserException", "(", "\"Process names nust not include underbar: \"", "+", "textProvider", ".", "getLastToken", "(", ")", ")", ";", "}", "return", "textProvider", ".", "getLastToken", "(", ")", ";", "}" ]
Method getProcessName. The process name is normally enclosed in quotes but it might be omitted in which case we generate a unique one. @return String @throws ParserException
[ "Method", "getProcessName", ".", "The", "process", "name", "is", "normally", "enclosed", "in", "quotes", "but", "it", "might", "be", "omitted", "in", "which", "case", "we", "generate", "a", "unique", "one", "." ]
3d26c322fc85a006ff0d0cbebacbc453aed8e492
https://github.com/RogerParkinson/madura-workflows/blob/3d26c322fc85a006ff0d0cbebacbc453aed8e492/madura-workflow/src/main/java/nz/co/senanque/process/parser/ParsePackage.java#L144-L155
149,592
RogerParkinson/madura-workflows
madura-workflow/src/main/java/nz/co/senanque/process/parser/ParsePackage.java
ParsePackage.processProcess
private ProcessDefinition processProcess(ProcessTextProvider textProvider) { int start = textProvider.getPos(); if (!JavaClass(textProvider)) { throw new ParserException("Missing class name",textProvider); } textProvider.accumulate(" "); String className = textProvider.getLastToken(); // if (className.indexOf('.') == -1) { // className = textProvider.getPackageName()+className; // } textProvider.setCurrentScope(className); String processName = getProcessName(textProvider); textProvider.addTOCElement(null, processName, start, textProvider.getPos(), TYPE_PROCESS); String launchForm = null; String queueName = null; String description = ""; if (quotedString('"',textProvider)) { description = textProvider.getLastToken(); } if (exact("launchForm", textProvider)) { exactOrError("=", textProvider); if (!CVariable(textProvider)) { throw new ParserException("Missing launch form name",textProvider); } launchForm = textProvider.getLastToken(); if (exact("queue", textProvider)) { exactOrError("=", textProvider); if (!quotedString('"', textProvider)) { throw new ParserException("Missing queue name",textProvider); } queueName = textProvider.getLastToken(); if (textProvider.getWorkflowManager().getQueue(queueName)==null) { throw new ParserException("Missing queue definition for "+queueName,textProvider); } } } ProcessDefinition ret = new ProcessDefinition(processName, className, textProvider.getWorkflowManager(), launchForm, queueName, textProvider.getPackageName(), description); ret.addTask(new TaskStart(ret)); log.debug(ret.getName()); textProvider.accumulate("\n"); processTaskList(ret,textProvider); commit(textProvider); return ret; }
java
private ProcessDefinition processProcess(ProcessTextProvider textProvider) { int start = textProvider.getPos(); if (!JavaClass(textProvider)) { throw new ParserException("Missing class name",textProvider); } textProvider.accumulate(" "); String className = textProvider.getLastToken(); // if (className.indexOf('.') == -1) { // className = textProvider.getPackageName()+className; // } textProvider.setCurrentScope(className); String processName = getProcessName(textProvider); textProvider.addTOCElement(null, processName, start, textProvider.getPos(), TYPE_PROCESS); String launchForm = null; String queueName = null; String description = ""; if (quotedString('"',textProvider)) { description = textProvider.getLastToken(); } if (exact("launchForm", textProvider)) { exactOrError("=", textProvider); if (!CVariable(textProvider)) { throw new ParserException("Missing launch form name",textProvider); } launchForm = textProvider.getLastToken(); if (exact("queue", textProvider)) { exactOrError("=", textProvider); if (!quotedString('"', textProvider)) { throw new ParserException("Missing queue name",textProvider); } queueName = textProvider.getLastToken(); if (textProvider.getWorkflowManager().getQueue(queueName)==null) { throw new ParserException("Missing queue definition for "+queueName,textProvider); } } } ProcessDefinition ret = new ProcessDefinition(processName, className, textProvider.getWorkflowManager(), launchForm, queueName, textProvider.getPackageName(), description); ret.addTask(new TaskStart(ret)); log.debug(ret.getName()); textProvider.accumulate("\n"); processTaskList(ret,textProvider); commit(textProvider); return ret; }
[ "private", "ProcessDefinition", "processProcess", "(", "ProcessTextProvider", "textProvider", ")", "{", "int", "start", "=", "textProvider", ".", "getPos", "(", ")", ";", "if", "(", "!", "JavaClass", "(", "textProvider", ")", ")", "{", "throw", "new", "ParserException", "(", "\"Missing class name\"", ",", "textProvider", ")", ";", "}", "textProvider", ".", "accumulate", "(", "\" \"", ")", ";", "String", "className", "=", "textProvider", ".", "getLastToken", "(", ")", ";", "// if (className.indexOf('.') == -1) {", "// \tclassName = textProvider.getPackageName()+className;", "// }", "textProvider", ".", "setCurrentScope", "(", "className", ")", ";", "String", "processName", "=", "getProcessName", "(", "textProvider", ")", ";", "textProvider", ".", "addTOCElement", "(", "null", ",", "processName", ",", "start", ",", "textProvider", ".", "getPos", "(", ")", ",", "TYPE_PROCESS", ")", ";", "String", "launchForm", "=", "null", ";", "String", "queueName", "=", "null", ";", "String", "description", "=", "\"\"", ";", "if", "(", "quotedString", "(", "'", "'", ",", "textProvider", ")", ")", "{", "description", "=", "textProvider", ".", "getLastToken", "(", ")", ";", "}", "if", "(", "exact", "(", "\"launchForm\"", ",", "textProvider", ")", ")", "{", "exactOrError", "(", "\"=\"", ",", "textProvider", ")", ";", "if", "(", "!", "CVariable", "(", "textProvider", ")", ")", "{", "throw", "new", "ParserException", "(", "\"Missing launch form name\"", ",", "textProvider", ")", ";", "}", "launchForm", "=", "textProvider", ".", "getLastToken", "(", ")", ";", "if", "(", "exact", "(", "\"queue\"", ",", "textProvider", ")", ")", "{", "exactOrError", "(", "\"=\"", ",", "textProvider", ")", ";", "if", "(", "!", "quotedString", "(", "'", "'", ",", "textProvider", ")", ")", "{", "throw", "new", "ParserException", "(", "\"Missing queue name\"", ",", "textProvider", ")", ";", "}", "queueName", "=", "textProvider", ".", "getLastToken", "(", ")", ";", "if", "(", "textProvider", ".", "getWorkflowManager", "(", ")", ".", "getQueue", "(", "queueName", ")", "==", "null", ")", "{", "throw", "new", "ParserException", "(", "\"Missing queue definition for \"", "+", "queueName", ",", "textProvider", ")", ";", "}", "}", "}", "ProcessDefinition", "ret", "=", "new", "ProcessDefinition", "(", "processName", ",", "className", ",", "textProvider", ".", "getWorkflowManager", "(", ")", ",", "launchForm", ",", "queueName", ",", "textProvider", ".", "getPackageName", "(", ")", ",", "description", ")", ";", "ret", ".", "addTask", "(", "new", "TaskStart", "(", "ret", ")", ")", ";", "log", ".", "debug", "(", "ret", ".", "getName", "(", ")", ")", ";", "textProvider", ".", "accumulate", "(", "\"\\n\"", ")", ";", "processTaskList", "(", "ret", ",", "textProvider", ")", ";", "commit", "(", "textProvider", ")", ";", "return", "ret", ";", "}" ]
Parse the process. @return ProcessDefinition
[ "Parse", "the", "process", "." ]
3d26c322fc85a006ff0d0cbebacbc453aed8e492
https://github.com/RogerParkinson/madura-workflows/blob/3d26c322fc85a006ff0d0cbebacbc453aed8e492/madura-workflow/src/main/java/nz/co/senanque/process/parser/ParsePackage.java#L559-L612
149,593
progolden/vraptor-boilerplate
vraptor-boilerplate-usercontrol/src/main/java/br/com/caelum/vraptor/boilerplate/ComponentFactory.java
ComponentFactory.register
public int register(T component) { if (component == null) { throw new IllegalArgumentException("Null component object passed."); } if (components.contains(component)) { throw new IllegalArgumentException("Duplicate component registering: "+component.getId()); } this.components.add(component); return this.components.size()-1; }
java
public int register(T component) { if (component == null) { throw new IllegalArgumentException("Null component object passed."); } if (components.contains(component)) { throw new IllegalArgumentException("Duplicate component registering: "+component.getId()); } this.components.add(component); return this.components.size()-1; }
[ "public", "int", "register", "(", "T", "component", ")", "{", "if", "(", "component", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Null component object passed.\"", ")", ";", "}", "if", "(", "components", ".", "contains", "(", "component", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Duplicate component registering: \"", "+", "component", ".", "getId", "(", ")", ")", ";", "}", "this", ".", "components", ".", "add", "(", "component", ")", ";", "return", "this", ".", "components", ".", "size", "(", ")", "-", "1", ";", "}" ]
Registra um novo componente nesta factory. @param component Componenete a ser registrado. @return Retorna o índice do componente registrado na lista interna.
[ "Registra", "um", "novo", "componente", "nesta", "factory", "." ]
3edf45cc0dc5aec61b16ca326b4d72c82d1d3e07
https://github.com/progolden/vraptor-boilerplate/blob/3edf45cc0dc5aec61b16ca326b4d72c82d1d3e07/vraptor-boilerplate-usercontrol/src/main/java/br/com/caelum/vraptor/boilerplate/ComponentFactory.java#L40-L49
149,594
progolden/vraptor-boilerplate
vraptor-boilerplate-usercontrol/src/main/java/br/com/caelum/vraptor/boilerplate/ComponentFactory.java
ComponentFactory.each
public void each(Consumer<T> operation) { for (T component : components) { operation.accept(component); } }
java
public void each(Consumer<T> operation) { for (T component : components) { operation.accept(component); } }
[ "public", "void", "each", "(", "Consumer", "<", "T", ">", "operation", ")", "{", "for", "(", "T", "component", ":", "components", ")", "{", "operation", ".", "accept", "(", "component", ")", ";", "}", "}" ]
Executa um consumer para cada componente registrado. @param operation Operação a ser executada.
[ "Executa", "um", "consumer", "para", "cada", "componente", "registrado", "." ]
3edf45cc0dc5aec61b16ca326b4d72c82d1d3e07
https://github.com/progolden/vraptor-boilerplate/blob/3edf45cc0dc5aec61b16ca326b4d72c82d1d3e07/vraptor-boilerplate-usercontrol/src/main/java/br/com/caelum/vraptor/boilerplate/ComponentFactory.java#L79-L83
149,595
progolden/vraptor-boilerplate
vraptor-boilerplate-usercontrol/src/main/java/br/com/caelum/vraptor/boilerplate/ComponentFactory.java
ComponentFactory.toJSON
public String toJSON() { StringBuilder json = new StringBuilder(); json.append("["); for (int t = 0; t < components.size(); t++) { if (t > 0) json.append(","); T component = components.get(t); json .append("{") .append("\"label\":\"").append(component.getDisplayName()).append("\"") .append(",\"id\":\"").append(component.getId()).append("\"") .append("}") ; } json.append("]"); return json.toString(); }
java
public String toJSON() { StringBuilder json = new StringBuilder(); json.append("["); for (int t = 0; t < components.size(); t++) { if (t > 0) json.append(","); T component = components.get(t); json .append("{") .append("\"label\":\"").append(component.getDisplayName()).append("\"") .append(",\"id\":\"").append(component.getId()).append("\"") .append("}") ; } json.append("]"); return json.toString(); }
[ "public", "String", "toJSON", "(", ")", "{", "StringBuilder", "json", "=", "new", "StringBuilder", "(", ")", ";", "json", ".", "append", "(", "\"[\"", ")", ";", "for", "(", "int", "t", "=", "0", ";", "t", "<", "components", ".", "size", "(", ")", ";", "t", "++", ")", "{", "if", "(", "t", ">", "0", ")", "json", ".", "append", "(", "\",\"", ")", ";", "T", "component", "=", "components", ".", "get", "(", "t", ")", ";", "json", ".", "append", "(", "\"{\"", ")", ".", "append", "(", "\"\\\"label\\\":\\\"\"", ")", ".", "append", "(", "component", ".", "getDisplayName", "(", ")", ")", ".", "append", "(", "\"\\\"\"", ")", ".", "append", "(", "\",\\\"id\\\":\\\"\"", ")", ".", "append", "(", "component", ".", "getId", "(", ")", ")", ".", "append", "(", "\"\\\"\"", ")", ".", "append", "(", "\"}\"", ")", ";", "}", "json", ".", "append", "(", "\"]\"", ")", ";", "return", "json", ".", "toString", "(", ")", ";", "}" ]
Serializa os componentes registrados em JSON. @return JSON que representa os componentes registrados.
[ "Serializa", "os", "componentes", "registrados", "em", "JSON", "." ]
3edf45cc0dc5aec61b16ca326b4d72c82d1d3e07
https://github.com/progolden/vraptor-boilerplate/blob/3edf45cc0dc5aec61b16ca326b4d72c82d1d3e07/vraptor-boilerplate-usercontrol/src/main/java/br/com/caelum/vraptor/boilerplate/ComponentFactory.java#L96-L112
149,596
yangjm/winlet
winlet/src/main/java/com/aggrepoint/winlet/utils/ValidateUtils.java
ValidateUtils.validateInput
public static String validateInput(final String context, final String input, final String type, final int maxLength, final boolean allowNull, final boolean canonicalize) throws ValidationException { return validator.getValidInput(context, input, type, maxLength, allowNull, canonicalize); }
java
public static String validateInput(final String context, final String input, final String type, final int maxLength, final boolean allowNull, final boolean canonicalize) throws ValidationException { return validator.getValidInput(context, input, type, maxLength, allowNull, canonicalize); }
[ "public", "static", "String", "validateInput", "(", "final", "String", "context", ",", "final", "String", "input", ",", "final", "String", "type", ",", "final", "int", "maxLength", ",", "final", "boolean", "allowNull", ",", "final", "boolean", "canonicalize", ")", "throws", "ValidationException", "{", "return", "validator", ".", "getValidInput", "(", "context", ",", "input", ",", "type", ",", "maxLength", ",", "allowNull", ",", "canonicalize", ")", ";", "}" ]
Regular Expression Validation @param context @param input @param type @param maxLength @param allowNull @param canonicalize @return
[ "Regular", "Expression", "Validation" ]
2126236f56858e283fa6ad69fe9279ee30f47b67
https://github.com/yangjm/winlet/blob/2126236f56858e283fa6ad69fe9279ee30f47b67/winlet/src/main/java/com/aggrepoint/winlet/utils/ValidateUtils.java#L136-L142
149,597
wb14123/bard
bard-core/src/main/java/com/bardframework/bard/core/Context.java
Context.putCustom
public <T> void putCustom(String key, T value) { custom.put(key, value); }
java
public <T> void putCustom(String key, T value) { custom.put(key, value); }
[ "public", "<", "T", ">", "void", "putCustom", "(", "String", "key", ",", "T", "value", ")", "{", "custom", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Put a custom value into context. @param key The key to get value. @param value The value. @param <T> The type of value.
[ "Put", "a", "custom", "value", "into", "context", "." ]
98618ae31fd80000c794661b4c130af1b1298d9b
https://github.com/wb14123/bard/blob/98618ae31fd80000c794661b4c130af1b1298d9b/bard-core/src/main/java/com/bardframework/bard/core/Context.java#L61-L63
149,598
wb14123/bard
bard-core/src/main/java/com/bardframework/bard/core/Context.java
Context.getCustom
@SuppressWarnings("unchecked") public <T> T getCustom(String key) { return (T) custom.get(key); }
java
@SuppressWarnings("unchecked") public <T> T getCustom(String key) { return (T) custom.get(key); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "getCustom", "(", "String", "key", ")", "{", "return", "(", "T", ")", "custom", ".", "get", "(", "key", ")", ";", "}" ]
Get the custom value in context. @param key The key to get value. @param <T> The type of value. @return The value.
[ "Get", "the", "custom", "value", "in", "context", "." ]
98618ae31fd80000c794661b4c130af1b1298d9b
https://github.com/wb14123/bard/blob/98618ae31fd80000c794661b4c130af1b1298d9b/bard-core/src/main/java/com/bardframework/bard/core/Context.java#L72-L75
149,599
javagl/Common
src/main/java/de/javagl/common/beans/BeanUtils.java
BeanUtils.getPropertyDescriptorsOptional
private static List<PropertyDescriptor> getPropertyDescriptorsOptional( Class<?> beanClass) { BeanInfo beanInfo = getBeanInfoOptional(beanClass); if (beanInfo == null) { return Collections.emptyList(); } PropertyDescriptor propertyDescriptors[] = beanInfo.getPropertyDescriptors(); if (propertyDescriptors == null) { return Collections.emptyList(); } return Collections.unmodifiableList( new ArrayList<PropertyDescriptor>( Arrays.asList(propertyDescriptors))); }
java
private static List<PropertyDescriptor> getPropertyDescriptorsOptional( Class<?> beanClass) { BeanInfo beanInfo = getBeanInfoOptional(beanClass); if (beanInfo == null) { return Collections.emptyList(); } PropertyDescriptor propertyDescriptors[] = beanInfo.getPropertyDescriptors(); if (propertyDescriptors == null) { return Collections.emptyList(); } return Collections.unmodifiableList( new ArrayList<PropertyDescriptor>( Arrays.asList(propertyDescriptors))); }
[ "private", "static", "List", "<", "PropertyDescriptor", ">", "getPropertyDescriptorsOptional", "(", "Class", "<", "?", ">", "beanClass", ")", "{", "BeanInfo", "beanInfo", "=", "getBeanInfoOptional", "(", "beanClass", ")", ";", "if", "(", "beanInfo", "==", "null", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "PropertyDescriptor", "propertyDescriptors", "[", "]", "=", "beanInfo", ".", "getPropertyDescriptors", "(", ")", ";", "if", "(", "propertyDescriptors", "==", "null", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "return", "Collections", ".", "unmodifiableList", "(", "new", "ArrayList", "<", "PropertyDescriptor", ">", "(", "Arrays", ".", "asList", "(", "propertyDescriptors", ")", ")", ")", ";", "}" ]
Returns an unmodifiable list containing the PropertyDescriptors of the given bean class. Returns an empty list if either the BeanInfo or the PropertyDescriptors could not be obtained. @param beanClass The bean class @return The PropertyDescriptors
[ "Returns", "an", "unmodifiable", "list", "containing", "the", "PropertyDescriptors", "of", "the", "given", "bean", "class", ".", "Returns", "an", "empty", "list", "if", "either", "the", "BeanInfo", "or", "the", "PropertyDescriptors", "could", "not", "be", "obtained", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/beans/BeanUtils.java#L72-L89