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
23,600
banq/jdonframework
JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java
PageIteratorSolver.getDatas
public PageIterator getDatas(String queryParam, String sqlqueryAllCount, String sqlquery, int start, int count) { if (UtilValidate.isEmpty(sqlqueryAllCount)) { Debug.logError(" the parameter sqlqueryAllCount is null", module); return new PageIterator(); } if (UtilValidate.isEmpty(sqlquery)) { Debug.logError(" the parameter sqlquery is null", module); return new PageIterator(); } Collection queryParams = new ArrayList(); if (!UtilValidate.isEmpty(queryParam)) queryParams.add(queryParam); return getPageIterator(sqlqueryAllCount, sqlquery, queryParams, start, count); }
java
public PageIterator getDatas(String queryParam, String sqlqueryAllCount, String sqlquery, int start, int count) { if (UtilValidate.isEmpty(sqlqueryAllCount)) { Debug.logError(" the parameter sqlqueryAllCount is null", module); return new PageIterator(); } if (UtilValidate.isEmpty(sqlquery)) { Debug.logError(" the parameter sqlquery is null", module); return new PageIterator(); } Collection queryParams = new ArrayList(); if (!UtilValidate.isEmpty(queryParam)) queryParams.add(queryParam); return getPageIterator(sqlqueryAllCount, sqlquery, queryParams, start, count); }
[ "public", "PageIterator", "getDatas", "(", "String", "queryParam", ",", "String", "sqlqueryAllCount", ",", "String", "sqlquery", ",", "int", "start", ",", "int", "count", ")", "{", "if", "(", "UtilValidate", ".", "isEmpty", "(", "sqlqueryAllCount", ")", ")", "{", "Debug", ".", "logError", "(", "\" the parameter sqlqueryAllCount is null\"", ",", "module", ")", ";", "return", "new", "PageIterator", "(", ")", ";", "}", "if", "(", "UtilValidate", ".", "isEmpty", "(", "sqlquery", ")", ")", "{", "Debug", ".", "logError", "(", "\" the parameter sqlquery is null\"", ",", "module", ")", ";", "return", "new", "PageIterator", "(", ")", ";", "}", "Collection", "queryParams", "=", "new", "ArrayList", "(", ")", ";", "if", "(", "!", "UtilValidate", ".", "isEmpty", "(", "queryParam", ")", ")", "queryParams", ".", "add", "(", "queryParam", ")", ";", "return", "getPageIterator", "(", "sqlqueryAllCount", ",", "sqlquery", ",", "queryParams", ",", "start", ",", "count", ")", ";", "}" ]
create a PageIterator instance @param queryParam the value of sqlquery's "?" @param sqlqueryAllCount the sql for query all count that fit for condition @param sqlquery the sql for query that fit for condtion, return id collection @param start @param count @return PageIterator @throws java.lang.Exception
[ "create", "a", "PageIterator", "instance" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java#L168-L183
23,601
banq/jdonframework
JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java
PageIteratorSolver.getPageIterator
public PageIterator getPageIterator(String sqlqueryAllCount, String sqlquery, String queryParam, int start, int count) { if (UtilValidate.isEmpty(sqlqueryAllCount)) { Debug.logError(" the parameter sqlqueryAllCount is null", module); return new PageIterator(); } if (UtilValidate.isEmpty(sqlquery)) { Debug.logError(" the parameter sqlquery is null", module); return new PageIterator(); } return getDatas(queryParam, sqlqueryAllCount, sqlquery, start, count); }
java
public PageIterator getPageIterator(String sqlqueryAllCount, String sqlquery, String queryParam, int start, int count) { if (UtilValidate.isEmpty(sqlqueryAllCount)) { Debug.logError(" the parameter sqlqueryAllCount is null", module); return new PageIterator(); } if (UtilValidate.isEmpty(sqlquery)) { Debug.logError(" the parameter sqlquery is null", module); return new PageIterator(); } return getDatas(queryParam, sqlqueryAllCount, sqlquery, start, count); }
[ "public", "PageIterator", "getPageIterator", "(", "String", "sqlqueryAllCount", ",", "String", "sqlquery", ",", "String", "queryParam", ",", "int", "start", ",", "int", "count", ")", "{", "if", "(", "UtilValidate", ".", "isEmpty", "(", "sqlqueryAllCount", ")", ")", "{", "Debug", ".", "logError", "(", "\" the parameter sqlqueryAllCount is null\"", ",", "module", ")", ";", "return", "new", "PageIterator", "(", ")", ";", "}", "if", "(", "UtilValidate", ".", "isEmpty", "(", "sqlquery", ")", ")", "{", "Debug", ".", "logError", "(", "\" the parameter sqlquery is null\"", ",", "module", ")", ";", "return", "new", "PageIterator", "(", ")", ";", "}", "return", "getDatas", "(", "queryParam", ",", "sqlqueryAllCount", ",", "sqlquery", ",", "start", ",", "count", ")", ";", "}" ]
same as getDatas the parameters sort is different from the getDatas method @param sqlqueryAllCount the sql sentence for "select count(1) .." @param sqlquery the sql sentence for "select id from xxxx"; @param queryParam the parameter of String type for the sqlquery. @param start the starting number of a page in allCount; @param count the display number of a page @return
[ "same", "as", "getDatas", "the", "parameters", "sort", "is", "different", "from", "the", "getDatas", "method" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java#L201-L211
23,602
banq/jdonframework
JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java
PageIteratorSolver.getPageIterator
public PageIterator getPageIterator(String sqlqueryAllCount, String sqlquery, Collection queryParams, int startIndex, int count) { Debug.logVerbose("[JdonFramework]enter getPageIterator .. start= " + startIndex + " count=" + count, module); if (queryParams == null) { Debug.logError(" the parameters collection is null", module); return new PageIterator(); } if ((count > blockStrategy.getBlockLength()) || (count <= 0)) { // every count = blockStrategy.getBlockLength(); } Block currentBlock = getBlock(sqlquery, queryParams, startIndex, count); if (currentBlock == null) { return new PageIterator(); } startIndex = currentBlock.getStart(); int endIndex = startIndex + currentBlock.getCount(); Object[] keys = currentBlock.getList().toArray(); int allCount = getDatasAllCount(queryParams, sqlqueryAllCount); Debug.logVerbose("[JdonFramework]currentBlock: startIndex=" + startIndex + " endIndex=" + endIndex + " keys length=" + keys.length, module); if (endIndex < startIndex) { Debug.logWarning("WARNNING : endIndex < startIndex", module); return new PageIterator(); } else { return new PageIterator(allCount, keys, startIndex, endIndex, count); } }
java
public PageIterator getPageIterator(String sqlqueryAllCount, String sqlquery, Collection queryParams, int startIndex, int count) { Debug.logVerbose("[JdonFramework]enter getPageIterator .. start= " + startIndex + " count=" + count, module); if (queryParams == null) { Debug.logError(" the parameters collection is null", module); return new PageIterator(); } if ((count > blockStrategy.getBlockLength()) || (count <= 0)) { // every count = blockStrategy.getBlockLength(); } Block currentBlock = getBlock(sqlquery, queryParams, startIndex, count); if (currentBlock == null) { return new PageIterator(); } startIndex = currentBlock.getStart(); int endIndex = startIndex + currentBlock.getCount(); Object[] keys = currentBlock.getList().toArray(); int allCount = getDatasAllCount(queryParams, sqlqueryAllCount); Debug.logVerbose("[JdonFramework]currentBlock: startIndex=" + startIndex + " endIndex=" + endIndex + " keys length=" + keys.length, module); if (endIndex < startIndex) { Debug.logWarning("WARNNING : endIndex < startIndex", module); return new PageIterator(); } else { return new PageIterator(allCount, keys, startIndex, endIndex, count); } }
[ "public", "PageIterator", "getPageIterator", "(", "String", "sqlqueryAllCount", ",", "String", "sqlquery", ",", "Collection", "queryParams", ",", "int", "startIndex", ",", "int", "count", ")", "{", "Debug", ".", "logVerbose", "(", "\"[JdonFramework]enter getPageIterator .. start= \"", "+", "startIndex", "+", "\" count=\"", "+", "count", ",", "module", ")", ";", "if", "(", "queryParams", "==", "null", ")", "{", "Debug", ".", "logError", "(", "\" the parameters collection is null\"", ",", "module", ")", ";", "return", "new", "PageIterator", "(", ")", ";", "}", "if", "(", "(", "count", ">", "blockStrategy", ".", "getBlockLength", "(", ")", ")", "||", "(", "count", "<=", "0", ")", ")", "{", "// every\r", "count", "=", "blockStrategy", ".", "getBlockLength", "(", ")", ";", "}", "Block", "currentBlock", "=", "getBlock", "(", "sqlquery", ",", "queryParams", ",", "startIndex", ",", "count", ")", ";", "if", "(", "currentBlock", "==", "null", ")", "{", "return", "new", "PageIterator", "(", ")", ";", "}", "startIndex", "=", "currentBlock", ".", "getStart", "(", ")", ";", "int", "endIndex", "=", "startIndex", "+", "currentBlock", ".", "getCount", "(", ")", ";", "Object", "[", "]", "keys", "=", "currentBlock", ".", "getList", "(", ")", ".", "toArray", "(", ")", ";", "int", "allCount", "=", "getDatasAllCount", "(", "queryParams", ",", "sqlqueryAllCount", ")", ";", "Debug", ".", "logVerbose", "(", "\"[JdonFramework]currentBlock: startIndex=\"", "+", "startIndex", "+", "\" endIndex=\"", "+", "endIndex", "+", "\" keys length=\"", "+", "keys", ".", "length", ",", "module", ")", ";", "if", "(", "endIndex", "<", "startIndex", ")", "{", "Debug", ".", "logWarning", "(", "\"WARNNING : endIndex < startIndex\"", ",", "module", ")", ";", "return", "new", "PageIterator", "(", ")", ";", "}", "else", "{", "return", "new", "PageIterator", "(", "allCount", ",", "keys", ",", "startIndex", ",", "endIndex", ",", "count", ")", ";", "}", "}" ]
get a PageIterator @param sqlqueryAllCount the sql sentence for "select count(1) .." @param sqlquery the sql sentence for "select id from xxxx"; @param queryParams the parameter collection for the sqlquery. @param start the starting number of a page in allCount; @param count the display number of a page @return
[ "get", "a", "PageIterator" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java#L228-L252
23,603
banq/jdonframework
JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java
PageIteratorSolver.locate
public Block locate(String sqlquery, Collection queryParams, Object locateId) { return blockStrategy.locate(sqlquery, queryParams, locateId); }
java
public Block locate(String sqlquery, Collection queryParams, Object locateId) { return blockStrategy.locate(sqlquery, queryParams, locateId); }
[ "public", "Block", "locate", "(", "String", "sqlquery", ",", "Collection", "queryParams", ",", "Object", "locateId", ")", "{", "return", "blockStrategy", ".", "locate", "(", "sqlquery", ",", "queryParams", ",", "locateId", ")", ";", "}" ]
looking for a block in that there is a primary key is equals to the locateId. for the sql sentence. @param sqlquery @param queryParams @param locateId @return if not locate, return null;
[ "looking", "for", "a", "block", "in", "that", "there", "is", "a", "primary", "key", "is", "equals", "to", "the", "locateId", ".", "for", "the", "sql", "sentence", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java#L263-L265
23,604
banq/jdonframework
src/main/java/com/jdon/util/ObjectCreator.java
ObjectCreator.createObject
public static Object createObject(String className, Object[] params) throws Exception { return createObject(Class.forName(className), params); }
java
public static Object createObject(String className, Object[] params) throws Exception { return createObject(Class.forName(className), params); }
[ "public", "static", "Object", "createObject", "(", "String", "className", ",", "Object", "[", "]", "params", ")", "throws", "Exception", "{", "return", "createObject", "(", "Class", ".", "forName", "(", "className", ")", ",", "params", ")", ";", "}" ]
Instantaite an Object instance, requires a constructor with parameters @param className full qualified name of the class @param params an array including the required parameters to instantaite the object @return the instantaited Object @exception java.lang.Exception if instantiation failed
[ "Instantaite", "an", "Object", "instance", "requires", "a", "constructor", "with", "parameters" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/ObjectCreator.java#L59-L61
23,605
banq/jdonframework
src/main/java/com/jdon/util/ObjectCreator.java
ObjectCreator.createObject
public static Object createObject(Class classObject, Object[] params) throws Exception { Constructor[] constructors = classObject.getConstructors(); Object object = null; for (int counter = 0; counter < constructors.length; counter++) { try { object = constructors[counter].newInstance(params); } catch (Exception e) { if (e instanceof InvocationTargetException) ((InvocationTargetException) e).getTargetException().printStackTrace(); // do nothing, try the next constructor } } if (object == null) throw new InstantiationException(); return object; }
java
public static Object createObject(Class classObject, Object[] params) throws Exception { Constructor[] constructors = classObject.getConstructors(); Object object = null; for (int counter = 0; counter < constructors.length; counter++) { try { object = constructors[counter].newInstance(params); } catch (Exception e) { if (e instanceof InvocationTargetException) ((InvocationTargetException) e).getTargetException().printStackTrace(); // do nothing, try the next constructor } } if (object == null) throw new InstantiationException(); return object; }
[ "public", "static", "Object", "createObject", "(", "Class", "classObject", ",", "Object", "[", "]", "params", ")", "throws", "Exception", "{", "Constructor", "[", "]", "constructors", "=", "classObject", ".", "getConstructors", "(", ")", ";", "Object", "object", "=", "null", ";", "for", "(", "int", "counter", "=", "0", ";", "counter", "<", "constructors", ".", "length", ";", "counter", "++", ")", "{", "try", "{", "object", "=", "constructors", "[", "counter", "]", ".", "newInstance", "(", "params", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "e", "instanceof", "InvocationTargetException", ")", "(", "(", "InvocationTargetException", ")", "e", ")", ".", "getTargetException", "(", ")", ".", "printStackTrace", "(", ")", ";", "// do nothing, try the next constructor\r", "}", "}", "if", "(", "object", "==", "null", ")", "throw", "new", "InstantiationException", "(", ")", ";", "return", "object", ";", "}" ]
Instantaite an Object instance, requires a constractor with parameters @param classObject , Class object representing the object type to be instantiated @param params an array including the required parameters to instantaite the object @return the instantaied Object @exception java.lang.Exception if instantiation failed
[ "Instantaite", "an", "Object", "instance", "requires", "a", "constractor", "with", "parameters" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/ObjectCreator.java#L75-L90
23,606
banq/jdonframework
src/main/java/com/jdon/container/visitor/http/HttpSessionProxyComponentVisitor.java
HttpSessionProxyComponentVisitor.valueUnbound
public void valueUnbound(HttpSessionBindingEvent event) { String sessionId = event.getSession().getId(); Debug.logVerbose("[JdonFramework] unvalueBound active, sessionId :" + sessionId, module); Debug.logVerbose("[JdonFramework] unvalueUnbound active, componentsboxs size" + componentsboxsInSession.size(), module); // removeObjects(); componentsboxsInSession.clear(); if (targetMetaRequestsHolder != null) targetMetaRequestsHolder.clear(); targetMetaRequestsHolder = null; componentVisitor = null; }
java
public void valueUnbound(HttpSessionBindingEvent event) { String sessionId = event.getSession().getId(); Debug.logVerbose("[JdonFramework] unvalueBound active, sessionId :" + sessionId, module); Debug.logVerbose("[JdonFramework] unvalueUnbound active, componentsboxs size" + componentsboxsInSession.size(), module); // removeObjects(); componentsboxsInSession.clear(); if (targetMetaRequestsHolder != null) targetMetaRequestsHolder.clear(); targetMetaRequestsHolder = null; componentVisitor = null; }
[ "public", "void", "valueUnbound", "(", "HttpSessionBindingEvent", "event", ")", "{", "String", "sessionId", "=", "event", ".", "getSession", "(", ")", ".", "getId", "(", ")", ";", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] unvalueBound active, sessionId :\"", "+", "sessionId", ",", "module", ")", ";", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] unvalueUnbound active, componentsboxs size\"", "+", "componentsboxsInSession", ".", "size", "(", ")", ",", "module", ")", ";", "// removeObjects();\r", "componentsboxsInSession", ".", "clear", "(", ")", ";", "if", "(", "targetMetaRequestsHolder", "!=", "null", ")", "targetMetaRequestsHolder", ".", "clear", "(", ")", ";", "targetMetaRequestsHolder", "=", "null", ";", "componentVisitor", "=", "null", ";", "}" ]
session destroyed. remove all references;
[ "session", "destroyed", ".", "remove", "all", "references", ";" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/container/visitor/http/HttpSessionProxyComponentVisitor.java#L101-L111
23,607
banq/jdonframework
src/main/java/com/jdon/container/visitor/http/HttpSessionProxyComponentVisitor.java
HttpSessionProxyComponentVisitor.visit
public Object visit() { Object o = null; try { TargetMetaRequest targetMetaRequest = targetMetaRequestsHolder.getTargetMetaRequest(); StringBuilder sb = new StringBuilder(targetMetaRequest.getTargetMetaDef().getCacheKey()); sb.append(targetMetaRequest.getVisitableName()); Debug.logVerbose("[JdonFramework] get the optimized instance for the key " + sb.toString(), module); o = componentsboxsInSession.get(sb.toString()); if (o == null) { Debug.logVerbose("[JdonFramework] first time visit: " + targetMetaRequest.getTargetMetaDef().getClassName(), module); // com.jdon.container.visitor.ComponentOriginalVisitor#visit o = componentVisitor.visit(); if (dynamiceProxyisCached) componentsboxsInSession.add(sb.toString(), o); } } catch (Exception e) { Debug.logError("[JdonFramework]visit error: " + e); } return o; }
java
public Object visit() { Object o = null; try { TargetMetaRequest targetMetaRequest = targetMetaRequestsHolder.getTargetMetaRequest(); StringBuilder sb = new StringBuilder(targetMetaRequest.getTargetMetaDef().getCacheKey()); sb.append(targetMetaRequest.getVisitableName()); Debug.logVerbose("[JdonFramework] get the optimized instance for the key " + sb.toString(), module); o = componentsboxsInSession.get(sb.toString()); if (o == null) { Debug.logVerbose("[JdonFramework] first time visit: " + targetMetaRequest.getTargetMetaDef().getClassName(), module); // com.jdon.container.visitor.ComponentOriginalVisitor#visit o = componentVisitor.visit(); if (dynamiceProxyisCached) componentsboxsInSession.add(sb.toString(), o); } } catch (Exception e) { Debug.logError("[JdonFramework]visit error: " + e); } return o; }
[ "public", "Object", "visit", "(", ")", "{", "Object", "o", "=", "null", ";", "try", "{", "TargetMetaRequest", "targetMetaRequest", "=", "targetMetaRequestsHolder", ".", "getTargetMetaRequest", "(", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "targetMetaRequest", ".", "getTargetMetaDef", "(", ")", ".", "getCacheKey", "(", ")", ")", ";", "sb", ".", "append", "(", "targetMetaRequest", ".", "getVisitableName", "(", ")", ")", ";", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] get the optimized instance for the key \"", "+", "sb", ".", "toString", "(", ")", ",", "module", ")", ";", "o", "=", "componentsboxsInSession", ".", "get", "(", "sb", ".", "toString", "(", ")", ")", ";", "if", "(", "o", "==", "null", ")", "{", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] first time visit: \"", "+", "targetMetaRequest", ".", "getTargetMetaDef", "(", ")", ".", "getClassName", "(", ")", ",", "module", ")", ";", "// com.jdon.container.visitor.ComponentOriginalVisitor#visit\r", "o", "=", "componentVisitor", ".", "visit", "(", ")", ";", "if", "(", "dynamiceProxyisCached", ")", "componentsboxsInSession", ".", "add", "(", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "Debug", ".", "logError", "(", "\"[JdonFramework]visit error: \"", "+", "e", ")", ";", "}", "return", "o", ";", "}" ]
the object type saved in componentsboxs is decided by the method" visitableFactory.createVisitable. only ejb service need cached, pojo service not need. @param targetMetaDef TargetMetaDef @return Object
[ "the", "object", "type", "saved", "in", "componentsboxs", "is", "decided", "by", "the", "method", "visitableFactory", ".", "createVisitable", ".", "only", "ejb", "service", "need", "cached", "pojo", "service", "not", "need", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/container/visitor/http/HttpSessionProxyComponentVisitor.java#L122-L141
23,608
banq/jdonframework
src/main/java/com/jdon/cache/UtilCache.java
UtilCache.put
public void put(Object key, Object value) { if ((key == null) || (value == null)) return; try { if (maxSize > 0) { // when maxSize is changed, the setter will take care of filling // the // LRU list if (cacheLineTable.containsKey(key)) { keyLRUList.moveFirst(key); } else { keyLRUList.addFirst(key); } } if (expireTime > 0) { cacheLineTable.put(key, new CacheLine(value, useSoftReference, System.currentTimeMillis())); } else { cacheLineTable.put(key, new CacheLine(value, useSoftReference)); } if (maxSize > 0 && cacheLineTable.size() > maxSize) { Object lastKey = keyLRUList.getLast(); removeObject(lastKey); } } catch (Exception e) { Debug.logError(e); } finally { } Debug.logVerbose("[JdonFramework]cache now size = " + keyLRUList.size() + " maxSize =" + maxSize + " this Cache id:" + this.hashCode(), module); }
java
public void put(Object key, Object value) { if ((key == null) || (value == null)) return; try { if (maxSize > 0) { // when maxSize is changed, the setter will take care of filling // the // LRU list if (cacheLineTable.containsKey(key)) { keyLRUList.moveFirst(key); } else { keyLRUList.addFirst(key); } } if (expireTime > 0) { cacheLineTable.put(key, new CacheLine(value, useSoftReference, System.currentTimeMillis())); } else { cacheLineTable.put(key, new CacheLine(value, useSoftReference)); } if (maxSize > 0 && cacheLineTable.size() > maxSize) { Object lastKey = keyLRUList.getLast(); removeObject(lastKey); } } catch (Exception e) { Debug.logError(e); } finally { } Debug.logVerbose("[JdonFramework]cache now size = " + keyLRUList.size() + " maxSize =" + maxSize + " this Cache id:" + this.hashCode(), module); }
[ "public", "void", "put", "(", "Object", "key", ",", "Object", "value", ")", "{", "if", "(", "(", "key", "==", "null", ")", "||", "(", "value", "==", "null", ")", ")", "return", ";", "try", "{", "if", "(", "maxSize", ">", "0", ")", "{", "// when maxSize is changed, the setter will take care of filling\r", "// the\r", "// LRU list\r", "if", "(", "cacheLineTable", ".", "containsKey", "(", "key", ")", ")", "{", "keyLRUList", ".", "moveFirst", "(", "key", ")", ";", "}", "else", "{", "keyLRUList", ".", "addFirst", "(", "key", ")", ";", "}", "}", "if", "(", "expireTime", ">", "0", ")", "{", "cacheLineTable", ".", "put", "(", "key", ",", "new", "CacheLine", "(", "value", ",", "useSoftReference", ",", "System", ".", "currentTimeMillis", "(", ")", ")", ")", ";", "}", "else", "{", "cacheLineTable", ".", "put", "(", "key", ",", "new", "CacheLine", "(", "value", ",", "useSoftReference", ")", ")", ";", "}", "if", "(", "maxSize", ">", "0", "&&", "cacheLineTable", ".", "size", "(", ")", ">", "maxSize", ")", "{", "Object", "lastKey", "=", "keyLRUList", ".", "getLast", "(", ")", ";", "removeObject", "(", "lastKey", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "Debug", ".", "logError", "(", "e", ")", ";", "}", "finally", "{", "}", "Debug", ".", "logVerbose", "(", "\"[JdonFramework]cache now size = \"", "+", "keyLRUList", ".", "size", "(", ")", "+", "\" maxSize =\"", "+", "maxSize", "+", "\" this Cache id:\"", "+", "this", ".", "hashCode", "(", ")", ",", "module", ")", ";", "}" ]
Puts or loads the passed element into the cache @param key The key for the element, used to reference it in the hastables and LRU linked list @param value The value of the element
[ "Puts", "or", "loads", "the", "passed", "element", "into", "the", "cache" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/cache/UtilCache.java#L164-L195
23,609
banq/jdonframework
src/main/java/com/jdon/cache/UtilCache.java
UtilCache.get
public Object get(final Object key) { if (key == null) return null; if (!cacheLineTable.containsKey(key)) return null; CacheLine line = (CacheLine) cacheLineTable.get(key); if (hasExpired(line)) { removeObject(key); line = null; } if (line == null) { missCount++; return null; } hitCount++; // double hitPercent = 100*(double)hitCount/(hitCount + missCount); // Debug.logVerbose("[JdonFramework]cache hit percent: " + // percentFormat.format(hitPercent)+"%", module); if (maxSize > 0) { keyLRUList.moveFirst(key); } return line.getValue(); }
java
public Object get(final Object key) { if (key == null) return null; if (!cacheLineTable.containsKey(key)) return null; CacheLine line = (CacheLine) cacheLineTable.get(key); if (hasExpired(line)) { removeObject(key); line = null; } if (line == null) { missCount++; return null; } hitCount++; // double hitPercent = 100*(double)hitCount/(hitCount + missCount); // Debug.logVerbose("[JdonFramework]cache hit percent: " + // percentFormat.format(hitPercent)+"%", module); if (maxSize > 0) { keyLRUList.moveFirst(key); } return line.getValue(); }
[ "public", "Object", "get", "(", "final", "Object", "key", ")", "{", "if", "(", "key", "==", "null", ")", "return", "null", ";", "if", "(", "!", "cacheLineTable", ".", "containsKey", "(", "key", ")", ")", "return", "null", ";", "CacheLine", "line", "=", "(", "CacheLine", ")", "cacheLineTable", ".", "get", "(", "key", ")", ";", "if", "(", "hasExpired", "(", "line", ")", ")", "{", "removeObject", "(", "key", ")", ";", "line", "=", "null", ";", "}", "if", "(", "line", "==", "null", ")", "{", "missCount", "++", ";", "return", "null", ";", "}", "hitCount", "++", ";", "// double hitPercent = 100*(double)hitCount/(hitCount + missCount);\r", "// Debug.logVerbose(\"[JdonFramework]cache hit percent: \" +\r", "// percentFormat.format(hitPercent)+\"%\", module);\r", "if", "(", "maxSize", ">", "0", ")", "{", "keyLRUList", ".", "moveFirst", "(", "key", ")", ";", "}", "return", "line", ".", "getValue", "(", ")", ";", "}" ]
Gets an element from the cache according to the specified key. If the requested element hasExpired, it is removed before it is looked up which causes the function to return null. @param key The key for the element, used to reference it in the hastables and LRU linked list @return The value of the element specified by the key
[ "Gets", "an", "element", "from", "the", "cache", "according", "to", "the", "specified", "key", ".", "If", "the", "requested", "element", "hasExpired", "it", "is", "removed", "before", "it", "is", "looked", "up", "which", "causes", "the", "function", "to", "return", "null", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/cache/UtilCache.java#L207-L234
23,610
banq/jdonframework
src/main/java/com/jdon/cache/UtilCache.java
UtilCache.setMaxSize
public void setMaxSize(long maxSize) { // if the new maxSize is <= 0, clear keyLRUList if (maxSize <= 0) { keyLRUList.clear(); } else if (maxSize > 0 && this.maxSize <= 0) { // if the new maxSize > 0 and the old is <= 0, fill in LRU list - // order will be meaningless for now Iterator keys = cacheLineTable.keySet().iterator(); while (keys.hasNext()) { keyLRUList.add(keys.next()); } } // if the new maxSize is less than the current cache size, shrink the // cache. if (maxSize > 0 && cacheLineTable.size() > maxSize) { while (cacheLineTable.size() > maxSize) { Object lastKey = keyLRUList.getLast(); removeObject(lastKey); } } this.maxSize = maxSize; }
java
public void setMaxSize(long maxSize) { // if the new maxSize is <= 0, clear keyLRUList if (maxSize <= 0) { keyLRUList.clear(); } else if (maxSize > 0 && this.maxSize <= 0) { // if the new maxSize > 0 and the old is <= 0, fill in LRU list - // order will be meaningless for now Iterator keys = cacheLineTable.keySet().iterator(); while (keys.hasNext()) { keyLRUList.add(keys.next()); } } // if the new maxSize is less than the current cache size, shrink the // cache. if (maxSize > 0 && cacheLineTable.size() > maxSize) { while (cacheLineTable.size() > maxSize) { Object lastKey = keyLRUList.getLast(); removeObject(lastKey); } } this.maxSize = maxSize; }
[ "public", "void", "setMaxSize", "(", "long", "maxSize", ")", "{", "// if the new maxSize is <= 0, clear keyLRUList\r", "if", "(", "maxSize", "<=", "0", ")", "{", "keyLRUList", ".", "clear", "(", ")", ";", "}", "else", "if", "(", "maxSize", ">", "0", "&&", "this", ".", "maxSize", "<=", "0", ")", "{", "// if the new maxSize > 0 and the old is <= 0, fill in LRU list -\r", "// order will be meaningless for now\r", "Iterator", "keys", "=", "cacheLineTable", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "keys", ".", "hasNext", "(", ")", ")", "{", "keyLRUList", ".", "add", "(", "keys", ".", "next", "(", ")", ")", ";", "}", "}", "// if the new maxSize is less than the current cache size, shrink the\r", "// cache.\r", "if", "(", "maxSize", ">", "0", "&&", "cacheLineTable", ".", "size", "(", ")", ">", "maxSize", ")", "{", "while", "(", "cacheLineTable", ".", "size", "(", ")", ">", "maxSize", ")", "{", "Object", "lastKey", "=", "keyLRUList", ".", "getLast", "(", ")", ";", "removeObject", "(", "lastKey", ")", ";", "}", "}", "this", ".", "maxSize", "=", "maxSize", ";", "}" ]
Sets the maximum number of elements in the cache. If 0, there is no maximum. @param maxSize The maximum number of elements in the cache
[ "Sets", "the", "maximum", "number", "of", "elements", "in", "the", "cache", ".", "If", "0", "there", "is", "no", "maximum", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/cache/UtilCache.java#L314-L339
23,611
banq/jdonframework
src/main/java/com/jdon/cache/UtilCache.java
UtilCache.setExpireTime
public void setExpireTime(long expireTime) { // if expire time was <= 0 and is now greater, fill expire table now if (this.expireTime <= 0 && expireTime > 0) { long currentTime = System.currentTimeMillis(); Iterator values = cacheLineTable.values().iterator(); while (values.hasNext()) { CacheLine line = (CacheLine) values.next(); line.setLoadTime(currentTime); } } else if (this.expireTime <= 0 && expireTime > 0) {// if expire time // was > 0 and is // now <=, do // nothing, just // leave the load // times in place, // won't hurt // anything... } this.expireTime = expireTime; }
java
public void setExpireTime(long expireTime) { // if expire time was <= 0 and is now greater, fill expire table now if (this.expireTime <= 0 && expireTime > 0) { long currentTime = System.currentTimeMillis(); Iterator values = cacheLineTable.values().iterator(); while (values.hasNext()) { CacheLine line = (CacheLine) values.next(); line.setLoadTime(currentTime); } } else if (this.expireTime <= 0 && expireTime > 0) {// if expire time // was > 0 and is // now <=, do // nothing, just // leave the load // times in place, // won't hurt // anything... } this.expireTime = expireTime; }
[ "public", "void", "setExpireTime", "(", "long", "expireTime", ")", "{", "// if expire time was <= 0 and is now greater, fill expire table now\r", "if", "(", "this", ".", "expireTime", "<=", "0", "&&", "expireTime", ">", "0", ")", "{", "long", "currentTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "Iterator", "values", "=", "cacheLineTable", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "values", ".", "hasNext", "(", ")", ")", "{", "CacheLine", "line", "=", "(", "CacheLine", ")", "values", ".", "next", "(", ")", ";", "line", ".", "setLoadTime", "(", "currentTime", ")", ";", "}", "}", "else", "if", "(", "this", ".", "expireTime", "<=", "0", "&&", "expireTime", ">", "0", ")", "{", "// if expire time\r", "// was > 0 and is\r", "// now <=, do\r", "// nothing, just\r", "// leave the load\r", "// times in place,\r", "// won't hurt\r", "// anything...\r", "}", "this", ".", "expireTime", "=", "expireTime", ";", "}" ]
Sets the expire time for the cache elements. If 0, elements never expire. @param expireTime The expire time for the cache elements
[ "Sets", "the", "expire", "time", "for", "the", "cache", "elements", ".", "If", "0", "elements", "never", "expire", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/cache/UtilCache.java#L356-L378
23,612
banq/jdonframework
src/main/java/com/jdon/cache/UtilCache.java
UtilCache.containsKey
public boolean containsKey(Object key) { CacheLine line = (CacheLine) cacheLineTable.get(key); if (hasExpired(line)) { removeObject(key); line = null; } if (line != null) { return true; } else { return false; } }
java
public boolean containsKey(Object key) { CacheLine line = (CacheLine) cacheLineTable.get(key); if (hasExpired(line)) { removeObject(key); line = null; } if (line != null) { return true; } else { return false; } }
[ "public", "boolean", "containsKey", "(", "Object", "key", ")", "{", "CacheLine", "line", "=", "(", "CacheLine", ")", "cacheLineTable", ".", "get", "(", "key", ")", ";", "if", "(", "hasExpired", "(", "line", ")", ")", "{", "removeObject", "(", "key", ")", ";", "line", "=", "null", ";", "}", "if", "(", "line", "!=", "null", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Returns a boolean specifying whether or not an element with the specified key is in the cache. If the requested element hasExpired, it is removed before it is looked up which causes the function to return false. @param key The key for the element, used to reference it in the hastables and LRU linked list @return True is the cache contains an element corresponding to the specified key, otherwise false
[ "Returns", "a", "boolean", "specifying", "whether", "or", "not", "an", "element", "with", "the", "specified", "key", "is", "in", "the", "cache", ".", "If", "the", "requested", "element", "hasExpired", "it", "is", "removed", "before", "it", "is", "looked", "up", "which", "causes", "the", "function", "to", "return", "false", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/cache/UtilCache.java#L417-L429
23,613
banq/jdonframework
src/main/java/com/jdon/cache/UtilCache.java
UtilCache.hasExpired
public boolean hasExpired(Object key) { if (key == null) return false; CacheLine line = (CacheLine) cacheLineTable.get(key); return hasExpired(line); }
java
public boolean hasExpired(Object key) { if (key == null) return false; CacheLine line = (CacheLine) cacheLineTable.get(key); return hasExpired(line); }
[ "public", "boolean", "hasExpired", "(", "Object", "key", ")", "{", "if", "(", "key", "==", "null", ")", "return", "false", ";", "CacheLine", "line", "=", "(", "CacheLine", ")", "cacheLineTable", ".", "get", "(", "key", ")", ";", "return", "hasExpired", "(", "line", ")", ";", "}" ]
Returns a boolean specifying whether or not the element corresponding to the key has expired. Only returns true if element is in cache and has expired. Error conditions return false, if no expireTable entry, returns true. Always returns false if expireTime <= 0. Also, if SoftReference in the CacheLine object has been cleared by the gc return true. @param key The key for the element, used to reference it in the hastables and LRU linked list @return True is the element corresponding to the specified key has expired, otherwise false
[ "Returns", "a", "boolean", "specifying", "whether", "or", "not", "the", "element", "corresponding", "to", "the", "key", "has", "expired", ".", "Only", "returns", "true", "if", "element", "is", "in", "cache", "and", "has", "expired", ".", "Error", "conditions", "return", "false", "if", "no", "expireTable", "entry", "returns", "true", ".", "Always", "returns", "false", "if", "expireTime", "<", "=", "0", ".", "Also", "if", "SoftReference", "in", "the", "CacheLine", "object", "has", "been", "cleared", "by", "the", "gc", "return", "true", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/cache/UtilCache.java#L444-L451
23,614
banq/jdonframework
src/main/java/com/jdon/cache/UtilCache.java
UtilCache.clearExpired
public void clearExpired() { Iterator keys = cacheLineTable.keySet().iterator(); while (keys.hasNext()) { Object key = keys.next(); if (hasExpired(key)) { removeObject(key); } } }
java
public void clearExpired() { Iterator keys = cacheLineTable.keySet().iterator(); while (keys.hasNext()) { Object key = keys.next(); if (hasExpired(key)) { removeObject(key); } } }
[ "public", "void", "clearExpired", "(", ")", "{", "Iterator", "keys", "=", "cacheLineTable", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "keys", ".", "hasNext", "(", ")", ")", "{", "Object", "key", "=", "keys", ".", "next", "(", ")", ";", "if", "(", "hasExpired", "(", "key", ")", ")", "{", "removeObject", "(", "key", ")", ";", "}", "}", "}" ]
Clears all expired cache entries; also clear any cache entries where the SoftReference in the CacheLine object has been cleared by the gc
[ "Clears", "all", "expired", "cache", "entries", ";", "also", "clear", "any", "cache", "entries", "where", "the", "SoftReference", "in", "the", "CacheLine", "object", "has", "been", "cleared", "by", "the", "gc" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/cache/UtilCache.java#L481-L491
23,615
banq/jdonframework
src/main/java/com/jdon/util/StringUtil.java
StringUtil.decodeString
public static String decodeString(String str) { try { return new String(Base64.decode(str)); } catch (IOException io) { throw new RuntimeException(io.getMessage(), io.getCause()); } }
java
public static String decodeString(String str) { try { return new String(Base64.decode(str)); } catch (IOException io) { throw new RuntimeException(io.getMessage(), io.getCause()); } }
[ "public", "static", "String", "decodeString", "(", "String", "str", ")", "{", "try", "{", "return", "new", "String", "(", "Base64", ".", "decode", "(", "str", ")", ")", ";", "}", "catch", "(", "IOException", "io", ")", "{", "throw", "new", "RuntimeException", "(", "io", ".", "getMessage", "(", ")", ",", "io", ".", "getCause", "(", ")", ")", ";", "}", "}" ]
Decode a string using Base64 encoding. @param str @return String
[ "Decode", "a", "string", "using", "Base64", "encoding", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/StringUtil.java#L552-L558
23,616
banq/jdonframework
src/main/java/com/jdon/container/builder/ContainerRegistry.java
ContainerRegistry.registerAppRoot
public void registerAppRoot() { containerWrapper.register(AppConfigureCollection.NAME, AppConfigureCollection.class); containerWrapper.register(StartablecomponentsRegistry.NAME, StartablecomponentsRegistry.class); }
java
public void registerAppRoot() { containerWrapper.register(AppConfigureCollection.NAME, AppConfigureCollection.class); containerWrapper.register(StartablecomponentsRegistry.NAME, StartablecomponentsRegistry.class); }
[ "public", "void", "registerAppRoot", "(", ")", "{", "containerWrapper", ".", "register", "(", "AppConfigureCollection", ".", "NAME", ",", "AppConfigureCollection", ".", "class", ")", ";", "containerWrapper", ".", "register", "(", "StartablecomponentsRegistry", ".", "NAME", ",", "StartablecomponentsRegistry", ".", "class", ")", ";", "}" ]
register at first before xml and annotation
[ "register", "at", "first", "before", "xml", "and", "annotation" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/container/builder/ContainerRegistry.java#L32-L35
23,617
banq/jdonframework
doc/english/AppContextJdon.java
AppContextJdon.setApplicationContext
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; if (servletContext == null) if (applicationContext instanceof WebApplicationContext) { servletContext = ((WebApplicationContext) applicationContext).getServletContext(); if (servletContext == null) { System.err.print("this class only fit for Spring Web Application"); return; } } // start up jdon AppContextWrapper acw = new ServletContextWrapper(servletContext); ContainerFinder containerFinder = new ContainerFinderImp(); containerWrapper = containerFinder.findContainer(acw); }
java
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; if (servletContext == null) if (applicationContext instanceof WebApplicationContext) { servletContext = ((WebApplicationContext) applicationContext).getServletContext(); if (servletContext == null) { System.err.print("this class only fit for Spring Web Application"); return; } } // start up jdon AppContextWrapper acw = new ServletContextWrapper(servletContext); ContainerFinder containerFinder = new ContainerFinderImp(); containerWrapper = containerFinder.findContainer(acw); }
[ "public", "void", "setApplicationContext", "(", "ApplicationContext", "applicationContext", ")", "throws", "BeansException", "{", "this", ".", "applicationContext", "=", "applicationContext", ";", "if", "(", "servletContext", "==", "null", ")", "if", "(", "applicationContext", "instanceof", "WebApplicationContext", ")", "{", "servletContext", "=", "(", "(", "WebApplicationContext", ")", "applicationContext", ")", ".", "getServletContext", "(", ")", ";", "if", "(", "servletContext", "==", "null", ")", "{", "System", ".", "err", ".", "print", "(", "\"this class only fit for Spring Web Application\"", ")", ";", "return", ";", "}", "}", "// start up jdon\r", "AppContextWrapper", "acw", "=", "new", "ServletContextWrapper", "(", "servletContext", ")", ";", "ContainerFinder", "containerFinder", "=", "new", "ContainerFinderImp", "(", ")", ";", "containerWrapper", "=", "containerFinder", ".", "findContainer", "(", "acw", ")", ";", "}" ]
ApplicationContextAware's method at first run, startup Jdon Framework *
[ "ApplicationContextAware", "s", "method" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/doc/english/AppContextJdon.java#L51-L69
23,618
banq/jdonframework
doc/english/AppContextJdon.java
AppContextJdon.postProcessBeanDefinitionRegistry
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { for (String beanName : registry.getBeanDefinitionNames()) { BeanDefinition beanDefinition = registry.getBeanDefinition(beanName); String beanClassName = beanDefinition.getBeanClassName(); try { Class beanClass = Class.forName(beanClassName); // large project need using Google Collection's lookup for (final Field field : ClassUtil.getAllDecaredFields(beanClass)) { if (field.isAnnotationPresent(Autowired.class)) { // inject jdon components into spring components with // AutoWire; Object o = findBeanClassInJdon(field.getType()); if (o != null) { neededJdonComponents.put(field.getName(), o); } } } } catch (ClassNotFoundException ex) { ex.printStackTrace(); } } }
java
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { for (String beanName : registry.getBeanDefinitionNames()) { BeanDefinition beanDefinition = registry.getBeanDefinition(beanName); String beanClassName = beanDefinition.getBeanClassName(); try { Class beanClass = Class.forName(beanClassName); // large project need using Google Collection's lookup for (final Field field : ClassUtil.getAllDecaredFields(beanClass)) { if (field.isAnnotationPresent(Autowired.class)) { // inject jdon components into spring components with // AutoWire; Object o = findBeanClassInJdon(field.getType()); if (o != null) { neededJdonComponents.put(field.getName(), o); } } } } catch (ClassNotFoundException ex) { ex.printStackTrace(); } } }
[ "public", "void", "postProcessBeanDefinitionRegistry", "(", "BeanDefinitionRegistry", "registry", ")", "throws", "BeansException", "{", "for", "(", "String", "beanName", ":", "registry", ".", "getBeanDefinitionNames", "(", ")", ")", "{", "BeanDefinition", "beanDefinition", "=", "registry", ".", "getBeanDefinition", "(", "beanName", ")", ";", "String", "beanClassName", "=", "beanDefinition", ".", "getBeanClassName", "(", ")", ";", "try", "{", "Class", "beanClass", "=", "Class", ".", "forName", "(", "beanClassName", ")", ";", "// large project need using Google Collection's lookup\r", "for", "(", "final", "Field", "field", ":", "ClassUtil", ".", "getAllDecaredFields", "(", "beanClass", ")", ")", "{", "if", "(", "field", ".", "isAnnotationPresent", "(", "Autowired", ".", "class", ")", ")", "{", "// inject jdon components into spring components with\r", "// AutoWire;\r", "Object", "o", "=", "findBeanClassInJdon", "(", "field", ".", "getType", "(", ")", ")", ";", "if", "(", "o", "!=", "null", ")", "{", "neededJdonComponents", ".", "put", "(", "field", ".", "getName", "(", ")", ",", "o", ")", ";", "}", "}", "}", "}", "catch", "(", "ClassNotFoundException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}", "}" ]
BeanDefinitionRegistryPostProcessor's method second run: check which spring bean that need injected from Jdon.
[ "BeanDefinitionRegistryPostProcessor", "s", "method" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/doc/english/AppContextJdon.java#L77-L99
23,619
banq/jdonframework
src/main/java/com/jdon/async/disruptor/DisruptorForCommandFactory.java
DisruptorForCommandFactory.createDisruptor
public Disruptor createDisruptor(String topic) { Disruptor disruptor = createDisruptorWithEventHandler(topic); if (disruptor != null) disruptor.start(); return disruptor; }
java
public Disruptor createDisruptor(String topic) { Disruptor disruptor = createDisruptorWithEventHandler(topic); if (disruptor != null) disruptor.start(); return disruptor; }
[ "public", "Disruptor", "createDisruptor", "(", "String", "topic", ")", "{", "Disruptor", "disruptor", "=", "createDisruptorWithEventHandler", "(", "topic", ")", ";", "if", "(", "disruptor", "!=", "null", ")", "disruptor", ".", "start", "(", ")", ";", "return", "disruptor", ";", "}" ]
one event one EventDisruptor @param topic @return
[ "one", "event", "one", "EventDisruptor" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/async/disruptor/DisruptorForCommandFactory.java#L94-L100
23,620
banq/jdonframework
src/main/java/com/jdon/aop/joinpoint/AdvisorChainFactory.java
AdvisorChainFactory.create
public List<MethodInterceptor> create(TargetMetaDef targetMetaDef) throws Exception { Debug.logVerbose("[JdonFramework] enter create PointcutAdvisor ", module); if (targetMetaDef.isEJB()) { if (interceptorsForEJB.isEmpty()) { createEJBAdvice(targetMetaDef); } return interceptorsForEJB; } if (interceptors.isEmpty()) { createPOJOAdvice(targetMetaDef); } List<MethodInterceptor> targets = targetInterceptors.get(targetMetaDef.getName()); if (targets == null) { targets = createTargetPOJOAdvice(targetMetaDef.getName()); targetInterceptors.put(targetMetaDef.getName(), targets); } return interceptors; }
java
public List<MethodInterceptor> create(TargetMetaDef targetMetaDef) throws Exception { Debug.logVerbose("[JdonFramework] enter create PointcutAdvisor ", module); if (targetMetaDef.isEJB()) { if (interceptorsForEJB.isEmpty()) { createEJBAdvice(targetMetaDef); } return interceptorsForEJB; } if (interceptors.isEmpty()) { createPOJOAdvice(targetMetaDef); } List<MethodInterceptor> targets = targetInterceptors.get(targetMetaDef.getName()); if (targets == null) { targets = createTargetPOJOAdvice(targetMetaDef.getName()); targetInterceptors.put(targetMetaDef.getName(), targets); } return interceptors; }
[ "public", "List", "<", "MethodInterceptor", ">", "create", "(", "TargetMetaDef", "targetMetaDef", ")", "throws", "Exception", "{", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] enter create PointcutAdvisor \"", ",", "module", ")", ";", "if", "(", "targetMetaDef", ".", "isEJB", "(", ")", ")", "{", "if", "(", "interceptorsForEJB", ".", "isEmpty", "(", ")", ")", "{", "createEJBAdvice", "(", "targetMetaDef", ")", ";", "}", "return", "interceptorsForEJB", ";", "}", "if", "(", "interceptors", ".", "isEmpty", "(", ")", ")", "{", "createPOJOAdvice", "(", "targetMetaDef", ")", ";", "}", "List", "<", "MethodInterceptor", ">", "targets", "=", "targetInterceptors", ".", "get", "(", "targetMetaDef", ".", "getName", "(", ")", ")", ";", "if", "(", "targets", "==", "null", ")", "{", "targets", "=", "createTargetPOJOAdvice", "(", "targetMetaDef", ".", "getName", "(", ")", ")", ";", "targetInterceptors", ".", "put", "(", "targetMetaDef", ".", "getName", "(", ")", ",", "targets", ")", ";", "}", "return", "interceptors", ";", "}" ]
create the all interceptor instances, and put them into interceptorsChain; the interceptors that prointcut is for SERVIERS are in the front, and then the EJB Interceptors , in the back there are POJO interceptors. you can change the orders bu replacing this class in container.xml
[ "create", "the", "all", "interceptor", "instances", "and", "put", "them", "into", "interceptorsChain", ";", "the", "interceptors", "that", "prointcut", "is", "for", "SERVIERS", "are", "in", "the", "front", "and", "then", "the", "EJB", "Interceptors", "in", "the", "back", "there", "are", "POJO", "interceptors", ".", "you", "can", "change", "the", "orders", "bu", "replacing", "this", "class", "in", "container", ".", "xml" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/aop/joinpoint/AdvisorChainFactory.java#L70-L90
23,621
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/ModelSaveAction.java
ModelSaveAction.getModelForm
protected ModelForm getModelForm(ModelHandler modelHandler, ActionForm actionForm, HttpServletRequest request) throws Exception { if (actionForm == null) { throw new Exception(" must define form-bean as 'action' name in struts-config.xml "); } ModelForm strutsForm = (ModelForm) actionForm; String action = strutsForm.getAction(); if ((action == null) || (action.length() == 0)) throw new Exception(" Need a field : <html:hidden property=action /> in jsp's form! "); return strutsForm; }
java
protected ModelForm getModelForm(ModelHandler modelHandler, ActionForm actionForm, HttpServletRequest request) throws Exception { if (actionForm == null) { throw new Exception(" must define form-bean as 'action' name in struts-config.xml "); } ModelForm strutsForm = (ModelForm) actionForm; String action = strutsForm.getAction(); if ((action == null) || (action.length() == 0)) throw new Exception(" Need a field : <html:hidden property=action /> in jsp's form! "); return strutsForm; }
[ "protected", "ModelForm", "getModelForm", "(", "ModelHandler", "modelHandler", ",", "ActionForm", "actionForm", ",", "HttpServletRequest", "request", ")", "throws", "Exception", "{", "if", "(", "actionForm", "==", "null", ")", "{", "throw", "new", "Exception", "(", "\" must define form-bean as 'action' name in struts-config.xml \"", ")", ";", "}", "ModelForm", "strutsForm", "=", "(", "ModelForm", ")", "actionForm", ";", "String", "action", "=", "strutsForm", ".", "getAction", "(", ")", ";", "if", "(", "(", "action", "==", "null", ")", "||", "(", "action", ".", "length", "(", ")", "==", "0", ")", ")", "throw", "new", "Exception", "(", "\" Need a field : <html:hidden property=action /> in jsp's form! \"", ")", ";", "return", "strutsForm", ";", "}" ]
get a ModelForm or create it.
[ "get", "a", "ModelForm", "or", "create", "it", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/ModelSaveAction.java#L119-L131
23,622
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/ModelSaveAction.java
ModelSaveAction.makeModel
protected Object makeModel(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, ModelHandler modelHandler) throws Exception { Object model = null; try { String formName = actionMapping.getName(); if (formName == null) throw new Exception("no define the FormName in struts_config.xml"); ModelMapping modelMapping = modelHandler.getModelMapping(); String keyName = modelMapping.getKeyName(); String keyValue = request.getParameter(keyName); if (keyValue == null) { Debug.logError("[JdonFramework]Need a model's key field : <html:hidden property=MODEL KEY /> in jsp's form! ", module); } modelManager.removeCache(keyValue); Debug.logVerbose("[JdonFramework] no model cache, keyName is " + keyName, module); model = modelManager.getModelObject(formName); } catch (Exception e) { Debug.logError("[JdonFramework] makeModel error: " + e); throw new Exception(e); } return model; }
java
protected Object makeModel(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, ModelHandler modelHandler) throws Exception { Object model = null; try { String formName = actionMapping.getName(); if (formName == null) throw new Exception("no define the FormName in struts_config.xml"); ModelMapping modelMapping = modelHandler.getModelMapping(); String keyName = modelMapping.getKeyName(); String keyValue = request.getParameter(keyName); if (keyValue == null) { Debug.logError("[JdonFramework]Need a model's key field : <html:hidden property=MODEL KEY /> in jsp's form! ", module); } modelManager.removeCache(keyValue); Debug.logVerbose("[JdonFramework] no model cache, keyName is " + keyName, module); model = modelManager.getModelObject(formName); } catch (Exception e) { Debug.logError("[JdonFramework] makeModel error: " + e); throw new Exception(e); } return model; }
[ "protected", "Object", "makeModel", "(", "ActionMapping", "actionMapping", ",", "ActionForm", "actionForm", ",", "HttpServletRequest", "request", ",", "ModelHandler", "modelHandler", ")", "throws", "Exception", "{", "Object", "model", "=", "null", ";", "try", "{", "String", "formName", "=", "actionMapping", ".", "getName", "(", ")", ";", "if", "(", "formName", "==", "null", ")", "throw", "new", "Exception", "(", "\"no define the FormName in struts_config.xml\"", ")", ";", "ModelMapping", "modelMapping", "=", "modelHandler", ".", "getModelMapping", "(", ")", ";", "String", "keyName", "=", "modelMapping", ".", "getKeyName", "(", ")", ";", "String", "keyValue", "=", "request", ".", "getParameter", "(", "keyName", ")", ";", "if", "(", "keyValue", "==", "null", ")", "{", "Debug", ".", "logError", "(", "\"[JdonFramework]Need a model's key field : <html:hidden property=MODEL KEY /> in jsp's form! \"", ",", "module", ")", ";", "}", "modelManager", ".", "removeCache", "(", "keyValue", ")", ";", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] no model cache, keyName is \"", "+", "keyName", ",", "module", ")", ";", "model", "=", "modelManager", ".", "getModelObject", "(", "formName", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Debug", ".", "logError", "(", "\"[JdonFramework] makeModel error: \"", "+", "e", ")", ";", "throw", "new", "Exception", "(", "e", ")", ";", "}", "return", "model", ";", "}" ]
create a Model from the jdonframework.xml @param actionMapping @param actionForm @param request @return Model @throws java.lang.Exception
[ "create", "a", "Model", "from", "the", "jdonframework", ".", "xml" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/ModelSaveAction.java#L142-L166
23,623
banq/jdonframework
JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/HessianToJdonServlet.java
HessianToJdonServlet.service
@Override public void service(final ServletRequest req, final ServletResponse resp) throws ServletException, IOException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) resp; final String beanName = request.getPathInfo().substring(1); // remove "/" htorp.process(beanName, request, response); }
java
@Override public void service(final ServletRequest req, final ServletResponse resp) throws ServletException, IOException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) resp; final String beanName = request.getPathInfo().substring(1); // remove "/" htorp.process(beanName, request, response); }
[ "@", "Override", "public", "void", "service", "(", "final", "ServletRequest", "req", ",", "final", "ServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "HttpServletRequest", "request", "=", "(", "HttpServletRequest", ")", "req", ";", "HttpServletResponse", "response", "=", "(", "HttpServletResponse", ")", "resp", ";", "final", "String", "beanName", "=", "request", ".", "getPathInfo", "(", ")", ".", "substring", "(", "1", ")", ";", "// remove \"/\"\r", "htorp", ".", "process", "(", "beanName", ",", "request", ",", "response", ")", ";", "}" ]
Servlet to handle incoming Hessian requests and invoke HessianToJdonRequestProcessor. @param req ServletRequest @param resp ServletResponse @throws javax.servlet.ServletException If errors occur @throws java.io.IOException If IO errors occur
[ "Servlet", "to", "handle", "incoming", "Hessian", "requests", "and", "invoke", "HessianToJdonRequestProcessor", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/HessianToJdonServlet.java#L56-L63
23,624
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toSqlDate
public static java.sql.Date toSqlDate(String date) { java.util.Date newDate = toDate(date, "00:00:00"); if (newDate != null) return new java.sql.Date(newDate.getTime()); else return null; }
java
public static java.sql.Date toSqlDate(String date) { java.util.Date newDate = toDate(date, "00:00:00"); if (newDate != null) return new java.sql.Date(newDate.getTime()); else return null; }
[ "public", "static", "java", ".", "sql", ".", "Date", "toSqlDate", "(", "String", "date", ")", "{", "java", ".", "util", ".", "Date", "newDate", "=", "toDate", "(", "date", ",", "\"00:00:00\"", ")", ";", "if", "(", "newDate", "!=", "null", ")", "return", "new", "java", ".", "sql", ".", "Date", "(", "newDate", ".", "getTime", "(", ")", ")", ";", "else", "return", "null", ";", "}" ]
Converts a date String into a java.sql.Date @param date The date String: MM/DD/YYYY @return A java.sql.Date made from the date String
[ "Converts", "a", "date", "String", "into", "a", "java", ".", "sql", ".", "Date" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L97-L104
23,625
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toSqlDate
public static java.sql.Date toSqlDate(String monthStr, String dayStr, String yearStr) { java.util.Date newDate = toDate(monthStr, dayStr, yearStr, "0", "0", "0"); if (newDate != null) return new java.sql.Date(newDate.getTime()); else return null; }
java
public static java.sql.Date toSqlDate(String monthStr, String dayStr, String yearStr) { java.util.Date newDate = toDate(monthStr, dayStr, yearStr, "0", "0", "0"); if (newDate != null) return new java.sql.Date(newDate.getTime()); else return null; }
[ "public", "static", "java", ".", "sql", ".", "Date", "toSqlDate", "(", "String", "monthStr", ",", "String", "dayStr", ",", "String", "yearStr", ")", "{", "java", ".", "util", ".", "Date", "newDate", "=", "toDate", "(", "monthStr", ",", "dayStr", ",", "yearStr", ",", "\"0\"", ",", "\"0\"", ",", "\"0\"", ")", ";", "if", "(", "newDate", "!=", "null", ")", "return", "new", "java", ".", "sql", ".", "Date", "(", "newDate", ".", "getTime", "(", ")", ")", ";", "else", "return", "null", ";", "}" ]
Makes a java.sql.Date from separate Strings for month, day, year @param monthStr The month String @param dayStr The day String @param yearStr The year String @return A java.sql.Date made from separate Strings for month, day, year
[ "Makes", "a", "java", ".", "sql", ".", "Date", "from", "separate", "Strings", "for", "month", "day", "year" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L117-L124
23,626
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toSqlDate
public static java.sql.Date toSqlDate(int month, int day, int year) { java.util.Date newDate = toDate(month, day, year, 0, 0, 0); if (newDate != null) return new java.sql.Date(newDate.getTime()); else return null; }
java
public static java.sql.Date toSqlDate(int month, int day, int year) { java.util.Date newDate = toDate(month, day, year, 0, 0, 0); if (newDate != null) return new java.sql.Date(newDate.getTime()); else return null; }
[ "public", "static", "java", ".", "sql", ".", "Date", "toSqlDate", "(", "int", "month", ",", "int", "day", ",", "int", "year", ")", "{", "java", ".", "util", ".", "Date", "newDate", "=", "toDate", "(", "month", ",", "day", ",", "year", ",", "0", ",", "0", ",", "0", ")", ";", "if", "(", "newDate", "!=", "null", ")", "return", "new", "java", ".", "sql", ".", "Date", "(", "newDate", ".", "getTime", "(", ")", ")", ";", "else", "return", "null", ";", "}" ]
Makes a java.sql.Date from separate ints for month, day, year @param month The month int @param day The day int @param year The year int @return A java.sql.Date made from separate ints for month, day, year
[ "Makes", "a", "java", ".", "sql", ".", "Date", "from", "separate", "ints", "for", "month", "day", "year" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L137-L144
23,627
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toSqlTime
public static java.sql.Time toSqlTime(String time) { java.util.Date newDate = toDate("1/1/1970", time); if (newDate != null) return new java.sql.Time(newDate.getTime()); else return null; }
java
public static java.sql.Time toSqlTime(String time) { java.util.Date newDate = toDate("1/1/1970", time); if (newDate != null) return new java.sql.Time(newDate.getTime()); else return null; }
[ "public", "static", "java", ".", "sql", ".", "Time", "toSqlTime", "(", "String", "time", ")", "{", "java", ".", "util", ".", "Date", "newDate", "=", "toDate", "(", "\"1/1/1970\"", ",", "time", ")", ";", "if", "(", "newDate", "!=", "null", ")", "return", "new", "java", ".", "sql", ".", "Time", "(", "newDate", ".", "getTime", "(", ")", ")", ";", "else", "return", "null", ";", "}" ]
Converts a time String into a java.sql.Time @param time The time String: either HH:MM or HH:MM:SS @return A java.sql.Time made from the time String
[ "Converts", "a", "time", "String", "into", "a", "java", ".", "sql", ".", "Time" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L153-L160
23,628
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toSqlTime
public static java.sql.Time toSqlTime(String hourStr, String minuteStr, String secondStr) { java.util.Date newDate = toDate("0", "0", "0", hourStr, minuteStr, secondStr); if (newDate != null) return new java.sql.Time(newDate.getTime()); else return null; }
java
public static java.sql.Time toSqlTime(String hourStr, String minuteStr, String secondStr) { java.util.Date newDate = toDate("0", "0", "0", hourStr, minuteStr, secondStr); if (newDate != null) return new java.sql.Time(newDate.getTime()); else return null; }
[ "public", "static", "java", ".", "sql", ".", "Time", "toSqlTime", "(", "String", "hourStr", ",", "String", "minuteStr", ",", "String", "secondStr", ")", "{", "java", ".", "util", ".", "Date", "newDate", "=", "toDate", "(", "\"0\"", ",", "\"0\"", ",", "\"0\"", ",", "hourStr", ",", "minuteStr", ",", "secondStr", ")", ";", "if", "(", "newDate", "!=", "null", ")", "return", "new", "java", ".", "sql", ".", "Time", "(", "newDate", ".", "getTime", "(", ")", ")", ";", "else", "return", "null", ";", "}" ]
Makes a java.sql.Time from separate Strings for hour, minute, and second. @param hourStr The hour String @param minuteStr The minute String @param secondStr The second String @return A java.sql.Time made from separate Strings for hour, minute, and second.
[ "Makes", "a", "java", ".", "sql", ".", "Time", "from", "separate", "Strings", "for", "hour", "minute", "and", "second", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L174-L181
23,629
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toSqlTime
public static java.sql.Time toSqlTime(int hour, int minute, int second) { java.util.Date newDate = toDate(0, 0, 0, hour, minute, second); if (newDate != null) return new java.sql.Time(newDate.getTime()); else return null; }
java
public static java.sql.Time toSqlTime(int hour, int minute, int second) { java.util.Date newDate = toDate(0, 0, 0, hour, minute, second); if (newDate != null) return new java.sql.Time(newDate.getTime()); else return null; }
[ "public", "static", "java", ".", "sql", ".", "Time", "toSqlTime", "(", "int", "hour", ",", "int", "minute", ",", "int", "second", ")", "{", "java", ".", "util", ".", "Date", "newDate", "=", "toDate", "(", "0", ",", "0", ",", "0", ",", "hour", ",", "minute", ",", "second", ")", ";", "if", "(", "newDate", "!=", "null", ")", "return", "new", "java", ".", "sql", ".", "Time", "(", "newDate", ".", "getTime", "(", ")", ")", ";", "else", "return", "null", ";", "}" ]
Makes a java.sql.Time from separate ints for hour, minute, and second. @param hour The hour int @param minute The minute int @param second The second int @return A java.sql.Time made from separate ints for hour, minute, and second.
[ "Makes", "a", "java", ".", "sql", ".", "Time", "from", "separate", "ints", "for", "hour", "minute", "and", "second", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L195-L202
23,630
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toTimestamp
public static java.sql.Timestamp toTimestamp(String dateTime) { java.util.Date newDate = toDate(dateTime); if (newDate != null) return new java.sql.Timestamp(newDate.getTime()); else return null; }
java
public static java.sql.Timestamp toTimestamp(String dateTime) { java.util.Date newDate = toDate(dateTime); if (newDate != null) return new java.sql.Timestamp(newDate.getTime()); else return null; }
[ "public", "static", "java", ".", "sql", ".", "Timestamp", "toTimestamp", "(", "String", "dateTime", ")", "{", "java", ".", "util", ".", "Date", "newDate", "=", "toDate", "(", "dateTime", ")", ";", "if", "(", "newDate", "!=", "null", ")", "return", "new", "java", ".", "sql", ".", "Timestamp", "(", "newDate", ".", "getTime", "(", ")", ")", ";", "else", "return", "null", ";", "}" ]
Converts a date and time String into a Timestamp @param dateTime A combined data and time string in the format "MM/DD/YYYY HH:MM:SS", the seconds are optional @return The corresponding Timestamp
[ "Converts", "a", "date", "and", "time", "String", "into", "a", "Timestamp" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L212-L219
23,631
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toTimestamp
public static java.sql.Timestamp toTimestamp(String date, String time) { java.util.Date newDate = toDate(date, time); if (newDate != null) return new java.sql.Timestamp(newDate.getTime()); else return null; }
java
public static java.sql.Timestamp toTimestamp(String date, String time) { java.util.Date newDate = toDate(date, time); if (newDate != null) return new java.sql.Timestamp(newDate.getTime()); else return null; }
[ "public", "static", "java", ".", "sql", ".", "Timestamp", "toTimestamp", "(", "String", "date", ",", "String", "time", ")", "{", "java", ".", "util", ".", "Date", "newDate", "=", "toDate", "(", "date", ",", "time", ")", ";", "if", "(", "newDate", "!=", "null", ")", "return", "new", "java", ".", "sql", ".", "Timestamp", "(", "newDate", ".", "getTime", "(", ")", ")", ";", "else", "return", "null", ";", "}" ]
Converts a date String and a time String into a Timestamp @param date The date String: MM/DD/YYYY @param time The time String: either HH:MM or HH:MM:SS @return A Timestamp made from the date and time Strings
[ "Converts", "a", "date", "String", "and", "a", "time", "String", "into", "a", "Timestamp" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L230-L237
23,632
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toTimestamp
public static java.sql.Timestamp toTimestamp(String monthStr, String dayStr, String yearStr, String hourStr, String minuteStr, String secondStr) { java.util.Date newDate = toDate(monthStr, dayStr, yearStr, hourStr, minuteStr, secondStr); if (newDate != null) return new java.sql.Timestamp(newDate.getTime()); else return null; }
java
public static java.sql.Timestamp toTimestamp(String monthStr, String dayStr, String yearStr, String hourStr, String minuteStr, String secondStr) { java.util.Date newDate = toDate(monthStr, dayStr, yearStr, hourStr, minuteStr, secondStr); if (newDate != null) return new java.sql.Timestamp(newDate.getTime()); else return null; }
[ "public", "static", "java", ".", "sql", ".", "Timestamp", "toTimestamp", "(", "String", "monthStr", ",", "String", "dayStr", ",", "String", "yearStr", ",", "String", "hourStr", ",", "String", "minuteStr", ",", "String", "secondStr", ")", "{", "java", ".", "util", ".", "Date", "newDate", "=", "toDate", "(", "monthStr", ",", "dayStr", ",", "yearStr", ",", "hourStr", ",", "minuteStr", ",", "secondStr", ")", ";", "if", "(", "newDate", "!=", "null", ")", "return", "new", "java", ".", "sql", ".", "Timestamp", "(", "newDate", ".", "getTime", "(", ")", ")", ";", "else", "return", "null", ";", "}" ]
Makes a Timestamp from separate Strings for month, day, year, hour, minute, and second. @param monthStr The month String @param dayStr The day String @param yearStr The year String @param hourStr The hour String @param minuteStr The minute String @param secondStr The second String @return A Timestamp made from separate Strings for month, day, year, hour, minute, and second.
[ "Makes", "a", "Timestamp", "from", "separate", "Strings", "for", "month", "day", "year", "hour", "minute", "and", "second", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L258-L265
23,633
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toTimestamp
public static java.sql.Timestamp toTimestamp(int month, int day, int year, int hour, int minute, int second) { java.util.Date newDate = toDate(month, day, year, hour, minute, second); if (newDate != null) return new java.sql.Timestamp(newDate.getTime()); else return null; }
java
public static java.sql.Timestamp toTimestamp(int month, int day, int year, int hour, int minute, int second) { java.util.Date newDate = toDate(month, day, year, hour, minute, second); if (newDate != null) return new java.sql.Timestamp(newDate.getTime()); else return null; }
[ "public", "static", "java", ".", "sql", ".", "Timestamp", "toTimestamp", "(", "int", "month", ",", "int", "day", ",", "int", "year", ",", "int", "hour", ",", "int", "minute", ",", "int", "second", ")", "{", "java", ".", "util", ".", "Date", "newDate", "=", "toDate", "(", "month", ",", "day", ",", "year", ",", "hour", ",", "minute", ",", "second", ")", ";", "if", "(", "newDate", "!=", "null", ")", "return", "new", "java", ".", "sql", ".", "Timestamp", "(", "newDate", ".", "getTime", "(", ")", ")", ";", "else", "return", "null", ";", "}" ]
Makes a Timestamp from separate ints for month, day, year, hour, minute, and second. @param month The month int @param day The day int @param year The year int @param hour The hour int @param minute The minute int @param second The second int @return A Timestamp made from separate ints for month, day, year, hour, minute, and second.
[ "Makes", "a", "Timestamp", "from", "separate", "ints", "for", "month", "day", "year", "hour", "minute", "and", "second", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L286-L293
23,634
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toDate
public static java.util.Date toDate(String dateTime) { // dateTime must have one space between the date and time... String date = dateTime.substring(0, dateTime.indexOf(" ")); String time = dateTime.substring(dateTime.indexOf(" ") + 1); return toDate(date, time); }
java
public static java.util.Date toDate(String dateTime) { // dateTime must have one space between the date and time... String date = dateTime.substring(0, dateTime.indexOf(" ")); String time = dateTime.substring(dateTime.indexOf(" ") + 1); return toDate(date, time); }
[ "public", "static", "java", ".", "util", ".", "Date", "toDate", "(", "String", "dateTime", ")", "{", "// dateTime must have one space between the date and time...\r", "String", "date", "=", "dateTime", ".", "substring", "(", "0", ",", "dateTime", ".", "indexOf", "(", "\" \"", ")", ")", ";", "String", "time", "=", "dateTime", ".", "substring", "(", "dateTime", ".", "indexOf", "(", "\" \"", ")", "+", "1", ")", ";", "return", "toDate", "(", "date", ",", "time", ")", ";", "}" ]
Converts a date and time String into a Date @param dateTime A combined data and time string in the format "MM/DD/YYYY HH:MM:SS", the seconds are optional @return The corresponding Date
[ "Converts", "a", "date", "and", "time", "String", "into", "a", "Date" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L303-L309
23,635
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toDate
public static java.util.Date toDate(String date, String time) { if (date == null || time == null) return null; String month; String day; String year; String hour; String minute; String second; int dateSlash1 = date.indexOf("/"); int dateSlash2 = date.lastIndexOf("/"); if (dateSlash1 <= 0 || dateSlash1 == dateSlash2) return null; int timeColon1 = time.indexOf(":"); int timeColon2 = time.lastIndexOf(":"); if (timeColon1 <= 0) return null; month = date.substring(0, dateSlash1); day = date.substring(dateSlash1 + 1, dateSlash2); year = date.substring(dateSlash2 + 1); hour = time.substring(0, timeColon1); if (timeColon1 == timeColon2) { minute = time.substring(timeColon1 + 1); second = "0"; } else { minute = time.substring(timeColon1 + 1, timeColon2); second = time.substring(timeColon2 + 1); } return toDate(month, day, year, hour, minute, second); }
java
public static java.util.Date toDate(String date, String time) { if (date == null || time == null) return null; String month; String day; String year; String hour; String minute; String second; int dateSlash1 = date.indexOf("/"); int dateSlash2 = date.lastIndexOf("/"); if (dateSlash1 <= 0 || dateSlash1 == dateSlash2) return null; int timeColon1 = time.indexOf(":"); int timeColon2 = time.lastIndexOf(":"); if (timeColon1 <= 0) return null; month = date.substring(0, dateSlash1); day = date.substring(dateSlash1 + 1, dateSlash2); year = date.substring(dateSlash2 + 1); hour = time.substring(0, timeColon1); if (timeColon1 == timeColon2) { minute = time.substring(timeColon1 + 1); second = "0"; } else { minute = time.substring(timeColon1 + 1, timeColon2); second = time.substring(timeColon2 + 1); } return toDate(month, day, year, hour, minute, second); }
[ "public", "static", "java", ".", "util", ".", "Date", "toDate", "(", "String", "date", ",", "String", "time", ")", "{", "if", "(", "date", "==", "null", "||", "time", "==", "null", ")", "return", "null", ";", "String", "month", ";", "String", "day", ";", "String", "year", ";", "String", "hour", ";", "String", "minute", ";", "String", "second", ";", "int", "dateSlash1", "=", "date", ".", "indexOf", "(", "\"/\"", ")", ";", "int", "dateSlash2", "=", "date", ".", "lastIndexOf", "(", "\"/\"", ")", ";", "if", "(", "dateSlash1", "<=", "0", "||", "dateSlash1", "==", "dateSlash2", ")", "return", "null", ";", "int", "timeColon1", "=", "time", ".", "indexOf", "(", "\":\"", ")", ";", "int", "timeColon2", "=", "time", ".", "lastIndexOf", "(", "\":\"", ")", ";", "if", "(", "timeColon1", "<=", "0", ")", "return", "null", ";", "month", "=", "date", ".", "substring", "(", "0", ",", "dateSlash1", ")", ";", "day", "=", "date", ".", "substring", "(", "dateSlash1", "+", "1", ",", "dateSlash2", ")", ";", "year", "=", "date", ".", "substring", "(", "dateSlash2", "+", "1", ")", ";", "hour", "=", "time", ".", "substring", "(", "0", ",", "timeColon1", ")", ";", "if", "(", "timeColon1", "==", "timeColon2", ")", "{", "minute", "=", "time", ".", "substring", "(", "timeColon1", "+", "1", ")", ";", "second", "=", "\"0\"", ";", "}", "else", "{", "minute", "=", "time", ".", "substring", "(", "timeColon1", "+", "1", ",", "timeColon2", ")", ";", "second", "=", "time", ".", "substring", "(", "timeColon2", "+", "1", ")", ";", "}", "return", "toDate", "(", "month", ",", "day", ",", "year", ",", "hour", ",", "minute", ",", "second", ")", ";", "}" ]
Converts a date String and a time String into a Date @param date The date String: MM/DD/YYYY @param time The time String: either HH:MM or HH:MM:SS @return A Date made from the date and time Strings
[ "Converts", "a", "date", "String", "and", "a", "time", "String", "into", "a", "Date" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L320-L354
23,636
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toDate
public static java.util.Date toDate(String monthStr, String dayStr, String yearStr, String hourStr, String minuteStr, String secondStr) { int month, day, year, hour, minute, second; try { month = Integer.parseInt(monthStr); day = Integer.parseInt(dayStr); year = Integer.parseInt(yearStr); hour = Integer.parseInt(hourStr); minute = Integer.parseInt(minuteStr); second = Integer.parseInt(secondStr); } catch (Exception e) { return null; } return toDate(month, day, year, hour, minute, second); }
java
public static java.util.Date toDate(String monthStr, String dayStr, String yearStr, String hourStr, String minuteStr, String secondStr) { int month, day, year, hour, minute, second; try { month = Integer.parseInt(monthStr); day = Integer.parseInt(dayStr); year = Integer.parseInt(yearStr); hour = Integer.parseInt(hourStr); minute = Integer.parseInt(minuteStr); second = Integer.parseInt(secondStr); } catch (Exception e) { return null; } return toDate(month, day, year, hour, minute, second); }
[ "public", "static", "java", ".", "util", ".", "Date", "toDate", "(", "String", "monthStr", ",", "String", "dayStr", ",", "String", "yearStr", ",", "String", "hourStr", ",", "String", "minuteStr", ",", "String", "secondStr", ")", "{", "int", "month", ",", "day", ",", "year", ",", "hour", ",", "minute", ",", "second", ";", "try", "{", "month", "=", "Integer", ".", "parseInt", "(", "monthStr", ")", ";", "day", "=", "Integer", ".", "parseInt", "(", "dayStr", ")", ";", "year", "=", "Integer", ".", "parseInt", "(", "yearStr", ")", ";", "hour", "=", "Integer", ".", "parseInt", "(", "hourStr", ")", ";", "minute", "=", "Integer", ".", "parseInt", "(", "minuteStr", ")", ";", "second", "=", "Integer", ".", "parseInt", "(", "secondStr", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "null", ";", "}", "return", "toDate", "(", "month", ",", "day", ",", "year", ",", "hour", ",", "minute", ",", "second", ")", ";", "}" ]
Makes a Date from separate Strings for month, day, year, hour, minute, and second. @param monthStr The month String @param dayStr The day String @param yearStr The year String @param hourStr The hour String @param minuteStr The minute String @param secondStr The second String @return A Date made from separate Strings for month, day, year, hour, minute, and second.
[ "Makes", "a", "Date", "from", "separate", "Strings", "for", "month", "day", "year", "hour", "minute", "and", "second", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L375-L389
23,637
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toDate
public static java.util.Date toDate(int month, int day, int year, int hour, int minute, int second) { Calendar calendar = Calendar.getInstance(); try { calendar.set(year, month - 1, day, hour, minute, second); } catch (Exception e) { return null; } return new java.util.Date(calendar.getTime().getTime()); }
java
public static java.util.Date toDate(int month, int day, int year, int hour, int minute, int second) { Calendar calendar = Calendar.getInstance(); try { calendar.set(year, month - 1, day, hour, minute, second); } catch (Exception e) { return null; } return new java.util.Date(calendar.getTime().getTime()); }
[ "public", "static", "java", ".", "util", ".", "Date", "toDate", "(", "int", "month", ",", "int", "day", ",", "int", "year", ",", "int", "hour", ",", "int", "minute", ",", "int", "second", ")", "{", "Calendar", "calendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "try", "{", "calendar", ".", "set", "(", "year", ",", "month", "-", "1", ",", "day", ",", "hour", ",", "minute", ",", "second", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "null", ";", "}", "return", "new", "java", ".", "util", ".", "Date", "(", "calendar", ".", "getTime", "(", ")", ".", "getTime", "(", ")", ")", ";", "}" ]
Makes a Date from separate ints for month, day, year, hour, minute, and second. @param month The month int @param day The day int @param year The year int @param hour The hour int @param minute The minute int @param second The second int @return A Date made from separate ints for month, day, year, hour, minute, and second.
[ "Makes", "a", "Date", "from", "separate", "ints", "for", "month", "day", "year", "hour", "minute", "and", "second", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L410-L419
23,638
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.monthBegin
public static java.sql.Timestamp monthBegin() { Calendar mth = Calendar.getInstance(); mth.set(Calendar.DAY_OF_MONTH, 1); mth.set(Calendar.HOUR_OF_DAY, 0); mth.set(Calendar.MINUTE, 0); mth.set(Calendar.SECOND, 0); mth.set(Calendar.AM_PM, Calendar.AM); return new java.sql.Timestamp(mth.getTime().getTime()); }
java
public static java.sql.Timestamp monthBegin() { Calendar mth = Calendar.getInstance(); mth.set(Calendar.DAY_OF_MONTH, 1); mth.set(Calendar.HOUR_OF_DAY, 0); mth.set(Calendar.MINUTE, 0); mth.set(Calendar.SECOND, 0); mth.set(Calendar.AM_PM, Calendar.AM); return new java.sql.Timestamp(mth.getTime().getTime()); }
[ "public", "static", "java", ".", "sql", ".", "Timestamp", "monthBegin", "(", ")", "{", "Calendar", "mth", "=", "Calendar", ".", "getInstance", "(", ")", ";", "mth", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "mth", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "0", ")", ";", "mth", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "0", ")", ";", "mth", ".", "set", "(", "Calendar", ".", "SECOND", ",", "0", ")", ";", "mth", ".", "set", "(", "Calendar", ".", "AM_PM", ",", "Calendar", ".", "AM", ")", ";", "return", "new", "java", ".", "sql", ".", "Timestamp", "(", "mth", ".", "getTime", "(", ")", ".", "getTime", "(", ")", ")", ";", "}" ]
Makes a Timestamp for the beginning of the month @return A Timestamp of the beginning of the month
[ "Makes", "a", "Timestamp", "for", "the", "beginning", "of", "the", "month" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L537-L546
23,639
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/file/MultiImageForm.java
MultiImageForm.validate
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = null; // has the maximum length been exceeded? Boolean maxLengthExceeded = (Boolean) request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED); if ((maxLengthExceeded != null) && (maxLengthExceeded.booleanValue())) { errors = new ActionErrors(); errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new ActionMessage("maxLengthExceeded")); } else if (fileMap.size() > MAX_IMAGES_COUNT) { errors = new ActionErrors(); errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new ActionMessage("maxLengthExceeded")); } else { // retrieve the file name Iterator iter = fileMap.values().iterator(); while (iter.hasNext()) { FormFile file = (FormFile) iter.next(); String fileName = file.getFileName(); if ((!fileName.toLowerCase().endsWith(".gif")) && !(fileName.toLowerCase().endsWith(".jpg")) && !(fileName.toLowerCase().endsWith(".png"))) { errors = new ActionErrors(); errors.add("notImage", new ActionMessage("notImage")); } } } return errors; }
java
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = null; // has the maximum length been exceeded? Boolean maxLengthExceeded = (Boolean) request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED); if ((maxLengthExceeded != null) && (maxLengthExceeded.booleanValue())) { errors = new ActionErrors(); errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new ActionMessage("maxLengthExceeded")); } else if (fileMap.size() > MAX_IMAGES_COUNT) { errors = new ActionErrors(); errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new ActionMessage("maxLengthExceeded")); } else { // retrieve the file name Iterator iter = fileMap.values().iterator(); while (iter.hasNext()) { FormFile file = (FormFile) iter.next(); String fileName = file.getFileName(); if ((!fileName.toLowerCase().endsWith(".gif")) && !(fileName.toLowerCase().endsWith(".jpg")) && !(fileName.toLowerCase().endsWith(".png"))) { errors = new ActionErrors(); errors.add("notImage", new ActionMessage("notImage")); } } } return errors; }
[ "public", "ActionErrors", "validate", "(", "ActionMapping", "mapping", ",", "HttpServletRequest", "request", ")", "{", "ActionErrors", "errors", "=", "null", ";", "// has the maximum length been exceeded?\r", "Boolean", "maxLengthExceeded", "=", "(", "Boolean", ")", "request", ".", "getAttribute", "(", "MultipartRequestHandler", ".", "ATTRIBUTE_MAX_LENGTH_EXCEEDED", ")", ";", "if", "(", "(", "maxLengthExceeded", "!=", "null", ")", "&&", "(", "maxLengthExceeded", ".", "booleanValue", "(", ")", ")", ")", "{", "errors", "=", "new", "ActionErrors", "(", ")", ";", "errors", ".", "add", "(", "ERROR_PROPERTY_MAX_LENGTH_EXCEEDED", ",", "new", "ActionMessage", "(", "\"maxLengthExceeded\"", ")", ")", ";", "}", "else", "if", "(", "fileMap", ".", "size", "(", ")", ">", "MAX_IMAGES_COUNT", ")", "{", "errors", "=", "new", "ActionErrors", "(", ")", ";", "errors", ".", "add", "(", "ERROR_PROPERTY_MAX_LENGTH_EXCEEDED", ",", "new", "ActionMessage", "(", "\"maxLengthExceeded\"", ")", ")", ";", "}", "else", "{", "// retrieve the file name\r", "Iterator", "iter", "=", "fileMap", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "FormFile", "file", "=", "(", "FormFile", ")", "iter", ".", "next", "(", ")", ";", "String", "fileName", "=", "file", ".", "getFileName", "(", ")", ";", "if", "(", "(", "!", "fileName", ".", "toLowerCase", "(", ")", ".", "endsWith", "(", "\".gif\"", ")", ")", "&&", "!", "(", "fileName", ".", "toLowerCase", "(", ")", ".", "endsWith", "(", "\".jpg\"", ")", ")", "&&", "!", "(", "fileName", ".", "toLowerCase", "(", ")", ".", "endsWith", "(", "\".png\"", ")", ")", ")", "{", "errors", "=", "new", "ActionErrors", "(", ")", ";", "errors", ".", "add", "(", "\"notImage\"", ",", "new", "ActionMessage", "(", "\"notImage\"", ")", ")", ";", "}", "}", "}", "return", "errors", ";", "}" ]
Check to make sure the client hasn't exceeded the maximum allowed upload size inside of this validate method.
[ "Check", "to", "make", "sure", "the", "client", "hasn", "t", "exceeded", "the", "maximum", "allowed", "upload", "size", "inside", "of", "this", "validate", "method", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/file/MultiImageForm.java#L94-L119
23,640
banq/jdonframework
src/main/java/com/jdon/aop/reflection/MethodInvokerUtil.java
MethodInvokerUtil.execute
public Object execute(Method method, Object targetObj, Object[] p_args) throws Throwable { try { if ((method == null) || (targetObj == null)) Debug.logError("[JdonFramework] no method or target, please check your configure", module); if (p_args == null) p_args = new Object[0]; Debug.logVerbose("[JdonFramework] method invoke: " + targetObj.getClass().getName() + " method=" + method.getName(), module); Object result = method.invoke(targetObj, p_args); Debug.logVerbose("[JdonFramework] method invoke successfully ", module); return result; } catch (IllegalArgumentException iex) { String errorInfo = "Errors happened in your method:[" + targetObj.getClass().getName() + "." + method.getName() + "]"; Debug.logError(errorInfo, module); errorInfo = "[JdonFramework] method invoke IllegalArgumentException: " + iex + " method argument type :[" + method.getParameterTypes() + "], but method arguments value p_args type:" + p_args.getClass().getName(); Debug.logError(errorInfo, module); throw new Throwable(errorInfo, iex); } catch (InvocationTargetException ex) { Debug.logError(ex); String errorInfo = "Errors happened in your method:[" + targetObj.getClass().getName() + "." + method.getName() + "]"; Debug.logError(errorInfo, module); throw new Throwable(errorInfo); } catch (IllegalAccessException ex) { String errorInfo = "Errors happened in your method:[" + targetObj.getClass().getName() + "." + method.getName() + "]"; Debug.logError(errorInfo, module); Debug.logError("[JdonFramework] method invoke IllegalAccessException: " + ex, module); throw new Throwable("access method:" + method + " " + ex, ex); } catch (Exception ex) { String errorInfo = "Errors happened in your method:[" + targetObj.getClass().getName() + "." + method.getName() + "]"; Debug.logError(errorInfo, module); Debug.logError("[JdonFramework] method invoke error: " + ex, module); throw new Throwable(" method invoke error: " + ex); } }
java
public Object execute(Method method, Object targetObj, Object[] p_args) throws Throwable { try { if ((method == null) || (targetObj == null)) Debug.logError("[JdonFramework] no method or target, please check your configure", module); if (p_args == null) p_args = new Object[0]; Debug.logVerbose("[JdonFramework] method invoke: " + targetObj.getClass().getName() + " method=" + method.getName(), module); Object result = method.invoke(targetObj, p_args); Debug.logVerbose("[JdonFramework] method invoke successfully ", module); return result; } catch (IllegalArgumentException iex) { String errorInfo = "Errors happened in your method:[" + targetObj.getClass().getName() + "." + method.getName() + "]"; Debug.logError(errorInfo, module); errorInfo = "[JdonFramework] method invoke IllegalArgumentException: " + iex + " method argument type :[" + method.getParameterTypes() + "], but method arguments value p_args type:" + p_args.getClass().getName(); Debug.logError(errorInfo, module); throw new Throwable(errorInfo, iex); } catch (InvocationTargetException ex) { Debug.logError(ex); String errorInfo = "Errors happened in your method:[" + targetObj.getClass().getName() + "." + method.getName() + "]"; Debug.logError(errorInfo, module); throw new Throwable(errorInfo); } catch (IllegalAccessException ex) { String errorInfo = "Errors happened in your method:[" + targetObj.getClass().getName() + "." + method.getName() + "]"; Debug.logError(errorInfo, module); Debug.logError("[JdonFramework] method invoke IllegalAccessException: " + ex, module); throw new Throwable("access method:" + method + " " + ex, ex); } catch (Exception ex) { String errorInfo = "Errors happened in your method:[" + targetObj.getClass().getName() + "." + method.getName() + "]"; Debug.logError(errorInfo, module); Debug.logError("[JdonFramework] method invoke error: " + ex, module); throw new Throwable(" method invoke error: " + ex); } }
[ "public", "Object", "execute", "(", "Method", "method", ",", "Object", "targetObj", ",", "Object", "[", "]", "p_args", ")", "throws", "Throwable", "{", "try", "{", "if", "(", "(", "method", "==", "null", ")", "||", "(", "targetObj", "==", "null", ")", ")", "Debug", ".", "logError", "(", "\"[JdonFramework] no method or target, please check your configure\"", ",", "module", ")", ";", "if", "(", "p_args", "==", "null", ")", "p_args", "=", "new", "Object", "[", "0", "]", ";", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] method invoke: \"", "+", "targetObj", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" method=\"", "+", "method", ".", "getName", "(", ")", ",", "module", ")", ";", "Object", "result", "=", "method", ".", "invoke", "(", "targetObj", ",", "p_args", ")", ";", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] method invoke successfully \"", ",", "module", ")", ";", "return", "result", ";", "}", "catch", "(", "IllegalArgumentException", "iex", ")", "{", "String", "errorInfo", "=", "\"Errors happened in your method:[\"", "+", "targetObj", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".\"", "+", "method", ".", "getName", "(", ")", "+", "\"]\"", ";", "Debug", ".", "logError", "(", "errorInfo", ",", "module", ")", ";", "errorInfo", "=", "\"[JdonFramework] method invoke IllegalArgumentException: \"", "+", "iex", "+", "\" method argument type :[\"", "+", "method", ".", "getParameterTypes", "(", ")", "+", "\"], but method arguments value p_args type:\"", "+", "p_args", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "Debug", ".", "logError", "(", "errorInfo", ",", "module", ")", ";", "throw", "new", "Throwable", "(", "errorInfo", ",", "iex", ")", ";", "}", "catch", "(", "InvocationTargetException", "ex", ")", "{", "Debug", ".", "logError", "(", "ex", ")", ";", "String", "errorInfo", "=", "\"Errors happened in your method:[\"", "+", "targetObj", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".\"", "+", "method", ".", "getName", "(", ")", "+", "\"]\"", ";", "Debug", ".", "logError", "(", "errorInfo", ",", "module", ")", ";", "throw", "new", "Throwable", "(", "errorInfo", ")", ";", "}", "catch", "(", "IllegalAccessException", "ex", ")", "{", "String", "errorInfo", "=", "\"Errors happened in your method:[\"", "+", "targetObj", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".\"", "+", "method", ".", "getName", "(", ")", "+", "\"]\"", ";", "Debug", ".", "logError", "(", "errorInfo", ",", "module", ")", ";", "Debug", ".", "logError", "(", "\"[JdonFramework] method invoke IllegalAccessException: \"", "+", "ex", ",", "module", ")", ";", "throw", "new", "Throwable", "(", "\"access method:\"", "+", "method", "+", "\" \"", "+", "ex", ",", "ex", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "String", "errorInfo", "=", "\"Errors happened in your method:[\"", "+", "targetObj", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".\"", "+", "method", ".", "getName", "(", ")", "+", "\"]\"", ";", "Debug", ".", "logError", "(", "errorInfo", ",", "module", ")", ";", "Debug", ".", "logError", "(", "\"[JdonFramework] method invoke error: \"", "+", "ex", ",", "module", ")", ";", "throw", "new", "Throwable", "(", "\" method invoke error: \"", "+", "ex", ")", ";", "}", "}" ]
the service execute by method reflection @param method @param targetObj @param p_args @return @throws Throwable
[ "the", "service", "execute", "by", "method", "reflection" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/aop/reflection/MethodInvokerUtil.java#L54-L88
23,641
banq/jdonframework
src/main/java/com/jdon/aop/reflection/MethodInvokerUtil.java
MethodInvokerUtil.createTargetObject
public Object createTargetObject(TargetServiceFactory targetServiceFactory) { Debug.logVerbose("[JdonFramework] now getTargetObject by visitor ", module); Object targetObjRef = null; try { TargetMetaRequest targetMetaRequest = targetMetaRequestsHolder.getTargetMetaRequest(); TargetMetaDef targetMetaDef = targetMetaRequest.getTargetMetaDef(); if (targetMetaDef.isEJB()) { // cache the ejb object ComponentVisitor cm = targetMetaRequest.getComponentVisitor(); targetMetaRequest.setVisitableName(ComponentKeys.TARGETSERVICE_FACTORY); Debug.logVerbose(ComponentKeys.TARGETSERVICE_FACTORY + " in action (cache)", module); targetObjRef = cm.visit(); } else { Debug.logVerbose("[JdonFramework] not active targer service instance cache !!!!", module); targetObjRef = targetServiceFactory.create(); } } catch (Exception e) { Debug.logError("[JdonFramework]createTargetObject error: " + e, module); } return targetObjRef; }
java
public Object createTargetObject(TargetServiceFactory targetServiceFactory) { Debug.logVerbose("[JdonFramework] now getTargetObject by visitor ", module); Object targetObjRef = null; try { TargetMetaRequest targetMetaRequest = targetMetaRequestsHolder.getTargetMetaRequest(); TargetMetaDef targetMetaDef = targetMetaRequest.getTargetMetaDef(); if (targetMetaDef.isEJB()) { // cache the ejb object ComponentVisitor cm = targetMetaRequest.getComponentVisitor(); targetMetaRequest.setVisitableName(ComponentKeys.TARGETSERVICE_FACTORY); Debug.logVerbose(ComponentKeys.TARGETSERVICE_FACTORY + " in action (cache)", module); targetObjRef = cm.visit(); } else { Debug.logVerbose("[JdonFramework] not active targer service instance cache !!!!", module); targetObjRef = targetServiceFactory.create(); } } catch (Exception e) { Debug.logError("[JdonFramework]createTargetObject error: " + e, module); } return targetObjRef; }
[ "public", "Object", "createTargetObject", "(", "TargetServiceFactory", "targetServiceFactory", ")", "{", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] now getTargetObject by visitor \"", ",", "module", ")", ";", "Object", "targetObjRef", "=", "null", ";", "try", "{", "TargetMetaRequest", "targetMetaRequest", "=", "targetMetaRequestsHolder", ".", "getTargetMetaRequest", "(", ")", ";", "TargetMetaDef", "targetMetaDef", "=", "targetMetaRequest", ".", "getTargetMetaDef", "(", ")", ";", "if", "(", "targetMetaDef", ".", "isEJB", "(", ")", ")", "{", "// cache the ejb object\r", "ComponentVisitor", "cm", "=", "targetMetaRequest", ".", "getComponentVisitor", "(", ")", ";", "targetMetaRequest", ".", "setVisitableName", "(", "ComponentKeys", ".", "TARGETSERVICE_FACTORY", ")", ";", "Debug", ".", "logVerbose", "(", "ComponentKeys", ".", "TARGETSERVICE_FACTORY", "+", "\" in action (cache)\"", ",", "module", ")", ";", "targetObjRef", "=", "cm", ".", "visit", "(", ")", ";", "}", "else", "{", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] not active targer service instance cache !!!!\"", ",", "module", ")", ";", "targetObjRef", "=", "targetServiceFactory", ".", "create", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "Debug", ".", "logError", "(", "\"[JdonFramework]createTargetObject error: \"", "+", "e", ",", "module", ")", ";", "}", "return", "targetObjRef", ";", "}" ]
if target service is ejb object, cache it, so this function can active stateful session bean. @param targetServiceFactory @param targetMetaDef @return @throws Exception
[ "if", "target", "service", "is", "ejb", "object", "cache", "it", "so", "this", "function", "can", "active", "stateful", "session", "bean", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/aop/reflection/MethodInvokerUtil.java#L99-L118
23,642
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandler.java
ModelHandler.initModelIF
public Object initModelIF(EventModel em, ModelForm form, HttpServletRequest request) throws Exception { return initModel(request); }
java
public Object initModelIF(EventModel em, ModelForm form, HttpServletRequest request) throws Exception { return initModel(request); }
[ "public", "Object", "initModelIF", "(", "EventModel", "em", ",", "ModelForm", "form", ",", "HttpServletRequest", "request", ")", "throws", "Exception", "{", "return", "initModel", "(", "request", ")", ";", "}" ]
Presentation layer need a ModelForm instance that include some initially data, these data must obtain from service. this method implements these functions by deleagating service. this mehtod is only availabe in pushing create view page in pushing editable view page, the model is obtained by it's key, not from this method; @param request @return Model instance @throws Exception @see CreateViewPageUtil
[ "Presentation", "layer", "need", "a", "ModelForm", "instance", "that", "include", "some", "initially", "data", "these", "data", "must", "obtain", "from", "service", ".", "this", "method", "implements", "these", "functions", "by", "deleagating", "service", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandler.java#L102-L104
23,643
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandler.java
ModelHandler.findModelIF
public Object findModelIF(Object keyValue, HttpServletRequest request) throws Exception { return findModelByKey((String) keyValue, request); // for old version }
java
public Object findModelIF(Object keyValue, HttpServletRequest request) throws Exception { return findModelByKey((String) keyValue, request); // for old version }
[ "public", "Object", "findModelIF", "(", "Object", "keyValue", ",", "HttpServletRequest", "request", ")", "throws", "Exception", "{", "return", "findModelByKey", "(", "(", "String", ")", "keyValue", ",", "request", ")", ";", "// for old version\r", "}" ]
obtain a existed Model instance by his primtive key. @param keyValue primtive key @param request @return Model @throws java.lang.Exception
[ "obtain", "a", "existed", "Model", "instance", "by", "his", "primtive", "key", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandler.java#L126-L128
23,644
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandler.java
ModelHandler.modelCopyToForm
public void modelCopyToForm(Model model, ModelForm form) throws Exception { try { PropertyUtils.copyProperties(form, model); } catch (Exception e) { String error = " Model:" + model.getClass().getName() + " copy To ModelForm:" + form.getClass().getName() + " error:" + e; Debug.logError(error, module); throw new Exception(error); } }
java
public void modelCopyToForm(Model model, ModelForm form) throws Exception { try { PropertyUtils.copyProperties(form, model); } catch (Exception e) { String error = " Model:" + model.getClass().getName() + " copy To ModelForm:" + form.getClass().getName() + " error:" + e; Debug.logError(error, module); throw new Exception(error); } }
[ "public", "void", "modelCopyToForm", "(", "Model", "model", ",", "ModelForm", "form", ")", "throws", "Exception", "{", "try", "{", "PropertyUtils", ".", "copyProperties", "(", "form", ",", "model", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "String", "error", "=", "\" Model:\"", "+", "model", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" copy To ModelForm:\"", "+", "form", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" error:\"", "+", "e", ";", "Debug", ".", "logError", "(", "error", ",", "module", ")", ";", "throw", "new", "Exception", "(", "error", ")", ";", "}", "}" ]
for old version below 1.4
[ "for", "old", "version", "below", "1", ".", "4" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandler.java#L148-L156
23,645
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandler.java
ModelHandler.formCopyToModelIF
public void formCopyToModelIF(ModelForm form, Object model) throws Exception { if (model == null || form == null) return; if (model instanceof Model) { // for below 1.4 version formCopyToModel(form, (Model) model); return; } try { PropertyUtils.copyProperties(model, form); } catch (InvocationTargetException ie) { String error = "error happened in getXXX method of ModelForm:" + form.getClass().getName() + " error:" + ie; Debug.logError(error, module); throw new Exception(error); } catch (Exception e) { String error = " ModelForm:" + form.getClass().getName() + " copy To Model:" + model.getClass().getName() + " error:" + e; Debug.logError(error, module); throw new Exception(error); } }
java
public void formCopyToModelIF(ModelForm form, Object model) throws Exception { if (model == null || form == null) return; if (model instanceof Model) { // for below 1.4 version formCopyToModel(form, (Model) model); return; } try { PropertyUtils.copyProperties(model, form); } catch (InvocationTargetException ie) { String error = "error happened in getXXX method of ModelForm:" + form.getClass().getName() + " error:" + ie; Debug.logError(error, module); throw new Exception(error); } catch (Exception e) { String error = " ModelForm:" + form.getClass().getName() + " copy To Model:" + model.getClass().getName() + " error:" + e; Debug.logError(error, module); throw new Exception(error); } }
[ "public", "void", "formCopyToModelIF", "(", "ModelForm", "form", ",", "Object", "model", ")", "throws", "Exception", "{", "if", "(", "model", "==", "null", "||", "form", "==", "null", ")", "return", ";", "if", "(", "model", "instanceof", "Model", ")", "{", "// for below 1.4 version\r", "formCopyToModel", "(", "form", ",", "(", "Model", ")", "model", ")", ";", "return", ";", "}", "try", "{", "PropertyUtils", ".", "copyProperties", "(", "model", ",", "form", ")", ";", "}", "catch", "(", "InvocationTargetException", "ie", ")", "{", "String", "error", "=", "\"error happened in getXXX method of ModelForm:\"", "+", "form", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" error:\"", "+", "ie", ";", "Debug", ".", "logError", "(", "error", ",", "module", ")", ";", "throw", "new", "Exception", "(", "error", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "String", "error", "=", "\" ModelForm:\"", "+", "form", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" copy To Model:\"", "+", "model", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" error:\"", "+", "e", ";", "Debug", ".", "logError", "(", "error", ",", "module", ")", ";", "throw", "new", "Exception", "(", "error", ")", ";", "}", "}" ]
ModelForm object's data transfer to Model object default implemention is copy mapping between with them; another implemention: String propertyName = StringUtil.getLastString(model.getClass().getName()); Model hasDataModel = PropertyUtils.getProperty(form, propertyName); model = hasDataModel; extends this class , and override this method @param model @param form @throws java.lang.Exception
[ "ModelForm", "object", "s", "data", "transfer", "to", "Model", "object" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandler.java#L214-L233
23,646
banq/jdonframework
JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/io/JdonJavaSerializer.java
JdonJavaSerializer.writeObject
public void writeObject(Object obj, AbstractHessianOutput out) throws IOException { if (out.addRef(obj)) { return; } Class< ? > cl = obj.getClass(); try { if (writeReplace != null) { Object repl = writeReplace.invoke(obj, new Object[0]); out.removeRef(obj); out.writeObject(repl); out.replaceRef(repl, obj); return; } } catch (Exception e) { log.log(Level.FINE, e.toString(), e); } int ref = out.writeObjectBegin(cl.getName()); if (ref < -1) { // Hessian 1.1 uses a map for (int i = 0; i < localMethods.length; i++) { Object value = null; try { value = localMethods[i].invoke(obj, (Object []) null); } catch (Exception e) { log.log(Level.FINE, e.toString(), e); } if (!LazyUtil.isPropertyInitialized(value)) { continue; } out.writeString(localNames[i]); out.writeObject(value); } out.writeMapEnd(); } else { if (ref == -1) { out.writeInt(localNames.length); for (int i = 0; i < localNames.length; i++) { out.writeString(localNames[i]); } out.writeObjectBegin(cl.getName()); } for (int i = 0; i < localMethods.length; i++) { Object value = null; try { value = localMethods[i].invoke(obj, (Object []) null); } catch (Exception e) { log.log(Level.FINER, e.toString(), e); } if (!LazyUtil.isPropertyInitialized(value)) { continue; } out.writeObject(value); } } }
java
public void writeObject(Object obj, AbstractHessianOutput out) throws IOException { if (out.addRef(obj)) { return; } Class< ? > cl = obj.getClass(); try { if (writeReplace != null) { Object repl = writeReplace.invoke(obj, new Object[0]); out.removeRef(obj); out.writeObject(repl); out.replaceRef(repl, obj); return; } } catch (Exception e) { log.log(Level.FINE, e.toString(), e); } int ref = out.writeObjectBegin(cl.getName()); if (ref < -1) { // Hessian 1.1 uses a map for (int i = 0; i < localMethods.length; i++) { Object value = null; try { value = localMethods[i].invoke(obj, (Object []) null); } catch (Exception e) { log.log(Level.FINE, e.toString(), e); } if (!LazyUtil.isPropertyInitialized(value)) { continue; } out.writeString(localNames[i]); out.writeObject(value); } out.writeMapEnd(); } else { if (ref == -1) { out.writeInt(localNames.length); for (int i = 0; i < localNames.length; i++) { out.writeString(localNames[i]); } out.writeObjectBegin(cl.getName()); } for (int i = 0; i < localMethods.length; i++) { Object value = null; try { value = localMethods[i].invoke(obj, (Object []) null); } catch (Exception e) { log.log(Level.FINER, e.toString(), e); } if (!LazyUtil.isPropertyInitialized(value)) { continue; } out.writeObject(value); } } }
[ "public", "void", "writeObject", "(", "Object", "obj", ",", "AbstractHessianOutput", "out", ")", "throws", "IOException", "{", "if", "(", "out", ".", "addRef", "(", "obj", ")", ")", "{", "return", ";", "}", "Class", "<", "?", ">", "cl", "=", "obj", ".", "getClass", "(", ")", ";", "try", "{", "if", "(", "writeReplace", "!=", "null", ")", "{", "Object", "repl", "=", "writeReplace", ".", "invoke", "(", "obj", ",", "new", "Object", "[", "0", "]", ")", ";", "out", ".", "removeRef", "(", "obj", ")", ";", "out", ".", "writeObject", "(", "repl", ")", ";", "out", ".", "replaceRef", "(", "repl", ",", "obj", ")", ";", "return", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "log", "(", "Level", ".", "FINE", ",", "e", ".", "toString", "(", ")", ",", "e", ")", ";", "}", "int", "ref", "=", "out", ".", "writeObjectBegin", "(", "cl", ".", "getName", "(", ")", ")", ";", "if", "(", "ref", "<", "-", "1", ")", "{", "// Hessian 1.1 uses a map\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "localMethods", ".", "length", ";", "i", "++", ")", "{", "Object", "value", "=", "null", ";", "try", "{", "value", "=", "localMethods", "[", "i", "]", ".", "invoke", "(", "obj", ",", "(", "Object", "[", "]", ")", "null", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "log", "(", "Level", ".", "FINE", ",", "e", ".", "toString", "(", ")", ",", "e", ")", ";", "}", "if", "(", "!", "LazyUtil", ".", "isPropertyInitialized", "(", "value", ")", ")", "{", "continue", ";", "}", "out", ".", "writeString", "(", "localNames", "[", "i", "]", ")", ";", "out", ".", "writeObject", "(", "value", ")", ";", "}", "out", ".", "writeMapEnd", "(", ")", ";", "}", "else", "{", "if", "(", "ref", "==", "-", "1", ")", "{", "out", ".", "writeInt", "(", "localNames", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "localNames", ".", "length", ";", "i", "++", ")", "{", "out", ".", "writeString", "(", "localNames", "[", "i", "]", ")", ";", "}", "out", ".", "writeObjectBegin", "(", "cl", ".", "getName", "(", ")", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "localMethods", ".", "length", ";", "i", "++", ")", "{", "Object", "value", "=", "null", ";", "try", "{", "value", "=", "localMethods", "[", "i", "]", ".", "invoke", "(", "obj", ",", "(", "Object", "[", "]", ")", "null", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "log", "(", "Level", ".", "FINER", ",", "e", ".", "toString", "(", ")", ",", "e", ")", ";", "}", "if", "(", "!", "LazyUtil", ".", "isPropertyInitialized", "(", "value", ")", ")", "{", "continue", ";", "}", "out", ".", "writeObject", "(", "value", ")", ";", "}", "}", "}" ]
Write object in output @param obj - Object @param out - AbstractHessianOutput @throws IOException - occur if input/output error occur
[ "Write", "object", "in", "output" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/io/JdonJavaSerializer.java#L124-L199
23,647
banq/jdonframework
JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/io/JdonJavaSerializer.java
JdonJavaSerializer.findSetter
private Method findSetter(Method []methods, String getterName, Class< ? > arg) { String setterName = "set" + getterName.substring(INT_VALUE); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (!method.getName().equals(setterName)) { continue; } if (!method.getReturnType().equals(void.class)) { continue; } Class< ? > []params = method.getParameterTypes(); if (params.length == 1 && params[0].equals(arg)) { return method; } } return null; }
java
private Method findSetter(Method []methods, String getterName, Class< ? > arg) { String setterName = "set" + getterName.substring(INT_VALUE); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (!method.getName().equals(setterName)) { continue; } if (!method.getReturnType().equals(void.class)) { continue; } Class< ? > []params = method.getParameterTypes(); if (params.length == 1 && params[0].equals(arg)) { return method; } } return null; }
[ "private", "Method", "findSetter", "(", "Method", "[", "]", "methods", ",", "String", "getterName", ",", "Class", "<", "?", ">", "arg", ")", "{", "String", "setterName", "=", "\"set\"", "+", "getterName", ".", "substring", "(", "INT_VALUE", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "methods", ".", "length", ";", "i", "++", ")", "{", "Method", "method", "=", "methods", "[", "i", "]", ";", "if", "(", "!", "method", ".", "getName", "(", ")", ".", "equals", "(", "setterName", ")", ")", "{", "continue", ";", "}", "if", "(", "!", "method", ".", "getReturnType", "(", ")", ".", "equals", "(", "void", ".", "class", ")", ")", "{", "continue", ";", "}", "Class", "<", "?", ">", "[", "]", "params", "=", "method", ".", "getParameterTypes", "(", ")", ";", "if", "(", "params", ".", "length", "==", "1", "&&", "params", "[", "0", "]", ".", "equals", "(", "arg", ")", ")", "{", "return", "method", ";", "}", "}", "return", "null", ";", "}" ]
Finds any matching setter.
[ "Finds", "any", "matching", "setter", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/io/JdonJavaSerializer.java#L204-L225
23,648
banq/jdonframework
src/main/java/com/jdon/controller/service/ServiceFacade.java
ServiceFacade.getServiceFactory
public ServiceFactory getServiceFactory(AppContextWrapper sc) { ContainerWrapper containerWrapper = containerFinder.findContainer(sc); ServiceFactory serviceFactory = (ServiceFactory) containerWrapper.lookup(ComponentKeys.WEBSERVICE_FACTORY); return serviceFactory; }
java
public ServiceFactory getServiceFactory(AppContextWrapper sc) { ContainerWrapper containerWrapper = containerFinder.findContainer(sc); ServiceFactory serviceFactory = (ServiceFactory) containerWrapper.lookup(ComponentKeys.WEBSERVICE_FACTORY); return serviceFactory; }
[ "public", "ServiceFactory", "getServiceFactory", "(", "AppContextWrapper", "sc", ")", "{", "ContainerWrapper", "containerWrapper", "=", "containerFinder", ".", "findContainer", "(", "sc", ")", ";", "ServiceFactory", "serviceFactory", "=", "(", "ServiceFactory", ")", "containerWrapper", ".", "lookup", "(", "ComponentKeys", ".", "WEBSERVICE_FACTORY", ")", ";", "return", "serviceFactory", ";", "}" ]
the model configure in jdonframework.xml will execute the service directly. and the remote servlet will call this method @return Returns the serviceFactory.
[ "the", "model", "configure", "in", "jdonframework", ".", "xml", "will", "execute", "the", "service", "directly", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/controller/service/ServiceFacade.java#L56-L60
23,649
banq/jdonframework
src/main/java/com/jdon/controller/service/WebServiceImp.java
WebServiceImp.execute
public Object execute(String name, MethodMetaArgs methodMetaArgs, AppContextWrapper acw) throws Exception { if ((methodMetaArgs == null) || (methodMetaArgs.getMethodName() == null)) { Debug.logWarning(" methodMetaArgs is null. cann't invoke service.execute"); } Debug.logVerbose("++++++++++++++++++++++++++++++<begin: invoking from jdonframework.xml", module); Debug.logVerbose("+++++++++++++++execute new service='" + name + "' method='" + methodMetaArgs.getMethodName() + "'", module); ContainerWrapper cw = containerCallback.getContainerWrapper(); TargetMetaDef targetMetaDef = userTargetMetaDefFactory.getTargetMetaDef(name, cw); if (targetMetaDef == null) return null; Object result = execute(targetMetaDef, methodMetaArgs, acw); Debug.logVerbose("+++++++++++++++execute service='" + name + "' method='" + methodMetaArgs.getMethodName() + "' successfully!", module); Debug.logVerbose("++++++++++++++++++++++++++++++<end:", module); return result; }
java
public Object execute(String name, MethodMetaArgs methodMetaArgs, AppContextWrapper acw) throws Exception { if ((methodMetaArgs == null) || (methodMetaArgs.getMethodName() == null)) { Debug.logWarning(" methodMetaArgs is null. cann't invoke service.execute"); } Debug.logVerbose("++++++++++++++++++++++++++++++<begin: invoking from jdonframework.xml", module); Debug.logVerbose("+++++++++++++++execute new service='" + name + "' method='" + methodMetaArgs.getMethodName() + "'", module); ContainerWrapper cw = containerCallback.getContainerWrapper(); TargetMetaDef targetMetaDef = userTargetMetaDefFactory.getTargetMetaDef(name, cw); if (targetMetaDef == null) return null; Object result = execute(targetMetaDef, methodMetaArgs, acw); Debug.logVerbose("+++++++++++++++execute service='" + name + "' method='" + methodMetaArgs.getMethodName() + "' successfully!", module); Debug.logVerbose("++++++++++++++++++++++++++++++<end:", module); return result; }
[ "public", "Object", "execute", "(", "String", "name", ",", "MethodMetaArgs", "methodMetaArgs", ",", "AppContextWrapper", "acw", ")", "throws", "Exception", "{", "if", "(", "(", "methodMetaArgs", "==", "null", ")", "||", "(", "methodMetaArgs", ".", "getMethodName", "(", ")", "==", "null", ")", ")", "{", "Debug", ".", "logWarning", "(", "\" methodMetaArgs is null. cann't invoke service.execute\"", ")", ";", "}", "Debug", ".", "logVerbose", "(", "\"++++++++++++++++++++++++++++++<begin: invoking from jdonframework.xml\"", ",", "module", ")", ";", "Debug", ".", "logVerbose", "(", "\"+++++++++++++++execute new service='\"", "+", "name", "+", "\"' method='\"", "+", "methodMetaArgs", ".", "getMethodName", "(", ")", "+", "\"'\"", ",", "module", ")", ";", "ContainerWrapper", "cw", "=", "containerCallback", ".", "getContainerWrapper", "(", ")", ";", "TargetMetaDef", "targetMetaDef", "=", "userTargetMetaDefFactory", ".", "getTargetMetaDef", "(", "name", ",", "cw", ")", ";", "if", "(", "targetMetaDef", "==", "null", ")", "return", "null", ";", "Object", "result", "=", "execute", "(", "targetMetaDef", ",", "methodMetaArgs", ",", "acw", ")", ";", "Debug", ".", "logVerbose", "(", "\"+++++++++++++++execute service='\"", "+", "name", "+", "\"' method='\"", "+", "methodMetaArgs", ".", "getMethodName", "(", ")", "+", "\"' successfully!\"", ",", "module", ")", ";", "Debug", ".", "logVerbose", "(", "\"++++++++++++++++++++++++++++++<end:\"", ",", "module", ")", ";", "return", "result", ";", "}" ]
running the service, and return the result without session
[ "running", "the", "service", "and", "return", "the", "result", "without", "session" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/controller/service/WebServiceImp.java#L78-L92
23,650
banq/jdonframework
src/main/java/com/jdon/aop/interceptor/CacheInterceptor.java
CacheInterceptor.methodMatchsModelGET
private boolean methodMatchsModelGET(Method method) { boolean condition = false; try { if (isModelCache.contains(method)) { condition = true; return condition; } String mehtodName = method.getName(); if (method.getReturnType() == null) return condition; // 无返回值,不做缓存 Class returnClass = method.getReturnType(); if (returnClass.getSuperclass() == null) return condition; // 无返回值,不做缓存 Debug.logVerbose( "[JdonFramework]methodMatchsModelGET: returnClassName = " + returnClass.getName(), module); if (ModelUtil.isModel(returnClass)) { if (mehtodName.indexOf(match_MethodName) != -1) { condition = true; // method name include "getXXXX" and return Type is subClass // of Model isModelCache.add(method); } } } catch (Exception ex) { Debug.logError("[JdonFramework]Exception error:" + ex, module); } catch (Throwable the) { Debug.logError("[JdonFramework]Throwable error:" + the, module); } return condition; }
java
private boolean methodMatchsModelGET(Method method) { boolean condition = false; try { if (isModelCache.contains(method)) { condition = true; return condition; } String mehtodName = method.getName(); if (method.getReturnType() == null) return condition; // 无返回值,不做缓存 Class returnClass = method.getReturnType(); if (returnClass.getSuperclass() == null) return condition; // 无返回值,不做缓存 Debug.logVerbose( "[JdonFramework]methodMatchsModelGET: returnClassName = " + returnClass.getName(), module); if (ModelUtil.isModel(returnClass)) { if (mehtodName.indexOf(match_MethodName) != -1) { condition = true; // method name include "getXXXX" and return Type is subClass // of Model isModelCache.add(method); } } } catch (Exception ex) { Debug.logError("[JdonFramework]Exception error:" + ex, module); } catch (Throwable the) { Debug.logError("[JdonFramework]Throwable error:" + the, module); } return condition; }
[ "private", "boolean", "methodMatchsModelGET", "(", "Method", "method", ")", "{", "boolean", "condition", "=", "false", ";", "try", "{", "if", "(", "isModelCache", ".", "contains", "(", "method", ")", ")", "{", "condition", "=", "true", ";", "return", "condition", ";", "}", "String", "mehtodName", "=", "method", ".", "getName", "(", ")", ";", "if", "(", "method", ".", "getReturnType", "(", ")", "==", "null", ")", "return", "condition", ";", "// 无返回值,不做缓存\r", "Class", "returnClass", "=", "method", ".", "getReturnType", "(", ")", ";", "if", "(", "returnClass", ".", "getSuperclass", "(", ")", "==", "null", ")", "return", "condition", ";", "// 无返回值,不做缓存\r", "Debug", ".", "logVerbose", "(", "\"[JdonFramework]methodMatchsModelGET: returnClassName = \"", "+", "returnClass", ".", "getName", "(", ")", ",", "module", ")", ";", "if", "(", "ModelUtil", ".", "isModel", "(", "returnClass", ")", ")", "{", "if", "(", "mehtodName", ".", "indexOf", "(", "match_MethodName", ")", "!=", "-", "1", ")", "{", "condition", "=", "true", ";", "// method name include \"getXXXX\" and return Type is subClass\r", "// of Model\r", "isModelCache", ".", "add", "(", "method", ")", ";", "}", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "Debug", ".", "logError", "(", "\"[JdonFramework]Exception error:\"", "+", "ex", ",", "module", ")", ";", "}", "catch", "(", "Throwable", "the", ")", "{", "Debug", ".", "logError", "(", "\"[JdonFramework]Throwable error:\"", "+", "the", ",", "module", ")", ";", "}", "return", "condition", ";", "}" ]
1.check return type if is Model 2.check method name if include "get" 3. if found them, cache this method @param method Method @return boolean
[ "1", ".", "check", "return", "type", "if", "is", "Model", "2", ".", "check", "method", "name", "if", "include", "get", "3", ".", "if", "found", "them", "cache", "this", "method" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/aop/interceptor/CacheInterceptor.java#L103-L136
23,651
banq/jdonframework
src/main/java/com/jdon/util/jdom/XMLProperties.java
XMLProperties.getProperty
public String getProperty(String name) { if (propertyCache.containsKey(name)) { return (String) propertyCache.get(name); } String[] propName = parsePropertyName(name); // Search for this property by traversing down the XML heirarchy. Element element = doc.getRootElement(); for (int i = 0; i < propName.length; i++) { element = element.getChild(propName[i]); if (element == null) { // This node doesn't match this part of the property name which // indicates this property doesn't exist so return null. return null; } } // At this point, we found a matching property, so return its value. // Empty strings are returned as null. String value = element.getText(); if ("".equals(value)) { return null; } else { // Add to cache so that getting property next time is fast. value = value.trim(); propertyCache.put(name, value); return value; } }
java
public String getProperty(String name) { if (propertyCache.containsKey(name)) { return (String) propertyCache.get(name); } String[] propName = parsePropertyName(name); // Search for this property by traversing down the XML heirarchy. Element element = doc.getRootElement(); for (int i = 0; i < propName.length; i++) { element = element.getChild(propName[i]); if (element == null) { // This node doesn't match this part of the property name which // indicates this property doesn't exist so return null. return null; } } // At this point, we found a matching property, so return its value. // Empty strings are returned as null. String value = element.getText(); if ("".equals(value)) { return null; } else { // Add to cache so that getting property next time is fast. value = value.trim(); propertyCache.put(name, value); return value; } }
[ "public", "String", "getProperty", "(", "String", "name", ")", "{", "if", "(", "propertyCache", ".", "containsKey", "(", "name", ")", ")", "{", "return", "(", "String", ")", "propertyCache", ".", "get", "(", "name", ")", ";", "}", "String", "[", "]", "propName", "=", "parsePropertyName", "(", "name", ")", ";", "// Search for this property by traversing down the XML heirarchy.\r", "Element", "element", "=", "doc", ".", "getRootElement", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "propName", ".", "length", ";", "i", "++", ")", "{", "element", "=", "element", ".", "getChild", "(", "propName", "[", "i", "]", ")", ";", "if", "(", "element", "==", "null", ")", "{", "// This node doesn't match this part of the property name which\r", "// indicates this property doesn't exist so return null.\r", "return", "null", ";", "}", "}", "// At this point, we found a matching property, so return its value.\r", "// Empty strings are returned as null.\r", "String", "value", "=", "element", ".", "getText", "(", ")", ";", "if", "(", "\"\"", ".", "equals", "(", "value", ")", ")", "{", "return", "null", ";", "}", "else", "{", "// Add to cache so that getting property next time is fast.\r", "value", "=", "value", ".", "trim", "(", ")", ";", "propertyCache", ".", "put", "(", "name", ",", "value", ")", ";", "return", "value", ";", "}", "}" ]
Returns the value of the specified property. @param name the name of the property to get. @return the value of the specified property.
[ "Returns", "the", "value", "of", "the", "specified", "property", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/jdom/XMLProperties.java#L95-L122
23,652
banq/jdonframework
src/main/java/com/jdon/util/jdom/XMLProperties.java
XMLProperties.setProperty
public void setProperty(String name, String value) { // Set cache correctly with prop name and value. propertyCache.put(name, value); String[] propName = parsePropertyName(name); // Search for this property by traversing down the XML heirarchy. Element element = doc.getRootElement(); for (int i = 0; i < propName.length; i++) { // If we don't find this part of the property in the XML heirarchy // we add it as a new node if (element.getChild(propName[i]) == null) { element.addContent(new Element(propName[i])); } element = element.getChild(propName[i]); } // Set the value of the property in this node. element.setText(value); }
java
public void setProperty(String name, String value) { // Set cache correctly with prop name and value. propertyCache.put(name, value); String[] propName = parsePropertyName(name); // Search for this property by traversing down the XML heirarchy. Element element = doc.getRootElement(); for (int i = 0; i < propName.length; i++) { // If we don't find this part of the property in the XML heirarchy // we add it as a new node if (element.getChild(propName[i]) == null) { element.addContent(new Element(propName[i])); } element = element.getChild(propName[i]); } // Set the value of the property in this node. element.setText(value); }
[ "public", "void", "setProperty", "(", "String", "name", ",", "String", "value", ")", "{", "// Set cache correctly with prop name and value.\r", "propertyCache", ".", "put", "(", "name", ",", "value", ")", ";", "String", "[", "]", "propName", "=", "parsePropertyName", "(", "name", ")", ";", "// Search for this property by traversing down the XML heirarchy.\r", "Element", "element", "=", "doc", ".", "getRootElement", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "propName", ".", "length", ";", "i", "++", ")", "{", "// If we don't find this part of the property in the XML heirarchy\r", "// we add it as a new node\r", "if", "(", "element", ".", "getChild", "(", "propName", "[", "i", "]", ")", "==", "null", ")", "{", "element", ".", "addContent", "(", "new", "Element", "(", "propName", "[", "i", "]", ")", ")", ";", "}", "element", "=", "element", ".", "getChild", "(", "propName", "[", "i", "]", ")", ";", "}", "// Set the value of the property in this node.\r", "element", ".", "setText", "(", "value", ")", ";", "}" ]
Sets the value of the specified property. If the property doesn't currently exist, it will be automatically created. @param name the name of the property to set. @param value the new value for the property.
[ "Sets", "the", "value", "of", "the", "specified", "property", ".", "If", "the", "property", "doesn", "t", "currently", "exist", "it", "will", "be", "automatically", "created", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/jdom/XMLProperties.java#L188-L206
23,653
banq/jdonframework
src/main/java/com/jdon/util/jdom/XMLProperties.java
XMLProperties.deleteProperty
public void deleteProperty(String name) { String[] propName = parsePropertyName(name); // Search for this property by traversing down the XML heirarchy. Element element = doc.getRootElement(); for (int i = 0; i < propName.length - 1; i++) { element = element.getChild(propName[i]); // Can't find the property so return. if (element == null) { return; } } // Found the correct element to remove, so remove it... element.removeChild(propName[propName.length - 1]); }
java
public void deleteProperty(String name) { String[] propName = parsePropertyName(name); // Search for this property by traversing down the XML heirarchy. Element element = doc.getRootElement(); for (int i = 0; i < propName.length - 1; i++) { element = element.getChild(propName[i]); // Can't find the property so return. if (element == null) { return; } } // Found the correct element to remove, so remove it... element.removeChild(propName[propName.length - 1]); }
[ "public", "void", "deleteProperty", "(", "String", "name", ")", "{", "String", "[", "]", "propName", "=", "parsePropertyName", "(", "name", ")", ";", "// Search for this property by traversing down the XML heirarchy.\r", "Element", "element", "=", "doc", ".", "getRootElement", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "propName", ".", "length", "-", "1", ";", "i", "++", ")", "{", "element", "=", "element", ".", "getChild", "(", "propName", "[", "i", "]", ")", ";", "// Can't find the property so return.\r", "if", "(", "element", "==", "null", ")", "{", "return", ";", "}", "}", "// Found the correct element to remove, so remove it...\r", "element", ".", "removeChild", "(", "propName", "[", "propName", ".", "length", "-", "1", "]", ")", ";", "}" ]
Deletes the specified property. @param name the property to delete.
[ "Deletes", "the", "specified", "property", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/jdom/XMLProperties.java#L214-L228
23,654
banq/jdonframework
src/main/java/com/jdon/util/jdom/XMLProperties.java
XMLProperties.parsePropertyName
private String[] parsePropertyName(String name) { // Figure out the number of parts of the name (this becomes the size // of the resulting array). int size = 1; for (int i = 0; i < name.length(); i++) { if (name.charAt(i) == '.') { size++; } } String[] propName = new String[size]; // Use a StringTokenizer to tokenize the property name. StringTokenizer tokenizer = new StringTokenizer(name, "."); int i = 0; while (tokenizer.hasMoreTokens()) { propName[i] = tokenizer.nextToken(); i++; } return propName; }
java
private String[] parsePropertyName(String name) { // Figure out the number of parts of the name (this becomes the size // of the resulting array). int size = 1; for (int i = 0; i < name.length(); i++) { if (name.charAt(i) == '.') { size++; } } String[] propName = new String[size]; // Use a StringTokenizer to tokenize the property name. StringTokenizer tokenizer = new StringTokenizer(name, "."); int i = 0; while (tokenizer.hasMoreTokens()) { propName[i] = tokenizer.nextToken(); i++; } return propName; }
[ "private", "String", "[", "]", "parsePropertyName", "(", "String", "name", ")", "{", "// Figure out the number of parts of the name (this becomes the size\r", "// of the resulting array).\r", "int", "size", "=", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "name", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "name", ".", "charAt", "(", "i", ")", "==", "'", "'", ")", "{", "size", "++", ";", "}", "}", "String", "[", "]", "propName", "=", "new", "String", "[", "size", "]", ";", "// Use a StringTokenizer to tokenize the property name.\r", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "name", ",", "\".\"", ")", ";", "int", "i", "=", "0", ";", "while", "(", "tokenizer", ".", "hasMoreTokens", "(", ")", ")", "{", "propName", "[", "i", "]", "=", "tokenizer", ".", "nextToken", "(", ")", ";", "i", "++", ";", "}", "return", "propName", ";", "}" ]
Returns an array representation of the given Jive property. Jive properties are always in the format "prop.name.is.this" which would be represented as an array of four Strings. @param name the name of the Jive property. @return an array representation of the given Jive property.
[ "Returns", "an", "array", "representation", "of", "the", "given", "Jive", "property", ".", "Jive", "properties", "are", "always", "in", "the", "format", "prop", ".", "name", ".", "is", ".", "this", "which", "would", "be", "represented", "as", "an", "array", "of", "four", "Strings", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/jdom/XMLProperties.java#L239-L257
23,655
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isWhitespace
public static boolean isWhitespace(String s) { // Is s empty? if (isEmpty(s)) return true; // Search through string's characters one by one // until we find a non-whitespace character. // When we do, return false; if we don't, return true. for (int i = 0; i < s.length(); i++) { // Check that current character isn't whitespace. char c = s.charAt(i); if (whitespace.indexOf(c) == -1) return false; } // All characters are whitespace. return true; }
java
public static boolean isWhitespace(String s) { // Is s empty? if (isEmpty(s)) return true; // Search through string's characters one by one // until we find a non-whitespace character. // When we do, return false; if we don't, return true. for (int i = 0; i < s.length(); i++) { // Check that current character isn't whitespace. char c = s.charAt(i); if (whitespace.indexOf(c) == -1) return false; } // All characters are whitespace. return true; }
[ "public", "static", "boolean", "isWhitespace", "(", "String", "s", ")", "{", "// Is s empty?\r", "if", "(", "isEmpty", "(", "s", ")", ")", "return", "true", ";", "// Search through string's characters one by one\r", "// until we find a non-whitespace character.\r", "// When we do, return false; if we don't, return true.\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s", ".", "length", "(", ")", ";", "i", "++", ")", "{", "// Check that current character isn't whitespace.\r", "char", "c", "=", "s", ".", "charAt", "(", "i", ")", ";", "if", "(", "whitespace", ".", "indexOf", "(", "c", ")", "==", "-", "1", ")", "return", "false", ";", "}", "// All characters are whitespace.\r", "return", "true", ";", "}" ]
Returns true if string s is empty or whitespace characters only.
[ "Returns", "true", "if", "string", "s", "is", "empty", "or", "whitespace", "characters", "only", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L209-L224
23,656
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.stripCharsInBag
public static String stripCharsInBag(String s, String bag) { int i; String returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length(); i++) { char c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; }
java
public static String stripCharsInBag(String s, String bag) { int i; String returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length(); i++) { char c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; }
[ "public", "static", "String", "stripCharsInBag", "(", "String", "s", ",", "String", "bag", ")", "{", "int", "i", ";", "String", "returnString", "=", "\"\"", ";", "// Search through string's characters one by one.\r", "// If character is not in bag, append to returnString.\r", "for", "(", "i", "=", "0", ";", "i", "<", "s", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "c", "=", "s", ".", "charAt", "(", "i", ")", ";", "if", "(", "bag", ".", "indexOf", "(", "c", ")", "==", "-", "1", ")", "returnString", "+=", "c", ";", "}", "return", "returnString", ";", "}" ]
Removes all characters which appear in string bag from string s.
[ "Removes", "all", "characters", "which", "appear", "in", "string", "bag", "from", "string", "s", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L227-L239
23,657
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isInteger
public static boolean isInteger(String s) { if (isEmpty(s)) return defaultEmptyOK; // Search through string's characters one by one // until we find a non-numeric character. // When we do, return false; if we don't, return true. for (int i = 0; i < s.length(); i++) { // Check that current character is number. char c = s.charAt(i); if (!isDigit(c)) return false; } // All characters are numbers. return true; }
java
public static boolean isInteger(String s) { if (isEmpty(s)) return defaultEmptyOK; // Search through string's characters one by one // until we find a non-numeric character. // When we do, return false; if we don't, return true. for (int i = 0; i < s.length(); i++) { // Check that current character is number. char c = s.charAt(i); if (!isDigit(c)) return false; } // All characters are numbers. return true; }
[ "public", "static", "boolean", "isInteger", "(", "String", "s", ")", "{", "if", "(", "isEmpty", "(", "s", ")", ")", "return", "defaultEmptyOK", ";", "// Search through string's characters one by one\r", "// until we find a non-numeric character.\r", "// When we do, return false; if we don't, return true.\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s", ".", "length", "(", ")", ";", "i", "++", ")", "{", "// Check that current character is number.\r", "char", "c", "=", "s", ".", "charAt", "(", "i", ")", ";", "if", "(", "!", "isDigit", "(", "c", ")", ")", "return", "false", ";", "}", "// All characters are numbers.\r", "return", "true", ";", "}" ]
Returns true if all characters in string s are numbers. Accepts non-signed integers only. Does not accept floating point, exponential notation, etc.
[ "Returns", "true", "if", "all", "characters", "in", "string", "s", "are", "numbers", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L305-L320
23,658
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isNonnegativeInteger
public static boolean isNonnegativeInteger(String s) { if (isEmpty(s)) return defaultEmptyOK; try { int temp = Integer.parseInt(s); if (temp >= 0) return true; return false; } catch (Exception e) { return false; } // return(isSignedInteger(s, secondArg) // &&((isEmpty(s) && secondArg) ||(parseInt(s) >= 0) ) ); }
java
public static boolean isNonnegativeInteger(String s) { if (isEmpty(s)) return defaultEmptyOK; try { int temp = Integer.parseInt(s); if (temp >= 0) return true; return false; } catch (Exception e) { return false; } // return(isSignedInteger(s, secondArg) // &&((isEmpty(s) && secondArg) ||(parseInt(s) >= 0) ) ); }
[ "public", "static", "boolean", "isNonnegativeInteger", "(", "String", "s", ")", "{", "if", "(", "isEmpty", "(", "s", ")", ")", "return", "defaultEmptyOK", ";", "try", "{", "int", "temp", "=", "Integer", ".", "parseInt", "(", "s", ")", ";", "if", "(", "temp", ">=", "0", ")", "return", "true", ";", "return", "false", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "false", ";", "}", "// return(isSignedInteger(s, secondArg)\r", "// &&((isEmpty(s) && secondArg) ||(parseInt(s) >= 0) ) );\r", "}" ]
Returns true if string s is an integer >= 0.
[ "Returns", "true", "if", "string", "s", "is", "an", "integer", ">", "=", "0", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L383-L397
23,659
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isAlphabetic
public static boolean isAlphabetic(String s) { if (isEmpty(s)) return defaultEmptyOK; // Search through string's characters one by one // until we find a non-alphabetic character. // When we do, return false; if we don't, return true. for (int i = 0; i < s.length(); i++) { // Check that current character is letter. char c = s.charAt(i); if (!isLetter(c)) return false; } // All characters are letters. return true; }
java
public static boolean isAlphabetic(String s) { if (isEmpty(s)) return defaultEmptyOK; // Search through string's characters one by one // until we find a non-alphabetic character. // When we do, return false; if we don't, return true. for (int i = 0; i < s.length(); i++) { // Check that current character is letter. char c = s.charAt(i); if (!isLetter(c)) return false; } // All characters are letters. return true; }
[ "public", "static", "boolean", "isAlphabetic", "(", "String", "s", ")", "{", "if", "(", "isEmpty", "(", "s", ")", ")", "return", "defaultEmptyOK", ";", "// Search through string's characters one by one\r", "// until we find a non-alphabetic character.\r", "// When we do, return false; if we don't, return true.\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s", ".", "length", "(", ")", ";", "i", "++", ")", "{", "// Check that current character is letter.\r", "char", "c", "=", "s", ".", "charAt", "(", "i", ")", ";", "if", "(", "!", "isLetter", "(", "c", ")", ")", "return", "false", ";", "}", "// All characters are letters.\r", "return", "true", ";", "}" ]
Returns true if string s is letters only. NOTE: This should handle i18n version to support European characters, etc. since it now uses Character.isLetter()
[ "Returns", "true", "if", "string", "s", "is", "letters", "only", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L518-L534
23,660
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isSSN
public static boolean isSSN(String s) { if (isEmpty(s)) return defaultEmptyOK; String normalizedSSN = stripCharsInBag(s, SSNDelimiters); return (isInteger(normalizedSSN) && normalizedSSN.length() == digitsInSocialSecurityNumber); }
java
public static boolean isSSN(String s) { if (isEmpty(s)) return defaultEmptyOK; String normalizedSSN = stripCharsInBag(s, SSNDelimiters); return (isInteger(normalizedSSN) && normalizedSSN.length() == digitsInSocialSecurityNumber); }
[ "public", "static", "boolean", "isSSN", "(", "String", "s", ")", "{", "if", "(", "isEmpty", "(", "s", ")", ")", "return", "defaultEmptyOK", ";", "String", "normalizedSSN", "=", "stripCharsInBag", "(", "s", ",", "SSNDelimiters", ")", ";", "return", "(", "isInteger", "(", "normalizedSSN", ")", "&&", "normalizedSSN", ".", "length", "(", ")", "==", "digitsInSocialSecurityNumber", ")", ";", "}" ]
isSSN returns true if string s is a valid U.S. Social Security Number. Must be 9 digits.
[ "isSSN", "returns", "true", "if", "string", "s", "is", "a", "valid", "U", ".", "S", ".", "Social", "Security", "Number", ".", "Must", "be", "9", "digits", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L562-L568
23,661
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isUSPhoneNumber
public static boolean isUSPhoneNumber(String s) { if (isEmpty(s)) return defaultEmptyOK; String normalizedPhone = stripCharsInBag(s, phoneNumberDelimiters); return (isInteger(normalizedPhone) && normalizedPhone.length() == digitsInUSPhoneNumber); }
java
public static boolean isUSPhoneNumber(String s) { if (isEmpty(s)) return defaultEmptyOK; String normalizedPhone = stripCharsInBag(s, phoneNumberDelimiters); return (isInteger(normalizedPhone) && normalizedPhone.length() == digitsInUSPhoneNumber); }
[ "public", "static", "boolean", "isUSPhoneNumber", "(", "String", "s", ")", "{", "if", "(", "isEmpty", "(", "s", ")", ")", "return", "defaultEmptyOK", ";", "String", "normalizedPhone", "=", "stripCharsInBag", "(", "s", ",", "phoneNumberDelimiters", ")", ";", "return", "(", "isInteger", "(", "normalizedPhone", ")", "&&", "normalizedPhone", ".", "length", "(", ")", "==", "digitsInUSPhoneNumber", ")", ";", "}" ]
isUSPhoneNumber returns true if string s is a valid U.S. Phone Number. Must be 10 digits.
[ "isUSPhoneNumber", "returns", "true", "if", "string", "s", "is", "a", "valid", "U", ".", "S", ".", "Phone", "Number", ".", "Must", "be", "10", "digits", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L571-L576
23,662
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isUSPhoneAreaCode
public static boolean isUSPhoneAreaCode(String s) { if (isEmpty(s)) return defaultEmptyOK; String normalizedPhone = stripCharsInBag(s, phoneNumberDelimiters); return (isInteger(normalizedPhone) && normalizedPhone.length() == digitsInUSPhoneAreaCode); }
java
public static boolean isUSPhoneAreaCode(String s) { if (isEmpty(s)) return defaultEmptyOK; String normalizedPhone = stripCharsInBag(s, phoneNumberDelimiters); return (isInteger(normalizedPhone) && normalizedPhone.length() == digitsInUSPhoneAreaCode); }
[ "public", "static", "boolean", "isUSPhoneAreaCode", "(", "String", "s", ")", "{", "if", "(", "isEmpty", "(", "s", ")", ")", "return", "defaultEmptyOK", ";", "String", "normalizedPhone", "=", "stripCharsInBag", "(", "s", ",", "phoneNumberDelimiters", ")", ";", "return", "(", "isInteger", "(", "normalizedPhone", ")", "&&", "normalizedPhone", ".", "length", "(", ")", "==", "digitsInUSPhoneAreaCode", ")", ";", "}" ]
isUSPhoneAreaCode returns true if string s is a valid U.S. Phone Area Code. Must be 3 digits.
[ "isUSPhoneAreaCode", "returns", "true", "if", "string", "s", "is", "a", "valid", "U", ".", "S", ".", "Phone", "Area", "Code", ".", "Must", "be", "3", "digits", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L579-L584
23,663
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isUSPhoneMainNumber
public static boolean isUSPhoneMainNumber(String s) { if (isEmpty(s)) return defaultEmptyOK; String normalizedPhone = stripCharsInBag(s, phoneNumberDelimiters); return (isInteger(normalizedPhone) && normalizedPhone.length() == digitsInUSPhoneMainNumber); }
java
public static boolean isUSPhoneMainNumber(String s) { if (isEmpty(s)) return defaultEmptyOK; String normalizedPhone = stripCharsInBag(s, phoneNumberDelimiters); return (isInteger(normalizedPhone) && normalizedPhone.length() == digitsInUSPhoneMainNumber); }
[ "public", "static", "boolean", "isUSPhoneMainNumber", "(", "String", "s", ")", "{", "if", "(", "isEmpty", "(", "s", ")", ")", "return", "defaultEmptyOK", ";", "String", "normalizedPhone", "=", "stripCharsInBag", "(", "s", ",", "phoneNumberDelimiters", ")", ";", "return", "(", "isInteger", "(", "normalizedPhone", ")", "&&", "normalizedPhone", ".", "length", "(", ")", "==", "digitsInUSPhoneMainNumber", ")", ";", "}" ]
isUSPhoneMainNumber returns true if string s is a valid U.S. Phone Main Number. Must be 7 digits.
[ "isUSPhoneMainNumber", "returns", "true", "if", "string", "s", "is", "a", "valid", "U", ".", "S", ".", "Phone", "Main", "Number", ".", "Must", "be", "7", "digits", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L587-L592
23,664
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isInternationalPhoneNumber
public static boolean isInternationalPhoneNumber(String s) { if (isEmpty(s)) return defaultEmptyOK; String normalizedPhone = stripCharsInBag(s, phoneNumberDelimiters); return isPositiveInteger(normalizedPhone); }
java
public static boolean isInternationalPhoneNumber(String s) { if (isEmpty(s)) return defaultEmptyOK; String normalizedPhone = stripCharsInBag(s, phoneNumberDelimiters); return isPositiveInteger(normalizedPhone); }
[ "public", "static", "boolean", "isInternationalPhoneNumber", "(", "String", "s", ")", "{", "if", "(", "isEmpty", "(", "s", ")", ")", "return", "defaultEmptyOK", ";", "String", "normalizedPhone", "=", "stripCharsInBag", "(", "s", ",", "phoneNumberDelimiters", ")", ";", "return", "isPositiveInteger", "(", "normalizedPhone", ")", ";", "}" ]
isInternationalPhoneNumber returns true if string s is a valid international phone number. Must be digits only; any length OK. May be prefixed by + character.
[ "isInternationalPhoneNumber", "returns", "true", "if", "string", "s", "is", "a", "valid", "international", "phone", "number", ".", "Must", "be", "digits", "only", ";", "any", "length", "OK", ".", "May", "be", "prefixed", "by", "+", "character", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L598-L604
23,665
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isZipCode
public static boolean isZipCode(String s) { if (isEmpty(s)) return defaultEmptyOK; String normalizedZip = stripCharsInBag(s, ZipCodeDelimiters); return (isInteger(normalizedZip) && ((normalizedZip.length() == digitsInZipCode1) || (normalizedZip.length() == digitsInZipCode2))); }
java
public static boolean isZipCode(String s) { if (isEmpty(s)) return defaultEmptyOK; String normalizedZip = stripCharsInBag(s, ZipCodeDelimiters); return (isInteger(normalizedZip) && ((normalizedZip.length() == digitsInZipCode1) || (normalizedZip.length() == digitsInZipCode2))); }
[ "public", "static", "boolean", "isZipCode", "(", "String", "s", ")", "{", "if", "(", "isEmpty", "(", "s", ")", ")", "return", "defaultEmptyOK", ";", "String", "normalizedZip", "=", "stripCharsInBag", "(", "s", ",", "ZipCodeDelimiters", ")", ";", "return", "(", "isInteger", "(", "normalizedZip", ")", "&&", "(", "(", "normalizedZip", ".", "length", "(", ")", "==", "digitsInZipCode1", ")", "||", "(", "normalizedZip", ".", "length", "(", ")", "==", "digitsInZipCode2", ")", ")", ")", ";", "}" ]
isZIPCode returns true if string s is a valid U.S. ZIP code. Must be 5 or 9 digits only.
[ "isZIPCode", "returns", "true", "if", "string", "s", "is", "a", "valid", "U", ".", "S", ".", "ZIP", "code", ".", "Must", "be", "5", "or", "9", "digits", "only", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L607-L613
23,666
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isContiguousZipCode
public static boolean isContiguousZipCode(String s) { boolean retval = false; if (isZipCode(s)) { if (isEmpty(s)) retval = defaultEmptyOK; else { String normalizedZip = s.substring(0,5); int iZip = Integer.parseInt(normalizedZip); if ((iZip >= 96701 && iZip <= 96898) || (iZip >= 99501 && iZip <= 99950)) retval = false; else retval = true; } } return retval; }
java
public static boolean isContiguousZipCode(String s) { boolean retval = false; if (isZipCode(s)) { if (isEmpty(s)) retval = defaultEmptyOK; else { String normalizedZip = s.substring(0,5); int iZip = Integer.parseInt(normalizedZip); if ((iZip >= 96701 && iZip <= 96898) || (iZip >= 99501 && iZip <= 99950)) retval = false; else retval = true; } } return retval; }
[ "public", "static", "boolean", "isContiguousZipCode", "(", "String", "s", ")", "{", "boolean", "retval", "=", "false", ";", "if", "(", "isZipCode", "(", "s", ")", ")", "{", "if", "(", "isEmpty", "(", "s", ")", ")", "retval", "=", "defaultEmptyOK", ";", "else", "{", "String", "normalizedZip", "=", "s", ".", "substring", "(", "0", ",", "5", ")", ";", "int", "iZip", "=", "Integer", ".", "parseInt", "(", "normalizedZip", ")", ";", "if", "(", "(", "iZip", ">=", "96701", "&&", "iZip", "<=", "96898", ")", "||", "(", "iZip", ">=", "99501", "&&", "iZip", "<=", "99950", ")", ")", "retval", "=", "false", ";", "else", "retval", "=", "true", ";", "}", "}", "return", "retval", ";", "}" ]
Returns true if string s is a valid contiguous U.S. Zip code. Must be 5 or 9 digits only.
[ "Returns", "true", "if", "string", "s", "is", "a", "valid", "contiguous", "U", ".", "S", ".", "Zip", "code", ".", "Must", "be", "5", "or", "9", "digits", "only", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L616-L628
23,667
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isEmail
public static boolean isEmail(String s) { if (isEmpty(s)) return defaultEmptyOK; // is s whitespace? if (isWhitespace(s)) return false; // there must be >= 1 character before @, so we // start looking at character position 1 // (i.e. second character) int i = 1; int sLength = s.length(); // look for @ while ((i < sLength) && (s.charAt(i) != '@')) i++; // there must be at least one character after the . if ((i >= sLength - 1) || (s.charAt(i) != '@')) return false; else return true; // DEJ 2001-10-13 Don't look for '.', some valid emails do not have a dot in the domain name // else i += 2; // look for . // while((i < sLength) && (s.charAt(i) != '.')) i++; // there must be at least one character after the . // if((i >= sLength - 1) || (s.charAt(i) != '.')) return false; // else return true; }
java
public static boolean isEmail(String s) { if (isEmpty(s)) return defaultEmptyOK; // is s whitespace? if (isWhitespace(s)) return false; // there must be >= 1 character before @, so we // start looking at character position 1 // (i.e. second character) int i = 1; int sLength = s.length(); // look for @ while ((i < sLength) && (s.charAt(i) != '@')) i++; // there must be at least one character after the . if ((i >= sLength - 1) || (s.charAt(i) != '@')) return false; else return true; // DEJ 2001-10-13 Don't look for '.', some valid emails do not have a dot in the domain name // else i += 2; // look for . // while((i < sLength) && (s.charAt(i) != '.')) i++; // there must be at least one character after the . // if((i >= sLength - 1) || (s.charAt(i) != '.')) return false; // else return true; }
[ "public", "static", "boolean", "isEmail", "(", "String", "s", ")", "{", "if", "(", "isEmpty", "(", "s", ")", ")", "return", "defaultEmptyOK", ";", "// is s whitespace?\r", "if", "(", "isWhitespace", "(", "s", ")", ")", "return", "false", ";", "// there must be >= 1 character before @, so we\r", "// start looking at character position 1\r", "// (i.e. second character)\r", "int", "i", "=", "1", ";", "int", "sLength", "=", "s", ".", "length", "(", ")", ";", "// look for @\r", "while", "(", "(", "i", "<", "sLength", ")", "&&", "(", "s", ".", "charAt", "(", "i", ")", "!=", "'", "'", ")", ")", "i", "++", ";", "// there must be at least one character after the .\r", "if", "(", "(", "i", ">=", "sLength", "-", "1", ")", "||", "(", "s", ".", "charAt", "(", "i", ")", "!=", "'", "'", ")", ")", "return", "false", ";", "else", "return", "true", ";", "// DEJ 2001-10-13 Don't look for '.', some valid emails do not have a dot in the domain name\r", "// else i += 2;\r", "// look for .\r", "// while((i < sLength) && (s.charAt(i) != '.')) i++;\r", "// there must be at least one character after the .\r", "// if((i >= sLength - 1) || (s.charAt(i) != '.')) return false;\r", "// else return true;\r", "}" ]
Email address must be of form a@b.c -- in other words: - there must be at least one character before the @ - there must be at least one character before and after the . - the characters @ and . are both required
[ "Email", "address", "must", "be", "of", "form", "a" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L647-L676
23,668
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isYear
public static boolean isYear(String s) { if (isEmpty(s)) return defaultEmptyOK; if (!isNonnegativeInteger(s)) return false; return ((s.length() == 2) || (s.length() == 4)); }
java
public static boolean isYear(String s) { if (isEmpty(s)) return defaultEmptyOK; if (!isNonnegativeInteger(s)) return false; return ((s.length() == 2) || (s.length() == 4)); }
[ "public", "static", "boolean", "isYear", "(", "String", "s", ")", "{", "if", "(", "isEmpty", "(", "s", ")", ")", "return", "defaultEmptyOK", ";", "if", "(", "!", "isNonnegativeInteger", "(", "s", ")", ")", "return", "false", ";", "return", "(", "(", "s", ".", "length", "(", ")", "==", "2", ")", "||", "(", "s", ".", "length", "(", ")", "==", "4", ")", ")", ";", "}" ]
isYear returns true if string s is a valid Year number. Must be 2 or 4 digits only. For Year 2000 compliance, you are advised to use 4-digit year numbers everywhere.
[ "isYear", "returns", "true", "if", "string", "s", "is", "a", "valid", "Year", "number", ".", "Must", "be", "2", "or", "4", "digits", "only", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L684-L689
23,669
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isIntegerInRange
public static boolean isIntegerInRange(String s, int a, int b) { if (isEmpty(s)) return defaultEmptyOK; // Catch non-integer strings to avoid creating a NaN below, // which isn't available on JavaScript 1.0 for Windows. if (!isSignedInteger(s)) return false; // Now, explicitly change the type to integer via parseInt // so that the comparison code below will work both on // JavaScript 1.2(which typechecks in equality comparisons) // and JavaScript 1.1 and before(which doesn't). int num = Integer.parseInt(s); return ((num >= a) && (num <= b)); }
java
public static boolean isIntegerInRange(String s, int a, int b) { if (isEmpty(s)) return defaultEmptyOK; // Catch non-integer strings to avoid creating a NaN below, // which isn't available on JavaScript 1.0 for Windows. if (!isSignedInteger(s)) return false; // Now, explicitly change the type to integer via parseInt // so that the comparison code below will work both on // JavaScript 1.2(which typechecks in equality comparisons) // and JavaScript 1.1 and before(which doesn't). int num = Integer.parseInt(s); return ((num >= a) && (num <= b)); }
[ "public", "static", "boolean", "isIntegerInRange", "(", "String", "s", ",", "int", "a", ",", "int", "b", ")", "{", "if", "(", "isEmpty", "(", "s", ")", ")", "return", "defaultEmptyOK", ";", "// Catch non-integer strings to avoid creating a NaN below,\r", "// which isn't available on JavaScript 1.0 for Windows.\r", "if", "(", "!", "isSignedInteger", "(", "s", ")", ")", "return", "false", ";", "// Now, explicitly change the type to integer via parseInt\r", "// so that the comparison code below will work both on\r", "// JavaScript 1.2(which typechecks in equality comparisons)\r", "// and JavaScript 1.1 and before(which doesn't).\r", "int", "num", "=", "Integer", ".", "parseInt", "(", "s", ")", ";", "return", "(", "(", "num", ">=", "a", ")", "&&", "(", "num", "<=", "b", ")", ")", ";", "}" ]
isIntegerInRange returns true if string s is an integer within the range of integer arguments a and b, inclusive.
[ "isIntegerInRange", "returns", "true", "if", "string", "s", "is", "an", "integer", "within", "the", "range", "of", "integer", "arguments", "a", "and", "b", "inclusive", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L694-L706
23,670
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isDate
public static boolean isDate(String year, String month, String day) { // catch invalid years(not 2- or 4-digit) and invalid months and days. if (!(isYear(year) && isMonth(month) && isDay(day))) return false; int intYear = Integer.parseInt(year); int intMonth = Integer.parseInt(month); int intDay = Integer.parseInt(day); // catch invalid days, except for February if (intDay > daysInMonth[intMonth - 1]) return false; if ((intMonth == 2) && (intDay > daysInFebruary(intYear))) return false; return true; }
java
public static boolean isDate(String year, String month, String day) { // catch invalid years(not 2- or 4-digit) and invalid months and days. if (!(isYear(year) && isMonth(month) && isDay(day))) return false; int intYear = Integer.parseInt(year); int intMonth = Integer.parseInt(month); int intDay = Integer.parseInt(day); // catch invalid days, except for February if (intDay > daysInMonth[intMonth - 1]) return false; if ((intMonth == 2) && (intDay > daysInFebruary(intYear))) return false; return true; }
[ "public", "static", "boolean", "isDate", "(", "String", "year", ",", "String", "month", ",", "String", "day", ")", "{", "// catch invalid years(not 2- or 4-digit) and invalid months and days.\r", "if", "(", "!", "(", "isYear", "(", "year", ")", "&&", "isMonth", "(", "month", ")", "&&", "isDay", "(", "day", ")", ")", ")", "return", "false", ";", "int", "intYear", "=", "Integer", ".", "parseInt", "(", "year", ")", ";", "int", "intMonth", "=", "Integer", ".", "parseInt", "(", "month", ")", ";", "int", "intDay", "=", "Integer", ".", "parseInt", "(", "day", ")", ";", "// catch invalid days, except for February\r", "if", "(", "intDay", ">", "daysInMonth", "[", "intMonth", "-", "1", "]", ")", "return", "false", ";", "if", "(", "(", "intMonth", "==", "2", ")", "&&", "(", "intDay", ">", "daysInFebruary", "(", "intYear", ")", ")", ")", "return", "false", ";", "return", "true", ";", "}" ]
isDate returns true if string arguments year, month, and day form a valid date.
[ "isDate", "returns", "true", "if", "string", "arguments", "year", "month", "and", "day", "form", "a", "valid", "date", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L746-L758
23,671
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isDate
public static boolean isDate(String date) { if (isEmpty(date)) return defaultEmptyOK; String month; String day; String year; int dateSlash1 = date.indexOf("/"); int dateSlash2 = date.lastIndexOf("/"); if (dateSlash1 <= 0 || dateSlash1 == dateSlash2) return false; month = date.substring(0, dateSlash1); day = date.substring(dateSlash1 + 1, dateSlash2); year = date.substring(dateSlash2 + 1); return isDate(year, month, day); }
java
public static boolean isDate(String date) { if (isEmpty(date)) return defaultEmptyOK; String month; String day; String year; int dateSlash1 = date.indexOf("/"); int dateSlash2 = date.lastIndexOf("/"); if (dateSlash1 <= 0 || dateSlash1 == dateSlash2) return false; month = date.substring(0, dateSlash1); day = date.substring(dateSlash1 + 1, dateSlash2); year = date.substring(dateSlash2 + 1); return isDate(year, month, day); }
[ "public", "static", "boolean", "isDate", "(", "String", "date", ")", "{", "if", "(", "isEmpty", "(", "date", ")", ")", "return", "defaultEmptyOK", ";", "String", "month", ";", "String", "day", ";", "String", "year", ";", "int", "dateSlash1", "=", "date", ".", "indexOf", "(", "\"/\"", ")", ";", "int", "dateSlash2", "=", "date", ".", "lastIndexOf", "(", "\"/\"", ")", ";", "if", "(", "dateSlash1", "<=", "0", "||", "dateSlash1", "==", "dateSlash2", ")", "return", "false", ";", "month", "=", "date", ".", "substring", "(", "0", ",", "dateSlash1", ")", ";", "day", "=", "date", ".", "substring", "(", "dateSlash1", "+", "1", ",", "dateSlash2", ")", ";", "year", "=", "date", ".", "substring", "(", "dateSlash2", "+", "1", ")", ";", "return", "isDate", "(", "year", ",", "month", ",", "day", ")", ";", "}" ]
isDate returns true if string argument date forms a valid date.
[ "isDate", "returns", "true", "if", "string", "argument", "date", "forms", "a", "valid", "date", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L761-L776
23,672
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isDateAfterToday
public static boolean isDateAfterToday(String date) { if (isEmpty(date)) return defaultEmptyOK; int dateSlash1 = date.indexOf("/"); int dateSlash2 = date.lastIndexOf("/"); if (dateSlash1 <= 0) return false; java.util.Date passed = null; if (dateSlash1 == dateSlash2) { // consider the day to be optional; use the first day of the following month for comparison since this is an is after test String month = date.substring(0, dateSlash1); String day = "28"; String year = date.substring(dateSlash1 + 1); if (!isDate(year, month, day)) return false; try { int monthInt = Integer.parseInt(month); int yearInt = Integer.parseInt(year); Calendar calendar = Calendar.getInstance(); calendar.set(yearInt, monthInt - 1, 0, 0, 0, 0); calendar.add(Calendar.MONTH, 1); passed = new java.util.Date(calendar.getTime().getTime()); } catch (Exception e) { passed = null; } } else { String month = date.substring(0, dateSlash1); String day = date.substring(dateSlash1 + 1, dateSlash2); String year = date.substring(dateSlash2 + 1); if (!isDate(year, month, day)) return false; passed = UtilDateTime.toDate(month, day, year, "0", "0", "0"); } java.util.Date now = UtilDateTime.nowDate(); if (passed != null) { return passed.after(now); } else { return false; } }
java
public static boolean isDateAfterToday(String date) { if (isEmpty(date)) return defaultEmptyOK; int dateSlash1 = date.indexOf("/"); int dateSlash2 = date.lastIndexOf("/"); if (dateSlash1 <= 0) return false; java.util.Date passed = null; if (dateSlash1 == dateSlash2) { // consider the day to be optional; use the first day of the following month for comparison since this is an is after test String month = date.substring(0, dateSlash1); String day = "28"; String year = date.substring(dateSlash1 + 1); if (!isDate(year, month, day)) return false; try { int monthInt = Integer.parseInt(month); int yearInt = Integer.parseInt(year); Calendar calendar = Calendar.getInstance(); calendar.set(yearInt, monthInt - 1, 0, 0, 0, 0); calendar.add(Calendar.MONTH, 1); passed = new java.util.Date(calendar.getTime().getTime()); } catch (Exception e) { passed = null; } } else { String month = date.substring(0, dateSlash1); String day = date.substring(dateSlash1 + 1, dateSlash2); String year = date.substring(dateSlash2 + 1); if (!isDate(year, month, day)) return false; passed = UtilDateTime.toDate(month, day, year, "0", "0", "0"); } java.util.Date now = UtilDateTime.nowDate(); if (passed != null) { return passed.after(now); } else { return false; } }
[ "public", "static", "boolean", "isDateAfterToday", "(", "String", "date", ")", "{", "if", "(", "isEmpty", "(", "date", ")", ")", "return", "defaultEmptyOK", ";", "int", "dateSlash1", "=", "date", ".", "indexOf", "(", "\"/\"", ")", ";", "int", "dateSlash2", "=", "date", ".", "lastIndexOf", "(", "\"/\"", ")", ";", "if", "(", "dateSlash1", "<=", "0", ")", "return", "false", ";", "java", ".", "util", ".", "Date", "passed", "=", "null", ";", "if", "(", "dateSlash1", "==", "dateSlash2", ")", "{", "// consider the day to be optional; use the first day of the following month for comparison since this is an is after test\r", "String", "month", "=", "date", ".", "substring", "(", "0", ",", "dateSlash1", ")", ";", "String", "day", "=", "\"28\"", ";", "String", "year", "=", "date", ".", "substring", "(", "dateSlash1", "+", "1", ")", ";", "if", "(", "!", "isDate", "(", "year", ",", "month", ",", "day", ")", ")", "return", "false", ";", "try", "{", "int", "monthInt", "=", "Integer", ".", "parseInt", "(", "month", ")", ";", "int", "yearInt", "=", "Integer", ".", "parseInt", "(", "year", ")", ";", "Calendar", "calendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "calendar", ".", "set", "(", "yearInt", ",", "monthInt", "-", "1", ",", "0", ",", "0", ",", "0", ",", "0", ")", ";", "calendar", ".", "add", "(", "Calendar", ".", "MONTH", ",", "1", ")", ";", "passed", "=", "new", "java", ".", "util", ".", "Date", "(", "calendar", ".", "getTime", "(", ")", ".", "getTime", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "passed", "=", "null", ";", "}", "}", "else", "{", "String", "month", "=", "date", ".", "substring", "(", "0", ",", "dateSlash1", ")", ";", "String", "day", "=", "date", ".", "substring", "(", "dateSlash1", "+", "1", ",", "dateSlash2", ")", ";", "String", "year", "=", "date", ".", "substring", "(", "dateSlash2", "+", "1", ")", ";", "if", "(", "!", "isDate", "(", "year", ",", "month", ",", "day", ")", ")", "return", "false", ";", "passed", "=", "UtilDateTime", ".", "toDate", "(", "month", ",", "day", ",", "year", ",", "\"0\"", ",", "\"0\"", ",", "\"0\"", ")", ";", "}", "java", ".", "util", ".", "Date", "now", "=", "UtilDateTime", ".", "nowDate", "(", ")", ";", "if", "(", "passed", "!=", "null", ")", "{", "return", "passed", ".", "after", "(", "now", ")", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
isDate returns true if string argument date forms a valid date and is after today.
[ "isDate", "returns", "true", "if", "string", "argument", "date", "forms", "a", "valid", "date", "and", "is", "after", "today", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L779-L818
23,673
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isTime
public static boolean isTime(String hour, String minute, String second) { // catch invalid years(not 2- or 4-digit) and invalid months and days. if (isHour(hour) && isMinute(minute) && isSecond(second)) return true; else return false; }
java
public static boolean isTime(String hour, String minute, String second) { // catch invalid years(not 2- or 4-digit) and invalid months and days. if (isHour(hour) && isMinute(minute) && isSecond(second)) return true; else return false; }
[ "public", "static", "boolean", "isTime", "(", "String", "hour", ",", "String", "minute", ",", "String", "second", ")", "{", "// catch invalid years(not 2- or 4-digit) and invalid months and days.\r", "if", "(", "isHour", "(", "hour", ")", "&&", "isMinute", "(", "minute", ")", "&&", "isSecond", "(", "second", ")", ")", "return", "true", ";", "else", "return", "false", ";", "}" ]
isTime returns true if string arguments hour, minute, and second form a valid time.
[ "isTime", "returns", "true", "if", "string", "arguments", "hour", "minute", "and", "second", "form", "a", "valid", "time", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L821-L827
23,674
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isTime
public static boolean isTime(String time) { if (isEmpty(time)) return defaultEmptyOK; String hour; String minute; String second; int timeColon1 = time.indexOf(":"); int timeColon2 = time.lastIndexOf(":"); if (timeColon1 <= 0) return false; hour = time.substring(0, timeColon1); if (timeColon1 == timeColon2) { minute = time.substring(timeColon1 + 1); second = "0"; } else { minute = time.substring(timeColon1 + 1, timeColon2); second = time.substring(timeColon2 + 1); } return isTime(hour, minute, second); }
java
public static boolean isTime(String time) { if (isEmpty(time)) return defaultEmptyOK; String hour; String minute; String second; int timeColon1 = time.indexOf(":"); int timeColon2 = time.lastIndexOf(":"); if (timeColon1 <= 0) return false; hour = time.substring(0, timeColon1); if (timeColon1 == timeColon2) { minute = time.substring(timeColon1 + 1); second = "0"; } else { minute = time.substring(timeColon1 + 1, timeColon2); second = time.substring(timeColon2 + 1); } return isTime(hour, minute, second); }
[ "public", "static", "boolean", "isTime", "(", "String", "time", ")", "{", "if", "(", "isEmpty", "(", "time", ")", ")", "return", "defaultEmptyOK", ";", "String", "hour", ";", "String", "minute", ";", "String", "second", ";", "int", "timeColon1", "=", "time", ".", "indexOf", "(", "\":\"", ")", ";", "int", "timeColon2", "=", "time", ".", "lastIndexOf", "(", "\":\"", ")", ";", "if", "(", "timeColon1", "<=", "0", ")", "return", "false", ";", "hour", "=", "time", ".", "substring", "(", "0", ",", "timeColon1", ")", ";", "if", "(", "timeColon1", "==", "timeColon2", ")", "{", "minute", "=", "time", ".", "substring", "(", "timeColon1", "+", "1", ")", ";", "second", "=", "\"0\"", ";", "}", "else", "{", "minute", "=", "time", ".", "substring", "(", "timeColon1", "+", "1", ",", "timeColon2", ")", ";", "second", "=", "time", ".", "substring", "(", "timeColon2", "+", "1", ")", ";", "}", "return", "isTime", "(", "hour", ",", "minute", ",", "second", ")", ";", "}" ]
isTime returns true if string argument time forms a valid time.
[ "isTime", "returns", "true", "if", "string", "argument", "time", "forms", "a", "valid", "time", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L830-L850
23,675
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isCreditCard
public static boolean isCreditCard(String stPassed) { if (isEmpty(stPassed)) return defaultEmptyOK; String st = stripCharsInBag(stPassed, creditCardDelimiters); int sum = 0; int mul = 1; int l = st.length(); // Encoding only works on cards with less than 19 digits if (l > 19) return (false); for (int i = 0; i < l; i++) { String digit = st.substring(l - i - 1, l - i); int tproduct = 0; try { tproduct = Integer.parseInt(digit, 10) * mul; } catch (Exception e) { Debug.logWarning(e.getMessage()); return false; } if (tproduct >= 10) sum += (tproduct % 10) + 1; else sum += tproduct; if (mul == 1) mul++; else mul--; } // Uncomment the following line to help create credit card numbers // 1. Create a dummy number with a 0 as the last digit // 2. Examine the sum written out // 3. Replace the last digit with the difference between the sum and // the next multiple of 10. // document.writeln("<BR>Sum = ",sum,"<BR>"); // alert("Sum = " + sum); if ((sum % 10) == 0) return true; else return false; }
java
public static boolean isCreditCard(String stPassed) { if (isEmpty(stPassed)) return defaultEmptyOK; String st = stripCharsInBag(stPassed, creditCardDelimiters); int sum = 0; int mul = 1; int l = st.length(); // Encoding only works on cards with less than 19 digits if (l > 19) return (false); for (int i = 0; i < l; i++) { String digit = st.substring(l - i - 1, l - i); int tproduct = 0; try { tproduct = Integer.parseInt(digit, 10) * mul; } catch (Exception e) { Debug.logWarning(e.getMessage()); return false; } if (tproduct >= 10) sum += (tproduct % 10) + 1; else sum += tproduct; if (mul == 1) mul++; else mul--; } // Uncomment the following line to help create credit card numbers // 1. Create a dummy number with a 0 as the last digit // 2. Examine the sum written out // 3. Replace the last digit with the difference between the sum and // the next multiple of 10. // document.writeln("<BR>Sum = ",sum,"<BR>"); // alert("Sum = " + sum); if ((sum % 10) == 0) return true; else return false; }
[ "public", "static", "boolean", "isCreditCard", "(", "String", "stPassed", ")", "{", "if", "(", "isEmpty", "(", "stPassed", ")", ")", "return", "defaultEmptyOK", ";", "String", "st", "=", "stripCharsInBag", "(", "stPassed", ",", "creditCardDelimiters", ")", ";", "int", "sum", "=", "0", ";", "int", "mul", "=", "1", ";", "int", "l", "=", "st", ".", "length", "(", ")", ";", "// Encoding only works on cards with less than 19 digits\r", "if", "(", "l", ">", "19", ")", "return", "(", "false", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "l", ";", "i", "++", ")", "{", "String", "digit", "=", "st", ".", "substring", "(", "l", "-", "i", "-", "1", ",", "l", "-", "i", ")", ";", "int", "tproduct", "=", "0", ";", "try", "{", "tproduct", "=", "Integer", ".", "parseInt", "(", "digit", ",", "10", ")", "*", "mul", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Debug", ".", "logWarning", "(", "e", ".", "getMessage", "(", ")", ")", ";", "return", "false", ";", "}", "if", "(", "tproduct", ">=", "10", ")", "sum", "+=", "(", "tproduct", "%", "10", ")", "+", "1", ";", "else", "sum", "+=", "tproduct", ";", "if", "(", "mul", "==", "1", ")", "mul", "++", ";", "else", "mul", "--", ";", "}", "// Uncomment the following line to help create credit card numbers\r", "// 1. Create a dummy number with a 0 as the last digit\r", "// 2. Examine the sum written out\r", "// 3. Replace the last digit with the difference between the sum and\r", "// the next multiple of 10.\r", "// document.writeln(\"<BR>Sum = \",sum,\"<BR>\");\r", "// alert(\"Sum = \" + sum);\r", "if", "(", "(", "sum", "%", "10", ")", "==", "0", ")", "return", "true", ";", "else", "return", "false", ";", "}" ]
Checks credit card number with Luhn Mod-10 test @param stPassed a string representing a credit card number @return true, if the credit card number passes the Luhn Mod-10 test, false otherwise
[ "Checks", "credit", "card", "number", "with", "Luhn", "Mod", "-", "10", "test" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L857-L899
23,676
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isVisa
public static boolean isVisa(String cc) { if (((cc.length() == 16) || (cc.length() == 13)) && (cc.substring(0, 1).equals("4"))) return isCreditCard(cc); return false; }
java
public static boolean isVisa(String cc) { if (((cc.length() == 16) || (cc.length() == 13)) && (cc.substring(0, 1).equals("4"))) return isCreditCard(cc); return false; }
[ "public", "static", "boolean", "isVisa", "(", "String", "cc", ")", "{", "if", "(", "(", "(", "cc", ".", "length", "(", ")", "==", "16", ")", "||", "(", "cc", ".", "length", "(", ")", "==", "13", ")", ")", "&&", "(", "cc", ".", "substring", "(", "0", ",", "1", ")", ".", "equals", "(", "\"4\"", ")", ")", ")", "return", "isCreditCard", "(", "cc", ")", ";", "return", "false", ";", "}" ]
Checks to see if the cc number is a valid Visa number @param cc a string representing a credit card number; Sample number: 4111 1111 1111 1111(16 digits) @return true, if the credit card number is a valid VISA number, false otherwise
[ "Checks", "to", "see", "if", "the", "cc", "number", "is", "a", "valid", "Visa", "number" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L906-L910
23,677
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isMasterCard
public static boolean isMasterCard(String cc) { int firstdig = Integer.parseInt(cc.substring(0, 1)); int seconddig = Integer.parseInt(cc.substring(1, 2)); if ((cc.length() == 16) && (firstdig == 5) && ((seconddig >= 1) && (seconddig <= 5))) return isCreditCard(cc); return false; }
java
public static boolean isMasterCard(String cc) { int firstdig = Integer.parseInt(cc.substring(0, 1)); int seconddig = Integer.parseInt(cc.substring(1, 2)); if ((cc.length() == 16) && (firstdig == 5) && ((seconddig >= 1) && (seconddig <= 5))) return isCreditCard(cc); return false; }
[ "public", "static", "boolean", "isMasterCard", "(", "String", "cc", ")", "{", "int", "firstdig", "=", "Integer", ".", "parseInt", "(", "cc", ".", "substring", "(", "0", ",", "1", ")", ")", ";", "int", "seconddig", "=", "Integer", ".", "parseInt", "(", "cc", ".", "substring", "(", "1", ",", "2", ")", ")", ";", "if", "(", "(", "cc", ".", "length", "(", ")", "==", "16", ")", "&&", "(", "firstdig", "==", "5", ")", "&&", "(", "(", "seconddig", ">=", "1", ")", "&&", "(", "seconddig", "<=", "5", ")", ")", ")", "return", "isCreditCard", "(", "cc", ")", ";", "return", "false", ";", "}" ]
Checks to see if the cc number is a valid Master Card number @param cc a string representing a credit card number; Sample number: 5500 0000 0000 0004(16 digits) @return true, if the credit card number is a valid MasterCard number, false otherwise
[ "Checks", "to", "see", "if", "the", "cc", "number", "is", "a", "valid", "Master", "Card", "number" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L917-L925
23,678
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isDiscover
public static boolean isDiscover(String cc) { String first4digs = cc.substring(0, 4); if ((cc.length() == 16) && (first4digs.equals("6011"))) return isCreditCard(cc); return false; }
java
public static boolean isDiscover(String cc) { String first4digs = cc.substring(0, 4); if ((cc.length() == 16) && (first4digs.equals("6011"))) return isCreditCard(cc); return false; }
[ "public", "static", "boolean", "isDiscover", "(", "String", "cc", ")", "{", "String", "first4digs", "=", "cc", ".", "substring", "(", "0", ",", "4", ")", ";", "if", "(", "(", "cc", ".", "length", "(", ")", "==", "16", ")", "&&", "(", "first4digs", ".", "equals", "(", "\"6011\"", ")", ")", ")", "return", "isCreditCard", "(", "cc", ")", ";", "return", "false", ";", "}" ]
Checks to see if the cc number is a valid Discover number @param cc - a string representing a credit card number; Sample number: 6011000000000004(16 digits) @return true, if the credit card number is a valid Discover card number, false otherwise
[ "Checks", "to", "see", "if", "the", "cc", "number", "is", "a", "valid", "Discover", "number" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L966-L972
23,679
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isJCB
public static boolean isJCB(String cc) { String first4digs = cc.substring(0, 4); if ((cc.length() == 16) && (first4digs.equals("3088") || first4digs.equals("3096") || first4digs.equals("3112") || first4digs.equals("3158") || first4digs.equals("3337") || first4digs.equals("3528"))) return isCreditCard(cc); return false; }
java
public static boolean isJCB(String cc) { String first4digs = cc.substring(0, 4); if ((cc.length() == 16) && (first4digs.equals("3088") || first4digs.equals("3096") || first4digs.equals("3112") || first4digs.equals("3158") || first4digs.equals("3337") || first4digs.equals("3528"))) return isCreditCard(cc); return false; }
[ "public", "static", "boolean", "isJCB", "(", "String", "cc", ")", "{", "String", "first4digs", "=", "cc", ".", "substring", "(", "0", ",", "4", ")", ";", "if", "(", "(", "cc", ".", "length", "(", ")", "==", "16", ")", "&&", "(", "first4digs", ".", "equals", "(", "\"3088\"", ")", "||", "first4digs", ".", "equals", "(", "\"3096\"", ")", "||", "first4digs", ".", "equals", "(", "\"3112\"", ")", "||", "first4digs", ".", "equals", "(", "\"3158\"", ")", "||", "first4digs", ".", "equals", "(", "\"3337\"", ")", "||", "first4digs", ".", "equals", "(", "\"3528\"", ")", ")", ")", "return", "isCreditCard", "(", "cc", ")", ";", "return", "false", ";", "}" ]
Checks to see if the cc number is a valid JCB number @param cc - a string representing a credit card number; Sample number: 3088000000000009(16 digits) @return true, if the credit card number is a valid JCB card number, false otherwise
[ "Checks", "to", "see", "if", "the", "cc", "number", "is", "a", "valid", "JCB", "number" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L990-L1002
23,680
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isAnyCard
public static boolean isAnyCard(String ccPassed) { if (isEmpty(ccPassed)) return defaultEmptyOK; String cc = stripCharsInBag(ccPassed, creditCardDelimiters); if (!isCreditCard(cc)) return false; if (isMasterCard(cc) || isVisa(cc) || isAmericanExpress(cc) || isDinersClub(cc) || isDiscover(cc) || isEnRoute(cc) || isJCB(cc)) return true; return false; }
java
public static boolean isAnyCard(String ccPassed) { if (isEmpty(ccPassed)) return defaultEmptyOK; String cc = stripCharsInBag(ccPassed, creditCardDelimiters); if (!isCreditCard(cc)) return false; if (isMasterCard(cc) || isVisa(cc) || isAmericanExpress(cc) || isDinersClub(cc) || isDiscover(cc) || isEnRoute(cc) || isJCB(cc)) return true; return false; }
[ "public", "static", "boolean", "isAnyCard", "(", "String", "ccPassed", ")", "{", "if", "(", "isEmpty", "(", "ccPassed", ")", ")", "return", "defaultEmptyOK", ";", "String", "cc", "=", "stripCharsInBag", "(", "ccPassed", ",", "creditCardDelimiters", ")", ";", "if", "(", "!", "isCreditCard", "(", "cc", ")", ")", "return", "false", ";", "if", "(", "isMasterCard", "(", "cc", ")", "||", "isVisa", "(", "cc", ")", "||", "isAmericanExpress", "(", "cc", ")", "||", "isDinersClub", "(", "cc", ")", "||", "isDiscover", "(", "cc", ")", "||", "isEnRoute", "(", "cc", ")", "||", "isJCB", "(", "cc", ")", ")", "return", "true", ";", "return", "false", ";", "}" ]
Checks to see if the cc number is a valid number for any accepted credit card @param ccPassed - a string representing a credit card number @return true, if the credit card number is any valid credit card number for any of the accepted card types, false otherwise
[ "Checks", "to", "see", "if", "the", "cc", "number", "is", "a", "valid", "number", "for", "any", "accepted", "credit", "card" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L1008-L1018
23,681
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.getCardType
public static String getCardType(String ccPassed) { if (isEmpty(ccPassed)) return "Unknown"; String cc = stripCharsInBag(ccPassed, creditCardDelimiters); if (!isCreditCard(cc)) return "Unknown"; if (isMasterCard(cc)) return "MasterCard"; if (isVisa(cc)) return "Visa"; if (isAmericanExpress(cc)) return "AmericanExpress"; if (isDinersClub(cc)) return "DinersClub"; if (isDiscover(cc)) return "Discover"; if (isEnRoute(cc)) return "EnRoute"; if (isJCB(cc)) return "JCB"; return "Unknown"; }
java
public static String getCardType(String ccPassed) { if (isEmpty(ccPassed)) return "Unknown"; String cc = stripCharsInBag(ccPassed, creditCardDelimiters); if (!isCreditCard(cc)) return "Unknown"; if (isMasterCard(cc)) return "MasterCard"; if (isVisa(cc)) return "Visa"; if (isAmericanExpress(cc)) return "AmericanExpress"; if (isDinersClub(cc)) return "DinersClub"; if (isDiscover(cc)) return "Discover"; if (isEnRoute(cc)) return "EnRoute"; if (isJCB(cc)) return "JCB"; return "Unknown"; }
[ "public", "static", "String", "getCardType", "(", "String", "ccPassed", ")", "{", "if", "(", "isEmpty", "(", "ccPassed", ")", ")", "return", "\"Unknown\"", ";", "String", "cc", "=", "stripCharsInBag", "(", "ccPassed", ",", "creditCardDelimiters", ")", ";", "if", "(", "!", "isCreditCard", "(", "cc", ")", ")", "return", "\"Unknown\"", ";", "if", "(", "isMasterCard", "(", "cc", ")", ")", "return", "\"MasterCard\"", ";", "if", "(", "isVisa", "(", "cc", ")", ")", "return", "\"Visa\"", ";", "if", "(", "isAmericanExpress", "(", "cc", ")", ")", "return", "\"AmericanExpress\"", ";", "if", "(", "isDinersClub", "(", "cc", ")", ")", "return", "\"DinersClub\"", ";", "if", "(", "isDiscover", "(", "cc", ")", ")", "return", "\"Discover\"", ";", "if", "(", "isEnRoute", "(", "cc", ")", ")", "return", "\"EnRoute\"", ";", "if", "(", "isJCB", "(", "cc", ")", ")", "return", "\"JCB\"", ";", "return", "\"Unknown\"", ";", "}" ]
Checks to see if the cc number is a valid number for any accepted credit card, and return the name of that type @param ccPassed - a string representing a credit card number @return true, if the credit card number is any valid credit card number for any of the accepted card types, false otherwise
[ "Checks", "to", "see", "if", "the", "cc", "number", "is", "a", "valid", "number", "for", "any", "accepted", "credit", "card", "and", "return", "the", "name", "of", "that", "type" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L1024-L1038
23,682
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isCardMatch
public static boolean isCardMatch(String cardType, String cardNumberPassed) { if (isEmpty(cardType)) return defaultEmptyOK; if (isEmpty(cardNumberPassed)) return defaultEmptyOK; String cardNumber = stripCharsInBag(cardNumberPassed, creditCardDelimiters); if ((cardType.equalsIgnoreCase("VISA")) && (isVisa(cardNumber))) return true; if ((cardType.equalsIgnoreCase("MASTERCARD")) && (isMasterCard(cardNumber))) return true; if (((cardType.equalsIgnoreCase("AMERICANEXPRESS")) || (cardType.equalsIgnoreCase("AMEX"))) && (isAmericanExpress(cardNumber))) return true; if ((cardType.equalsIgnoreCase("DISCOVER")) && (isDiscover(cardNumber))) return true; if ((cardType.equalsIgnoreCase("JCB")) && (isJCB(cardNumber))) return true; if (((cardType.equalsIgnoreCase("DINERSCLUB")) || (cardType.equalsIgnoreCase("DINERS"))) && (isDinersClub(cardNumber))) return true; if ((cardType.equalsIgnoreCase("CARTEBLANCHE")) && (isCarteBlanche(cardNumber))) return true; if ((cardType.equalsIgnoreCase("ENROUTE")) && (isEnRoute(cardNumber))) return true; return false; }
java
public static boolean isCardMatch(String cardType, String cardNumberPassed) { if (isEmpty(cardType)) return defaultEmptyOK; if (isEmpty(cardNumberPassed)) return defaultEmptyOK; String cardNumber = stripCharsInBag(cardNumberPassed, creditCardDelimiters); if ((cardType.equalsIgnoreCase("VISA")) && (isVisa(cardNumber))) return true; if ((cardType.equalsIgnoreCase("MASTERCARD")) && (isMasterCard(cardNumber))) return true; if (((cardType.equalsIgnoreCase("AMERICANEXPRESS")) || (cardType.equalsIgnoreCase("AMEX"))) && (isAmericanExpress(cardNumber))) return true; if ((cardType.equalsIgnoreCase("DISCOVER")) && (isDiscover(cardNumber))) return true; if ((cardType.equalsIgnoreCase("JCB")) && (isJCB(cardNumber))) return true; if (((cardType.equalsIgnoreCase("DINERSCLUB")) || (cardType.equalsIgnoreCase("DINERS"))) && (isDinersClub(cardNumber))) return true; if ((cardType.equalsIgnoreCase("CARTEBLANCHE")) && (isCarteBlanche(cardNumber))) return true; if ((cardType.equalsIgnoreCase("ENROUTE")) && (isEnRoute(cardNumber))) return true; return false; }
[ "public", "static", "boolean", "isCardMatch", "(", "String", "cardType", ",", "String", "cardNumberPassed", ")", "{", "if", "(", "isEmpty", "(", "cardType", ")", ")", "return", "defaultEmptyOK", ";", "if", "(", "isEmpty", "(", "cardNumberPassed", ")", ")", "return", "defaultEmptyOK", ";", "String", "cardNumber", "=", "stripCharsInBag", "(", "cardNumberPassed", ",", "creditCardDelimiters", ")", ";", "if", "(", "(", "cardType", ".", "equalsIgnoreCase", "(", "\"VISA\"", ")", ")", "&&", "(", "isVisa", "(", "cardNumber", ")", ")", ")", "return", "true", ";", "if", "(", "(", "cardType", ".", "equalsIgnoreCase", "(", "\"MASTERCARD\"", ")", ")", "&&", "(", "isMasterCard", "(", "cardNumber", ")", ")", ")", "return", "true", ";", "if", "(", "(", "(", "cardType", ".", "equalsIgnoreCase", "(", "\"AMERICANEXPRESS\"", ")", ")", "||", "(", "cardType", ".", "equalsIgnoreCase", "(", "\"AMEX\"", ")", ")", ")", "&&", "(", "isAmericanExpress", "(", "cardNumber", ")", ")", ")", "return", "true", ";", "if", "(", "(", "cardType", ".", "equalsIgnoreCase", "(", "\"DISCOVER\"", ")", ")", "&&", "(", "isDiscover", "(", "cardNumber", ")", ")", ")", "return", "true", ";", "if", "(", "(", "cardType", ".", "equalsIgnoreCase", "(", "\"JCB\"", ")", ")", "&&", "(", "isJCB", "(", "cardNumber", ")", ")", ")", "return", "true", ";", "if", "(", "(", "(", "cardType", ".", "equalsIgnoreCase", "(", "\"DINERSCLUB\"", ")", ")", "||", "(", "cardType", ".", "equalsIgnoreCase", "(", "\"DINERS\"", ")", ")", ")", "&&", "(", "isDinersClub", "(", "cardNumber", ")", ")", ")", "return", "true", ";", "if", "(", "(", "cardType", ".", "equalsIgnoreCase", "(", "\"CARTEBLANCHE\"", ")", ")", "&&", "(", "isCarteBlanche", "(", "cardNumber", ")", ")", ")", "return", "true", ";", "if", "(", "(", "cardType", ".", "equalsIgnoreCase", "(", "\"ENROUTE\"", ")", ")", "&&", "(", "isEnRoute", "(", "cardNumber", ")", ")", ")", "return", "true", ";", "return", "false", ";", "}" ]
Checks to see if the cc number is a valid number for the specified type @param cardType - a string representing the credit card type @param cardNumberPassed - a string representing a credit card number @return true, if the credit card number is valid for the particular credit card type given in "cardType", false otherwise
[ "Checks", "to", "see", "if", "the", "cc", "number", "is", "a", "valid", "number", "for", "the", "specified", "type" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L1045-L1059
23,683
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.isNotPoBox
public static boolean isNotPoBox(String s) { if (isEmpty(s)) return defaultEmptyOK; // strings to check from Greg's program // "P.O. B" // "P.o.B" // "P.O B" // "PO. B" // "P O B" // "PO B" // "P.0. B" // "P0 B" String sl = s.toLowerCase(); if (sl.indexOf("p.o. b") != -1) return false; if (sl.indexOf("p.o.b") != -1) return false; if (sl.indexOf("p.o b") != -1) return false; if (sl.indexOf("p o b") != -1) return false; if (sl.indexOf("po b") != -1) return false; if (sl.indexOf("pobox") != -1) return false; if (sl.indexOf("po#") != -1) return false; if (sl.indexOf("po #") != -1) return false; // now with 0's for them sneaky folks if (sl.indexOf("p.0. b") != -1) return false; if (sl.indexOf("p.0.b") != -1) return false; if (sl.indexOf("p.0 b") != -1) return false; if (sl.indexOf("p 0 b") != -1) return false; if (sl.indexOf("p0 b") != -1) return false; if (sl.indexOf("p0box") != -1) return false; if (sl.indexOf("p0#") != -1) return false; if (sl.indexOf("p0 #") != -1) return false; return true; }
java
public static boolean isNotPoBox(String s) { if (isEmpty(s)) return defaultEmptyOK; // strings to check from Greg's program // "P.O. B" // "P.o.B" // "P.O B" // "PO. B" // "P O B" // "PO B" // "P.0. B" // "P0 B" String sl = s.toLowerCase(); if (sl.indexOf("p.o. b") != -1) return false; if (sl.indexOf("p.o.b") != -1) return false; if (sl.indexOf("p.o b") != -1) return false; if (sl.indexOf("p o b") != -1) return false; if (sl.indexOf("po b") != -1) return false; if (sl.indexOf("pobox") != -1) return false; if (sl.indexOf("po#") != -1) return false; if (sl.indexOf("po #") != -1) return false; // now with 0's for them sneaky folks if (sl.indexOf("p.0. b") != -1) return false; if (sl.indexOf("p.0.b") != -1) return false; if (sl.indexOf("p.0 b") != -1) return false; if (sl.indexOf("p 0 b") != -1) return false; if (sl.indexOf("p0 b") != -1) return false; if (sl.indexOf("p0box") != -1) return false; if (sl.indexOf("p0#") != -1) return false; if (sl.indexOf("p0 #") != -1) return false; return true; }
[ "public", "static", "boolean", "isNotPoBox", "(", "String", "s", ")", "{", "if", "(", "isEmpty", "(", "s", ")", ")", "return", "defaultEmptyOK", ";", "// strings to check from Greg's program\r", "// \"P.O. B\"\r", "// \"P.o.B\"\r", "// \"P.O B\"\r", "// \"PO. B\"\r", "// \"P O B\"\r", "// \"PO B\"\r", "// \"P.0. B\"\r", "// \"P0 B\"\r", "String", "sl", "=", "s", ".", "toLowerCase", "(", ")", ";", "if", "(", "sl", ".", "indexOf", "(", "\"p.o. b\"", ")", "!=", "-", "1", ")", "return", "false", ";", "if", "(", "sl", ".", "indexOf", "(", "\"p.o.b\"", ")", "!=", "-", "1", ")", "return", "false", ";", "if", "(", "sl", ".", "indexOf", "(", "\"p.o b\"", ")", "!=", "-", "1", ")", "return", "false", ";", "if", "(", "sl", ".", "indexOf", "(", "\"p o b\"", ")", "!=", "-", "1", ")", "return", "false", ";", "if", "(", "sl", ".", "indexOf", "(", "\"po b\"", ")", "!=", "-", "1", ")", "return", "false", ";", "if", "(", "sl", ".", "indexOf", "(", "\"pobox\"", ")", "!=", "-", "1", ")", "return", "false", ";", "if", "(", "sl", ".", "indexOf", "(", "\"po#\"", ")", "!=", "-", "1", ")", "return", "false", ";", "if", "(", "sl", ".", "indexOf", "(", "\"po #\"", ")", "!=", "-", "1", ")", "return", "false", ";", "// now with 0's for them sneaky folks\r", "if", "(", "sl", ".", "indexOf", "(", "\"p.0. b\"", ")", "!=", "-", "1", ")", "return", "false", ";", "if", "(", "sl", ".", "indexOf", "(", "\"p.0.b\"", ")", "!=", "-", "1", ")", "return", "false", ";", "if", "(", "sl", ".", "indexOf", "(", "\"p.0 b\"", ")", "!=", "-", "1", ")", "return", "false", ";", "if", "(", "sl", ".", "indexOf", "(", "\"p 0 b\"", ")", "!=", "-", "1", ")", "return", "false", ";", "if", "(", "sl", ".", "indexOf", "(", "\"p0 b\"", ")", "!=", "-", "1", ")", "return", "false", ";", "if", "(", "sl", ".", "indexOf", "(", "\"p0box\"", ")", "!=", "-", "1", ")", "return", "false", ";", "if", "(", "sl", ".", "indexOf", "(", "\"p0#\"", ")", "!=", "-", "1", ")", "return", "false", ";", "if", "(", "sl", ".", "indexOf", "(", "\"p0 #\"", ")", "!=", "-", "1", ")", "return", "false", ";", "return", "true", ";", "}" ]
isNotPoBox returns true if address argument does not contain anything that looks like a a PO Box.
[ "isNotPoBox", "returns", "true", "if", "address", "argument", "does", "not", "contain", "anything", "that", "looks", "like", "a", "a", "PO", "Box", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L1063-L1096
23,684
banq/jdonframework
JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/HessianToJdonRequestProcessor.java
HessianToJdonRequestProcessor.process
public void process(final String beanName, final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { InputStream is = request.getInputStream(); OutputStream os = response.getOutputStream(); Hessian2Input in = new Hessian2Input(is); AbstractHessianOutput out; SerializerFactory serializerFactory = new SerializerFactory(); serializerFactory.setAllowNonSerializable(true); serializerFactory.addFactory(new JdonSerializerFactory()); in.setSerializerFactory(serializerFactory); int code = in.read(); if (code != 'c') { // XXX: deflate throw new IOException("expected 'c' in hessian input at " + code); } int major = in.read(); in.read(); if (major >= HESSIAN_PROTOCOL_MAJOR_VERSION) { out = new Hessian2Output(os); } else { out = new HessianOutput(os); } out.setSerializerFactory(serializerFactory); // backward compatibility for some frameworks that don't read // the call type first in.skipOptionalCall(); out.startReply(); readHeaders(in); // read headers from call try { out.writeObject(makeCall(in, beanName, request)); } catch (Exception e) { writeException(out, e); } // The complete call needs to be after the invoke to handle a // trailing InputStream in.completeCall(); out.completeReply(); out.close(); }
java
public void process(final String beanName, final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { InputStream is = request.getInputStream(); OutputStream os = response.getOutputStream(); Hessian2Input in = new Hessian2Input(is); AbstractHessianOutput out; SerializerFactory serializerFactory = new SerializerFactory(); serializerFactory.setAllowNonSerializable(true); serializerFactory.addFactory(new JdonSerializerFactory()); in.setSerializerFactory(serializerFactory); int code = in.read(); if (code != 'c') { // XXX: deflate throw new IOException("expected 'c' in hessian input at " + code); } int major = in.read(); in.read(); if (major >= HESSIAN_PROTOCOL_MAJOR_VERSION) { out = new Hessian2Output(os); } else { out = new HessianOutput(os); } out.setSerializerFactory(serializerFactory); // backward compatibility for some frameworks that don't read // the call type first in.skipOptionalCall(); out.startReply(); readHeaders(in); // read headers from call try { out.writeObject(makeCall(in, beanName, request)); } catch (Exception e) { writeException(out, e); } // The complete call needs to be after the invoke to handle a // trailing InputStream in.completeCall(); out.completeReply(); out.close(); }
[ "public", "void", "process", "(", "final", "String", "beanName", ",", "final", "HttpServletRequest", "request", ",", "final", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "InputStream", "is", "=", "request", ".", "getInputStream", "(", ")", ";", "OutputStream", "os", "=", "response", ".", "getOutputStream", "(", ")", ";", "Hessian2Input", "in", "=", "new", "Hessian2Input", "(", "is", ")", ";", "AbstractHessianOutput", "out", ";", "SerializerFactory", "serializerFactory", "=", "new", "SerializerFactory", "(", ")", ";", "serializerFactory", ".", "setAllowNonSerializable", "(", "true", ")", ";", "serializerFactory", ".", "addFactory", "(", "new", "JdonSerializerFactory", "(", ")", ")", ";", "in", ".", "setSerializerFactory", "(", "serializerFactory", ")", ";", "int", "code", "=", "in", ".", "read", "(", ")", ";", "if", "(", "code", "!=", "'", "'", ")", "{", "// XXX: deflate\r", "throw", "new", "IOException", "(", "\"expected 'c' in hessian input at \"", "+", "code", ")", ";", "}", "int", "major", "=", "in", ".", "read", "(", ")", ";", "in", ".", "read", "(", ")", ";", "if", "(", "major", ">=", "HESSIAN_PROTOCOL_MAJOR_VERSION", ")", "{", "out", "=", "new", "Hessian2Output", "(", "os", ")", ";", "}", "else", "{", "out", "=", "new", "HessianOutput", "(", "os", ")", ";", "}", "out", ".", "setSerializerFactory", "(", "serializerFactory", ")", ";", "// backward compatibility for some frameworks that don't read\r", "// the call type first\r", "in", ".", "skipOptionalCall", "(", ")", ";", "out", ".", "startReply", "(", ")", ";", "readHeaders", "(", "in", ")", ";", "// read headers from call\r", "try", "{", "out", ".", "writeObject", "(", "makeCall", "(", "in", ",", "beanName", ",", "request", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "writeException", "(", "out", ",", "e", ")", ";", "}", "// The complete call needs to be after the invoke to handle a\r", "// trailing InputStream\r", "in", ".", "completeCall", "(", ")", ";", "out", ".", "completeReply", "(", ")", ";", "out", ".", "close", "(", ")", ";", "}" ]
Process servlet requests and writes bean's method result to output @param beanName String @param request HttpServletRequest @param response HttpServletResponse @throws javax.servlet.ServletException If error occur @throws java.io.IOException If error occur
[ "Process", "servlet", "requests", "and", "writes", "bean", "s", "method", "result", "to", "output" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/HessianToJdonRequestProcessor.java#L56-L110
23,685
banq/jdonframework
JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/HessianToJdonRequestProcessor.java
HessianToJdonRequestProcessor.readHeaders
public Map readHeaders(Hessian2Input hessian2Input) throws IOException { Map headers = new HashMap(); String header = hessian2Input.readHeader(); while (header != null) { headers.put(header, hessian2Input.readObject()); header = hessian2Input.readHeader(); } return headers; }
java
public Map readHeaders(Hessian2Input hessian2Input) throws IOException { Map headers = new HashMap(); String header = hessian2Input.readHeader(); while (header != null) { headers.put(header, hessian2Input.readObject()); header = hessian2Input.readHeader(); } return headers; }
[ "public", "Map", "readHeaders", "(", "Hessian2Input", "hessian2Input", ")", "throws", "IOException", "{", "Map", "headers", "=", "new", "HashMap", "(", ")", ";", "String", "header", "=", "hessian2Input", ".", "readHeader", "(", ")", ";", "while", "(", "header", "!=", "null", ")", "{", "headers", ".", "put", "(", "header", ",", "hessian2Input", ".", "readObject", "(", ")", ")", ";", "header", "=", "hessian2Input", ".", "readHeader", "(", ")", ";", "}", "return", "headers", ";", "}" ]
Reads headers from call. @param hessian2Input - HessianInput @return Map of headers @throws java.io.IOException If error occurs
[ "Reads", "headers", "from", "call", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/HessianToJdonRequestProcessor.java#L185-L193
23,686
banq/jdonframework
JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/HessianToJdonRequestProcessor.java
HessianToJdonRequestProcessor.writeException
protected void writeException(final AbstractHessianOutput out, Exception ex) throws IOException { OutputStream os = new ByteArrayOutputStream(); ex.printStackTrace(new PrintStream(os)); out.writeFault(ex.getClass().toString(), os.toString(), null); }
java
protected void writeException(final AbstractHessianOutput out, Exception ex) throws IOException { OutputStream os = new ByteArrayOutputStream(); ex.printStackTrace(new PrintStream(os)); out.writeFault(ex.getClass().toString(), os.toString(), null); }
[ "protected", "void", "writeException", "(", "final", "AbstractHessianOutput", "out", ",", "Exception", "ex", ")", "throws", "IOException", "{", "OutputStream", "os", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "ex", ".", "printStackTrace", "(", "new", "PrintStream", "(", "os", ")", ")", ";", "out", ".", "writeFault", "(", "ex", ".", "getClass", "(", ")", ".", "toString", "(", ")", ",", "os", ".", "toString", "(", ")", ",", "null", ")", ";", "}" ]
Writes Exception information to Hessian Output. @param out Hessian Output @param ex Exception @throws java.io.IOException If i/o error occur
[ "Writes", "Exception", "information", "to", "Hessian", "Output", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/HessianToJdonRequestProcessor.java#L205-L210
23,687
banq/jdonframework
src/main/java/com/jdon/container/pico/PicoContainerWrapper.java
PicoContainerWrapper.getComponentNewInstance
public Object getComponentNewInstance(String name) { Debug.logVerbose("[JdonFramework]getComponentNewInstance: name=" + name, module); ComponentAdapter componentAdapter = container.getComponentAdapter(name); if (componentAdapter == null) { Debug.logWarning("[JdonFramework]Not find the component in container :" + name, module); return null; } return componentAdapter.getComponentInstance(container); }
java
public Object getComponentNewInstance(String name) { Debug.logVerbose("[JdonFramework]getComponentNewInstance: name=" + name, module); ComponentAdapter componentAdapter = container.getComponentAdapter(name); if (componentAdapter == null) { Debug.logWarning("[JdonFramework]Not find the component in container :" + name, module); return null; } return componentAdapter.getComponentInstance(container); }
[ "public", "Object", "getComponentNewInstance", "(", "String", "name", ")", "{", "Debug", ".", "logVerbose", "(", "\"[JdonFramework]getComponentNewInstance: name=\"", "+", "name", ",", "module", ")", ";", "ComponentAdapter", "componentAdapter", "=", "container", ".", "getComponentAdapter", "(", "name", ")", ";", "if", "(", "componentAdapter", "==", "null", ")", "{", "Debug", ".", "logWarning", "(", "\"[JdonFramework]Not find the component in container :\"", "+", "name", ",", "module", ")", ";", "return", "null", ";", "}", "return", "componentAdapter", ".", "getComponentInstance", "(", "container", ")", ";", "}" ]
This method will usually create a new instance each time it is called @param name component name @return object new instance
[ "This", "method", "will", "usually", "create", "a", "new", "instance", "each", "time", "it", "is", "called" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/container/pico/PicoContainerWrapper.java#L209-L217
23,688
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandlerManagerImp.java
ModelHandlerManagerImp.borrowtHandlerObject
public ModelHandler borrowtHandlerObject(String formName) { ModelHandler modelHandler = null; try { modelHandler = handlerObjectFactory.borrowHandlerObject(formName); modelHandler.setModelMapping(modelFactory.getModelMapping(formName)); } catch (Exception ex) { Debug.logError("[JdonFramework]can't get the modelHandler for the formName " + formName, module); returnHandlerObject(modelHandler); } return modelHandler; }
java
public ModelHandler borrowtHandlerObject(String formName) { ModelHandler modelHandler = null; try { modelHandler = handlerObjectFactory.borrowHandlerObject(formName); modelHandler.setModelMapping(modelFactory.getModelMapping(formName)); } catch (Exception ex) { Debug.logError("[JdonFramework]can't get the modelHandler for the formName " + formName, module); returnHandlerObject(modelHandler); } return modelHandler; }
[ "public", "ModelHandler", "borrowtHandlerObject", "(", "String", "formName", ")", "{", "ModelHandler", "modelHandler", "=", "null", ";", "try", "{", "modelHandler", "=", "handlerObjectFactory", ".", "borrowHandlerObject", "(", "formName", ")", ";", "modelHandler", ".", "setModelMapping", "(", "modelFactory", ".", "getModelMapping", "(", "formName", ")", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "Debug", ".", "logError", "(", "\"[JdonFramework]can't get the modelHandler for the formName \"", "+", "formName", ",", "module", ")", ";", "returnHandlerObject", "(", "modelHandler", ")", ";", "}", "return", "modelHandler", ";", "}" ]
borrow a Handler instance from Modelhandler pool
[ "borrow", "a", "Handler", "instance", "from", "Modelhandler", "pool" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandlerManagerImp.java#L54-L64
23,689
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandlerManagerImp.java
ModelHandlerManagerImp.returnHandlerObject
public void returnHandlerObject(ModelHandler modelHandler) { if (modelHandler == null) return; try { handlerObjectFactory.returnHandlerObject(modelHandler); } catch (Exception ex) { Debug.logError("[JdonFramework] return modelHandler error" + ex, module); } }
java
public void returnHandlerObject(ModelHandler modelHandler) { if (modelHandler == null) return; try { handlerObjectFactory.returnHandlerObject(modelHandler); } catch (Exception ex) { Debug.logError("[JdonFramework] return modelHandler error" + ex, module); } }
[ "public", "void", "returnHandlerObject", "(", "ModelHandler", "modelHandler", ")", "{", "if", "(", "modelHandler", "==", "null", ")", "return", ";", "try", "{", "handlerObjectFactory", ".", "returnHandlerObject", "(", "modelHandler", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "Debug", ".", "logError", "(", "\"[JdonFramework] return modelHandler error\"", "+", "ex", ",", "module", ")", ";", "}", "}" ]
return the Handler instance.
[ "return", "the", "Handler", "instance", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandlerManagerImp.java#L70-L79
23,690
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandlerManagerImp.java
ModelHandlerManagerImp.makeModelObject
private Object makeModelObject(String formName) { Object object = null; Class modelClass = null; try { modelClass = (Class) modelFactory.getModelClasses(formName); if (modelClass == null) { throw new Exception(" not found the model in config xml, formName=" + formName); } object = modelClass.newInstance(); // inject modelProxyInjection.injectProperties(object); } catch (Exception e) { Debug.logError("[JdonFramework]--> call Model: " + modelClass + " error:" + e, module); } return object; }
java
private Object makeModelObject(String formName) { Object object = null; Class modelClass = null; try { modelClass = (Class) modelFactory.getModelClasses(formName); if (modelClass == null) { throw new Exception(" not found the model in config xml, formName=" + formName); } object = modelClass.newInstance(); // inject modelProxyInjection.injectProperties(object); } catch (Exception e) { Debug.logError("[JdonFramework]--> call Model: " + modelClass + " error:" + e, module); } return object; }
[ "private", "Object", "makeModelObject", "(", "String", "formName", ")", "{", "Object", "object", "=", "null", ";", "Class", "modelClass", "=", "null", ";", "try", "{", "modelClass", "=", "(", "Class", ")", "modelFactory", ".", "getModelClasses", "(", "formName", ")", ";", "if", "(", "modelClass", "==", "null", ")", "{", "throw", "new", "Exception", "(", "\" not found the model in config xml, formName=\"", "+", "formName", ")", ";", "}", "object", "=", "modelClass", ".", "newInstance", "(", ")", ";", "// inject\r", "modelProxyInjection", ".", "injectProperties", "(", "object", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Debug", ".", "logError", "(", "\"[JdonFramework]--> call Model: \"", "+", "modelClass", "+", "\" error:\"", "+", "e", ",", "module", ")", ";", "}", "return", "object", ";", "}" ]
create model instance from the model class that read from the xml configure. @param formName @return @throws Exception
[ "create", "model", "instance", "from", "the", "model", "class", "that", "read", "from", "the", "xml", "configure", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandlerManagerImp.java#L99-L114
23,691
banq/jdonframework
JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/controller/model/PageIterator.java
PageIterator.hasNext
public boolean hasNext() { if (currentIndex == endIndex) { return false; } // Otherwise, see if nextElement is null. If so, try to load the next // element to make sure it exists. if (nextElement == null) { nextElement = getNextElement(); if (nextElement == null) { return false; } } return true; }
java
public boolean hasNext() { if (currentIndex == endIndex) { return false; } // Otherwise, see if nextElement is null. If so, try to load the next // element to make sure it exists. if (nextElement == null) { nextElement = getNextElement(); if (nextElement == null) { return false; } } return true; }
[ "public", "boolean", "hasNext", "(", ")", "{", "if", "(", "currentIndex", "==", "endIndex", ")", "{", "return", "false", ";", "}", "// Otherwise, see if nextElement is null. If so, try to load the next\r", "// element to make sure it exists.\r", "if", "(", "nextElement", "==", "null", ")", "{", "nextElement", "=", "getNextElement", "(", ")", ";", "if", "(", "nextElement", "==", "null", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Returns true if there are more elements in the iteration. @return true if the iterator has more elements.
[ "Returns", "true", "if", "there", "are", "more", "elements", "in", "the", "iteration", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/controller/model/PageIterator.java#L213-L227
23,692
banq/jdonframework
JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/controller/model/PageIterator.java
PageIterator.next
public Object next() throws java.util.NoSuchElementException { Object element = null; if (nextElement != null) { element = nextElement; nextElement = null; } else { element = getNextElement(); if (element == null) { throw new java.util.NoSuchElementException(); } } return element; }
java
public Object next() throws java.util.NoSuchElementException { Object element = null; if (nextElement != null) { element = nextElement; nextElement = null; } else { element = getNextElement(); if (element == null) { throw new java.util.NoSuchElementException(); } } return element; }
[ "public", "Object", "next", "(", ")", "throws", "java", ".", "util", ".", "NoSuchElementException", "{", "Object", "element", "=", "null", ";", "if", "(", "nextElement", "!=", "null", ")", "{", "element", "=", "nextElement", ";", "nextElement", "=", "null", ";", "}", "else", "{", "element", "=", "getNextElement", "(", ")", ";", "if", "(", "element", "==", "null", ")", "{", "throw", "new", "java", ".", "util", ".", "NoSuchElementException", "(", ")", ";", "}", "}", "return", "element", ";", "}" ]
Returns the next element of primary key collection. @return the next element. @throws NoSuchElementException if there are no more elements.
[ "Returns", "the", "next", "element", "of", "primary", "key", "collection", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/controller/model/PageIterator.java#L236-L248
23,693
banq/jdonframework
JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/controller/model/PageIterator.java
PageIterator.hasPrevious
public boolean hasPrevious() { // If we are at the start of the list there are no previous elements. if (currentIndex == startIndex) { return false; } // Otherwise, see if previous Element is null. If so, try to load the // previous element to make sure it exists. if (previousElement == null) { previousElement = getPreviousElement(); // If getting the previous element failed, return false. if (previousElement == null) { return false; } } return true; }
java
public boolean hasPrevious() { // If we are at the start of the list there are no previous elements. if (currentIndex == startIndex) { return false; } // Otherwise, see if previous Element is null. If so, try to load the // previous element to make sure it exists. if (previousElement == null) { previousElement = getPreviousElement(); // If getting the previous element failed, return false. if (previousElement == null) { return false; } } return true; }
[ "public", "boolean", "hasPrevious", "(", ")", "{", "// If we are at the start of the list there are no previous elements.\r", "if", "(", "currentIndex", "==", "startIndex", ")", "{", "return", "false", ";", "}", "// Otherwise, see if previous Element is null. If so, try to load the\r", "// previous element to make sure it exists.\r", "if", "(", "previousElement", "==", "null", ")", "{", "previousElement", "=", "getPreviousElement", "(", ")", ";", "// If getting the previous element failed, return false.\r", "if", "(", "previousElement", "==", "null", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Returns true if there are previous elements in the iteration. @return
[ "Returns", "true", "if", "there", "are", "previous", "elements", "in", "the", "iteration", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/controller/model/PageIterator.java#L255-L270
23,694
banq/jdonframework
JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/controller/model/PageIterator.java
PageIterator.getPreviousElement
private Object getPreviousElement() { Object element = null; while (currentIndex >= startIndex && element == null) { currentIndex--; element = getElement(); } return element; }
java
private Object getPreviousElement() { Object element = null; while (currentIndex >= startIndex && element == null) { currentIndex--; element = getElement(); } return element; }
[ "private", "Object", "getPreviousElement", "(", ")", "{", "Object", "element", "=", "null", ";", "while", "(", "currentIndex", ">=", "startIndex", "&&", "element", "==", "null", ")", "{", "currentIndex", "--", ";", "element", "=", "getElement", "(", ")", ";", "}", "return", "element", ";", "}" ]
Returns the previous element, or null if there are no more elements to return. @return the previous element.
[ "Returns", "the", "previous", "element", "or", "null", "if", "there", "are", "no", "more", "elements", "to", "return", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/controller/model/PageIterator.java#L297-L304
23,695
banq/jdonframework
JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/controller/model/PageIterator.java
PageIterator.getNextElement
public Object getNextElement() { Object element = null; while (currentIndex+1 < endIndex && element == null) { currentIndex++; element = getElement(); } return element; }
java
public Object getNextElement() { Object element = null; while (currentIndex+1 < endIndex && element == null) { currentIndex++; element = getElement(); } return element; }
[ "public", "Object", "getNextElement", "(", ")", "{", "Object", "element", "=", "null", ";", "while", "(", "currentIndex", "+", "1", "<", "endIndex", "&&", "element", "==", "null", ")", "{", "currentIndex", "++", ";", "element", "=", "getElement", "(", ")", ";", "}", "return", "element", ";", "}" ]
Returns the next available element of primary key collection, or null if there are no more elements to return. @return the next available element.
[ "Returns", "the", "next", "available", "element", "of", "primary", "key", "collection", "or", "null", "if", "there", "are", "no", "more", "elements", "to", "return", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/controller/model/PageIterator.java#L319-L326
23,696
banq/jdonframework
src/main/java/com/jdon/util/jdom/DataUnformatFilter.java
DataUnformatFilter.emitWhitespace
protected void emitWhitespace() throws SAXException { char[] data = new char[whitespace.length()]; whitespace.getChars(0, data.length, data, 0); whitespace.setLength(0); super.characters(data, 0, data.length); }
java
protected void emitWhitespace() throws SAXException { char[] data = new char[whitespace.length()]; whitespace.getChars(0, data.length, data, 0); whitespace.setLength(0); super.characters(data, 0, data.length); }
[ "protected", "void", "emitWhitespace", "(", ")", "throws", "SAXException", "{", "char", "[", "]", "data", "=", "new", "char", "[", "whitespace", ".", "length", "(", ")", "]", ";", "whitespace", ".", "getChars", "(", "0", ",", "data", ".", "length", ",", "data", ",", "0", ")", ";", "whitespace", ".", "setLength", "(", "0", ")", ";", "super", ".", "characters", "(", "data", ",", "0", ",", "data", ".", "length", ")", ";", "}" ]
Passes saved whitespace down the filter chain.
[ "Passes", "saved", "whitespace", "down", "the", "filter", "chain", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/jdom/DataUnformatFilter.java#L280-L285
23,697
banq/jdonframework
src/main/java/com/jdon/controller/cache/CacheKey.java
CacheKey.getKey
public String getKey() { StringBuilder buffer = new StringBuilder(cacheType); buffer.append(dataTypeName); if (dataKey != null) buffer.append(dataKey.toString()); return buffer.toString().intern(); }
java
public String getKey() { StringBuilder buffer = new StringBuilder(cacheType); buffer.append(dataTypeName); if (dataKey != null) buffer.append(dataKey.toString()); return buffer.toString().intern(); }
[ "public", "String", "getKey", "(", ")", "{", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", "cacheType", ")", ";", "buffer", ".", "append", "(", "dataTypeName", ")", ";", "if", "(", "dataKey", "!=", "null", ")", "buffer", ".", "append", "(", "dataKey", ".", "toString", "(", ")", ")", ";", "return", "buffer", ".", "toString", "(", ")", ".", "intern", "(", ")", ";", "}" ]
cacheType + dataTypeName + dataKey
[ "cacheType", "+", "dataTypeName", "+", "dataKey" ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/controller/cache/CacheKey.java#L49-L55
23,698
banq/jdonframework
src/main/java/com/jdon/util/jdom/XMLFilterBase.java
XMLFilterBase.startElement
public void startElement (String uri, String localName) throws SAXException { startElement(uri, localName, "", EMPTY_ATTS); }
java
public void startElement (String uri, String localName) throws SAXException { startElement(uri, localName, "", EMPTY_ATTS); }
[ "public", "void", "startElement", "(", "String", "uri", ",", "String", "localName", ")", "throws", "SAXException", "{", "startElement", "(", "uri", ",", "localName", ",", "\"\"", ",", "EMPTY_ATTS", ")", ";", "}" ]
Start a new element without a qname or attributes. <p>This method will provide a default empty attribute list and an empty string for the qualified name. It invokes {@link #startElement(String, String, String, Attributes)} directly.</p> @param uri The element's Namespace URI. @param localName The element's local name. @exception org.xml.sax.SAXException If a filter further down the chain raises an exception. @see org.xml.sax.ContentHandler#startElement
[ "Start", "a", "new", "element", "without", "a", "qname", "or", "attributes", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/jdom/XMLFilterBase.java#L168-L172
23,699
banq/jdonframework
src/main/java/com/jdon/util/jdom/XMLFilterBase.java
XMLFilterBase.emptyElement
public void emptyElement (String uri, String localName, String qName, Attributes atts) throws SAXException { startElement(uri, localName, qName, atts); endElement(uri, localName, qName); }
java
public void emptyElement (String uri, String localName, String qName, Attributes atts) throws SAXException { startElement(uri, localName, qName, atts); endElement(uri, localName, qName); }
[ "public", "void", "emptyElement", "(", "String", "uri", ",", "String", "localName", ",", "String", "qName", ",", "Attributes", "atts", ")", "throws", "SAXException", "{", "startElement", "(", "uri", ",", "localName", ",", "qName", ",", "atts", ")", ";", "endElement", "(", "uri", ",", "localName", ",", "qName", ")", ";", "}" ]
Add an empty element. Both a {@link #startElement startElement} and an {@link #endElement endElement} event will be passed on down the filter chain. @param uri The element's Namespace URI, or the empty string if the element has no Namespace or if Namespace processing is not being performed. @param localName The element's local name (without prefix). This parameter must be provided. @param qName The element's qualified name (with prefix), or the empty string if none is available. This parameter is strictly advisory: the writer may or may not use the prefix attached. @param atts The element's attribute list. @exception org.xml.sax.SAXException If a filter further down the chain raises an exception. @see org.xml.sax.ContentHandler#startElement @see org.xml.sax.ContentHandler#endElement
[ "Add", "an", "empty", "element", "." ]
72b451caac04f775e57f52aaed3d8775044ead53
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/jdom/XMLFilterBase.java#L280-L286