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
151,900
JM-Lab/utils-java9
src/main/java/kr/jm/utils/helper/JMJson.java
JMJson.withFilePathOrClasspath
public static <T> T withFilePathOrClasspath( String resourceFilePathOrClasspath, TypeReference<T> typeReference) { return withJsonString(JMResources .getStringWithFilePathOrClasspath(resourceFilePathOrClasspath), typeReference); }
java
public static <T> T withFilePathOrClasspath( String resourceFilePathOrClasspath, TypeReference<T> typeReference) { return withJsonString(JMResources .getStringWithFilePathOrClasspath(resourceFilePathOrClasspath), typeReference); }
[ "public", "static", "<", "T", ">", "T", "withFilePathOrClasspath", "(", "String", "resourceFilePathOrClasspath", ",", "TypeReference", "<", "T", ">", "typeReference", ")", "{", "return", "withJsonString", "(", "JMResources", ".", "getStringWithFilePathOrClasspath", "(", "resourceFilePathOrClasspath", ")", ",", "typeReference", ")", ";", "}" ]
With file path or classpath t. @param <T> the type parameter @param resourceFilePathOrClasspath the resource file path or classpath @param typeReference the type reference @return the t
[ "With", "file", "path", "or", "classpath", "t", "." ]
ee80235b2760396a616cf7563cbdc98d4affe8e1
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMJson.java#L364-L370
151,901
JM-Lab/utils-java9
src/main/java/kr/jm/utils/helper/JMJson.java
JMJson.transformToMap
public static <T> Map<String, Object> transformToMap(T object) { return transform(object, MAP_TYPE_REFERENCE); }
java
public static <T> Map<String, Object> transformToMap(T object) { return transform(object, MAP_TYPE_REFERENCE); }
[ "public", "static", "<", "T", ">", "Map", "<", "String", ",", "Object", ">", "transformToMap", "(", "T", "object", ")", "{", "return", "transform", "(", "object", ",", "MAP_TYPE_REFERENCE", ")", ";", "}" ]
Transform to map map. @param <T> the type parameter @param object the object @return the map
[ "Transform", "to", "map", "map", "." ]
ee80235b2760396a616cf7563cbdc98d4affe8e1
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMJson.java#L379-L381
151,902
JM-Lab/utils-java9
src/main/java/kr/jm/utils/helper/JMJson.java
JMJson.toPrettyJsonString
public static String toPrettyJsonString(Object object) { try { return jsonMapper.writerWithDefaultPrettyPrinter() .writeValueAsString(object); } catch (JsonProcessingException e) { return JMExceptionManager.handleExceptionAndReturnNull(log, e, "toPrettyJsonString", object); } }
java
public static String toPrettyJsonString(Object object) { try { return jsonMapper.writerWithDefaultPrettyPrinter() .writeValueAsString(object); } catch (JsonProcessingException e) { return JMExceptionManager.handleExceptionAndReturnNull(log, e, "toPrettyJsonString", object); } }
[ "public", "static", "String", "toPrettyJsonString", "(", "Object", "object", ")", "{", "try", "{", "return", "jsonMapper", ".", "writerWithDefaultPrettyPrinter", "(", ")", ".", "writeValueAsString", "(", "object", ")", ";", "}", "catch", "(", "JsonProcessingException", "e", ")", "{", "return", "JMExceptionManager", ".", "handleExceptionAndReturnNull", "(", "log", ",", "e", ",", "\"toPrettyJsonString\"", ",", "object", ")", ";", "}", "}" ]
To pretty json string string. @param object the object @return the string
[ "To", "pretty", "json", "string", "string", "." ]
ee80235b2760396a616cf7563cbdc98d4affe8e1
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMJson.java#L437-L445
151,903
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/modify/ModifyFileExtensions.java
ModifyFileExtensions.modifyFile
public static void modifyFile(Path inFilePath, Path outFilePath, FileChangable modifier) throws IOException { try ( BufferedReader bufferedReader = new BufferedReader(new FileReader(inFilePath.toFile())); Writer writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(outFilePath.toFile()), "utf-8"))) { String readLine; int counter = 0; while ((readLine = bufferedReader.readLine()) != null) { writer.write(modifier.apply(counter, readLine)); counter++; } } }
java
public static void modifyFile(Path inFilePath, Path outFilePath, FileChangable modifier) throws IOException { try ( BufferedReader bufferedReader = new BufferedReader(new FileReader(inFilePath.toFile())); Writer writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(outFilePath.toFile()), "utf-8"))) { String readLine; int counter = 0; while ((readLine = bufferedReader.readLine()) != null) { writer.write(modifier.apply(counter, readLine)); counter++; } } }
[ "public", "static", "void", "modifyFile", "(", "Path", "inFilePath", ",", "Path", "outFilePath", ",", "FileChangable", "modifier", ")", "throws", "IOException", "{", "try", "(", "BufferedReader", "bufferedReader", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "inFilePath", ".", "toFile", "(", ")", ")", ")", ";", "Writer", "writer", "=", "new", "BufferedWriter", "(", "new", "OutputStreamWriter", "(", "new", "FileOutputStream", "(", "outFilePath", ".", "toFile", "(", ")", ")", ",", "\"utf-8\"", ")", ")", ")", "{", "String", "readLine", ";", "int", "counter", "=", "0", ";", "while", "(", "(", "readLine", "=", "bufferedReader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "writer", ".", "write", "(", "modifier", ".", "apply", "(", "counter", ",", "readLine", ")", ")", ";", "counter", "++", ";", "}", "}", "}" ]
Modifies the input file line by line and writes the modification in the new output file @param inFilePath the in file path @param outFilePath the out file path @param modifier the modifier {@linkplain BiFunction} @throws IOException Signals that an I/O exception has occurred.
[ "Modifies", "the", "input", "file", "line", "by", "line", "and", "writes", "the", "modification", "in", "the", "new", "output", "file" ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/modify/ModifyFileExtensions.java#L59-L75
151,904
jbundle/jbundle
app/program/demo/src/main/java/org/jbundle/app/program/demo/message/UserInfoMessageData.java
UserInfoMessageData.getRawRecordData
public int getRawRecordData(Rec record) { int iErrorCode = super.getRawRecordData(record); this.getRawFieldData(record.getField(UserInfo.USER_NAME)); this.getRawFieldData(record.getField(UserInfo.PASSWORD)); return iErrorCode; }
java
public int getRawRecordData(Rec record) { int iErrorCode = super.getRawRecordData(record); this.getRawFieldData(record.getField(UserInfo.USER_NAME)); this.getRawFieldData(record.getField(UserInfo.PASSWORD)); return iErrorCode; }
[ "public", "int", "getRawRecordData", "(", "Rec", "record", ")", "{", "int", "iErrorCode", "=", "super", ".", "getRawRecordData", "(", "record", ")", ";", "this", ".", "getRawFieldData", "(", "record", ".", "getField", "(", "UserInfo", ".", "USER_NAME", ")", ")", ";", "this", ".", "getRawFieldData", "(", "record", ".", "getField", "(", "UserInfo", ".", "PASSWORD", ")", ")", ";", "return", "iErrorCode", ";", "}" ]
Move the map values to the correct record fields. If this method is used, is must be overidden to move the correct fields.
[ "Move", "the", "map", "values", "to", "the", "correct", "record", "fields", ".", "If", "this", "method", "is", "used", "is", "must", "be", "overidden", "to", "move", "the", "correct", "fields", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/demo/src/main/java/org/jbundle/app/program/demo/message/UserInfoMessageData.java#L70-L76
151,905
aequologica/geppaequo
geppaequo-cmis/src/main/java/net/aequologica/neo/geppaequo/document/impl/ECMHelperImpl.java
ECMHelperImpl.getOrCreateFolder
private static Folder getOrCreateFolder(final Folder parentFolder, final String folderName) throws IOException { Folder childFolder = null; // get existing if any ItemIterable<CmisObject> children = parentFolder.getChildren(); if (children.iterator().hasNext()) { for (CmisObject cmisObject : children) { if (cmisObject instanceof Folder && cmisObject.getName().equals(folderName)) { log.debug("Found '{}' folder.", folderName); return childFolder = (Folder)cmisObject; } } } // Create new folder (requires at least type id and name of the folder) log.debug("'{}' folder not found, about to create...", folderName); Map<String, String> folderProps = new HashMap<String, String>(); folderProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder"); folderProps.put(PropertyIds.NAME, folderName); childFolder = parentFolder.createFolder(folderProps); log.info("'{}' folder created!", folderName); return childFolder; }
java
private static Folder getOrCreateFolder(final Folder parentFolder, final String folderName) throws IOException { Folder childFolder = null; // get existing if any ItemIterable<CmisObject> children = parentFolder.getChildren(); if (children.iterator().hasNext()) { for (CmisObject cmisObject : children) { if (cmisObject instanceof Folder && cmisObject.getName().equals(folderName)) { log.debug("Found '{}' folder.", folderName); return childFolder = (Folder)cmisObject; } } } // Create new folder (requires at least type id and name of the folder) log.debug("'{}' folder not found, about to create...", folderName); Map<String, String> folderProps = new HashMap<String, String>(); folderProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder"); folderProps.put(PropertyIds.NAME, folderName); childFolder = parentFolder.createFolder(folderProps); log.info("'{}' folder created!", folderName); return childFolder; }
[ "private", "static", "Folder", "getOrCreateFolder", "(", "final", "Folder", "parentFolder", ",", "final", "String", "folderName", ")", "throws", "IOException", "{", "Folder", "childFolder", "=", "null", ";", "// get existing if any", "ItemIterable", "<", "CmisObject", ">", "children", "=", "parentFolder", ".", "getChildren", "(", ")", ";", "if", "(", "children", ".", "iterator", "(", ")", ".", "hasNext", "(", ")", ")", "{", "for", "(", "CmisObject", "cmisObject", ":", "children", ")", "{", "if", "(", "cmisObject", "instanceof", "Folder", "&&", "cmisObject", ".", "getName", "(", ")", ".", "equals", "(", "folderName", ")", ")", "{", "log", ".", "debug", "(", "\"Found '{}' folder.\"", ",", "folderName", ")", ";", "return", "childFolder", "=", "(", "Folder", ")", "cmisObject", ";", "}", "}", "}", "// Create new folder (requires at least type id and name of the folder)", "log", ".", "debug", "(", "\"'{}' folder not found, about to create...\"", ",", "folderName", ")", ";", "Map", "<", "String", ",", "String", ">", "folderProps", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "folderProps", ".", "put", "(", "PropertyIds", ".", "OBJECT_TYPE_ID", ",", "\"cmis:folder\"", ")", ";", "folderProps", ".", "put", "(", "PropertyIds", ".", "NAME", ",", "folderName", ")", ";", "childFolder", "=", "parentFolder", ".", "createFolder", "(", "folderProps", ")", ";", "log", ".", "info", "(", "\"'{}' folder created!\"", ",", "folderName", ")", ";", "return", "childFolder", ";", "}" ]
look for a child folder of the parent folder, if not found, create it and return it.
[ "look", "for", "a", "child", "folder", "of", "the", "parent", "folder", "if", "not", "found", "create", "it", "and", "return", "it", "." ]
b72e5f6356535fd045a931f8c544d4a8ea6e35a2
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-cmis/src/main/java/net/aequologica/neo/geppaequo/document/impl/ECMHelperImpl.java#L583-L611
151,906
aequologica/geppaequo
geppaequo-cmis/src/main/java/net/aequologica/neo/geppaequo/document/impl/ECMHelperImpl.java
ECMHelperImpl.utf8inputStream2String
private static String utf8inputStream2String(final InputStream inputStream) throws IOException { StringBuilder stringBuilder = new StringBuilder(); try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { String line = null; while ((line = bufferedReader.readLine()) != null) { stringBuilder.append(line); stringBuilder.append("\n"); // I know, if the original data stream has no ending line feed, this will add one... } } return stringBuilder.toString(); }
java
private static String utf8inputStream2String(final InputStream inputStream) throws IOException { StringBuilder stringBuilder = new StringBuilder(); try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { String line = null; while ((line = bufferedReader.readLine()) != null) { stringBuilder.append(line); stringBuilder.append("\n"); // I know, if the original data stream has no ending line feed, this will add one... } } return stringBuilder.toString(); }
[ "private", "static", "String", "utf8inputStream2String", "(", "final", "InputStream", "inputStream", ")", "throws", "IOException", "{", "StringBuilder", "stringBuilder", "=", "new", "StringBuilder", "(", ")", ";", "try", "(", "BufferedReader", "bufferedReader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "inputStream", ",", "StandardCharsets", ".", "UTF_8", ")", ")", ")", "{", "String", "line", "=", "null", ";", "while", "(", "(", "line", "=", "bufferedReader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "stringBuilder", ".", "append", "(", "line", ")", ";", "stringBuilder", ".", "append", "(", "\"\\n\"", ")", ";", "// I know, if the original data stream has no ending line feed, this will add one...", "}", "}", "return", "stringBuilder", ".", "toString", "(", ")", ";", "}" ]
convert InputStream to String
[ "convert", "InputStream", "to", "String" ]
b72e5f6356535fd045a931f8c544d4a8ea6e35a2
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-cmis/src/main/java/net/aequologica/neo/geppaequo/document/impl/ECMHelperImpl.java#L647-L657
151,907
jbundle/jbundle
thin/base/screen/cal/sample/basic/src/main/java/org/jbundle/thin/base/screen/cal/sample/basic/CalendarVector.java
CalendarVector.getHeaderIcon
public ImageIcon getHeaderIcon() { return org.jbundle.thin.base.screen.BaseApplet.getSharedInstance().loadImageIcon("tour/buttons/Meal.gif", "Meal"); }
java
public ImageIcon getHeaderIcon() { return org.jbundle.thin.base.screen.BaseApplet.getSharedInstance().loadImageIcon("tour/buttons/Meal.gif", "Meal"); }
[ "public", "ImageIcon", "getHeaderIcon", "(", ")", "{", "return", "org", ".", "jbundle", ".", "thin", ".", "base", ".", "screen", ".", "BaseApplet", ".", "getSharedInstance", "(", ")", ".", "loadImageIcon", "(", "\"tour/buttons/Meal.gif\"", ",", "\"Meal\"", ")", ";", "}" ]
Get the icon for a meal.
[ "Get", "the", "icon", "for", "a", "meal", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/sample/basic/src/main/java/org/jbundle/thin/base/screen/cal/sample/basic/CalendarVector.java#L72-L75
151,908
amlinv/amq-topo-utils
src/main/java/com/amlinv/activemq/topo/registry/model/DestinationState.java
DestinationState.existsAnyBroker
public boolean existsAnyBroker () { boolean result = false; synchronized ( this.brokerDetails ) { Iterator<PerBrokerInfo> iter = this.brokerDetails.values().iterator(); while ( ( ! result ) && ( iter.hasNext() ) ) { result = iter.next().exists; } } return result; }
java
public boolean existsAnyBroker () { boolean result = false; synchronized ( this.brokerDetails ) { Iterator<PerBrokerInfo> iter = this.brokerDetails.values().iterator(); while ( ( ! result ) && ( iter.hasNext() ) ) { result = iter.next().exists; } } return result; }
[ "public", "boolean", "existsAnyBroker", "(", ")", "{", "boolean", "result", "=", "false", ";", "synchronized", "(", "this", ".", "brokerDetails", ")", "{", "Iterator", "<", "PerBrokerInfo", ">", "iter", "=", "this", ".", "brokerDetails", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "(", "!", "result", ")", "&&", "(", "iter", ".", "hasNext", "(", ")", ")", ")", "{", "result", "=", "iter", ".", "next", "(", ")", ".", "exists", ";", "}", "}", "return", "result", ";", "}" ]
Determine if this destination currently is known to exist on any broker registered for the destination. @return true => the destination is known to exist on at least one broker; false => the destination is not known to exist on any broker.
[ "Determine", "if", "this", "destination", "currently", "is", "known", "to", "exist", "on", "any", "broker", "registered", "for", "the", "destination", "." ]
4d82d5735d59f9c95e149362a09ea4d27d9ac4ac
https://github.com/amlinv/amq-topo-utils/blob/4d82d5735d59f9c95e149362a09ea4d27d9ac4ac/src/main/java/com/amlinv/activemq/topo/registry/model/DestinationState.java#L71-L83
151,909
amlinv/amq-topo-utils
src/main/java/com/amlinv/activemq/topo/registry/model/DestinationState.java
DestinationState.existsOnBroker
public boolean existsOnBroker (String brokerId) { boolean result = false; PerBrokerInfo info; synchronized (this.brokerDetails) { info = this.brokerDetails.get(brokerId); } if ((info != null) && (info.exists)) { result = true; } return result; }
java
public boolean existsOnBroker (String brokerId) { boolean result = false; PerBrokerInfo info; synchronized (this.brokerDetails) { info = this.brokerDetails.get(brokerId); } if ((info != null) && (info.exists)) { result = true; } return result; }
[ "public", "boolean", "existsOnBroker", "(", "String", "brokerId", ")", "{", "boolean", "result", "=", "false", ";", "PerBrokerInfo", "info", ";", "synchronized", "(", "this", ".", "brokerDetails", ")", "{", "info", "=", "this", ".", "brokerDetails", ".", "get", "(", "brokerId", ")", ";", "}", "if", "(", "(", "info", "!=", "null", ")", "&&", "(", "info", ".", "exists", ")", ")", "{", "result", "=", "true", ";", "}", "return", "result", ";", "}" ]
Determine whether this destination exists on the broker with the given ID. @param brokerId ID of the broker on which to check for existence of the destination. @return true => if the destination exists on the broker with the given ID; false if the destination does not exist on the broker with the given ID regardless of whether the destination has even been seen on the same broker.
[ "Determine", "whether", "this", "destination", "exists", "on", "the", "broker", "with", "the", "given", "ID", "." ]
4d82d5735d59f9c95e149362a09ea4d27d9ac4ac
https://github.com/amlinv/amq-topo-utils/blob/4d82d5735d59f9c95e149362a09ea4d27d9ac4ac/src/main/java/com/amlinv/activemq/topo/registry/model/DestinationState.java#L93-L106
151,910
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/TopScreen.java
TopScreen.getDefaultJava
public char getDefaultJava(String strBrowser, String strOS) { char chJavaLaunch = 'A'; // Applet = default if ("safari".equalsIgnoreCase(strBrowser)) chJavaLaunch = 'W'; // Web start // if ("linux".equalsIgnoreCase(strOS)) // chJavaLaunch = 'W'; // Web start return chJavaLaunch; }
java
public char getDefaultJava(String strBrowser, String strOS) { char chJavaLaunch = 'A'; // Applet = default if ("safari".equalsIgnoreCase(strBrowser)) chJavaLaunch = 'W'; // Web start // if ("linux".equalsIgnoreCase(strOS)) // chJavaLaunch = 'W'; // Web start return chJavaLaunch; }
[ "public", "char", "getDefaultJava", "(", "String", "strBrowser", ",", "String", "strOS", ")", "{", "char", "chJavaLaunch", "=", "'", "'", ";", "// Applet = default", "if", "(", "\"safari\"", ".", "equalsIgnoreCase", "(", "strBrowser", ")", ")", "chJavaLaunch", "=", "'", "'", ";", "// Web start", "// if (\"linux\".equalsIgnoreCase(strOS))", "// chJavaLaunch = 'W'; // Web start", "return", "chJavaLaunch", ";", "}" ]
Get best way to launch java @param strBrowser @param strOS @return
[ "Get", "best", "way", "to", "launch", "java" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/TopScreen.java#L356-L364
151,911
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/TopScreen.java
TopScreen.checkSecurity
public ScreenModel checkSecurity(ScreenModel screen, ScreenModel parentScreen) { int iErrorCode = DBConstants.NORMAL_RETURN; if (screen != null) iErrorCode = ((BaseScreen)screen).checkSecurity(); if (iErrorCode == Constants.READ_ACCESS) { ((BaseScreen)screen).setEditing(false); ((BaseScreen)screen).setAppending(false); iErrorCode = DBConstants.NORMAL_RETURN; } if (iErrorCode == DBConstants.NORMAL_RETURN) return screen; // Good, access allowed else { if (screen != null) screen.free(); return this.getSecurityScreen(iErrorCode, (BasePanel)parentScreen); // Create and return the login or error screen } }
java
public ScreenModel checkSecurity(ScreenModel screen, ScreenModel parentScreen) { int iErrorCode = DBConstants.NORMAL_RETURN; if (screen != null) iErrorCode = ((BaseScreen)screen).checkSecurity(); if (iErrorCode == Constants.READ_ACCESS) { ((BaseScreen)screen).setEditing(false); ((BaseScreen)screen).setAppending(false); iErrorCode = DBConstants.NORMAL_RETURN; } if (iErrorCode == DBConstants.NORMAL_RETURN) return screen; // Good, access allowed else { if (screen != null) screen.free(); return this.getSecurityScreen(iErrorCode, (BasePanel)parentScreen); // Create and return the login or error screen } }
[ "public", "ScreenModel", "checkSecurity", "(", "ScreenModel", "screen", ",", "ScreenModel", "parentScreen", ")", "{", "int", "iErrorCode", "=", "DBConstants", ".", "NORMAL_RETURN", ";", "if", "(", "screen", "!=", "null", ")", "iErrorCode", "=", "(", "(", "BaseScreen", ")", "screen", ")", ".", "checkSecurity", "(", ")", ";", "if", "(", "iErrorCode", "==", "Constants", ".", "READ_ACCESS", ")", "{", "(", "(", "BaseScreen", ")", "screen", ")", ".", "setEditing", "(", "false", ")", ";", "(", "(", "BaseScreen", ")", "screen", ")", ".", "setAppending", "(", "false", ")", ";", "iErrorCode", "=", "DBConstants", ".", "NORMAL_RETURN", ";", "}", "if", "(", "iErrorCode", "==", "DBConstants", ".", "NORMAL_RETURN", ")", "return", "screen", ";", "// Good, access allowed", "else", "{", "if", "(", "screen", "!=", "null", ")", "screen", ".", "free", "(", ")", ";", "return", "this", ".", "getSecurityScreen", "(", "iErrorCode", ",", "(", "BasePanel", ")", "parentScreen", ")", ";", "// Create and return the login or error screen", "}", "}" ]
Make sure I am allowed access to this screen. @param strClassResource @return
[ "Make", "sure", "I", "am", "allowed", "access", "to", "this", "screen", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/TopScreen.java#L370-L389
151,912
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/TopScreen.java
TopScreen.changeParameters
public void changeParameters() { //Get the session object String string = null; String strPreferences = this.getProperty(DBParams.PREFERENCES); // Changing parameters boolean bSetDefault = true; if ((strPreferences == null) || (strPreferences.length() == 0)) bSetDefault = false; // Set using a URL (vs set using a form) Application application = (BaseApplication)this.getTask().getApplication(); string = this.getProperty(DBParams.FRAMES); if (bSetDefault) if (string == null) string = DBConstants.NO; if (string != null) application.setProperty(DBParams.FRAMES, string); string = this.getProperty(DBParams.MENUBARS); if (bSetDefault) if (string == null) string = UserInfoModel.YES; if (string != null) application.setProperty(DBParams.MENUBARS, string); string = this.getProperty(DBParams.NAVMENUS); if (bSetDefault) if (string == null) string = UserInfoModel.NO_ICONS; if (string != null) application.setProperty(DBParams.NAVMENUS, string); string = this.getProperty(DBParams.JAVA); if (bSetDefault) if (string == null) string = UserInfoModel.DEFAULT; // Changing parameters if (string != null) application.setProperty(DBParams.JAVA, string); string = this.getProperty(DBParams.BANNERS); if (bSetDefault) if (string == null) string = DBConstants.NO; if (string != null) application.setProperty(DBParams.BANNERS, string); string = this.getProperty(DBParams.LOGOS); if (bSetDefault) if (string == null) string = UserInfoModel.HOME_PAGE_ONLY; if (string != null) application.setProperty(DBParams.LOGOS, string); string = this.getProperty(DBParams.TRAILERS); if (bSetDefault) if (string == null) string = UserInfoModel.HOME_PAGE_ONLY; if (string != null) application.setProperty(DBParams.TRAILERS, string); string = this.getProperty(DBConstants.SYSTEM_NAME); if (string != null) application.setProperty(DBConstants.SYSTEM_NAME, string); string = this.getProperty(DBConstants.MODE); if (string != null) application.setProperty(DBConstants.MODE, string); string = this.getProperty(DBParams.LANGUAGE); if (bSetDefault) if (string == null) string = UserInfoModel.DEFAULT; /** en (english)*/; if (string != null) application.setLanguage(string); if (application instanceof MainApplication) { // Always ((MainApplication)application).readUserInfo(true, true); // Flush the new properties } }
java
public void changeParameters() { //Get the session object String string = null; String strPreferences = this.getProperty(DBParams.PREFERENCES); // Changing parameters boolean bSetDefault = true; if ((strPreferences == null) || (strPreferences.length() == 0)) bSetDefault = false; // Set using a URL (vs set using a form) Application application = (BaseApplication)this.getTask().getApplication(); string = this.getProperty(DBParams.FRAMES); if (bSetDefault) if (string == null) string = DBConstants.NO; if (string != null) application.setProperty(DBParams.FRAMES, string); string = this.getProperty(DBParams.MENUBARS); if (bSetDefault) if (string == null) string = UserInfoModel.YES; if (string != null) application.setProperty(DBParams.MENUBARS, string); string = this.getProperty(DBParams.NAVMENUS); if (bSetDefault) if (string == null) string = UserInfoModel.NO_ICONS; if (string != null) application.setProperty(DBParams.NAVMENUS, string); string = this.getProperty(DBParams.JAVA); if (bSetDefault) if (string == null) string = UserInfoModel.DEFAULT; // Changing parameters if (string != null) application.setProperty(DBParams.JAVA, string); string = this.getProperty(DBParams.BANNERS); if (bSetDefault) if (string == null) string = DBConstants.NO; if (string != null) application.setProperty(DBParams.BANNERS, string); string = this.getProperty(DBParams.LOGOS); if (bSetDefault) if (string == null) string = UserInfoModel.HOME_PAGE_ONLY; if (string != null) application.setProperty(DBParams.LOGOS, string); string = this.getProperty(DBParams.TRAILERS); if (bSetDefault) if (string == null) string = UserInfoModel.HOME_PAGE_ONLY; if (string != null) application.setProperty(DBParams.TRAILERS, string); string = this.getProperty(DBConstants.SYSTEM_NAME); if (string != null) application.setProperty(DBConstants.SYSTEM_NAME, string); string = this.getProperty(DBConstants.MODE); if (string != null) application.setProperty(DBConstants.MODE, string); string = this.getProperty(DBParams.LANGUAGE); if (bSetDefault) if (string == null) string = UserInfoModel.DEFAULT; /** en (english)*/; if (string != null) application.setLanguage(string); if (application instanceof MainApplication) { // Always ((MainApplication)application).readUserInfo(true, true); // Flush the new properties } }
[ "public", "void", "changeParameters", "(", ")", "{", "//Get the session object", "String", "string", "=", "null", ";", "String", "strPreferences", "=", "this", ".", "getProperty", "(", "DBParams", ".", "PREFERENCES", ")", ";", "// Changing parameters", "boolean", "bSetDefault", "=", "true", ";", "if", "(", "(", "strPreferences", "==", "null", ")", "||", "(", "strPreferences", ".", "length", "(", ")", "==", "0", ")", ")", "bSetDefault", "=", "false", ";", "// Set using a URL (vs set using a form)", "Application", "application", "=", "(", "BaseApplication", ")", "this", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", ";", "string", "=", "this", ".", "getProperty", "(", "DBParams", ".", "FRAMES", ")", ";", "if", "(", "bSetDefault", ")", "if", "(", "string", "==", "null", ")", "string", "=", "DBConstants", ".", "NO", ";", "if", "(", "string", "!=", "null", ")", "application", ".", "setProperty", "(", "DBParams", ".", "FRAMES", ",", "string", ")", ";", "string", "=", "this", ".", "getProperty", "(", "DBParams", ".", "MENUBARS", ")", ";", "if", "(", "bSetDefault", ")", "if", "(", "string", "==", "null", ")", "string", "=", "UserInfoModel", ".", "YES", ";", "if", "(", "string", "!=", "null", ")", "application", ".", "setProperty", "(", "DBParams", ".", "MENUBARS", ",", "string", ")", ";", "string", "=", "this", ".", "getProperty", "(", "DBParams", ".", "NAVMENUS", ")", ";", "if", "(", "bSetDefault", ")", "if", "(", "string", "==", "null", ")", "string", "=", "UserInfoModel", ".", "NO_ICONS", ";", "if", "(", "string", "!=", "null", ")", "application", ".", "setProperty", "(", "DBParams", ".", "NAVMENUS", ",", "string", ")", ";", "string", "=", "this", ".", "getProperty", "(", "DBParams", ".", "JAVA", ")", ";", "if", "(", "bSetDefault", ")", "if", "(", "string", "==", "null", ")", "string", "=", "UserInfoModel", ".", "DEFAULT", ";", "// Changing parameters", "if", "(", "string", "!=", "null", ")", "application", ".", "setProperty", "(", "DBParams", ".", "JAVA", ",", "string", ")", ";", "string", "=", "this", ".", "getProperty", "(", "DBParams", ".", "BANNERS", ")", ";", "if", "(", "bSetDefault", ")", "if", "(", "string", "==", "null", ")", "string", "=", "DBConstants", ".", "NO", ";", "if", "(", "string", "!=", "null", ")", "application", ".", "setProperty", "(", "DBParams", ".", "BANNERS", ",", "string", ")", ";", "string", "=", "this", ".", "getProperty", "(", "DBParams", ".", "LOGOS", ")", ";", "if", "(", "bSetDefault", ")", "if", "(", "string", "==", "null", ")", "string", "=", "UserInfoModel", ".", "HOME_PAGE_ONLY", ";", "if", "(", "string", "!=", "null", ")", "application", ".", "setProperty", "(", "DBParams", ".", "LOGOS", ",", "string", ")", ";", "string", "=", "this", ".", "getProperty", "(", "DBParams", ".", "TRAILERS", ")", ";", "if", "(", "bSetDefault", ")", "if", "(", "string", "==", "null", ")", "string", "=", "UserInfoModel", ".", "HOME_PAGE_ONLY", ";", "if", "(", "string", "!=", "null", ")", "application", ".", "setProperty", "(", "DBParams", ".", "TRAILERS", ",", "string", ")", ";", "string", "=", "this", ".", "getProperty", "(", "DBConstants", ".", "SYSTEM_NAME", ")", ";", "if", "(", "string", "!=", "null", ")", "application", ".", "setProperty", "(", "DBConstants", ".", "SYSTEM_NAME", ",", "string", ")", ";", "string", "=", "this", ".", "getProperty", "(", "DBConstants", ".", "MODE", ")", ";", "if", "(", "string", "!=", "null", ")", "application", ".", "setProperty", "(", "DBConstants", ".", "MODE", ",", "string", ")", ";", "string", "=", "this", ".", "getProperty", "(", "DBParams", ".", "LANGUAGE", ")", ";", "if", "(", "bSetDefault", ")", "if", "(", "string", "==", "null", ")", "string", "=", "UserInfoModel", ".", "DEFAULT", ";", "/** en (english)*/", ";", "if", "(", "string", "!=", "null", ")", "application", ".", "setLanguage", "(", "string", ")", ";", "if", "(", "application", "instanceof", "MainApplication", ")", "{", "// Always", "(", "(", "MainApplication", ")", "application", ")", ".", "readUserInfo", "(", "true", ",", "true", ")", ";", "// Flush the new properties", "}", "}" ]
Change the session parameters. @exception IOException From inherited class.
[ "Change", "the", "session", "parameters", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/TopScreen.java#L429-L508
151,913
microfocus-idol/java-configuration-impl
src/main/java/com/hp/autonomy/frontend/configuration/validation/ValidationServiceImpl.java
ValidationServiceImpl.setValidators
public void setValidators(final Iterable<Validator<?>> validators) { this.validators.clear(); for (final Validator<?> validator : validators) { // this ensures we map OptionalConfigurationComponent classes to validators of the same class this.validators.put(validator.getSupportedClass(), validator); } }
java
public void setValidators(final Iterable<Validator<?>> validators) { this.validators.clear(); for (final Validator<?> validator : validators) { // this ensures we map OptionalConfigurationComponent classes to validators of the same class this.validators.put(validator.getSupportedClass(), validator); } }
[ "public", "void", "setValidators", "(", "final", "Iterable", "<", "Validator", "<", "?", ">", ">", "validators", ")", "{", "this", ".", "validators", ".", "clear", "(", ")", ";", "for", "(", "final", "Validator", "<", "?", ">", "validator", ":", "validators", ")", "{", "// this ensures we map OptionalConfigurationComponent classes to validators of the same class", "this", ".", "validators", ".", "put", "(", "validator", ".", "getSupportedClass", "(", ")", ",", "validator", ")", ";", "}", "}" ]
Set the validators used by the service. This will clear any existing validators. This method is thread safe. @param validators The new validators to be used by the service
[ "Set", "the", "validators", "used", "by", "the", "service", ".", "This", "will", "clear", "any", "existing", "validators", ".", "This", "method", "is", "thread", "safe", "." ]
cd9d744cacfaaae3c76cacc211e65742bbc7b00a
https://github.com/microfocus-idol/java-configuration-impl/blob/cd9d744cacfaaae3c76cacc211e65742bbc7b00a/src/main/java/com/hp/autonomy/frontend/configuration/validation/ValidationServiceImpl.java#L74-L81
151,914
jbundle/jbundle
app/program/db/src/main/java/org/jbundle/app/program/db/ScreenIn.java
ScreenIn.makeScreen
public ScreenParent makeScreen(ScreenLoc itsLocation, ComponentParent parentScreen, int iDocMode, Map<String,Object> properties) { ScreenParent screen = null; if ((iDocMode & ScreenConstants.MAINT_MODE) == ScreenConstants.MAINT_MODE) screen = Record.makeNewScreen(SCREEN_IN_SCREEN_CLASS, itsLocation, parentScreen, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties, this, true); else if ((iDocMode & ScreenConstants.DISPLAY_MODE) == ScreenConstants.DISPLAY_MODE) screen = Record.makeNewScreen(SCREEN_IN_GRID_SCREEN_CLASS, itsLocation, parentScreen, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties, this, true); else screen = super.makeScreen(itsLocation, parentScreen, iDocMode, properties); return screen; }
java
public ScreenParent makeScreen(ScreenLoc itsLocation, ComponentParent parentScreen, int iDocMode, Map<String,Object> properties) { ScreenParent screen = null; if ((iDocMode & ScreenConstants.MAINT_MODE) == ScreenConstants.MAINT_MODE) screen = Record.makeNewScreen(SCREEN_IN_SCREEN_CLASS, itsLocation, parentScreen, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties, this, true); else if ((iDocMode & ScreenConstants.DISPLAY_MODE) == ScreenConstants.DISPLAY_MODE) screen = Record.makeNewScreen(SCREEN_IN_GRID_SCREEN_CLASS, itsLocation, parentScreen, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties, this, true); else screen = super.makeScreen(itsLocation, parentScreen, iDocMode, properties); return screen; }
[ "public", "ScreenParent", "makeScreen", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "parentScreen", ",", "int", "iDocMode", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "ScreenParent", "screen", "=", "null", ";", "if", "(", "(", "iDocMode", "&", "ScreenConstants", ".", "MAINT_MODE", ")", "==", "ScreenConstants", ".", "MAINT_MODE", ")", "screen", "=", "Record", ".", "makeNewScreen", "(", "SCREEN_IN_SCREEN_CLASS", ",", "itsLocation", ",", "parentScreen", ",", "iDocMode", "|", "ScreenConstants", ".", "DONT_DISPLAY_FIELD_DESC", ",", "properties", ",", "this", ",", "true", ")", ";", "else", "if", "(", "(", "iDocMode", "&", "ScreenConstants", ".", "DISPLAY_MODE", ")", "==", "ScreenConstants", ".", "DISPLAY_MODE", ")", "screen", "=", "Record", ".", "makeNewScreen", "(", "SCREEN_IN_GRID_SCREEN_CLASS", ",", "itsLocation", ",", "parentScreen", ",", "iDocMode", "|", "ScreenConstants", ".", "DONT_DISPLAY_FIELD_DESC", ",", "properties", ",", "this", ",", "true", ")", ";", "else", "screen", "=", "super", ".", "makeScreen", "(", "itsLocation", ",", "parentScreen", ",", "iDocMode", ",", "properties", ")", ";", "return", "screen", ";", "}" ]
Make a default screen.
[ "Make", "a", "default", "screen", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/ScreenIn.java#L86-L96
151,915
jlib-framework/jlib-array
src/main/java/org/jlib/array/ArrayUtility.java
ArrayUtility.getFlattenedItemsCount
public static int getFlattenedItemsCount(final Object... items) { return stream(items) .map(item -> item.getClass().isArray() ? getFlattenedItemsCount((Object[]) item) : 1) .reduce(0, Integer::sum); }
java
public static int getFlattenedItemsCount(final Object... items) { return stream(items) .map(item -> item.getClass().isArray() ? getFlattenedItemsCount((Object[]) item) : 1) .reduce(0, Integer::sum); }
[ "public", "static", "int", "getFlattenedItemsCount", "(", "final", "Object", "...", "items", ")", "{", "return", "stream", "(", "items", ")", ".", "map", "(", "item", "->", "item", ".", "getClass", "(", ")", ".", "isArray", "(", ")", "?", "getFlattenedItemsCount", "(", "(", "Object", "[", "]", ")", "item", ")", ":", "1", ")", ".", "reduce", "(", "0", ",", "Integer", "::", "sum", ")", ";", "}" ]
Returns the total number of non array items held in the specified array, recursively descending in every array item. @param items comma separated sequence of {@link Object} items @return integer specifying the total number of itemsnew
[ "Returns", "the", "total", "number", "of", "non", "array", "items", "held", "in", "the", "specified", "array", "recursively", "descending", "in", "every", "array", "item", "." ]
d0aa06fe95aa70fdac0d34e066fe8f883a8e855a
https://github.com/jlib-framework/jlib-array/blob/d0aa06fe95aa70fdac0d34e066fe8f883a8e855a/src/main/java/org/jlib/array/ArrayUtility.java#L125-L130
151,916
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/io/StreamSupport.java
StreamSupport.absorbInputStream
public static byte[] absorbInputStream(InputStream input) throws IOException { ByteArrayOutputStream output = null; try{ output = new ByteArrayOutputStream(); absorbInputStream(input, output); return output.toByteArray(); } finally { output.close(); } }
java
public static byte[] absorbInputStream(InputStream input) throws IOException { ByteArrayOutputStream output = null; try{ output = new ByteArrayOutputStream(); absorbInputStream(input, output); return output.toByteArray(); } finally { output.close(); } }
[ "public", "static", "byte", "[", "]", "absorbInputStream", "(", "InputStream", "input", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "output", "=", "null", ";", "try", "{", "output", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "absorbInputStream", "(", "input", ",", "output", ")", ";", "return", "output", ".", "toByteArray", "(", ")", ";", "}", "finally", "{", "output", ".", "close", "(", ")", ";", "}", "}" ]
Reads all bytes from an input stream. @param input @return @throws IOException
[ "Reads", "all", "bytes", "from", "an", "input", "stream", "." ]
971eb022115247b1e34dc26dd02e7e621e29e910
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/StreamSupport.java#L41-L50
151,917
nwillc/almost-functional
src/main/java/almost/functional/utils/Preconditions.java
Preconditions.precondition
public static <T> T precondition(T reference, Predicate<T> predicate, Class<? extends RuntimeException> ex, String msg) throws RuntimeException { if (predicate.test(reference)) { return reference; } final Constructor<? extends RuntimeException> constructor; try { constructor = ex.getConstructor(String.class); throw constructor.newInstance(msg); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(msg); } }
java
public static <T> T precondition(T reference, Predicate<T> predicate, Class<? extends RuntimeException> ex, String msg) throws RuntimeException { if (predicate.test(reference)) { return reference; } final Constructor<? extends RuntimeException> constructor; try { constructor = ex.getConstructor(String.class); throw constructor.newInstance(msg); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(msg); } }
[ "public", "static", "<", "T", ">", "T", "precondition", "(", "T", "reference", ",", "Predicate", "<", "T", ">", "predicate", ",", "Class", "<", "?", "extends", "RuntimeException", ">", "ex", ",", "String", "msg", ")", "throws", "RuntimeException", "{", "if", "(", "predicate", ".", "test", "(", "reference", ")", ")", "{", "return", "reference", ";", "}", "final", "Constructor", "<", "?", "extends", "RuntimeException", ">", "constructor", ";", "try", "{", "constructor", "=", "ex", ".", "getConstructor", "(", "String", ".", "class", ")", ";", "throw", "constructor", ".", "newInstance", "(", "msg", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "msg", ")", ";", "}", "}" ]
Test a Predicate against a reference value, and if it fails throw a runtime exception with a message. @param reference the value to test @param predicate the predicate test to invoke @param ex The RuntimeException to use @param msg The message to add to the exception @param <T> The type of the reference value @return The reference value @throws RuntimeException An instance of ex if the predicate fails
[ "Test", "a", "Predicate", "against", "a", "reference", "value", "and", "if", "it", "fails", "throw", "a", "runtime", "exception", "with", "a", "message", "." ]
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Preconditions.java#L43-L59
151,918
nwillc/almost-functional
src/main/java/almost/functional/utils/Preconditions.java
Preconditions.checkNotNull
public static <T> T checkNotNull(final T reference, final String errorMessage) { return precondition(reference, Predicates.<T>notNull(), IllegalArgumentException.class, errorMessage); }
java
public static <T> T checkNotNull(final T reference, final String errorMessage) { return precondition(reference, Predicates.<T>notNull(), IllegalArgumentException.class, errorMessage); }
[ "public", "static", "<", "T", ">", "T", "checkNotNull", "(", "final", "T", "reference", ",", "final", "String", "errorMessage", ")", "{", "return", "precondition", "(", "reference", ",", "Predicates", ".", "<", "T", ">", "notNull", "(", ")", ",", "IllegalArgumentException", ".", "class", ",", "errorMessage", ")", ";", "}" ]
Check that a reference is not null, throwing a IllegalArgumentException if it is. @param reference The reference to check @param errorMessage the message for the exception if the reference is null @param <T> the type of the reference @throws java.lang.IllegalArgumentException if the reference is null
[ "Check", "that", "a", "reference", "is", "not", "null", "throwing", "a", "IllegalArgumentException", "if", "it", "is", "." ]
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Preconditions.java#L69-L72
151,919
nwillc/almost-functional
src/main/java/almost/functional/utils/Preconditions.java
Preconditions.checkNonEmptyString
public static String checkNonEmptyString(final String reference, final String errorMessage) { return precondition(reference, Predicates.notEmptyString(), IllegalArgumentException.class, errorMessage); }
java
public static String checkNonEmptyString(final String reference, final String errorMessage) { return precondition(reference, Predicates.notEmptyString(), IllegalArgumentException.class, errorMessage); }
[ "public", "static", "String", "checkNonEmptyString", "(", "final", "String", "reference", ",", "final", "String", "errorMessage", ")", "{", "return", "precondition", "(", "reference", ",", "Predicates", ".", "notEmptyString", "(", ")", ",", "IllegalArgumentException", ".", "class", ",", "errorMessage", ")", ";", "}" ]
Check that a String is not empty after removing whitespace. @param reference the string @param errorMessage the message for the exception @throws java.lang.NullPointerException if the String is null @throws java.lang.IllegalArgumentException if the string is non-null but zero length
[ "Check", "that", "a", "String", "is", "not", "empty", "after", "removing", "whitespace", "." ]
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Preconditions.java#L82-L85
151,920
nwillc/almost-functional
src/main/java/almost/functional/utils/Preconditions.java
Preconditions.isAssignableTo
public static Class isAssignableTo(final Class<?> reference, final Class<?> toValue, final String message) { return precondition(reference, new Predicate<Class>() { @Override public boolean test(Class testValue) { return toValue.isAssignableFrom(testValue); } }, ClassCastException.class, message); }
java
public static Class isAssignableTo(final Class<?> reference, final Class<?> toValue, final String message) { return precondition(reference, new Predicate<Class>() { @Override public boolean test(Class testValue) { return toValue.isAssignableFrom(testValue); } }, ClassCastException.class, message); }
[ "public", "static", "Class", "isAssignableTo", "(", "final", "Class", "<", "?", ">", "reference", ",", "final", "Class", "<", "?", ">", "toValue", ",", "final", "String", "message", ")", "{", "return", "precondition", "(", "reference", ",", "new", "Predicate", "<", "Class", ">", "(", ")", "{", "@", "Override", "public", "boolean", "test", "(", "Class", "testValue", ")", "{", "return", "toValue", ".", "isAssignableFrom", "(", "testValue", ")", ";", "}", "}", ",", "ClassCastException", ".", "class", ",", "message", ")", ";", "}" ]
Check that one class is assignable to another. @param reference the class to test @param toValue the class assigning to @param message the message used in the exception if thrown @throws ClassCastException if the assignment can not be made
[ "Check", "that", "one", "class", "is", "assignable", "to", "another", "." ]
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Preconditions.java#L95-L102
151,921
jbundle/jbundle
app/program/script/src/main/java/org/jbundle/app/program/script/process/SetupProjectProcess.java
SetupProjectProcess.convertAndWriteXML
public void convertAndWriteXML(String xml, String path) { ClassProject classProject = (ClassProject)this.getMainRecord(); Record recProgramControl = this.getRecord(ProgramControl.PROGRAM_CONTROL_FILE); Model model = (Model)this.unmarshalMessage(xml); String name = model.getName(); CodeType codeType = CodeType.THICK; String thickDir = classProject.getFileName("", null, codeType, true, false); if (name == null) codeType = CodeType.THICK; else if (name.endsWith("model")) codeType = CodeType.INTERFACE; else if (name.endsWith("thin")) codeType = CodeType.THIN; else if (name.endsWith("res")) codeType = CodeType.RESOURCE_PROPERTIES; xml = replaceParams(xml, codeType); model = (Model)this.unmarshalMessage(xml); String strSourcePath = recProgramControl.getField(ProgramControl.CLASS_DIRECTORY).toString(); String destDir = classProject.getFileName("", null, codeType, true, false); if (codeType != CodeType.THICK) if (destDir.equals(thickDir)) return; // Can't be the same as thick dir if (destDir.endsWith(strSourcePath)) destDir = destDir.substring(0, destDir.length() - strSourcePath.length()); if (name != null) if (name.endsWith("reactor")) { if (destDir.endsWith("/")) destDir = destDir.substring(0, destDir.length() - 1); if (destDir.lastIndexOf('/') != -1) destDir = destDir.substring(0, destDir.lastIndexOf('/')); } path = "pom.xml"; path = org.jbundle.base.model.Utility.addToPath(destDir, path); File fileOut = new File(path); File fileDir = fileOut.getParentFile(); if (!fileDir.exists()) fileDir.mkdirs(); //xml = this.marshalObject(model); // Later Reader in = new StringReader(xml); org.jbundle.base.model.Utility.transferURLStream(null, path, in, null); }
java
public void convertAndWriteXML(String xml, String path) { ClassProject classProject = (ClassProject)this.getMainRecord(); Record recProgramControl = this.getRecord(ProgramControl.PROGRAM_CONTROL_FILE); Model model = (Model)this.unmarshalMessage(xml); String name = model.getName(); CodeType codeType = CodeType.THICK; String thickDir = classProject.getFileName("", null, codeType, true, false); if (name == null) codeType = CodeType.THICK; else if (name.endsWith("model")) codeType = CodeType.INTERFACE; else if (name.endsWith("thin")) codeType = CodeType.THIN; else if (name.endsWith("res")) codeType = CodeType.RESOURCE_PROPERTIES; xml = replaceParams(xml, codeType); model = (Model)this.unmarshalMessage(xml); String strSourcePath = recProgramControl.getField(ProgramControl.CLASS_DIRECTORY).toString(); String destDir = classProject.getFileName("", null, codeType, true, false); if (codeType != CodeType.THICK) if (destDir.equals(thickDir)) return; // Can't be the same as thick dir if (destDir.endsWith(strSourcePath)) destDir = destDir.substring(0, destDir.length() - strSourcePath.length()); if (name != null) if (name.endsWith("reactor")) { if (destDir.endsWith("/")) destDir = destDir.substring(0, destDir.length() - 1); if (destDir.lastIndexOf('/') != -1) destDir = destDir.substring(0, destDir.lastIndexOf('/')); } path = "pom.xml"; path = org.jbundle.base.model.Utility.addToPath(destDir, path); File fileOut = new File(path); File fileDir = fileOut.getParentFile(); if (!fileDir.exists()) fileDir.mkdirs(); //xml = this.marshalObject(model); // Later Reader in = new StringReader(xml); org.jbundle.base.model.Utility.transferURLStream(null, path, in, null); }
[ "public", "void", "convertAndWriteXML", "(", "String", "xml", ",", "String", "path", ")", "{", "ClassProject", "classProject", "=", "(", "ClassProject", ")", "this", ".", "getMainRecord", "(", ")", ";", "Record", "recProgramControl", "=", "this", ".", "getRecord", "(", "ProgramControl", ".", "PROGRAM_CONTROL_FILE", ")", ";", "Model", "model", "=", "(", "Model", ")", "this", ".", "unmarshalMessage", "(", "xml", ")", ";", "String", "name", "=", "model", ".", "getName", "(", ")", ";", "CodeType", "codeType", "=", "CodeType", ".", "THICK", ";", "String", "thickDir", "=", "classProject", ".", "getFileName", "(", "\"\"", ",", "null", ",", "codeType", ",", "true", ",", "false", ")", ";", "if", "(", "name", "==", "null", ")", "codeType", "=", "CodeType", ".", "THICK", ";", "else", "if", "(", "name", ".", "endsWith", "(", "\"model\"", ")", ")", "codeType", "=", "CodeType", ".", "INTERFACE", ";", "else", "if", "(", "name", ".", "endsWith", "(", "\"thin\"", ")", ")", "codeType", "=", "CodeType", ".", "THIN", ";", "else", "if", "(", "name", ".", "endsWith", "(", "\"res\"", ")", ")", "codeType", "=", "CodeType", ".", "RESOURCE_PROPERTIES", ";", "xml", "=", "replaceParams", "(", "xml", ",", "codeType", ")", ";", "model", "=", "(", "Model", ")", "this", ".", "unmarshalMessage", "(", "xml", ")", ";", "String", "strSourcePath", "=", "recProgramControl", ".", "getField", "(", "ProgramControl", ".", "CLASS_DIRECTORY", ")", ".", "toString", "(", ")", ";", "String", "destDir", "=", "classProject", ".", "getFileName", "(", "\"\"", ",", "null", ",", "codeType", ",", "true", ",", "false", ")", ";", "if", "(", "codeType", "!=", "CodeType", ".", "THICK", ")", "if", "(", "destDir", ".", "equals", "(", "thickDir", ")", ")", "return", ";", "// Can't be the same as thick dir", "if", "(", "destDir", ".", "endsWith", "(", "strSourcePath", ")", ")", "destDir", "=", "destDir", ".", "substring", "(", "0", ",", "destDir", ".", "length", "(", ")", "-", "strSourcePath", ".", "length", "(", ")", ")", ";", "if", "(", "name", "!=", "null", ")", "if", "(", "name", ".", "endsWith", "(", "\"reactor\"", ")", ")", "{", "if", "(", "destDir", ".", "endsWith", "(", "\"/\"", ")", ")", "destDir", "=", "destDir", ".", "substring", "(", "0", ",", "destDir", ".", "length", "(", ")", "-", "1", ")", ";", "if", "(", "destDir", ".", "lastIndexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "destDir", "=", "destDir", ".", "substring", "(", "0", ",", "destDir", ".", "lastIndexOf", "(", "'", "'", ")", ")", ";", "}", "path", "=", "\"pom.xml\"", ";", "path", "=", "org", ".", "jbundle", ".", "base", ".", "model", ".", "Utility", ".", "addToPath", "(", "destDir", ",", "path", ")", ";", "File", "fileOut", "=", "new", "File", "(", "path", ")", ";", "File", "fileDir", "=", "fileOut", ".", "getParentFile", "(", ")", ";", "if", "(", "!", "fileDir", ".", "exists", "(", ")", ")", "fileDir", ".", "mkdirs", "(", ")", ";", "//xml = this.marshalObject(model); // Later", "Reader", "in", "=", "new", "StringReader", "(", "xml", ")", ";", "org", ".", "jbundle", ".", "base", ".", "model", ".", "Utility", ".", "transferURLStream", "(", "null", ",", "path", ",", "in", ",", "null", ")", ";", "}" ]
ConvertAndWriteXML Method.
[ "ConvertAndWriteXML", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/process/SetupProjectProcess.java#L134-L180
151,922
jbundle/jbundle
app/program/script/src/main/java/org/jbundle/app/program/script/process/SetupProjectProcess.java
SetupProjectProcess.replaceParams
public String replaceParams(String xml, CodeType codeType) { ClassProject classProject = (ClassProject)this.getMainRecord(); Map<String, String> ht = new HashMap<String, String>(); ht.put(START + "project" + END, classProject.getField(ClassProject.NAME).toString()); ht.put(START + "version" + END, "1.0.0-SNAPSHOT"); ht.put(START + "groupId" + END, classProject.getFullPackage(CodeType.THICK, "")); ht.put(START + "packagedb" + END, classProject.getFullPackage(CodeType.THICK, "")); ht.put(START + "packagethin" + END, classProject.getFullPackage(CodeType.THIN, "")); ht.put(START + "packageres" + END, classProject.getFullPackage(CodeType.RESOURCE_PROPERTIES, "")); ht.put(START + "packagemodel" + END, classProject.getFullPackage(CodeType.INTERFACE, "")); ht.put(START + "package" + END, classProject.getFullPackage(codeType, "")); xml = org.jbundle.base.model.Utility.replace(xml, ht); return xml; }
java
public String replaceParams(String xml, CodeType codeType) { ClassProject classProject = (ClassProject)this.getMainRecord(); Map<String, String> ht = new HashMap<String, String>(); ht.put(START + "project" + END, classProject.getField(ClassProject.NAME).toString()); ht.put(START + "version" + END, "1.0.0-SNAPSHOT"); ht.put(START + "groupId" + END, classProject.getFullPackage(CodeType.THICK, "")); ht.put(START + "packagedb" + END, classProject.getFullPackage(CodeType.THICK, "")); ht.put(START + "packagethin" + END, classProject.getFullPackage(CodeType.THIN, "")); ht.put(START + "packageres" + END, classProject.getFullPackage(CodeType.RESOURCE_PROPERTIES, "")); ht.put(START + "packagemodel" + END, classProject.getFullPackage(CodeType.INTERFACE, "")); ht.put(START + "package" + END, classProject.getFullPackage(codeType, "")); xml = org.jbundle.base.model.Utility.replace(xml, ht); return xml; }
[ "public", "String", "replaceParams", "(", "String", "xml", ",", "CodeType", "codeType", ")", "{", "ClassProject", "classProject", "=", "(", "ClassProject", ")", "this", ".", "getMainRecord", "(", ")", ";", "Map", "<", "String", ",", "String", ">", "ht", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "ht", ".", "put", "(", "START", "+", "\"project\"", "+", "END", ",", "classProject", ".", "getField", "(", "ClassProject", ".", "NAME", ")", ".", "toString", "(", ")", ")", ";", "ht", ".", "put", "(", "START", "+", "\"version\"", "+", "END", ",", "\"1.0.0-SNAPSHOT\"", ")", ";", "ht", ".", "put", "(", "START", "+", "\"groupId\"", "+", "END", ",", "classProject", ".", "getFullPackage", "(", "CodeType", ".", "THICK", ",", "\"\"", ")", ")", ";", "ht", ".", "put", "(", "START", "+", "\"packagedb\"", "+", "END", ",", "classProject", ".", "getFullPackage", "(", "CodeType", ".", "THICK", ",", "\"\"", ")", ")", ";", "ht", ".", "put", "(", "START", "+", "\"packagethin\"", "+", "END", ",", "classProject", ".", "getFullPackage", "(", "CodeType", ".", "THIN", ",", "\"\"", ")", ")", ";", "ht", ".", "put", "(", "START", "+", "\"packageres\"", "+", "END", ",", "classProject", ".", "getFullPackage", "(", "CodeType", ".", "RESOURCE_PROPERTIES", ",", "\"\"", ")", ")", ";", "ht", ".", "put", "(", "START", "+", "\"packagemodel\"", "+", "END", ",", "classProject", ".", "getFullPackage", "(", "CodeType", ".", "INTERFACE", ",", "\"\"", ")", ")", ";", "ht", ".", "put", "(", "START", "+", "\"package\"", "+", "END", ",", "classProject", ".", "getFullPackage", "(", "codeType", ",", "\"\"", ")", ")", ";", "xml", "=", "org", ".", "jbundle", ".", "base", ".", "model", ".", "Utility", ".", "replace", "(", "xml", ",", "ht", ")", ";", "return", "xml", ";", "}" ]
ReplaceParams Method.
[ "ReplaceParams", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/process/SetupProjectProcess.java#L184-L198
151,923
jbundle/jbundle
app/program/script/src/main/java/org/jbundle/app/program/script/process/SetupProjectProcess.java
SetupProjectProcess.transferStream
public String transferStream(InputStream in, int size) { StringBuilder sb = new StringBuilder(); try { byte[] cbuf = new byte[1000]; int iLen = Math.max(size, cbuf.length); while ((iLen = in.read(cbuf, 0, iLen)) > 0) { // Write the entire file to the output buffer for (int i = 0; i < iLen; i++) { sb.append(Character.toChars(cbuf[i])); } size = size - iLen; iLen = Math.max(size, cbuf.length); } } catch (MalformedURLException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } return sb.toString(); }
java
public String transferStream(InputStream in, int size) { StringBuilder sb = new StringBuilder(); try { byte[] cbuf = new byte[1000]; int iLen = Math.max(size, cbuf.length); while ((iLen = in.read(cbuf, 0, iLen)) > 0) { // Write the entire file to the output buffer for (int i = 0; i < iLen; i++) { sb.append(Character.toChars(cbuf[i])); } size = size - iLen; iLen = Math.max(size, cbuf.length); } } catch (MalformedURLException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } return sb.toString(); }
[ "public", "String", "transferStream", "(", "InputStream", "in", ",", "int", "size", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "try", "{", "byte", "[", "]", "cbuf", "=", "new", "byte", "[", "1000", "]", ";", "int", "iLen", "=", "Math", ".", "max", "(", "size", ",", "cbuf", ".", "length", ")", ";", "while", "(", "(", "iLen", "=", "in", ".", "read", "(", "cbuf", ",", "0", ",", "iLen", ")", ")", ">", "0", ")", "{", "// Write the entire file to the output buffer", "for", "(", "int", "i", "=", "0", ";", "i", "<", "iLen", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "Character", ".", "toChars", "(", "cbuf", "[", "i", "]", ")", ")", ";", "}", "size", "=", "size", "-", "iLen", ";", "iLen", "=", "Math", ".", "max", "(", "size", ",", "cbuf", ".", "length", ")", ";", "}", "}", "catch", "(", "MalformedURLException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
TransferStream Method.
[ "TransferStream", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/process/SetupProjectProcess.java#L202-L223
151,924
jbundle/jbundle
app/program/script/src/main/java/org/jbundle/app/program/script/process/SetupProjectProcess.java
SetupProjectProcess.marshalObject
public String marshalObject(Object message) { try { IBindingFactory jc = BindingDirectory.getFactory(Model.class); IMarshallingContext marshaller = jc.createMarshallingContext(); ByteArrayOutputStream out = new ByteArrayOutputStream(); marshaller.setIndent(2); marshaller.marshalDocument(message, URL_ENCODING, null, out); String xml = out.toString(STRING_ENCODING); return xml; } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (JiBXException e) { e.printStackTrace(); } return null; }
java
public String marshalObject(Object message) { try { IBindingFactory jc = BindingDirectory.getFactory(Model.class); IMarshallingContext marshaller = jc.createMarshallingContext(); ByteArrayOutputStream out = new ByteArrayOutputStream(); marshaller.setIndent(2); marshaller.marshalDocument(message, URL_ENCODING, null, out); String xml = out.toString(STRING_ENCODING); return xml; } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (JiBXException e) { e.printStackTrace(); } return null; }
[ "public", "String", "marshalObject", "(", "Object", "message", ")", "{", "try", "{", "IBindingFactory", "jc", "=", "BindingDirectory", ".", "getFactory", "(", "Model", ".", "class", ")", ";", "IMarshallingContext", "marshaller", "=", "jc", ".", "createMarshallingContext", "(", ")", ";", "ByteArrayOutputStream", "out", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "marshaller", ".", "setIndent", "(", "2", ")", ";", "marshaller", ".", "marshalDocument", "(", "message", ",", "URL_ENCODING", ",", "null", ",", "out", ")", ";", "String", "xml", "=", "out", ".", "toString", "(", "STRING_ENCODING", ")", ";", "return", "xml", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "JiBXException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}" ]
Marshal this object to an XML string @param message @return.
[ "Marshal", "this", "object", "to", "an", "XML", "string" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/process/SetupProjectProcess.java#L229-L245
151,925
jbundle/jbundle
app/program/script/src/main/java/org/jbundle/app/program/script/process/SetupProjectProcess.java
SetupProjectProcess.unmarshalMessage
public Object unmarshalMessage(String xml) { try { IBindingFactory jc = BindingDirectory.getFactory(Model.class); IUnmarshallingContext unmarshaller = jc.createUnmarshallingContext(); Reader inStream = new StringReader(xml); Object message = unmarshaller.unmarshalDocument( inStream, BINDING_NAME); return message; } catch (JiBXException e) { e.printStackTrace(); } return null; }
java
public Object unmarshalMessage(String xml) { try { IBindingFactory jc = BindingDirectory.getFactory(Model.class); IUnmarshallingContext unmarshaller = jc.createUnmarshallingContext(); Reader inStream = new StringReader(xml); Object message = unmarshaller.unmarshalDocument( inStream, BINDING_NAME); return message; } catch (JiBXException e) { e.printStackTrace(); } return null; }
[ "public", "Object", "unmarshalMessage", "(", "String", "xml", ")", "{", "try", "{", "IBindingFactory", "jc", "=", "BindingDirectory", ".", "getFactory", "(", "Model", ".", "class", ")", ";", "IUnmarshallingContext", "unmarshaller", "=", "jc", ".", "createUnmarshallingContext", "(", ")", ";", "Reader", "inStream", "=", "new", "StringReader", "(", "xml", ")", ";", "Object", "message", "=", "unmarshaller", ".", "unmarshalDocument", "(", "inStream", ",", "BINDING_NAME", ")", ";", "return", "message", ";", "}", "catch", "(", "JiBXException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}" ]
Unmarshal this xml Message to an object. @param xml @param system @return.
[ "Unmarshal", "this", "xml", "Message", "to", "an", "object", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/process/SetupProjectProcess.java#L252-L264
151,926
jbundle/jbundle
main/screen/src/main/java/org/jbundle/main/user/screen/UserLoginScreen.java
UserLoginScreen.getHiddenParams
public Map<String, Object> getHiddenParams() { Map<String, Object> mapParams = super.getHiddenParams(); if (this.getTask() instanceof ServletTask) mapParams = ((ServletTask)this.getTask()).getRequestProperties(((ServletTask)this.getTask()).getServletRequest(), false); mapParams.remove(DBParams.USER_NAME); mapParams.remove(DBParams.USER_ID); return mapParams; }
java
public Map<String, Object> getHiddenParams() { Map<String, Object> mapParams = super.getHiddenParams(); if (this.getTask() instanceof ServletTask) mapParams = ((ServletTask)this.getTask()).getRequestProperties(((ServletTask)this.getTask()).getServletRequest(), false); mapParams.remove(DBParams.USER_NAME); mapParams.remove(DBParams.USER_ID); return mapParams; }
[ "public", "Map", "<", "String", ",", "Object", ">", "getHiddenParams", "(", ")", "{", "Map", "<", "String", ",", "Object", ">", "mapParams", "=", "super", ".", "getHiddenParams", "(", ")", ";", "if", "(", "this", ".", "getTask", "(", ")", "instanceof", "ServletTask", ")", "mapParams", "=", "(", "(", "ServletTask", ")", "this", ".", "getTask", "(", ")", ")", ".", "getRequestProperties", "(", "(", "(", "ServletTask", ")", "this", ".", "getTask", "(", ")", ")", ".", "getServletRequest", "(", ")", ",", "false", ")", ";", "mapParams", ".", "remove", "(", "DBParams", ".", "USER_NAME", ")", ";", "mapParams", ".", "remove", "(", "DBParams", ".", "USER_ID", ")", ";", "return", "mapParams", ";", "}" ]
Get this screen's hidden params. @return This screens hidden params. .
[ "Get", "this", "screen", "s", "hidden", "params", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/screen/src/main/java/org/jbundle/main/user/screen/UserLoginScreen.java#L237-L245
151,927
simter/simter-jwt
src/main/java/tech/simter/jwt/Header.java
Header.decode
public static Header decode(String header) { // verify to json with JAX-RS standard JsonObject json; try { json = Json.createReader(new ByteArrayInputStream(Base64.getUrlDecoder().decode(header))).readObject(); } catch (JsonException e) { throw new DecodeException("Failed convert to JsonObject", e); } catch (IllegalArgumentException e) { throw new DecodeException("The header is not in valid Base64 scheme", e); } // validate the typ parameter String type = json.containsKey("typ") ? json.getString("typ") : null; if (type != null && !DEFAULT_TYPE.equals(type)) throw new DecodeException("The header type '" + type + "' is not support."); // validate the alg parameter String algorithm = json.containsKey("alg") ? json.getString("alg") : null; if (algorithm != null && !Algorithm.HS256.name().equals(algorithm)) throw new DecodeException("The header algorithm '" + algorithm + "' is not support."); // construct a header instance if (DEFAULT_TYPE.equals(type) && Algorithm.HS256.name().equals(algorithm)) { // optimise the default standard header to always the same instance return Header.DEFAULT; } else { // create a whole new instance Header h = new Header(); h.type = type; h.algorithm = (algorithm != null ? Algorithm.valueOf(algorithm) : null); return h; } }
java
public static Header decode(String header) { // verify to json with JAX-RS standard JsonObject json; try { json = Json.createReader(new ByteArrayInputStream(Base64.getUrlDecoder().decode(header))).readObject(); } catch (JsonException e) { throw new DecodeException("Failed convert to JsonObject", e); } catch (IllegalArgumentException e) { throw new DecodeException("The header is not in valid Base64 scheme", e); } // validate the typ parameter String type = json.containsKey("typ") ? json.getString("typ") : null; if (type != null && !DEFAULT_TYPE.equals(type)) throw new DecodeException("The header type '" + type + "' is not support."); // validate the alg parameter String algorithm = json.containsKey("alg") ? json.getString("alg") : null; if (algorithm != null && !Algorithm.HS256.name().equals(algorithm)) throw new DecodeException("The header algorithm '" + algorithm + "' is not support."); // construct a header instance if (DEFAULT_TYPE.equals(type) && Algorithm.HS256.name().equals(algorithm)) { // optimise the default standard header to always the same instance return Header.DEFAULT; } else { // create a whole new instance Header h = new Header(); h.type = type; h.algorithm = (algorithm != null ? Algorithm.valueOf(algorithm) : null); return h; } }
[ "public", "static", "Header", "decode", "(", "String", "header", ")", "{", "// verify to json with JAX-RS standard", "JsonObject", "json", ";", "try", "{", "json", "=", "Json", ".", "createReader", "(", "new", "ByteArrayInputStream", "(", "Base64", ".", "getUrlDecoder", "(", ")", ".", "decode", "(", "header", ")", ")", ")", ".", "readObject", "(", ")", ";", "}", "catch", "(", "JsonException", "e", ")", "{", "throw", "new", "DecodeException", "(", "\"Failed convert to JsonObject\"", ",", "e", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "throw", "new", "DecodeException", "(", "\"The header is not in valid Base64 scheme\"", ",", "e", ")", ";", "}", "// validate the typ parameter", "String", "type", "=", "json", ".", "containsKey", "(", "\"typ\"", ")", "?", "json", ".", "getString", "(", "\"typ\"", ")", ":", "null", ";", "if", "(", "type", "!=", "null", "&&", "!", "DEFAULT_TYPE", ".", "equals", "(", "type", ")", ")", "throw", "new", "DecodeException", "(", "\"The header type '\"", "+", "type", "+", "\"' is not support.\"", ")", ";", "// validate the alg parameter", "String", "algorithm", "=", "json", ".", "containsKey", "(", "\"alg\"", ")", "?", "json", ".", "getString", "(", "\"alg\"", ")", ":", "null", ";", "if", "(", "algorithm", "!=", "null", "&&", "!", "Algorithm", ".", "HS256", ".", "name", "(", ")", ".", "equals", "(", "algorithm", ")", ")", "throw", "new", "DecodeException", "(", "\"The header algorithm '\"", "+", "algorithm", "+", "\"' is not support.\"", ")", ";", "// construct a header instance", "if", "(", "DEFAULT_TYPE", ".", "equals", "(", "type", ")", "&&", "Algorithm", ".", "HS256", ".", "name", "(", ")", ".", "equals", "(", "algorithm", ")", ")", "{", "// optimise the default standard header to always the same instance", "return", "Header", ".", "DEFAULT", ";", "}", "else", "{", "// create a whole new instance", "Header", "h", "=", "new", "Header", "(", ")", ";", "h", ".", "type", "=", "type", ";", "h", ".", "algorithm", "=", "(", "algorithm", "!=", "null", "?", "Algorithm", ".", "valueOf", "(", "algorithm", ")", ":", "null", ")", ";", "return", "h", ";", "}", "}" ]
Decode the base64-string to Header. @param header the base64-string to be decoded @return the header instance @throws DecodeException if header is not a standard jwt header
[ "Decode", "the", "base64", "-", "string", "to", "Header", "." ]
fea8d520e8eeb26c2ab9f5eeb2bd3f5a6c0e4433
https://github.com/simter/simter-jwt/blob/fea8d520e8eeb26c2ab9f5eeb2bd3f5a6c0e4433/src/main/java/tech/simter/jwt/Header.java#L61-L93
151,928
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/CipherRegistry.java
CipherRegistry.registerCiphers
public static CipherRegistry registerCiphers(String[]... ciphers) { for (String[] cipher : ciphers) { instance.register(cipher); } return instance; }
java
public static CipherRegistry registerCiphers(String[]... ciphers) { for (String[] cipher : ciphers) { instance.register(cipher); } return instance; }
[ "public", "static", "CipherRegistry", "registerCiphers", "(", "String", "[", "]", "...", "ciphers", ")", "{", "for", "(", "String", "[", "]", "cipher", ":", "ciphers", ")", "{", "instance", ".", "register", "(", "cipher", ")", ";", "}", "return", "instance", ";", "}" ]
Register multiple ciphers. @param ciphers Ciphers to be registered. @return CipherRegistry instance (for chaining).
[ "Register", "multiple", "ciphers", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/CipherRegistry.java#L72-L77
151,929
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/CipherRegistry.java
CipherRegistry.registerCiphers
public static CipherRegistry registerCiphers(InputStream source) { try { if (source == null) { throw new IllegalArgumentException("Cipher source not found."); } List<String> lines = IOUtils.readLines(source); int start = -1; int index = 0; boolean error = false; while (index < lines.size()) { String line = lines.get(index); if (line.trim().isEmpty()) { lines.remove(index); continue; } if (line.equals("-----BEGIN CIPHER-----")) { if (start == -1) { start = index + 1; } else { error = true; } } else if (line.equals("-----END CIPHER-----")) { if (start > 0) { int length = index - start; String[] cipher = new String[length]; registerCipher(lines.subList(start, index).toArray(cipher)); start = -1; } else { error = true; } } if (error) { throw new IllegalArgumentException("Unexpected text in cipher: " + line); } index++; } if (start > 0) { throw new IllegalArgumentException("Missing end cipher token."); } } catch (IOException e) { throw MiscUtil.toUnchecked(e); } finally { IOUtils.closeQuietly(source); } return instance; }
java
public static CipherRegistry registerCiphers(InputStream source) { try { if (source == null) { throw new IllegalArgumentException("Cipher source not found."); } List<String> lines = IOUtils.readLines(source); int start = -1; int index = 0; boolean error = false; while (index < lines.size()) { String line = lines.get(index); if (line.trim().isEmpty()) { lines.remove(index); continue; } if (line.equals("-----BEGIN CIPHER-----")) { if (start == -1) { start = index + 1; } else { error = true; } } else if (line.equals("-----END CIPHER-----")) { if (start > 0) { int length = index - start; String[] cipher = new String[length]; registerCipher(lines.subList(start, index).toArray(cipher)); start = -1; } else { error = true; } } if (error) { throw new IllegalArgumentException("Unexpected text in cipher: " + line); } index++; } if (start > 0) { throw new IllegalArgumentException("Missing end cipher token."); } } catch (IOException e) { throw MiscUtil.toUnchecked(e); } finally { IOUtils.closeQuietly(source); } return instance; }
[ "public", "static", "CipherRegistry", "registerCiphers", "(", "InputStream", "source", ")", "{", "try", "{", "if", "(", "source", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cipher source not found.\"", ")", ";", "}", "List", "<", "String", ">", "lines", "=", "IOUtils", ".", "readLines", "(", "source", ")", ";", "int", "start", "=", "-", "1", ";", "int", "index", "=", "0", ";", "boolean", "error", "=", "false", ";", "while", "(", "index", "<", "lines", ".", "size", "(", ")", ")", "{", "String", "line", "=", "lines", ".", "get", "(", "index", ")", ";", "if", "(", "line", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "lines", ".", "remove", "(", "index", ")", ";", "continue", ";", "}", "if", "(", "line", ".", "equals", "(", "\"-----BEGIN CIPHER-----\"", ")", ")", "{", "if", "(", "start", "==", "-", "1", ")", "{", "start", "=", "index", "+", "1", ";", "}", "else", "{", "error", "=", "true", ";", "}", "}", "else", "if", "(", "line", ".", "equals", "(", "\"-----END CIPHER-----\"", ")", ")", "{", "if", "(", "start", ">", "0", ")", "{", "int", "length", "=", "index", "-", "start", ";", "String", "[", "]", "cipher", "=", "new", "String", "[", "length", "]", ";", "registerCipher", "(", "lines", ".", "subList", "(", "start", ",", "index", ")", ".", "toArray", "(", "cipher", ")", ")", ";", "start", "=", "-", "1", ";", "}", "else", "{", "error", "=", "true", ";", "}", "}", "if", "(", "error", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unexpected text in cipher: \"", "+", "line", ")", ";", "}", "index", "++", ";", "}", "if", "(", "start", ">", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Missing end cipher token.\"", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "MiscUtil", ".", "toUnchecked", "(", "e", ")", ";", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "source", ")", ";", "}", "return", "instance", ";", "}" ]
Register one or more ciphers from an input stream. @param source Input stream containing cipher(s). @return CipherRegistry instance (for chaining).
[ "Register", "one", "or", "more", "ciphers", "from", "an", "input", "stream", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/CipherRegistry.java#L85-L139
151,930
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/CipherRegistry.java
CipherRegistry.get
@Override public String[] get(String key) { String[] cipher = super.get(key); if (cipher == null) { throw new IllegalArgumentException("Cipher is unknown."); } return cipher; }
java
@Override public String[] get(String key) { String[] cipher = super.get(key); if (cipher == null) { throw new IllegalArgumentException("Cipher is unknown."); } return cipher; }
[ "@", "Override", "public", "String", "[", "]", "get", "(", "String", "key", ")", "{", "String", "[", "]", "cipher", "=", "super", ".", "get", "(", "key", ")", ";", "if", "(", "cipher", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cipher is unknown.\"", ")", ";", "}", "return", "cipher", ";", "}" ]
Override to return default cipher if input is null or throw an exception if the cipher key is not recognized.
[ "Override", "to", "return", "default", "cipher", "if", "input", "is", "null", "or", "throw", "an", "exception", "if", "the", "cipher", "key", "is", "not", "recognized", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/CipherRegistry.java#L162-L171
151,931
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerUtil.java
BrokerUtil.buildSubscript
public static String buildSubscript(Iterable<Object> subscripts) { StringBuilder sb = new StringBuilder(); for (Object subscript : subscripts) { String value = toString(subscript); if (value.isEmpty()) { throw new RuntimeException("Null subscript not allowed."); } if (sb.length() > 0) { sb.append(","); } if (StringUtils.isNumeric(value)) { sb.append(value); } else { sb.append(QT); sb.append(value.replaceAll(QT, QT2)); sb.append(QT); } } return sb.toString(); }
java
public static String buildSubscript(Iterable<Object> subscripts) { StringBuilder sb = new StringBuilder(); for (Object subscript : subscripts) { String value = toString(subscript); if (value.isEmpty()) { throw new RuntimeException("Null subscript not allowed."); } if (sb.length() > 0) { sb.append(","); } if (StringUtils.isNumeric(value)) { sb.append(value); } else { sb.append(QT); sb.append(value.replaceAll(QT, QT2)); sb.append(QT); } } return sb.toString(); }
[ "public", "static", "String", "buildSubscript", "(", "Iterable", "<", "Object", ">", "subscripts", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Object", "subscript", ":", "subscripts", ")", "{", "String", "value", "=", "toString", "(", "subscript", ")", ";", "if", "(", "value", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Null subscript not allowed.\"", ")", ";", "}", "if", "(", "sb", ".", "length", "(", ")", ">", "0", ")", "{", "sb", ".", "append", "(", "\",\"", ")", ";", "}", "if", "(", "StringUtils", ".", "isNumeric", "(", "value", ")", ")", "{", "sb", ".", "append", "(", "value", ")", ";", "}", "else", "{", "sb", ".", "append", "(", "QT", ")", ";", "sb", ".", "append", "(", "value", ".", "replaceAll", "(", "QT", ",", "QT2", ")", ")", ";", "sb", ".", "append", "(", "QT", ")", ";", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Converts a list of objects to a string of M subscripts. @param subscripts List to convert. @return List of subscripts in M format.
[ "Converts", "a", "list", "of", "objects", "to", "a", "string", "of", "M", "subscripts", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerUtil.java#L82-L106
151,932
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/structures/TagRequirements.java
TagRequirements.merge
public void merge(final TagRequirements other) { if (other != null) { matchAllOf.addAll(other.matchAllOf); matchOneOf.addAll(other.matchOneOf); } }
java
public void merge(final TagRequirements other) { if (other != null) { matchAllOf.addAll(other.matchAllOf); matchOneOf.addAll(other.matchOneOf); } }
[ "public", "void", "merge", "(", "final", "TagRequirements", "other", ")", "{", "if", "(", "other", "!=", "null", ")", "{", "matchAllOf", ".", "addAll", "(", "other", ".", "matchAllOf", ")", ";", "matchOneOf", ".", "addAll", "(", "other", ".", "matchOneOf", ")", ";", "}", "}" ]
This method will merge the tag information stored in another TagRequirements object with the tag information stored in this object. @param other the other TagRequirements object to merge with
[ "This", "method", "will", "merge", "the", "tag", "information", "stored", "in", "another", "TagRequirements", "object", "with", "the", "tag", "information", "stored", "in", "this", "object", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/structures/TagRequirements.java#L89-L94
151,933
js-lib-com/net-client
src/main/java/js/net/client/ConnectionFactory.java
ConnectionFactory.isSecure
private static boolean isSecure(String protocol) throws BugError { if (HTTP.equalsIgnoreCase(protocol)) { return false; } else if (HTTPS.equalsIgnoreCase(protocol)) { return true; } else { throw new BugError("Unsupported protocol |%s| for HTTP transaction.", protocol); } }
java
private static boolean isSecure(String protocol) throws BugError { if (HTTP.equalsIgnoreCase(protocol)) { return false; } else if (HTTPS.equalsIgnoreCase(protocol)) { return true; } else { throw new BugError("Unsupported protocol |%s| for HTTP transaction.", protocol); } }
[ "private", "static", "boolean", "isSecure", "(", "String", "protocol", ")", "throws", "BugError", "{", "if", "(", "HTTP", ".", "equalsIgnoreCase", "(", "protocol", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "HTTPS", ".", "equalsIgnoreCase", "(", "protocol", ")", ")", "{", "return", "true", ";", "}", "else", "{", "throw", "new", "BugError", "(", "\"Unsupported protocol |%s| for HTTP transaction.\"", ",", "protocol", ")", ";", "}", "}" ]
Predicate to test if given protocol is secure. @param protocol protocol to test if secure. @return true it given <code>protocol</code> is secure. @throws BugError if given protocol is not supported.
[ "Predicate", "to", "test", "if", "given", "protocol", "is", "secure", "." ]
0489f85d8baa1be1ff115aa79929e0cf05d4c72d
https://github.com/js-lib-com/net-client/blob/0489f85d8baa1be1ff115aa79929e0cf05d4c72d/src/main/java/js/net/client/ConnectionFactory.java#L167-L175
151,934
jbundle/jbundle
app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java
WriteClass.writeClass
public void writeClass(String strClassName, CodeType codeType) { if (!this.readThisClass(strClassName)) // Get the field this is based on return; this.writeHeading(strClassName, this.getPackage(codeType), codeType); // Write the first few lines of the files this.writeIncludes(codeType); if (m_MethodNameList.size() != 0) m_MethodNameList.removeAllElements(); this.writeClassInterface(); this.writeClassFields(CodeType.THICK); // Write the C++ fields for this class this.writeDefaultConstructor(strClassName); this.writeClassInit(); this.writeInit(); // Special case... zero all class fields! this.writeProgramDesc(strClassName); this.writeClassMethods(CodeType.THICK); // Write the remaining methods for this class this.writeEndCode(true); }
java
public void writeClass(String strClassName, CodeType codeType) { if (!this.readThisClass(strClassName)) // Get the field this is based on return; this.writeHeading(strClassName, this.getPackage(codeType), codeType); // Write the first few lines of the files this.writeIncludes(codeType); if (m_MethodNameList.size() != 0) m_MethodNameList.removeAllElements(); this.writeClassInterface(); this.writeClassFields(CodeType.THICK); // Write the C++ fields for this class this.writeDefaultConstructor(strClassName); this.writeClassInit(); this.writeInit(); // Special case... zero all class fields! this.writeProgramDesc(strClassName); this.writeClassMethods(CodeType.THICK); // Write the remaining methods for this class this.writeEndCode(true); }
[ "public", "void", "writeClass", "(", "String", "strClassName", ",", "CodeType", "codeType", ")", "{", "if", "(", "!", "this", ".", "readThisClass", "(", "strClassName", ")", ")", "// Get the field this is based on", "return", ";", "this", ".", "writeHeading", "(", "strClassName", ",", "this", ".", "getPackage", "(", "codeType", ")", ",", "codeType", ")", ";", "// Write the first few lines of the files", "this", ".", "writeIncludes", "(", "codeType", ")", ";", "if", "(", "m_MethodNameList", ".", "size", "(", ")", "!=", "0", ")", "m_MethodNameList", ".", "removeAllElements", "(", ")", ";", "this", ".", "writeClassInterface", "(", ")", ";", "this", ".", "writeClassFields", "(", "CodeType", ".", "THICK", ")", ";", "// Write the C++ fields for this class", "this", ".", "writeDefaultConstructor", "(", "strClassName", ")", ";", "this", ".", "writeClassInit", "(", ")", ";", "this", ".", "writeInit", "(", ")", ";", "// Special case... zero all class fields!", "this", ".", "writeProgramDesc", "(", "strClassName", ")", ";", "this", ".", "writeClassMethods", "(", "CodeType", ".", "THICK", ")", ";", "// Write the remaining methods for this class", "this", ".", "writeEndCode", "(", "true", ")", ";", "}" ]
Create the Class for this field. @param codeType
[ "Create", "the", "Class", "for", "this", "field", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java#L157-L179
151,935
jbundle/jbundle
app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java
WriteClass.readThisClass
public boolean readThisClass( String strClassName) { try { Record recClassInfo = this.getMainRecord(); recClassInfo.getField(ClassInfo.CLASS_NAME).setString(strClassName); recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY); return recClassInfo.seek("="); // Get this class record back } catch (DBException ex) { ex.printStackTrace(); return false; } }
java
public boolean readThisClass( String strClassName) { try { Record recClassInfo = this.getMainRecord(); recClassInfo.getField(ClassInfo.CLASS_NAME).setString(strClassName); recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY); return recClassInfo.seek("="); // Get this class record back } catch (DBException ex) { ex.printStackTrace(); return false; } }
[ "public", "boolean", "readThisClass", "(", "String", "strClassName", ")", "{", "try", "{", "Record", "recClassInfo", "=", "this", ".", "getMainRecord", "(", ")", ";", "recClassInfo", ".", "getField", "(", "ClassInfo", ".", "CLASS_NAME", ")", ".", "setString", "(", "strClassName", ")", ";", "recClassInfo", ".", "setKeyArea", "(", "ClassInfo", ".", "CLASS_NAME_KEY", ")", ";", "return", "recClassInfo", ".", "seek", "(", "\"=\"", ")", ";", "// Get this class record back", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "return", "false", ";", "}", "}" ]
Read the class with this name.
[ "Read", "the", "class", "with", "this", "name", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java#L183-L194
151,936
jbundle/jbundle
app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java
WriteClass.writeClassInterface
public void writeClassInterface() { Record recClassInfo = this.getMainRecord(); String strClassName = recClassInfo.getField(ClassInfo.CLASS_NAME).getString(); String strBaseClass = recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getString(); String strClassDesc = recClassInfo.getField(ClassInfo.CLASS_DESC).getString(); String strClassInterface = recClassInfo.getField(ClassInfo.CLASS_IMPLEMENTS).getString(); String implementsClass = null; if (((ClassInfo)recClassInfo).isARecord(false)) implementsClass = strClassName + "Model"; if ((implementsClass != null) && (implementsClass.length() > 0)) { m_IncludeNameList.addInclude(this.getPackage(CodeType.INTERFACE), null); // Make sure this is included if ((strClassInterface == null) || (strClassInterface.length() == 0)) strClassInterface = implementsClass; else strClassInterface = implementsClass + ", " + strClassInterface; } m_IncludeNameList.addInclude(strBaseClass, null); // Make sure this is included m_StreamOut.writeit("\n/**\n *\t" + strClassName + " - " + strClassDesc + ".\n */\n"); if ((strClassInterface == null) || (strClassInterface.length() == 0)) strClassInterface = ""; else strClassInterface = "\n\t implements " + strClassInterface; String strClassType = "class"; if ("interface".equals(recClassInfo.getField(ClassInfo.CLASS_TYPE).toString())) strClassType = "interface"; String strExtends = " extends "; if (strBaseClass.length() == 0) strExtends = ""; m_StreamOut.writeit("public " + strClassType + " " + strClassName + strExtends + strBaseClass + strClassInterface + "\n{\n"); m_StreamOut.setTabs(+1); }
java
public void writeClassInterface() { Record recClassInfo = this.getMainRecord(); String strClassName = recClassInfo.getField(ClassInfo.CLASS_NAME).getString(); String strBaseClass = recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getString(); String strClassDesc = recClassInfo.getField(ClassInfo.CLASS_DESC).getString(); String strClassInterface = recClassInfo.getField(ClassInfo.CLASS_IMPLEMENTS).getString(); String implementsClass = null; if (((ClassInfo)recClassInfo).isARecord(false)) implementsClass = strClassName + "Model"; if ((implementsClass != null) && (implementsClass.length() > 0)) { m_IncludeNameList.addInclude(this.getPackage(CodeType.INTERFACE), null); // Make sure this is included if ((strClassInterface == null) || (strClassInterface.length() == 0)) strClassInterface = implementsClass; else strClassInterface = implementsClass + ", " + strClassInterface; } m_IncludeNameList.addInclude(strBaseClass, null); // Make sure this is included m_StreamOut.writeit("\n/**\n *\t" + strClassName + " - " + strClassDesc + ".\n */\n"); if ((strClassInterface == null) || (strClassInterface.length() == 0)) strClassInterface = ""; else strClassInterface = "\n\t implements " + strClassInterface; String strClassType = "class"; if ("interface".equals(recClassInfo.getField(ClassInfo.CLASS_TYPE).toString())) strClassType = "interface"; String strExtends = " extends "; if (strBaseClass.length() == 0) strExtends = ""; m_StreamOut.writeit("public " + strClassType + " " + strClassName + strExtends + strBaseClass + strClassInterface + "\n{\n"); m_StreamOut.setTabs(+1); }
[ "public", "void", "writeClassInterface", "(", ")", "{", "Record", "recClassInfo", "=", "this", ".", "getMainRecord", "(", ")", ";", "String", "strClassName", "=", "recClassInfo", ".", "getField", "(", "ClassInfo", ".", "CLASS_NAME", ")", ".", "getString", "(", ")", ";", "String", "strBaseClass", "=", "recClassInfo", ".", "getField", "(", "ClassInfo", ".", "BASE_CLASS_NAME", ")", ".", "getString", "(", ")", ";", "String", "strClassDesc", "=", "recClassInfo", ".", "getField", "(", "ClassInfo", ".", "CLASS_DESC", ")", ".", "getString", "(", ")", ";", "String", "strClassInterface", "=", "recClassInfo", ".", "getField", "(", "ClassInfo", ".", "CLASS_IMPLEMENTS", ")", ".", "getString", "(", ")", ";", "String", "implementsClass", "=", "null", ";", "if", "(", "(", "(", "ClassInfo", ")", "recClassInfo", ")", ".", "isARecord", "(", "false", ")", ")", "implementsClass", "=", "strClassName", "+", "\"Model\"", ";", "if", "(", "(", "implementsClass", "!=", "null", ")", "&&", "(", "implementsClass", ".", "length", "(", ")", ">", "0", ")", ")", "{", "m_IncludeNameList", ".", "addInclude", "(", "this", ".", "getPackage", "(", "CodeType", ".", "INTERFACE", ")", ",", "null", ")", ";", "// Make sure this is included", "if", "(", "(", "strClassInterface", "==", "null", ")", "||", "(", "strClassInterface", ".", "length", "(", ")", "==", "0", ")", ")", "strClassInterface", "=", "implementsClass", ";", "else", "strClassInterface", "=", "implementsClass", "+", "\", \"", "+", "strClassInterface", ";", "}", "m_IncludeNameList", ".", "addInclude", "(", "strBaseClass", ",", "null", ")", ";", "// Make sure this is included", "m_StreamOut", ".", "writeit", "(", "\"\\n/**\\n *\\t\"", "+", "strClassName", "+", "\" - \"", "+", "strClassDesc", "+", "\".\\n */\\n\"", ")", ";", "if", "(", "(", "strClassInterface", "==", "null", ")", "||", "(", "strClassInterface", ".", "length", "(", ")", "==", "0", ")", ")", "strClassInterface", "=", "\"\"", ";", "else", "strClassInterface", "=", "\"\\n\\t implements \"", "+", "strClassInterface", ";", "String", "strClassType", "=", "\"class\"", ";", "if", "(", "\"interface\"", ".", "equals", "(", "recClassInfo", ".", "getField", "(", "ClassInfo", ".", "CLASS_TYPE", ")", ".", "toString", "(", ")", ")", ")", "strClassType", "=", "\"interface\"", ";", "String", "strExtends", "=", "\" extends \"", ";", "if", "(", "strBaseClass", ".", "length", "(", ")", "==", "0", ")", "strExtends", "=", "\"\"", ";", "m_StreamOut", ".", "writeit", "(", "\"public \"", "+", "strClassType", "+", "\" \"", "+", "strClassName", "+", "strExtends", "+", "strBaseClass", "+", "strClassInterface", "+", "\"\\n{\\n\"", ")", ";", "m_StreamOut", ".", "setTabs", "(", "+", "1", ")", ";", "}" ]
Start the interface.
[ "Start", "the", "interface", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java#L271-L305
151,937
jbundle/jbundle
app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java
WriteClass.writeEndCode
public void writeEndCode(boolean bJavaFile) { m_StreamOut.setTabs(-1); if (bJavaFile) m_StreamOut.writeit("\n}"); m_StreamOut.writeit("\n"); m_StreamOut.free(); m_StreamOut = null; m_IncludeNameList.free(); m_IncludeNameList = null; }
java
public void writeEndCode(boolean bJavaFile) { m_StreamOut.setTabs(-1); if (bJavaFile) m_StreamOut.writeit("\n}"); m_StreamOut.writeit("\n"); m_StreamOut.free(); m_StreamOut = null; m_IncludeNameList.free(); m_IncludeNameList = null; }
[ "public", "void", "writeEndCode", "(", "boolean", "bJavaFile", ")", "{", "m_StreamOut", ".", "setTabs", "(", "-", "1", ")", ";", "if", "(", "bJavaFile", ")", "m_StreamOut", ".", "writeit", "(", "\"\\n}\"", ")", ";", "m_StreamOut", ".", "writeit", "(", "\"\\n\"", ")", ";", "m_StreamOut", ".", "free", "(", ")", ";", "m_StreamOut", "=", "null", ";", "m_IncludeNameList", ".", "free", "(", ")", ";", "m_IncludeNameList", "=", "null", ";", "}" ]
Write the end of class code.
[ "Write", "the", "end", "of", "class", "code", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java#L547-L558
151,938
jbundle/jbundle
app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java
WriteClass.readThisMethod
public boolean readThisMethod(String strMethodName) { Record recClassInfo = this.getMainRecord(); LogicFile recLogicFile = (LogicFile)this.getRecord(LogicFile.LOGIC_FILE_FILE); try { String strClassName = recClassInfo.getField(ClassInfo.CLASS_NAME).getString(); recLogicFile.getField(LogicFile.METHOD_CLASS_NAME).setString(strClassName); recLogicFile.getField(LogicFile.METHOD_NAME).setString(strMethodName); recLogicFile.setKeyArea(LogicFile.METHOD_CLASS_NAME_KEY); if (recLogicFile.seek("=")) return true; else { // Set up a fake record and return recLogicFile.handleNewRecord(false); // Clear the record recLogicFile.getField(LogicFile.METHOD_CLASS_NAME).setString(strClassName); recLogicFile.getField(LogicFile.METHOD_NAME).setString(strMethodName); return false; } } catch (DBException ex) { ex.printStackTrace(); } finally { recLogicFile.setKeyArea(LogicFile.SEQUENCE_KEY); // set this back } return false; }
java
public boolean readThisMethod(String strMethodName) { Record recClassInfo = this.getMainRecord(); LogicFile recLogicFile = (LogicFile)this.getRecord(LogicFile.LOGIC_FILE_FILE); try { String strClassName = recClassInfo.getField(ClassInfo.CLASS_NAME).getString(); recLogicFile.getField(LogicFile.METHOD_CLASS_NAME).setString(strClassName); recLogicFile.getField(LogicFile.METHOD_NAME).setString(strMethodName); recLogicFile.setKeyArea(LogicFile.METHOD_CLASS_NAME_KEY); if (recLogicFile.seek("=")) return true; else { // Set up a fake record and return recLogicFile.handleNewRecord(false); // Clear the record recLogicFile.getField(LogicFile.METHOD_CLASS_NAME).setString(strClassName); recLogicFile.getField(LogicFile.METHOD_NAME).setString(strMethodName); return false; } } catch (DBException ex) { ex.printStackTrace(); } finally { recLogicFile.setKeyArea(LogicFile.SEQUENCE_KEY); // set this back } return false; }
[ "public", "boolean", "readThisMethod", "(", "String", "strMethodName", ")", "{", "Record", "recClassInfo", "=", "this", ".", "getMainRecord", "(", ")", ";", "LogicFile", "recLogicFile", "=", "(", "LogicFile", ")", "this", ".", "getRecord", "(", "LogicFile", ".", "LOGIC_FILE_FILE", ")", ";", "try", "{", "String", "strClassName", "=", "recClassInfo", ".", "getField", "(", "ClassInfo", ".", "CLASS_NAME", ")", ".", "getString", "(", ")", ";", "recLogicFile", ".", "getField", "(", "LogicFile", ".", "METHOD_CLASS_NAME", ")", ".", "setString", "(", "strClassName", ")", ";", "recLogicFile", ".", "getField", "(", "LogicFile", ".", "METHOD_NAME", ")", ".", "setString", "(", "strMethodName", ")", ";", "recLogicFile", ".", "setKeyArea", "(", "LogicFile", ".", "METHOD_CLASS_NAME_KEY", ")", ";", "if", "(", "recLogicFile", ".", "seek", "(", "\"=\"", ")", ")", "return", "true", ";", "else", "{", "// Set up a fake record and return", "recLogicFile", ".", "handleNewRecord", "(", "false", ")", ";", "// Clear the record", "recLogicFile", ".", "getField", "(", "LogicFile", ".", "METHOD_CLASS_NAME", ")", ".", "setString", "(", "strClassName", ")", ";", "recLogicFile", ".", "getField", "(", "LogicFile", ".", "METHOD_NAME", ")", ".", "setString", "(", "strMethodName", ")", ";", "return", "false", ";", "}", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "recLogicFile", ".", "setKeyArea", "(", "LogicFile", ".", "SEQUENCE_KEY", ")", ";", "// set this back", "}", "return", "false", ";", "}" ]
Read this method.
[ "Read", "this", "method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java#L562-L586
151,939
jbundle/jbundle
app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java
WriteClass.writeDefaultMethodCode
public void writeDefaultMethodCode(String strMethodName, String strMethodReturns, String strMethodInterface, String strClassName) { String strBaseClass, strMethodVariables = DBConstants.BLANK; Record recClassInfo = this.getMainRecord(); LogicFile recLogicFile = (LogicFile)this.getRecord(LogicFile.LOGIC_FILE_FILE); strBaseClass = recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getString(); // Get the base class name strMethodVariables = this.getMethodVariables(strMethodInterface); if (strClassName.equals(strMethodName)) { // Call super.NewC initializer if (strMethodVariables.equalsIgnoreCase("VOID")) strMethodVariables = ""; if (strMethodInterface.length() == 0) m_StreamOut.writeit("\tsuper();\n"); else { boolean bSuperFound = false; if ((strMethodReturns.length() == 0) || (strMethodReturns.equalsIgnoreCase("void"))) if (recLogicFile.getField(LogicFile.LOGIC_SOURCE).getLength() > 0) strMethodReturns = strMethodVariables; // Special case - if you have code, pass the default variables if ((strMethodReturns.length() == 0) || (strMethodReturns.equalsIgnoreCase("void"))) m_StreamOut.writeit("\tthis();\n\tthis.init(" + strMethodVariables + ");\n"); else { // Special Case - Different variables are passed in, must supply and init method w/the correct interface if (!strMethodReturns.equalsIgnoreCase("INIT")) { m_StreamOut.writeit("\tthis();\n\tthis.init(" + strMethodVariables + ");\n"); m_StreamOut.writeit("}\n"); m_strLastMethodInterface = strMethodInterface; m_strLastMethod = strMethodName; this.writeMethodInterface(null, "init", "void", strMethodInterface, "", "Initialize class fields", null); if (strMethodReturns.equalsIgnoreCase("VOID")) strMethodReturns = ""; this.writeClassInitialize(true); } else bSuperFound = true; // Don't call init.super(); if (recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString().length() != 0) { m_StreamOut.setTabs(+1); //x bSuperFound = m_MethodsOut.writeit(recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString() + "\n"); bSuperFound = bSuperFound | this.writeTextField(recLogicFile.getField(LogicFile.LOGIC_SOURCE), strBaseClass, "init", strMethodReturns, strClassName); m_StreamOut.setTabs(-1); } if (!bSuperFound) m_StreamOut.writeit("\tsuper.init(" + strMethodReturns + ");\n"); } } } else { // Call super.NewC if (!strMethodName.equals("setupSFields")) { String beginString = ""; if (strMethodReturns.length() == 0) beginString = "return "; m_StreamOut.writeit("\t" + beginString + "super." + strMethodName + "(" + strMethodVariables + ");\n"); } else this.writeSetupSCode(strMethodName, strMethodReturns, strMethodInterface, strClassName); } }
java
public void writeDefaultMethodCode(String strMethodName, String strMethodReturns, String strMethodInterface, String strClassName) { String strBaseClass, strMethodVariables = DBConstants.BLANK; Record recClassInfo = this.getMainRecord(); LogicFile recLogicFile = (LogicFile)this.getRecord(LogicFile.LOGIC_FILE_FILE); strBaseClass = recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getString(); // Get the base class name strMethodVariables = this.getMethodVariables(strMethodInterface); if (strClassName.equals(strMethodName)) { // Call super.NewC initializer if (strMethodVariables.equalsIgnoreCase("VOID")) strMethodVariables = ""; if (strMethodInterface.length() == 0) m_StreamOut.writeit("\tsuper();\n"); else { boolean bSuperFound = false; if ((strMethodReturns.length() == 0) || (strMethodReturns.equalsIgnoreCase("void"))) if (recLogicFile.getField(LogicFile.LOGIC_SOURCE).getLength() > 0) strMethodReturns = strMethodVariables; // Special case - if you have code, pass the default variables if ((strMethodReturns.length() == 0) || (strMethodReturns.equalsIgnoreCase("void"))) m_StreamOut.writeit("\tthis();\n\tthis.init(" + strMethodVariables + ");\n"); else { // Special Case - Different variables are passed in, must supply and init method w/the correct interface if (!strMethodReturns.equalsIgnoreCase("INIT")) { m_StreamOut.writeit("\tthis();\n\tthis.init(" + strMethodVariables + ");\n"); m_StreamOut.writeit("}\n"); m_strLastMethodInterface = strMethodInterface; m_strLastMethod = strMethodName; this.writeMethodInterface(null, "init", "void", strMethodInterface, "", "Initialize class fields", null); if (strMethodReturns.equalsIgnoreCase("VOID")) strMethodReturns = ""; this.writeClassInitialize(true); } else bSuperFound = true; // Don't call init.super(); if (recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString().length() != 0) { m_StreamOut.setTabs(+1); //x bSuperFound = m_MethodsOut.writeit(recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString() + "\n"); bSuperFound = bSuperFound | this.writeTextField(recLogicFile.getField(LogicFile.LOGIC_SOURCE), strBaseClass, "init", strMethodReturns, strClassName); m_StreamOut.setTabs(-1); } if (!bSuperFound) m_StreamOut.writeit("\tsuper.init(" + strMethodReturns + ");\n"); } } } else { // Call super.NewC if (!strMethodName.equals("setupSFields")) { String beginString = ""; if (strMethodReturns.length() == 0) beginString = "return "; m_StreamOut.writeit("\t" + beginString + "super." + strMethodName + "(" + strMethodVariables + ");\n"); } else this.writeSetupSCode(strMethodName, strMethodReturns, strMethodInterface, strClassName); } }
[ "public", "void", "writeDefaultMethodCode", "(", "String", "strMethodName", ",", "String", "strMethodReturns", ",", "String", "strMethodInterface", ",", "String", "strClassName", ")", "{", "String", "strBaseClass", ",", "strMethodVariables", "=", "DBConstants", ".", "BLANK", ";", "Record", "recClassInfo", "=", "this", ".", "getMainRecord", "(", ")", ";", "LogicFile", "recLogicFile", "=", "(", "LogicFile", ")", "this", ".", "getRecord", "(", "LogicFile", ".", "LOGIC_FILE_FILE", ")", ";", "strBaseClass", "=", "recClassInfo", ".", "getField", "(", "ClassInfo", ".", "BASE_CLASS_NAME", ")", ".", "getString", "(", ")", ";", "// Get the base class name", "strMethodVariables", "=", "this", ".", "getMethodVariables", "(", "strMethodInterface", ")", ";", "if", "(", "strClassName", ".", "equals", "(", "strMethodName", ")", ")", "{", "// Call super.NewC initializer", "if", "(", "strMethodVariables", ".", "equalsIgnoreCase", "(", "\"VOID\"", ")", ")", "strMethodVariables", "=", "\"\"", ";", "if", "(", "strMethodInterface", ".", "length", "(", ")", "==", "0", ")", "m_StreamOut", ".", "writeit", "(", "\"\\tsuper();\\n\"", ")", ";", "else", "{", "boolean", "bSuperFound", "=", "false", ";", "if", "(", "(", "strMethodReturns", ".", "length", "(", ")", "==", "0", ")", "||", "(", "strMethodReturns", ".", "equalsIgnoreCase", "(", "\"void\"", ")", ")", ")", "if", "(", "recLogicFile", ".", "getField", "(", "LogicFile", ".", "LOGIC_SOURCE", ")", ".", "getLength", "(", ")", ">", "0", ")", "strMethodReturns", "=", "strMethodVariables", ";", "// Special case - if you have code, pass the default variables", "if", "(", "(", "strMethodReturns", ".", "length", "(", ")", "==", "0", ")", "||", "(", "strMethodReturns", ".", "equalsIgnoreCase", "(", "\"void\"", ")", ")", ")", "m_StreamOut", ".", "writeit", "(", "\"\\tthis();\\n\\tthis.init(\"", "+", "strMethodVariables", "+", "\");\\n\"", ")", ";", "else", "{", "// Special Case - Different variables are passed in, must supply and init method w/the correct interface", "if", "(", "!", "strMethodReturns", ".", "equalsIgnoreCase", "(", "\"INIT\"", ")", ")", "{", "m_StreamOut", ".", "writeit", "(", "\"\\tthis();\\n\\tthis.init(\"", "+", "strMethodVariables", "+", "\");\\n\"", ")", ";", "m_StreamOut", ".", "writeit", "(", "\"}\\n\"", ")", ";", "m_strLastMethodInterface", "=", "strMethodInterface", ";", "m_strLastMethod", "=", "strMethodName", ";", "this", ".", "writeMethodInterface", "(", "null", ",", "\"init\"", ",", "\"void\"", ",", "strMethodInterface", ",", "\"\"", ",", "\"Initialize class fields\"", ",", "null", ")", ";", "if", "(", "strMethodReturns", ".", "equalsIgnoreCase", "(", "\"VOID\"", ")", ")", "strMethodReturns", "=", "\"\"", ";", "this", ".", "writeClassInitialize", "(", "true", ")", ";", "}", "else", "bSuperFound", "=", "true", ";", "// Don't call init.super();", "if", "(", "recLogicFile", ".", "getField", "(", "LogicFile", ".", "LOGIC_SOURCE", ")", ".", "getString", "(", ")", ".", "length", "(", ")", "!=", "0", ")", "{", "m_StreamOut", ".", "setTabs", "(", "+", "1", ")", ";", "//x bSuperFound = m_MethodsOut.writeit(recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString() + \"\\n\");", "bSuperFound", "=", "bSuperFound", "|", "this", ".", "writeTextField", "(", "recLogicFile", ".", "getField", "(", "LogicFile", ".", "LOGIC_SOURCE", ")", ",", "strBaseClass", ",", "\"init\"", ",", "strMethodReturns", ",", "strClassName", ")", ";", "m_StreamOut", ".", "setTabs", "(", "-", "1", ")", ";", "}", "if", "(", "!", "bSuperFound", ")", "m_StreamOut", ".", "writeit", "(", "\"\\tsuper.init(\"", "+", "strMethodReturns", "+", "\");\\n\"", ")", ";", "}", "}", "}", "else", "{", "// Call super.NewC", "if", "(", "!", "strMethodName", ".", "equals", "(", "\"setupSFields\"", ")", ")", "{", "String", "beginString", "=", "\"\"", ";", "if", "(", "strMethodReturns", ".", "length", "(", ")", "==", "0", ")", "beginString", "=", "\"return \"", ";", "m_StreamOut", ".", "writeit", "(", "\"\\t\"", "+", "beginString", "+", "\"super.\"", "+", "strMethodName", "+", "\"(\"", "+", "strMethodVariables", "+", "\");\\n\"", ")", ";", "}", "else", "this", ".", "writeSetupSCode", "(", "strMethodName", ",", "strMethodReturns", ",", "strMethodInterface", ",", "strClassName", ")", ";", "}", "}" ]
No code supplied, write default code.
[ "No", "code", "supplied", "write", "default", "code", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java#L627-L687
151,940
jbundle/jbundle
app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java
WriteClass.writeClassMethods
public void writeClassMethods(CodeType codeType) { LogicFile recLogicFile = (LogicFile)this.getRecord(LogicFile.LOGIC_FILE_FILE); try { Set<String> methodsIncluded = new HashSet<String>(); Set<String> methodInterfaces = new HashSet<String>(); recLogicFile.close(); while (recLogicFile.hasNext()) { recLogicFile.next(); if (((IncludeScopeField)recLogicFile.getField(LogicFile.INCLUDE_SCOPE)).includeThis(codeType, false)) { this.writeThisMethod(codeType); String strMethodName = recLogicFile.getField(LogicFile.METHOD_NAME).toString(); if (strMethodName.length() > 2) if (strMethodName.charAt(strMethodName.length() - 2) == '*') strMethodName = strMethodName.substring(0, strMethodName.length() - 2); methodsIncluded.add(strMethodName); } if (((IncludeScopeField)recLogicFile.getField(LogicFile.INCLUDE_SCOPE)).includeThis(CodeType.INTERFACE, false)) { String strMethodName = recLogicFile.getField(LogicFile.METHOD_NAME).toString(); if (strMethodName.length() > 2) if (strMethodName.charAt(strMethodName.length() - 2) == '*') strMethodName = strMethodName.substring(0, strMethodName.length() - 2); methodInterfaces.add(strMethodName); } } // Now add a empty implementation for any methods that I don't have recLogicFile.close(); while (recLogicFile.hasNext()) { recLogicFile.next(); String strMethodName = recLogicFile.getField(LogicFile.METHOD_NAME).toString(); if (strMethodName.length() > 2) if (strMethodName.charAt(strMethodName.length() - 2) == '*') strMethodName = strMethodName.substring(0, strMethodName.length() - 2); if ((methodInterfaces.contains(strMethodName)) && (!methodsIncluded.contains(strMethodName))) this.writeThisMethod(codeType); // Write a default impl of this method. } recLogicFile.close(); } catch (DBException ex) { ex.printStackTrace(); } }
java
public void writeClassMethods(CodeType codeType) { LogicFile recLogicFile = (LogicFile)this.getRecord(LogicFile.LOGIC_FILE_FILE); try { Set<String> methodsIncluded = new HashSet<String>(); Set<String> methodInterfaces = new HashSet<String>(); recLogicFile.close(); while (recLogicFile.hasNext()) { recLogicFile.next(); if (((IncludeScopeField)recLogicFile.getField(LogicFile.INCLUDE_SCOPE)).includeThis(codeType, false)) { this.writeThisMethod(codeType); String strMethodName = recLogicFile.getField(LogicFile.METHOD_NAME).toString(); if (strMethodName.length() > 2) if (strMethodName.charAt(strMethodName.length() - 2) == '*') strMethodName = strMethodName.substring(0, strMethodName.length() - 2); methodsIncluded.add(strMethodName); } if (((IncludeScopeField)recLogicFile.getField(LogicFile.INCLUDE_SCOPE)).includeThis(CodeType.INTERFACE, false)) { String strMethodName = recLogicFile.getField(LogicFile.METHOD_NAME).toString(); if (strMethodName.length() > 2) if (strMethodName.charAt(strMethodName.length() - 2) == '*') strMethodName = strMethodName.substring(0, strMethodName.length() - 2); methodInterfaces.add(strMethodName); } } // Now add a empty implementation for any methods that I don't have recLogicFile.close(); while (recLogicFile.hasNext()) { recLogicFile.next(); String strMethodName = recLogicFile.getField(LogicFile.METHOD_NAME).toString(); if (strMethodName.length() > 2) if (strMethodName.charAt(strMethodName.length() - 2) == '*') strMethodName = strMethodName.substring(0, strMethodName.length() - 2); if ((methodInterfaces.contains(strMethodName)) && (!methodsIncluded.contains(strMethodName))) this.writeThisMethod(codeType); // Write a default impl of this method. } recLogicFile.close(); } catch (DBException ex) { ex.printStackTrace(); } }
[ "public", "void", "writeClassMethods", "(", "CodeType", "codeType", ")", "{", "LogicFile", "recLogicFile", "=", "(", "LogicFile", ")", "this", ".", "getRecord", "(", "LogicFile", ".", "LOGIC_FILE_FILE", ")", ";", "try", "{", "Set", "<", "String", ">", "methodsIncluded", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "Set", "<", "String", ">", "methodInterfaces", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "recLogicFile", ".", "close", "(", ")", ";", "while", "(", "recLogicFile", ".", "hasNext", "(", ")", ")", "{", "recLogicFile", ".", "next", "(", ")", ";", "if", "(", "(", "(", "IncludeScopeField", ")", "recLogicFile", ".", "getField", "(", "LogicFile", ".", "INCLUDE_SCOPE", ")", ")", ".", "includeThis", "(", "codeType", ",", "false", ")", ")", "{", "this", ".", "writeThisMethod", "(", "codeType", ")", ";", "String", "strMethodName", "=", "recLogicFile", ".", "getField", "(", "LogicFile", ".", "METHOD_NAME", ")", ".", "toString", "(", ")", ";", "if", "(", "strMethodName", ".", "length", "(", ")", ">", "2", ")", "if", "(", "strMethodName", ".", "charAt", "(", "strMethodName", ".", "length", "(", ")", "-", "2", ")", "==", "'", "'", ")", "strMethodName", "=", "strMethodName", ".", "substring", "(", "0", ",", "strMethodName", ".", "length", "(", ")", "-", "2", ")", ";", "methodsIncluded", ".", "add", "(", "strMethodName", ")", ";", "}", "if", "(", "(", "(", "IncludeScopeField", ")", "recLogicFile", ".", "getField", "(", "LogicFile", ".", "INCLUDE_SCOPE", ")", ")", ".", "includeThis", "(", "CodeType", ".", "INTERFACE", ",", "false", ")", ")", "{", "String", "strMethodName", "=", "recLogicFile", ".", "getField", "(", "LogicFile", ".", "METHOD_NAME", ")", ".", "toString", "(", ")", ";", "if", "(", "strMethodName", ".", "length", "(", ")", ">", "2", ")", "if", "(", "strMethodName", ".", "charAt", "(", "strMethodName", ".", "length", "(", ")", "-", "2", ")", "==", "'", "'", ")", "strMethodName", "=", "strMethodName", ".", "substring", "(", "0", ",", "strMethodName", ".", "length", "(", ")", "-", "2", ")", ";", "methodInterfaces", ".", "add", "(", "strMethodName", ")", ";", "}", "}", "// Now add a empty implementation for any methods that I don't have", "recLogicFile", ".", "close", "(", ")", ";", "while", "(", "recLogicFile", ".", "hasNext", "(", ")", ")", "{", "recLogicFile", ".", "next", "(", ")", ";", "String", "strMethodName", "=", "recLogicFile", ".", "getField", "(", "LogicFile", ".", "METHOD_NAME", ")", ".", "toString", "(", ")", ";", "if", "(", "strMethodName", ".", "length", "(", ")", ">", "2", ")", "if", "(", "strMethodName", ".", "charAt", "(", "strMethodName", ".", "length", "(", ")", "-", "2", ")", "==", "'", "'", ")", "strMethodName", "=", "strMethodName", ".", "substring", "(", "0", ",", "strMethodName", ".", "length", "(", ")", "-", "2", ")", ";", "if", "(", "(", "methodInterfaces", ".", "contains", "(", "strMethodName", ")", ")", "&&", "(", "!", "methodsIncluded", ".", "contains", "(", "strMethodName", ")", ")", ")", "this", ".", "writeThisMethod", "(", "codeType", ")", ";", "// Write a default impl of this method.", "}", "recLogicFile", ".", "close", "(", ")", ";", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Write the methods for this class. @param codeType Interface only
[ "Write", "the", "methods", "for", "this", "class", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java#L979-L1020
151,941
jbundle/jbundle
app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java
WriteClass.writeTextField
public boolean writeTextField(BaseField textField, String strBaseClass, String strMethodName, String strMethodInterface, String strClassName) { if (textField.getString().length() == 0) return false; String beforeMethodCode; //, currentString; beforeMethodCode = textField.getString(); int inher = beforeMethodCode.indexOf("super;"); if (inher != -1) { String strSuper = "super"; if (strClassName != strMethodName) strSuper = "super." + strMethodName; strMethodInterface = this.getMethodVariables(strMethodInterface); beforeMethodCode = beforeMethodCode.substring(0, inher) + strSuper + "(" + strMethodInterface + ");" + beforeMethodCode.substring(inher + 6, beforeMethodCode.length()); } m_StreamOut.writeit(beforeMethodCode); m_StreamOut.writeit("\n"); return (inher != -1); }
java
public boolean writeTextField(BaseField textField, String strBaseClass, String strMethodName, String strMethodInterface, String strClassName) { if (textField.getString().length() == 0) return false; String beforeMethodCode; //, currentString; beforeMethodCode = textField.getString(); int inher = beforeMethodCode.indexOf("super;"); if (inher != -1) { String strSuper = "super"; if (strClassName != strMethodName) strSuper = "super." + strMethodName; strMethodInterface = this.getMethodVariables(strMethodInterface); beforeMethodCode = beforeMethodCode.substring(0, inher) + strSuper + "(" + strMethodInterface + ");" + beforeMethodCode.substring(inher + 6, beforeMethodCode.length()); } m_StreamOut.writeit(beforeMethodCode); m_StreamOut.writeit("\n"); return (inher != -1); }
[ "public", "boolean", "writeTextField", "(", "BaseField", "textField", ",", "String", "strBaseClass", ",", "String", "strMethodName", ",", "String", "strMethodInterface", ",", "String", "strClassName", ")", "{", "if", "(", "textField", ".", "getString", "(", ")", ".", "length", "(", ")", "==", "0", ")", "return", "false", ";", "String", "beforeMethodCode", ";", "//, currentString;", "beforeMethodCode", "=", "textField", ".", "getString", "(", ")", ";", "int", "inher", "=", "beforeMethodCode", ".", "indexOf", "(", "\"super;\"", ")", ";", "if", "(", "inher", "!=", "-", "1", ")", "{", "String", "strSuper", "=", "\"super\"", ";", "if", "(", "strClassName", "!=", "strMethodName", ")", "strSuper", "=", "\"super.\"", "+", "strMethodName", ";", "strMethodInterface", "=", "this", ".", "getMethodVariables", "(", "strMethodInterface", ")", ";", "beforeMethodCode", "=", "beforeMethodCode", ".", "substring", "(", "0", ",", "inher", ")", "+", "strSuper", "+", "\"(\"", "+", "strMethodInterface", "+", "\");\"", "+", "beforeMethodCode", ".", "substring", "(", "inher", "+", "6", ",", "beforeMethodCode", ".", "length", "(", ")", ")", ";", "}", "m_StreamOut", ".", "writeit", "(", "beforeMethodCode", ")", ";", "m_StreamOut", ".", "writeit", "(", "\"\\n\"", ")", ";", "return", "(", "inher", "!=", "-", "1", ")", ";", "}" ]
Write this text field out - line by line. @return true if "super" found in text.
[ "Write", "this", "text", "field", "out", "-", "line", "by", "line", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java#L1025-L1043
151,942
jbundle/jbundle
app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java
WriteClass.fixSQLName
public String fixSQLName(String strName) { int index = 0; while (index != -1) { index = strName.indexOf(' '); if (index != -1) strName = strName.substring(0, index) + strName.substring(index + 1, strName.length()); } return strName; }
java
public String fixSQLName(String strName) { int index = 0; while (index != -1) { index = strName.indexOf(' '); if (index != -1) strName = strName.substring(0, index) + strName.substring(index + 1, strName.length()); } return strName; }
[ "public", "String", "fixSQLName", "(", "String", "strName", ")", "{", "int", "index", "=", "0", ";", "while", "(", "index", "!=", "-", "1", ")", "{", "index", "=", "strName", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "strName", "=", "strName", ".", "substring", "(", "0", ",", "index", ")", "+", "strName", ".", "substring", "(", "index", "+", "1", ",", "strName", ".", "length", "(", ")", ")", ";", "}", "return", "strName", ";", "}" ]
Take out the spaces in the name.
[ "Take", "out", "the", "spaces", "in", "the", "name", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java#L1157-L1167
151,943
jbundle/jbundle
app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java
WriteClass.convertDescToJavaDoc
String convertDescToJavaDoc(String strDesc) { for (int i = 0; i < strDesc.length() - 1; i++) { if (strDesc.charAt(i) == '\n') strDesc = strDesc.substring(0, i + 1) + " * " + strDesc.substring(i + 1); } strDesc = " * " + strDesc; if (!strDesc.endsWith(".")) strDesc += '.'; return strDesc; }
java
String convertDescToJavaDoc(String strDesc) { for (int i = 0; i < strDesc.length() - 1; i++) { if (strDesc.charAt(i) == '\n') strDesc = strDesc.substring(0, i + 1) + " * " + strDesc.substring(i + 1); } strDesc = " * " + strDesc; if (!strDesc.endsWith(".")) strDesc += '.'; return strDesc; }
[ "String", "convertDescToJavaDoc", "(", "String", "strDesc", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "strDesc", ".", "length", "(", ")", "-", "1", ";", "i", "++", ")", "{", "if", "(", "strDesc", ".", "charAt", "(", "i", ")", "==", "'", "'", ")", "strDesc", "=", "strDesc", ".", "substring", "(", "0", ",", "i", "+", "1", ")", "+", "\" * \"", "+", "strDesc", ".", "substring", "(", "i", "+", "1", ")", ";", "}", "strDesc", "=", "\" * \"", "+", "strDesc", ";", "if", "(", "!", "strDesc", ".", "endsWith", "(", "\".\"", ")", ")", "strDesc", "+=", "'", "'", ";", "return", "strDesc", ";", "}" ]
Convert the description to a javadoc compatible description. @param strDesc The original description string. @return The new javadoc description.
[ "Convert", "the", "description", "to", "a", "javadoc", "compatible", "description", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClass.java#L1173-L1184
151,944
jbundle/jbundle
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JRemoteComboBox.java
JRemoteComboBox.getControlValue
public Object getControlValue() { int iIndex = this.getSelectedIndex(); try { FieldTable table = m_record.getTable(); if (m_strIndexValue != null) if (iIndex != 0) if (table.get(iIndex - 1) != null) // I use get, so the index matches the index of JComboBox { FieldInfo field = m_record.getField(m_strIndexValue); if (field == null) field = m_record.getField(0); return field.getData(); } } catch (Exception ex) { ex.printStackTrace(); } if (iIndex == 0) return null; // None selected. return this.getSelectedItem(); }
java
public Object getControlValue() { int iIndex = this.getSelectedIndex(); try { FieldTable table = m_record.getTable(); if (m_strIndexValue != null) if (iIndex != 0) if (table.get(iIndex - 1) != null) // I use get, so the index matches the index of JComboBox { FieldInfo field = m_record.getField(m_strIndexValue); if (field == null) field = m_record.getField(0); return field.getData(); } } catch (Exception ex) { ex.printStackTrace(); } if (iIndex == 0) return null; // None selected. return this.getSelectedItem(); }
[ "public", "Object", "getControlValue", "(", ")", "{", "int", "iIndex", "=", "this", ".", "getSelectedIndex", "(", ")", ";", "try", "{", "FieldTable", "table", "=", "m_record", ".", "getTable", "(", ")", ";", "if", "(", "m_strIndexValue", "!=", "null", ")", "if", "(", "iIndex", "!=", "0", ")", "if", "(", "table", ".", "get", "(", "iIndex", "-", "1", ")", "!=", "null", ")", "// I use get, so the index matches the index of JComboBox", "{", "FieldInfo", "field", "=", "m_record", ".", "getField", "(", "m_strIndexValue", ")", ";", "if", "(", "field", "==", "null", ")", "field", "=", "m_record", ".", "getField", "(", "0", ")", ";", "return", "field", ".", "getData", "(", ")", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "if", "(", "iIndex", "==", "0", ")", "return", "null", ";", "// None selected.", "return", "this", ".", "getSelectedItem", "(", ")", ";", "}" ]
Get this component's value as an object that FieldInfo can use. @return This component's raw data.
[ "Get", "this", "component", "s", "value", "as", "an", "object", "that", "FieldInfo", "can", "use", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JRemoteComboBox.java#L148-L168
151,945
jbundle/jbundle
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JRemoteComboBox.java
JRemoteComboBox.valueToIndex
public int valueToIndex(Object value) { if (value != null) if (!(value instanceof String)) value = value.toString(); if ((m_record != null) && (m_strIndexValue != null)) { try { FieldTable table = m_record.getTable(); for (int iIndex = 0; ; iIndex++) { if (table.get(iIndex) == null) // I use get, so the index matches the index of JComboBox break; FieldInfo field = m_record.getField(m_strIndexValue); if (field == null) field = m_record.getField(0); String strValue = field.getString(); if ((strValue != null) && (strValue.length() > 0)) if (strValue.equals(value)) return iIndex + 1; } } catch (Exception ex) { ex.printStackTrace(); } } else { this.setSelectedItem(value); if (this.getSelectedIndex() != -1) return this.getSelectedIndex(); } return 0; }
java
public int valueToIndex(Object value) { if (value != null) if (!(value instanceof String)) value = value.toString(); if ((m_record != null) && (m_strIndexValue != null)) { try { FieldTable table = m_record.getTable(); for (int iIndex = 0; ; iIndex++) { if (table.get(iIndex) == null) // I use get, so the index matches the index of JComboBox break; FieldInfo field = m_record.getField(m_strIndexValue); if (field == null) field = m_record.getField(0); String strValue = field.getString(); if ((strValue != null) && (strValue.length() > 0)) if (strValue.equals(value)) return iIndex + 1; } } catch (Exception ex) { ex.printStackTrace(); } } else { this.setSelectedItem(value); if (this.getSelectedIndex() != -1) return this.getSelectedIndex(); } return 0; }
[ "public", "int", "valueToIndex", "(", "Object", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "if", "(", "!", "(", "value", "instanceof", "String", ")", ")", "value", "=", "value", ".", "toString", "(", ")", ";", "if", "(", "(", "m_record", "!=", "null", ")", "&&", "(", "m_strIndexValue", "!=", "null", ")", ")", "{", "try", "{", "FieldTable", "table", "=", "m_record", ".", "getTable", "(", ")", ";", "for", "(", "int", "iIndex", "=", "0", ";", ";", "iIndex", "++", ")", "{", "if", "(", "table", ".", "get", "(", "iIndex", ")", "==", "null", ")", "// I use get, so the index matches the index of JComboBox", "break", ";", "FieldInfo", "field", "=", "m_record", ".", "getField", "(", "m_strIndexValue", ")", ";", "if", "(", "field", "==", "null", ")", "field", "=", "m_record", ".", "getField", "(", "0", ")", ";", "String", "strValue", "=", "field", ".", "getString", "(", ")", ";", "if", "(", "(", "strValue", "!=", "null", ")", "&&", "(", "strValue", ".", "length", "(", ")", ">", "0", ")", ")", "if", "(", "strValue", ".", "equals", "(", "value", ")", ")", "return", "iIndex", "+", "1", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}", "else", "{", "this", ".", "setSelectedItem", "(", "value", ")", ";", "if", "(", "this", ".", "getSelectedIndex", "(", ")", "!=", "-", "1", ")", "return", "this", ".", "getSelectedIndex", "(", ")", ";", "}", "return", "0", ";", "}" ]
Convert this value to a selection index. @param value The raw-data to convert. @return The index in this popup of this value (will return 0 [the first value] if it doesn't exist).
[ "Convert", "this", "value", "to", "a", "selection", "index", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JRemoteComboBox.java#L182-L214
151,946
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java
BrokerSession.callRPC
public String callRPC(String name, boolean async, int timeout, RPCParameters params) { ensureConnection(); String version = ""; String context = connectionParams.getAppid(); if (name.contains(":")) { String pcs[] = StrUtil.split(name, ":", 3, true); name = pcs[0]; version = pcs[1]; context = pcs[2].isEmpty() ? context : pcs[2]; } Request request = new Request(Action.RPC); request.addParameter("UID", id); request.addParameter("CTX", context); request.addParameter("VER", version); request.addParameter("RPC", name); request.addParameter("ASY", async); if (params != null) { request.addParameters(params); } Response response = netCall(request, timeout); return response.getData(); }
java
public String callRPC(String name, boolean async, int timeout, RPCParameters params) { ensureConnection(); String version = ""; String context = connectionParams.getAppid(); if (name.contains(":")) { String pcs[] = StrUtil.split(name, ":", 3, true); name = pcs[0]; version = pcs[1]; context = pcs[2].isEmpty() ? context : pcs[2]; } Request request = new Request(Action.RPC); request.addParameter("UID", id); request.addParameter("CTX", context); request.addParameter("VER", version); request.addParameter("RPC", name); request.addParameter("ASY", async); if (params != null) { request.addParameters(params); } Response response = netCall(request, timeout); return response.getData(); }
[ "public", "String", "callRPC", "(", "String", "name", ",", "boolean", "async", ",", "int", "timeout", ",", "RPCParameters", "params", ")", "{", "ensureConnection", "(", ")", ";", "String", "version", "=", "\"\"", ";", "String", "context", "=", "connectionParams", ".", "getAppid", "(", ")", ";", "if", "(", "name", ".", "contains", "(", "\":\"", ")", ")", "{", "String", "pcs", "[", "]", "=", "StrUtil", ".", "split", "(", "name", ",", "\":\"", ",", "3", ",", "true", ")", ";", "name", "=", "pcs", "[", "0", "]", ";", "version", "=", "pcs", "[", "1", "]", ";", "context", "=", "pcs", "[", "2", "]", ".", "isEmpty", "(", ")", "?", "context", ":", "pcs", "[", "2", "]", ";", "}", "Request", "request", "=", "new", "Request", "(", "Action", ".", "RPC", ")", ";", "request", ".", "addParameter", "(", "\"UID\"", ",", "id", ")", ";", "request", ".", "addParameter", "(", "\"CTX\"", ",", "context", ")", ";", "request", ".", "addParameter", "(", "\"VER\"", ",", "version", ")", ";", "request", ".", "addParameter", "(", "\"RPC\"", ",", "name", ")", ";", "request", ".", "addParameter", "(", "\"ASY\"", ",", "async", ")", ";", "if", "(", "params", "!=", "null", ")", "{", "request", ".", "addParameters", "(", "params", ")", ";", "}", "Response", "response", "=", "netCall", "(", "request", ",", "timeout", ")", ";", "return", "response", ".", "getData", "(", ")", ";", "}" ]
Performs a remote procedure call. @param name Name of the remote procedure. This has the format: <p> <pre> &lt;remote procedure name&gt;[:&lt;remote procedure version&gt;][:&lt;calling context&gt;] </pre> <p> where only the remote procedure name is required. If the server supports multiple versions of a remote procedure, an explicit version specifier may be added. If a different calling context is desired, this may be specified to override the default. For example: <p> <pre> GET LAB RESULTS:2.4:LR CONTEXT </pre> @param async If true, the remote procedure call will be executed asynchronously. In this case, the value returned by the method will be the unique handle for the asynchronous request. @param timeout The timeout, in milliseconds, to wait for remote procedure completion. @param params Parameters to be passed to the remote procedure. This may be null. @return The data returned by the remote procedure called if called synchronously, or the unique handle of the request, if call asynchronously.
[ "Performs", "a", "remote", "procedure", "call", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java#L288-L313
151,947
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java
BrokerSession.packageParams
private RPCParameters packageParams(Object... params) { if (params == null) { return null; } if (params.length == 1 && params[0] instanceof RPCParameters) { return (RPCParameters) params[0]; } return new RPCParameters(params); }
java
private RPCParameters packageParams(Object... params) { if (params == null) { return null; } if (params.length == 1 && params[0] instanceof RPCParameters) { return (RPCParameters) params[0]; } return new RPCParameters(params); }
[ "private", "RPCParameters", "packageParams", "(", "Object", "...", "params", ")", "{", "if", "(", "params", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "params", ".", "length", "==", "1", "&&", "params", "[", "0", "]", "instanceof", "RPCParameters", ")", "{", "return", "(", "RPCParameters", ")", "params", "[", "0", "]", ";", "}", "return", "new", "RPCParameters", "(", "params", ")", ";", "}" ]
Package parameters for RPC call. If parameters already packaged, simply return the package. @param params Parameters to be packaged. @return Packaged parameters.
[ "Package", "parameters", "for", "RPC", "call", ".", "If", "parameters", "already", "packaged", "simply", "return", "the", "package", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java#L321-L331
151,948
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java
BrokerSession.authenticate
public AuthResult authenticate(String username, String password, String division) { ensureConnection(); if (isAuthenticated()) { return new AuthResult("0"); } String av = username + ";" + password; List<String> results = callRPCList("RGNETBRP AUTH:" + Constants.VERSION, null, connectionParams.getAppid(), getLocalName(), "", // This is the pre-authentication token ";".equals(av) ? av : Security.encrypt(av, serverCaps.getCipherKey()), getLocalAddress(), division); AuthResult authResult = new AuthResult(results.get(0)); if (authResult.status.succeeded()) { setPostLoginMessage(results.subList(2, results.size())); init(results.get(1)); } return authResult; }
java
public AuthResult authenticate(String username, String password, String division) { ensureConnection(); if (isAuthenticated()) { return new AuthResult("0"); } String av = username + ";" + password; List<String> results = callRPCList("RGNETBRP AUTH:" + Constants.VERSION, null, connectionParams.getAppid(), getLocalName(), "", // This is the pre-authentication token ";".equals(av) ? av : Security.encrypt(av, serverCaps.getCipherKey()), getLocalAddress(), division); AuthResult authResult = new AuthResult(results.get(0)); if (authResult.status.succeeded()) { setPostLoginMessage(results.subList(2, results.size())); init(results.get(1)); } return authResult; }
[ "public", "AuthResult", "authenticate", "(", "String", "username", ",", "String", "password", ",", "String", "division", ")", "{", "ensureConnection", "(", ")", ";", "if", "(", "isAuthenticated", "(", ")", ")", "{", "return", "new", "AuthResult", "(", "\"0\"", ")", ";", "}", "String", "av", "=", "username", "+", "\";\"", "+", "password", ";", "List", "<", "String", ">", "results", "=", "callRPCList", "(", "\"RGNETBRP AUTH:\"", "+", "Constants", ".", "VERSION", ",", "null", ",", "connectionParams", ".", "getAppid", "(", ")", ",", "getLocalName", "(", ")", ",", "\"\"", ",", "// This is the pre-authentication token", "\";\"", ".", "equals", "(", "av", ")", "?", "av", ":", "Security", ".", "encrypt", "(", "av", ",", "serverCaps", ".", "getCipherKey", "(", ")", ")", ",", "getLocalAddress", "(", ")", ",", "division", ")", ";", "AuthResult", "authResult", "=", "new", "AuthResult", "(", "results", ".", "get", "(", "0", ")", ")", ";", "if", "(", "authResult", ".", "status", ".", "succeeded", "(", ")", ")", "{", "setPostLoginMessage", "(", "results", ".", "subList", "(", "2", ",", "results", ".", "size", "(", ")", ")", ")", ";", "init", "(", "results", ".", "get", "(", "1", ")", ")", ";", "}", "return", "authResult", ";", "}" ]
Request authentication from the server. @param username User name. @param password Password. @param division Login division (may be null). @return Result of authentication.
[ "Request", "authentication", "from", "the", "server", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java#L434-L453
151,949
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java
BrokerSession.init
protected void init(String init) { String[] pcs = StrUtil.split(init, StrUtil.U, 4); id = StrUtil.toInt(pcs[0]); serverCaps.domainName = pcs[1]; serverCaps.siteName = pcs[2]; userId = StrUtil.toInt(pcs[3]); }
java
protected void init(String init) { String[] pcs = StrUtil.split(init, StrUtil.U, 4); id = StrUtil.toInt(pcs[0]); serverCaps.domainName = pcs[1]; serverCaps.siteName = pcs[2]; userId = StrUtil.toInt(pcs[3]); }
[ "protected", "void", "init", "(", "String", "init", ")", "{", "String", "[", "]", "pcs", "=", "StrUtil", ".", "split", "(", "init", ",", "StrUtil", ".", "U", ",", "4", ")", ";", "id", "=", "StrUtil", ".", "toInt", "(", "pcs", "[", "0", "]", ")", ";", "serverCaps", ".", "domainName", "=", "pcs", "[", "1", "]", ";", "serverCaps", ".", "siteName", "=", "pcs", "[", "2", "]", ";", "userId", "=", "StrUtil", ".", "toInt", "(", "pcs", "[", "3", "]", ")", ";", "}" ]
Initializes the broker session with information returned by the server. @param init Initialization data.
[ "Initializes", "the", "broker", "session", "with", "information", "returned", "by", "the", "server", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java#L511-L517
151,950
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java
BrokerSession.netCall
protected synchronized Response netCall(Request request, int timeout) { Response response = null; if (serverCaps != null && serverCaps.isDebugMode()) { timeout = 0; } try { socket.setSoTimeout(timeout); DataOutputStream requestPacket = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream())); request.write(requestPacket, nextSequenceId()); requestPacket.flush(); DataInputStream responsePacket = new DataInputStream(new BufferedInputStream(socket.getInputStream())); response = new Response(responsePacket); if (response.getSequenceId() != request.getSequenceId()) { throw new IOException("Response is not for current request."); } } catch (Exception e) { netFlush(); throw MiscUtil.toUnchecked(e); } if (response.getResponseType() == ResponseType.ERROR) { throw new RPCException(response.getData()); } return response; }
java
protected synchronized Response netCall(Request request, int timeout) { Response response = null; if (serverCaps != null && serverCaps.isDebugMode()) { timeout = 0; } try { socket.setSoTimeout(timeout); DataOutputStream requestPacket = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream())); request.write(requestPacket, nextSequenceId()); requestPacket.flush(); DataInputStream responsePacket = new DataInputStream(new BufferedInputStream(socket.getInputStream())); response = new Response(responsePacket); if (response.getSequenceId() != request.getSequenceId()) { throw new IOException("Response is not for current request."); } } catch (Exception e) { netFlush(); throw MiscUtil.toUnchecked(e); } if (response.getResponseType() == ResponseType.ERROR) { throw new RPCException(response.getData()); } return response; }
[ "protected", "synchronized", "Response", "netCall", "(", "Request", "request", ",", "int", "timeout", ")", "{", "Response", "response", "=", "null", ";", "if", "(", "serverCaps", "!=", "null", "&&", "serverCaps", ".", "isDebugMode", "(", ")", ")", "{", "timeout", "=", "0", ";", "}", "try", "{", "socket", ".", "setSoTimeout", "(", "timeout", ")", ";", "DataOutputStream", "requestPacket", "=", "new", "DataOutputStream", "(", "new", "BufferedOutputStream", "(", "socket", ".", "getOutputStream", "(", ")", ")", ")", ";", "request", ".", "write", "(", "requestPacket", ",", "nextSequenceId", "(", ")", ")", ";", "requestPacket", ".", "flush", "(", ")", ";", "DataInputStream", "responsePacket", "=", "new", "DataInputStream", "(", "new", "BufferedInputStream", "(", "socket", ".", "getInputStream", "(", ")", ")", ")", ";", "response", "=", "new", "Response", "(", "responsePacket", ")", ";", "if", "(", "response", ".", "getSequenceId", "(", ")", "!=", "request", ".", "getSequenceId", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"Response is not for current request.\"", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "netFlush", "(", ")", ";", "throw", "MiscUtil", ".", "toUnchecked", "(", "e", ")", ";", "}", "if", "(", "response", ".", "getResponseType", "(", ")", "==", "ResponseType", ".", "ERROR", ")", "{", "throw", "new", "RPCException", "(", "response", ".", "getData", "(", ")", ")", ";", "}", "return", "response", ";", "}" ]
Issues a request to the server, returning the response. @param request Request to be sent. @param timeout The timeout, in milliseconds, to await a response. @return Response returned by the server.
[ "Issues", "a", "request", "to", "the", "server", "returning", "the", "response", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java#L537-L565
151,951
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java
BrokerSession.addHostEventHandler
public void addHostEventHandler(IHostEventHandler hostEventHandler) { synchronized (hostEventHandlers) { if (!hostEventHandlers.contains(hostEventHandler)) { hostEventHandlers.add(hostEventHandler); } } }
java
public void addHostEventHandler(IHostEventHandler hostEventHandler) { synchronized (hostEventHandlers) { if (!hostEventHandlers.contains(hostEventHandler)) { hostEventHandlers.add(hostEventHandler); } } }
[ "public", "void", "addHostEventHandler", "(", "IHostEventHandler", "hostEventHandler", ")", "{", "synchronized", "(", "hostEventHandlers", ")", "{", "if", "(", "!", "hostEventHandlers", ".", "contains", "(", "hostEventHandler", ")", ")", "{", "hostEventHandlers", ".", "add", "(", "hostEventHandler", ")", ";", "}", "}", "}" ]
Adds an event handler for background polling events. @param hostEventHandler An event handler.
[ "Adds", "an", "event", "handler", "for", "background", "polling", "events", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java#L600-L606
151,952
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java
BrokerSession.onRPCError
protected void onRPCError(int asyncHandle, int asyncError, String text) { IAsyncRPCEvent callback = getCallback(asyncHandle); if (callback != null) { callback.onRPCError(asyncHandle, asyncError, text); } }
java
protected void onRPCError(int asyncHandle, int asyncError, String text) { IAsyncRPCEvent callback = getCallback(asyncHandle); if (callback != null) { callback.onRPCError(asyncHandle, asyncError, text); } }
[ "protected", "void", "onRPCError", "(", "int", "asyncHandle", ",", "int", "asyncError", ",", "String", "text", ")", "{", "IAsyncRPCEvent", "callback", "=", "getCallback", "(", "asyncHandle", ")", ";", "if", "(", "callback", "!=", "null", ")", "{", "callback", ".", "onRPCError", "(", "asyncHandle", ",", "asyncError", ",", "text", ")", ";", "}", "}" ]
Invokes the callback for the specified handle when an error is encountered during an asynchronous RPC call. @param asyncHandle The unique handle for the asynchronous RPC call. @param asyncError The error code. @param text The error text.
[ "Invokes", "the", "callback", "for", "the", "specified", "handle", "when", "an", "error", "is", "encountered", "during", "an", "asynchronous", "RPC", "call", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java#L666-L672
151,953
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java
BrokerSession.onRPCComplete
protected void onRPCComplete(int asyncHandle, String data) { IAsyncRPCEvent callback = getCallback(asyncHandle); if (callback != null) { callback.onRPCComplete(asyncHandle, data); } }
java
protected void onRPCComplete(int asyncHandle, String data) { IAsyncRPCEvent callback = getCallback(asyncHandle); if (callback != null) { callback.onRPCComplete(asyncHandle, data); } }
[ "protected", "void", "onRPCComplete", "(", "int", "asyncHandle", ",", "String", "data", ")", "{", "IAsyncRPCEvent", "callback", "=", "getCallback", "(", "asyncHandle", ")", ";", "if", "(", "callback", "!=", "null", ")", "{", "callback", ".", "onRPCComplete", "(", "asyncHandle", ",", "data", ")", ";", "}", "}" ]
Invokes the callback for the specified handle upon successful completion of an asynchronous RPC call. @param asyncHandle The unique handle for the asynchronous RPC call. @param data The data returned by the RPC.
[ "Invokes", "the", "callback", "for", "the", "specified", "handle", "upon", "successful", "completion", "of", "an", "asynchronous", "RPC", "call", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java#L681-L687
151,954
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java
BrokerSession.setSerializationMethod
public void setSerializationMethod(SerializationMethod serializationMethod) { if (serializationMethod == SerializationMethod.NULL) { throw new IllegalArgumentException("Invalid serialization method."); } this.serializationMethod = serializationMethod == null ? SerializationMethod.JSON : serializationMethod; }
java
public void setSerializationMethod(SerializationMethod serializationMethod) { if (serializationMethod == SerializationMethod.NULL) { throw new IllegalArgumentException("Invalid serialization method."); } this.serializationMethod = serializationMethod == null ? SerializationMethod.JSON : serializationMethod; }
[ "public", "void", "setSerializationMethod", "(", "SerializationMethod", "serializationMethod", ")", "{", "if", "(", "serializationMethod", "==", "SerializationMethod", ".", "NULL", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid serialization method.\"", ")", ";", "}", "this", ".", "serializationMethod", "=", "serializationMethod", "==", "null", "?", "SerializationMethod", ".", "JSON", ":", "serializationMethod", ";", "}" ]
Sets the serialization method to be used when sending objects. @param serializationMethod The serialization method.
[ "Sets", "the", "serialization", "method", "to", "be", "used", "when", "sending", "objects", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerSession.java#L749-L755
151,955
AlexLandau/gdl-validation
src/main/java/net/alloyggp/griddle/validator/Validators.java
Validators.getExperimentalValidator
public static Validator getExperimentalValidator() { return CascadingValidator.create( ParenthesesValidator.INSTANCE, ConfigurableValidator.create(ValidatorConfiguration.createExperimental())); }
java
public static Validator getExperimentalValidator() { return CascadingValidator.create( ParenthesesValidator.INSTANCE, ConfigurableValidator.create(ValidatorConfiguration.createExperimental())); }
[ "public", "static", "Validator", "getExperimentalValidator", "(", ")", "{", "return", "CascadingValidator", ".", "create", "(", "ParenthesesValidator", ".", "INSTANCE", ",", "ConfigurableValidator", ".", "create", "(", "ValidatorConfiguration", ".", "createExperimental", "(", ")", ")", ")", ";", "}" ]
This validator includes support for the experimental 'gdl' keyword and associated GDL variants.
[ "This", "validator", "includes", "support", "for", "the", "experimental", "gdl", "keyword", "and", "associated", "GDL", "variants", "." ]
ec87cc9fdd8af32d79aa7d130b7cb062f29834fb
https://github.com/AlexLandau/gdl-validation/blob/ec87cc9fdd8af32d79aa7d130b7cb062f29834fb/src/main/java/net/alloyggp/griddle/validator/Validators.java#L18-L22
151,956
lunarray-org/common-event
src/main/java/org/lunarray/common/event/Bus.java
Bus.handleEvent
public <T> void handleEvent(final T event) throws EventException { final Class<?> type = event.getClass(); if (!this.cachedListeners.containsKey(event.getClass())) { this.cachedListeners.put(type, new LinkedList<ListenerInstancePair<?>>()); for (final ListenerInstancePair<?> listener : this.listeners) { final Type observableType = GenericsUtil.getEntityGenericType(listener.listener.getClass(), 0, Listener.class); final Class<?> observable = GenericsUtil.guessClazz(observableType); if (observable.isAssignableFrom(type)) { this.cachedListeners.get(type).add(listener); } } } @SuppressWarnings("unchecked") final List<ListenerInstancePair<T>> resolvedListeners = List.class.cast(this.cachedListeners.get(event.getClass())); for (final ListenerInstancePair<T> listener : resolvedListeners) { listener.handleEvent(event, null); } }
java
public <T> void handleEvent(final T event) throws EventException { final Class<?> type = event.getClass(); if (!this.cachedListeners.containsKey(event.getClass())) { this.cachedListeners.put(type, new LinkedList<ListenerInstancePair<?>>()); for (final ListenerInstancePair<?> listener : this.listeners) { final Type observableType = GenericsUtil.getEntityGenericType(listener.listener.getClass(), 0, Listener.class); final Class<?> observable = GenericsUtil.guessClazz(observableType); if (observable.isAssignableFrom(type)) { this.cachedListeners.get(type).add(listener); } } } @SuppressWarnings("unchecked") final List<ListenerInstancePair<T>> resolvedListeners = List.class.cast(this.cachedListeners.get(event.getClass())); for (final ListenerInstancePair<T> listener : resolvedListeners) { listener.handleEvent(event, null); } }
[ "public", "<", "T", ">", "void", "handleEvent", "(", "final", "T", "event", ")", "throws", "EventException", "{", "final", "Class", "<", "?", ">", "type", "=", "event", ".", "getClass", "(", ")", ";", "if", "(", "!", "this", ".", "cachedListeners", ".", "containsKey", "(", "event", ".", "getClass", "(", ")", ")", ")", "{", "this", ".", "cachedListeners", ".", "put", "(", "type", ",", "new", "LinkedList", "<", "ListenerInstancePair", "<", "?", ">", ">", "(", ")", ")", ";", "for", "(", "final", "ListenerInstancePair", "<", "?", ">", "listener", ":", "this", ".", "listeners", ")", "{", "final", "Type", "observableType", "=", "GenericsUtil", ".", "getEntityGenericType", "(", "listener", ".", "listener", ".", "getClass", "(", ")", ",", "0", ",", "Listener", ".", "class", ")", ";", "final", "Class", "<", "?", ">", "observable", "=", "GenericsUtil", ".", "guessClazz", "(", "observableType", ")", ";", "if", "(", "observable", ".", "isAssignableFrom", "(", "type", ")", ")", "{", "this", ".", "cachedListeners", ".", "get", "(", "type", ")", ".", "add", "(", "listener", ")", ";", "}", "}", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "final", "List", "<", "ListenerInstancePair", "<", "T", ">", ">", "resolvedListeners", "=", "List", ".", "class", ".", "cast", "(", "this", ".", "cachedListeners", ".", "get", "(", "event", ".", "getClass", "(", ")", ")", ")", ";", "for", "(", "final", "ListenerInstancePair", "<", "T", ">", "listener", ":", "resolvedListeners", ")", "{", "listener", ".", "handleEvent", "(", "event", ",", "null", ")", ";", "}", "}" ]
Handle an event. @param event The event to handle. @param <T> The event type. @throws EventException Thrown if the event could not be processed.
[ "Handle", "an", "event", "." ]
a92102546d136d5f4270cfe8dbd69e4188a46202
https://github.com/lunarray-org/common-event/blob/a92102546d136d5f4270cfe8dbd69e4188a46202/src/main/java/org/lunarray/common/event/Bus.java#L134-L151
151,957
jbundle/jbundle
thin/base/screen/util-misc/src/main/java/org/jbundle/thin/base/screen/util/html/JHelpPane.java
JHelpPane.getPreferredSize
public Dimension getPreferredSize() { if (this.getParent() != null) return new Dimension(this.getParent().getWidth() / 3, super.getPreferredSize().height); return super.getPreferredSize(); }
java
public Dimension getPreferredSize() { if (this.getParent() != null) return new Dimension(this.getParent().getWidth() / 3, super.getPreferredSize().height); return super.getPreferredSize(); }
[ "public", "Dimension", "getPreferredSize", "(", ")", "{", "if", "(", "this", ".", "getParent", "(", ")", "!=", "null", ")", "return", "new", "Dimension", "(", "this", ".", "getParent", "(", ")", ".", "getWidth", "(", ")", "/", "3", ",", "super", ".", "getPreferredSize", "(", ")", ".", "height", ")", ";", "return", "super", ".", "getPreferredSize", "(", ")", ";", "}" ]
Preferred panel size. @return The preferred help panel width.
[ "Preferred", "panel", "size", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util-misc/src/main/java/org/jbundle/thin/base/screen/util/html/JHelpPane.java#L157-L162
151,958
greenbird/greenbird-core
src/main/java/com/greenbird/xml/XPathRoot.java
XPathRoot.removeAbsoluteRootPathElement
private String removeAbsoluteRootPathElement(String xPath) { String trimmedXpath = xPath; if (xPath.startsWith("/") && xPath.charAt(1) != '/') { trimmedXpath = xPath.substring(1); } return trimmedXpath; }
java
private String removeAbsoluteRootPathElement(String xPath) { String trimmedXpath = xPath; if (xPath.startsWith("/") && xPath.charAt(1) != '/') { trimmedXpath = xPath.substring(1); } return trimmedXpath; }
[ "private", "String", "removeAbsoluteRootPathElement", "(", "String", "xPath", ")", "{", "String", "trimmedXpath", "=", "xPath", ";", "if", "(", "xPath", ".", "startsWith", "(", "\"/\"", ")", "&&", "xPath", ".", "charAt", "(", "1", ")", "!=", "'", "'", ")", "{", "trimmedXpath", "=", "xPath", ".", "substring", "(", "1", ")", ";", "}", "return", "trimmedXpath", ";", "}" ]
we stop absolute queries on sub-roots from failing
[ "we", "stop", "absolute", "queries", "on", "sub", "-", "roots", "from", "failing" ]
d0046db0155adbbc14184221ffa140701f2c1ed9
https://github.com/greenbird/greenbird-core/blob/d0046db0155adbbc14184221ffa140701f2c1ed9/src/main/java/com/greenbird/xml/XPathRoot.java#L119-L125
151,959
inkstand-io/scribble
scribble-inject/src/main/java/io/inkstand/scribble/inject/Injection.java
Injection.injectInto
private void injectInto(final Object target, final boolean oneMatch) throws AssertionError { boolean success = false; for (final Field field : this.collectFieldCandidates(target)) { if (this.isMatching(field)) { Object val = getValue(field); try { field.setAccessible(true); this.inject(target, field, val); success = true; } catch (IllegalArgumentException | IllegalAccessException e) { throw new AssertionError("Injection of " + val + " into " + target + " failed", e); } if (oneMatch) { return; } } } assertTrue("No matching field for injection found", success); }
java
private void injectInto(final Object target, final boolean oneMatch) throws AssertionError { boolean success = false; for (final Field field : this.collectFieldCandidates(target)) { if (this.isMatching(field)) { Object val = getValue(field); try { field.setAccessible(true); this.inject(target, field, val); success = true; } catch (IllegalArgumentException | IllegalAccessException e) { throw new AssertionError("Injection of " + val + " into " + target + " failed", e); } if (oneMatch) { return; } } } assertTrue("No matching field for injection found", success); }
[ "private", "void", "injectInto", "(", "final", "Object", "target", ",", "final", "boolean", "oneMatch", ")", "throws", "AssertionError", "{", "boolean", "success", "=", "false", ";", "for", "(", "final", "Field", "field", ":", "this", ".", "collectFieldCandidates", "(", "target", ")", ")", "{", "if", "(", "this", ".", "isMatching", "(", "field", ")", ")", "{", "Object", "val", "=", "getValue", "(", "field", ")", ";", "try", "{", "field", ".", "setAccessible", "(", "true", ")", ";", "this", ".", "inject", "(", "target", ",", "field", ",", "val", ")", ";", "success", "=", "true", ";", "}", "catch", "(", "IllegalArgumentException", "|", "IllegalAccessException", "e", ")", "{", "throw", "new", "AssertionError", "(", "\"Injection of \"", "+", "val", "+", "\" into \"", "+", "target", "+", "\" failed\"", ",", "e", ")", ";", "}", "if", "(", "oneMatch", ")", "{", "return", ";", "}", "}", "}", "assertTrue", "(", "\"No matching field for injection found\"", ",", "success", ")", ";", "}" ]
Injects the value of the Injection into the target. @param target the target for the injection operation @param oneMatch if set to <code>true</code>, the method returns after one injection operation has been performed. If set to <code>false</code> the injection value is injected into all matching fields. @throws AssertionError if the value could not be inject because the field is not accessible.
[ "Injects", "the", "value", "of", "the", "Injection", "into", "the", "target", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-inject/src/main/java/io/inkstand/scribble/inject/Injection.java#L157-L177
151,960
inkstand-io/scribble
scribble-inject/src/main/java/io/inkstand/scribble/inject/Injection.java
Injection.collectFieldCandidates
private List<Field> collectFieldCandidates(final Object target) { final Class<?> targetClass = target.getClass(); return this.collectFieldCandidates(this.value, targetClass); }
java
private List<Field> collectFieldCandidates(final Object target) { final Class<?> targetClass = target.getClass(); return this.collectFieldCandidates(this.value, targetClass); }
[ "private", "List", "<", "Field", ">", "collectFieldCandidates", "(", "final", "Object", "target", ")", "{", "final", "Class", "<", "?", ">", "targetClass", "=", "target", ".", "getClass", "(", ")", ";", "return", "this", ".", "collectFieldCandidates", "(", "this", ".", "value", ",", "targetClass", ")", ";", "}" ]
Determines all fields that are candidates for the injection as their type is compatible with the injected object. The method checks the target objects type and supertypes for declared fields. @param target the target object for which the candidate fields should be determined @return an array of all fields into which the injection object can be injected.
[ "Determines", "all", "fields", "that", "are", "candidates", "for", "the", "injection", "as", "their", "type", "is", "compatible", "with", "the", "injected", "object", ".", "The", "method", "checks", "the", "target", "objects", "type", "and", "supertypes", "for", "declared", "fields", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-inject/src/main/java/io/inkstand/scribble/inject/Injection.java#L187-L191
151,961
inkstand-io/scribble
scribble-inject/src/main/java/io/inkstand/scribble/inject/Injection.java
Injection.collectFieldCandidates
private List<Field> collectFieldCandidates(final Object injectedValue, final Class<?> targetClass) { final List<Field> fieldCandidates = new ArrayList<>(); Class<?> current = targetClass; while (current != Object.class) { fieldCandidates.addAll(this.collectionDeclaredFieldCandidates(injectedValue, current)); current = current.getSuperclass(); } return fieldCandidates; }
java
private List<Field> collectFieldCandidates(final Object injectedValue, final Class<?> targetClass) { final List<Field> fieldCandidates = new ArrayList<>(); Class<?> current = targetClass; while (current != Object.class) { fieldCandidates.addAll(this.collectionDeclaredFieldCandidates(injectedValue, current)); current = current.getSuperclass(); } return fieldCandidates; }
[ "private", "List", "<", "Field", ">", "collectFieldCandidates", "(", "final", "Object", "injectedValue", ",", "final", "Class", "<", "?", ">", "targetClass", ")", "{", "final", "List", "<", "Field", ">", "fieldCandidates", "=", "new", "ArrayList", "<>", "(", ")", ";", "Class", "<", "?", ">", "current", "=", "targetClass", ";", "while", "(", "current", "!=", "Object", ".", "class", ")", "{", "fieldCandidates", ".", "addAll", "(", "this", ".", "collectionDeclaredFieldCandidates", "(", "injectedValue", ",", "current", ")", ")", ";", "current", "=", "current", ".", "getSuperclass", "(", ")", ";", "}", "return", "fieldCandidates", ";", "}" ]
Collects all matching declared fields of the target class and returns the result as a list. @param injectedValue the value that should be injected @param targetClass the class of the target of the injection whose declared fields should be collected @return a list of fields that are type-compatible with the injected class.
[ "Collects", "all", "matching", "declared", "fields", "of", "the", "target", "class", "and", "returns", "the", "result", "as", "a", "list", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-inject/src/main/java/io/inkstand/scribble/inject/Injection.java#L235-L245
151,962
inkstand-io/scribble
scribble-inject/src/main/java/io/inkstand/scribble/inject/Injection.java
Injection.isNullOrMatchingType
private boolean isNullOrMatchingType(final Object injectedValue, final Field field) { if (injectedValue == null) { // null is always type-compatible return true; } final Class<?> fieldType = field.getType(); final Class<?> valueType = injectedValue.getClass(); if (fieldType.isPrimitive()) { return fieldType == primitiveTypeFor(valueType); } return fieldType.isAssignableFrom(valueType); }
java
private boolean isNullOrMatchingType(final Object injectedValue, final Field field) { if (injectedValue == null) { // null is always type-compatible return true; } final Class<?> fieldType = field.getType(); final Class<?> valueType = injectedValue.getClass(); if (fieldType.isPrimitive()) { return fieldType == primitiveTypeFor(valueType); } return fieldType.isAssignableFrom(valueType); }
[ "private", "boolean", "isNullOrMatchingType", "(", "final", "Object", "injectedValue", ",", "final", "Field", "field", ")", "{", "if", "(", "injectedValue", "==", "null", ")", "{", "// null is always type-compatible", "return", "true", ";", "}", "final", "Class", "<", "?", ">", "fieldType", "=", "field", ".", "getType", "(", ")", ";", "final", "Class", "<", "?", ">", "valueType", "=", "injectedValue", ".", "getClass", "(", ")", ";", "if", "(", "fieldType", ".", "isPrimitive", "(", ")", ")", "{", "return", "fieldType", "==", "primitiveTypeFor", "(", "valueType", ")", ";", "}", "return", "fieldType", ".", "isAssignableFrom", "(", "valueType", ")", ";", "}" ]
Checks if the specified value is either null or compatible with the field. Compatibility is verified based on inheritance or primitive-type compatibility. @param injectedValue the value that is checked against the field @param field the field that should be compatible with the value @return <code>true</code> if the value is compatible with the field
[ "Checks", "if", "the", "specified", "value", "is", "either", "null", "or", "compatible", "with", "the", "field", ".", "Compatibility", "is", "verified", "based", "on", "inheritance", "or", "primitive", "-", "type", "compatibility", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-inject/src/main/java/io/inkstand/scribble/inject/Injection.java#L257-L271
151,963
inkstand-io/scribble
scribble-inject/src/main/java/io/inkstand/scribble/inject/Injection.java
Injection.collectionDeclaredFieldCandidates
private List<Field> collectionDeclaredFieldCandidates(final Object injectedValue, final Class<?> targetClass) { final List<Field> fieldCandidates = new ArrayList<>(); for (final Field field : targetClass.getDeclaredFields()) { if (this.isFieldCandidate(field, injectedValue)) { fieldCandidates.add(field); } } return fieldCandidates; }
java
private List<Field> collectionDeclaredFieldCandidates(final Object injectedValue, final Class<?> targetClass) { final List<Field> fieldCandidates = new ArrayList<>(); for (final Field field : targetClass.getDeclaredFields()) { if (this.isFieldCandidate(field, injectedValue)) { fieldCandidates.add(field); } } return fieldCandidates; }
[ "private", "List", "<", "Field", ">", "collectionDeclaredFieldCandidates", "(", "final", "Object", "injectedValue", ",", "final", "Class", "<", "?", ">", "targetClass", ")", "{", "final", "List", "<", "Field", ">", "fieldCandidates", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "final", "Field", "field", ":", "targetClass", ".", "getDeclaredFields", "(", ")", ")", "{", "if", "(", "this", ".", "isFieldCandidate", "(", "field", ",", "injectedValue", ")", ")", "{", "fieldCandidates", ".", "add", "(", "field", ")", ";", "}", "}", "return", "fieldCandidates", ";", "}" ]
Collects all declared fields from the targetClass that are type-compatible with the class of the injected value into the fieldCandidates list. @param injectedValue the value that should be injected @param targetClass the class or any of its superclasses of the injection target @return list of declared {@link Field}s that are type-compatible with the injected class
[ "Collects", "all", "declared", "fields", "from", "the", "targetClass", "that", "are", "type", "-", "compatible", "with", "the", "class", "of", "the", "injected", "value", "into", "the", "fieldCandidates", "list", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-inject/src/main/java/io/inkstand/scribble/inject/Injection.java#L283-L291
151,964
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/util/FieldUtils.java
FieldUtils.getDeclaredFields
public static Set<Field> getDeclaredFields(Class<?> clazz, FieldFilter filter) { Set<Field> fields = new HashSet<Field>(); Field[] allFields = clazz.getDeclaredFields(); for(Field field : allFields) { if(filter.passFilter(field)) { fields.add(field); } } return fields; }
java
public static Set<Field> getDeclaredFields(Class<?> clazz, FieldFilter filter) { Set<Field> fields = new HashSet<Field>(); Field[] allFields = clazz.getDeclaredFields(); for(Field field : allFields) { if(filter.passFilter(field)) { fields.add(field); } } return fields; }
[ "public", "static", "Set", "<", "Field", ">", "getDeclaredFields", "(", "Class", "<", "?", ">", "clazz", ",", "FieldFilter", "filter", ")", "{", "Set", "<", "Field", ">", "fields", "=", "new", "HashSet", "<", "Field", ">", "(", ")", ";", "Field", "[", "]", "allFields", "=", "clazz", ".", "getDeclaredFields", "(", ")", ";", "for", "(", "Field", "field", ":", "allFields", ")", "{", "if", "(", "filter", ".", "passFilter", "(", "field", ")", ")", "{", "fields", ".", "add", "(", "field", ")", ";", "}", "}", "return", "fields", ";", "}" ]
Returns a set of all fields matching the supplied filter declared in the clazz class. @param clazz The class to inspect. @param filter Filter to use. @return All matching fields declared by the clazz class.
[ "Returns", "a", "set", "of", "all", "fields", "matching", "the", "supplied", "filter", "declared", "in", "the", "clazz", "class", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/FieldUtils.java#L24-L33
151,965
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/shared/FakeTable.java
FakeTable.moveRecordToBase
public Record moveRecordToBase(Record record) { SharedBaseRecordTable sharedTable = this.getSharedTable(); sharedTable.setCurrentRecord(record); boolean bCopyEditMode = false; boolean bOnlyModifiedFields = false; Record recBase = sharedTable.getBaseRecord(); sharedTable.copyRecordInfo(recBase, record, bCopyEditMode, bOnlyModifiedFields); return recBase; }
java
public Record moveRecordToBase(Record record) { SharedBaseRecordTable sharedTable = this.getSharedTable(); sharedTable.setCurrentRecord(record); boolean bCopyEditMode = false; boolean bOnlyModifiedFields = false; Record recBase = sharedTable.getBaseRecord(); sharedTable.copyRecordInfo(recBase, record, bCopyEditMode, bOnlyModifiedFields); return recBase; }
[ "public", "Record", "moveRecordToBase", "(", "Record", "record", ")", "{", "SharedBaseRecordTable", "sharedTable", "=", "this", ".", "getSharedTable", "(", ")", ";", "sharedTable", ".", "setCurrentRecord", "(", "record", ")", ";", "boolean", "bCopyEditMode", "=", "false", ";", "boolean", "bOnlyModifiedFields", "=", "false", ";", "Record", "recBase", "=", "sharedTable", ".", "getBaseRecord", "(", ")", ";", "sharedTable", ".", "copyRecordInfo", "(", "recBase", ",", "record", ",", "bCopyEditMode", ",", "bOnlyModifiedFields", ")", ";", "return", "recBase", ";", "}" ]
Copy this record to the base table.
[ "Copy", "this", "record", "to", "the", "base", "table", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/shared/FakeTable.java#L44-L53
151,966
nwillc/almost-functional
src/main/java/almost/functional/utils/Compose.java
Compose.compose
public static <T, R, V> Function<T, V> compose(final Function<T, R> first, final Function<? super R, ? extends V> second) { return new Function<T, V>() { @Override public V apply(T argument) { return second.apply(first.apply(argument)); } }; }
java
public static <T, R, V> Function<T, V> compose(final Function<T, R> first, final Function<? super R, ? extends V> second) { return new Function<T, V>() { @Override public V apply(T argument) { return second.apply(first.apply(argument)); } }; }
[ "public", "static", "<", "T", ",", "R", ",", "V", ">", "Function", "<", "T", ",", "V", ">", "compose", "(", "final", "Function", "<", "T", ",", "R", ">", "first", ",", "final", "Function", "<", "?", "super", "R", ",", "?", "extends", "V", ">", "second", ")", "{", "return", "new", "Function", "<", "T", ",", "V", ">", "(", ")", "{", "@", "Override", "public", "V", "apply", "(", "T", "argument", ")", "{", "return", "second", ".", "apply", "(", "first", ".", "apply", "(", "argument", ")", ")", ";", "}", "}", ";", "}" ]
Create a function that uses the result of the first function as the input to the second. @param first a function @param second a function @param <T> input to the first function @param <R> result of the first function, input to second @param <V> result of the second function @return a function composed o first and second
[ "Create", "a", "function", "that", "uses", "the", "result", "of", "the", "first", "function", "as", "the", "input", "to", "the", "second", "." ]
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Compose.java#L26-L33
151,967
nwillc/almost-functional
src/main/java/almost/functional/utils/Compose.java
Compose.andThen
public static <F, S, R, V> BiFunction<F, S, V> andThen(final BiFunction<F, S, R> first, final Function<? super R, ? extends V> second) { return new BiFunction<F, S, V>() { @Override public V apply(F f, S s) { return second.apply(first.apply(f, s)); } }; }
java
public static <F, S, R, V> BiFunction<F, S, V> andThen(final BiFunction<F, S, R> first, final Function<? super R, ? extends V> second) { return new BiFunction<F, S, V>() { @Override public V apply(F f, S s) { return second.apply(first.apply(f, s)); } }; }
[ "public", "static", "<", "F", ",", "S", ",", "R", ",", "V", ">", "BiFunction", "<", "F", ",", "S", ",", "V", ">", "andThen", "(", "final", "BiFunction", "<", "F", ",", "S", ",", "R", ">", "first", ",", "final", "Function", "<", "?", "super", "R", ",", "?", "extends", "V", ">", "second", ")", "{", "return", "new", "BiFunction", "<", "F", ",", "S", ",", "V", ">", "(", ")", "{", "@", "Override", "public", "V", "apply", "(", "F", "f", ",", "S", "s", ")", "{", "return", "second", ".", "apply", "(", "first", ".", "apply", "(", "f", ",", "s", ")", ")", ";", "}", "}", ";", "}" ]
Compose a BiFunction which applies a Function to the result of another BiFunction. @param first a Bifunction @param second a Function @param <F> first argument of BiFunction @param <S> second argument to Bifunction @param <R> result type of first BiFunction @param <V> result type of resultant BiFunction @return A new BiFunction
[ "Compose", "a", "BiFunction", "which", "applies", "a", "Function", "to", "the", "result", "of", "another", "BiFunction", "." ]
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Compose.java#L46-L53
151,968
nwillc/almost-functional
src/main/java/almost/functional/utils/Compose.java
Compose.andThen
public static <T> Consumer<T> andThen(final Consumer<T> first, final Consumer<T> second) { return new Consumer<T>() { @Override public void accept(T consumable) { first.accept(consumable); second.accept(consumable); } }; }
java
public static <T> Consumer<T> andThen(final Consumer<T> first, final Consumer<T> second) { return new Consumer<T>() { @Override public void accept(T consumable) { first.accept(consumable); second.accept(consumable); } }; }
[ "public", "static", "<", "T", ">", "Consumer", "<", "T", ">", "andThen", "(", "final", "Consumer", "<", "T", ">", "first", ",", "final", "Consumer", "<", "T", ">", "second", ")", "{", "return", "new", "Consumer", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "void", "accept", "(", "T", "consumable", ")", "{", "first", ".", "accept", "(", "consumable", ")", ";", "second", ".", "accept", "(", "consumable", ")", ";", "}", "}", ";", "}" ]
Compose a new consumer from two existing ones. The consumable will be passed to the first then the second. @param first a consumer @param second a consumer @param <T> the type the consumers consume @return a new consumer
[ "Compose", "a", "new", "consumer", "from", "two", "existing", "ones", ".", "The", "consumable", "will", "be", "passed", "to", "the", "first", "then", "the", "second", "." ]
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Compose.java#L63-L71
151,969
tvesalainen/util
util/src/main/java/org/vesalainen/util/logging/JavaLogging.java
JavaLogging.xmlConfig
public static final void xmlConfig(File configFile) throws IOException { try { JAXBContext jaxbCtx = JAXBContext.newInstance("org.vesalainen.util.jaxb"); Unmarshaller unmarshaller = jaxbCtx.createUnmarshaller(); JavaLoggingConfig javaLoggingConfig = (JavaLoggingConfig) unmarshaller.unmarshal(configFile); Map<String,String> expressionMap = new HashMap<>(); Properties properties = javaLoggingConfig.getProperties(); if (properties != null) { for (Element element : properties.getAny()) { String property = element.getTagName(); String expression = element.getTextContent(); expressionMap.put(property, expression); } } ExpressionParser ep = new ExpressionParser(expressionMap); for (LoggerType loggerType : javaLoggingConfig.getLogger()) { String name = ep.replace(loggerType.getName()); JavaLogging javaLogging = getLogger(name); Logger logger = javaLogging.getLogger(); String lev = ep.replace(loggerType.getLevel()); Level level = lev != null ? BaseLogging.parseLevel(lev) : null; if (level != null) { logger.setLevel(level); } logger.setUseParentHandlers(parseBoolean(ep.replace(loggerType.getUseParentHandlers()))); String resourceBundleString = ep.replace(loggerType.getResourceBundle()); if (resourceBundleString != null) { Locale locale; String languageTag = ep.replace(loggerType.getLocale()); if (languageTag != null) { locale = Locale.forLanguageTag(languageTag); } else { locale = Locale.getDefault(); } ResourceBundle resourceBundle = ResourceBundle.getBundle(resourceBundleString, locale); logger.setResourceBundle(resourceBundle); } logger.setFilter(getInstance(ep.replace(loggerType.getFilter()))); for (ConsoleHandlerType consoleHandlerType : loggerType.getConsoleHandler()) { logger.addHandler(createConsoleHandler(ep, consoleHandlerType, level)); } for (FileHandlerType fileHandlerType : loggerType.getFileHandler()) { logger.addHandler(createFileHandler(ep, fileHandlerType, level)); } for (MemoryHandlerType memoryHandlerType : loggerType.getMemoryHandler()) { logger.addHandler(createMemoryHandler(ep, memoryHandlerType, level)); } for (SocketHandlerType socketHandlerType : loggerType.getSocketHandler()) { logger.addHandler(createSocketHandler(ep, socketHandlerType, level)); } } } catch (JAXBException ex) { throw new RuntimeException(ex); } }
java
public static final void xmlConfig(File configFile) throws IOException { try { JAXBContext jaxbCtx = JAXBContext.newInstance("org.vesalainen.util.jaxb"); Unmarshaller unmarshaller = jaxbCtx.createUnmarshaller(); JavaLoggingConfig javaLoggingConfig = (JavaLoggingConfig) unmarshaller.unmarshal(configFile); Map<String,String> expressionMap = new HashMap<>(); Properties properties = javaLoggingConfig.getProperties(); if (properties != null) { for (Element element : properties.getAny()) { String property = element.getTagName(); String expression = element.getTextContent(); expressionMap.put(property, expression); } } ExpressionParser ep = new ExpressionParser(expressionMap); for (LoggerType loggerType : javaLoggingConfig.getLogger()) { String name = ep.replace(loggerType.getName()); JavaLogging javaLogging = getLogger(name); Logger logger = javaLogging.getLogger(); String lev = ep.replace(loggerType.getLevel()); Level level = lev != null ? BaseLogging.parseLevel(lev) : null; if (level != null) { logger.setLevel(level); } logger.setUseParentHandlers(parseBoolean(ep.replace(loggerType.getUseParentHandlers()))); String resourceBundleString = ep.replace(loggerType.getResourceBundle()); if (resourceBundleString != null) { Locale locale; String languageTag = ep.replace(loggerType.getLocale()); if (languageTag != null) { locale = Locale.forLanguageTag(languageTag); } else { locale = Locale.getDefault(); } ResourceBundle resourceBundle = ResourceBundle.getBundle(resourceBundleString, locale); logger.setResourceBundle(resourceBundle); } logger.setFilter(getInstance(ep.replace(loggerType.getFilter()))); for (ConsoleHandlerType consoleHandlerType : loggerType.getConsoleHandler()) { logger.addHandler(createConsoleHandler(ep, consoleHandlerType, level)); } for (FileHandlerType fileHandlerType : loggerType.getFileHandler()) { logger.addHandler(createFileHandler(ep, fileHandlerType, level)); } for (MemoryHandlerType memoryHandlerType : loggerType.getMemoryHandler()) { logger.addHandler(createMemoryHandler(ep, memoryHandlerType, level)); } for (SocketHandlerType socketHandlerType : loggerType.getSocketHandler()) { logger.addHandler(createSocketHandler(ep, socketHandlerType, level)); } } } catch (JAXBException ex) { throw new RuntimeException(ex); } }
[ "public", "static", "final", "void", "xmlConfig", "(", "File", "configFile", ")", "throws", "IOException", "{", "try", "{", "JAXBContext", "jaxbCtx", "=", "JAXBContext", ".", "newInstance", "(", "\"org.vesalainen.util.jaxb\"", ")", ";", "Unmarshaller", "unmarshaller", "=", "jaxbCtx", ".", "createUnmarshaller", "(", ")", ";", "JavaLoggingConfig", "javaLoggingConfig", "=", "(", "JavaLoggingConfig", ")", "unmarshaller", ".", "unmarshal", "(", "configFile", ")", ";", "Map", "<", "String", ",", "String", ">", "expressionMap", "=", "new", "HashMap", "<>", "(", ")", ";", "Properties", "properties", "=", "javaLoggingConfig", ".", "getProperties", "(", ")", ";", "if", "(", "properties", "!=", "null", ")", "{", "for", "(", "Element", "element", ":", "properties", ".", "getAny", "(", ")", ")", "{", "String", "property", "=", "element", ".", "getTagName", "(", ")", ";", "String", "expression", "=", "element", ".", "getTextContent", "(", ")", ";", "expressionMap", ".", "put", "(", "property", ",", "expression", ")", ";", "}", "}", "ExpressionParser", "ep", "=", "new", "ExpressionParser", "(", "expressionMap", ")", ";", "for", "(", "LoggerType", "loggerType", ":", "javaLoggingConfig", ".", "getLogger", "(", ")", ")", "{", "String", "name", "=", "ep", ".", "replace", "(", "loggerType", ".", "getName", "(", ")", ")", ";", "JavaLogging", "javaLogging", "=", "getLogger", "(", "name", ")", ";", "Logger", "logger", "=", "javaLogging", ".", "getLogger", "(", ")", ";", "String", "lev", "=", "ep", ".", "replace", "(", "loggerType", ".", "getLevel", "(", ")", ")", ";", "Level", "level", "=", "lev", "!=", "null", "?", "BaseLogging", ".", "parseLevel", "(", "lev", ")", ":", "null", ";", "if", "(", "level", "!=", "null", ")", "{", "logger", ".", "setLevel", "(", "level", ")", ";", "}", "logger", ".", "setUseParentHandlers", "(", "parseBoolean", "(", "ep", ".", "replace", "(", "loggerType", ".", "getUseParentHandlers", "(", ")", ")", ")", ")", ";", "String", "resourceBundleString", "=", "ep", ".", "replace", "(", "loggerType", ".", "getResourceBundle", "(", ")", ")", ";", "if", "(", "resourceBundleString", "!=", "null", ")", "{", "Locale", "locale", ";", "String", "languageTag", "=", "ep", ".", "replace", "(", "loggerType", ".", "getLocale", "(", ")", ")", ";", "if", "(", "languageTag", "!=", "null", ")", "{", "locale", "=", "Locale", ".", "forLanguageTag", "(", "languageTag", ")", ";", "}", "else", "{", "locale", "=", "Locale", ".", "getDefault", "(", ")", ";", "}", "ResourceBundle", "resourceBundle", "=", "ResourceBundle", ".", "getBundle", "(", "resourceBundleString", ",", "locale", ")", ";", "logger", ".", "setResourceBundle", "(", "resourceBundle", ")", ";", "}", "logger", ".", "setFilter", "(", "getInstance", "(", "ep", ".", "replace", "(", "loggerType", ".", "getFilter", "(", ")", ")", ")", ")", ";", "for", "(", "ConsoleHandlerType", "consoleHandlerType", ":", "loggerType", ".", "getConsoleHandler", "(", ")", ")", "{", "logger", ".", "addHandler", "(", "createConsoleHandler", "(", "ep", ",", "consoleHandlerType", ",", "level", ")", ")", ";", "}", "for", "(", "FileHandlerType", "fileHandlerType", ":", "loggerType", ".", "getFileHandler", "(", ")", ")", "{", "logger", ".", "addHandler", "(", "createFileHandler", "(", "ep", ",", "fileHandlerType", ",", "level", ")", ")", ";", "}", "for", "(", "MemoryHandlerType", "memoryHandlerType", ":", "loggerType", ".", "getMemoryHandler", "(", ")", ")", "{", "logger", ".", "addHandler", "(", "createMemoryHandler", "(", "ep", ",", "memoryHandlerType", ",", "level", ")", ")", ";", "}", "for", "(", "SocketHandlerType", "socketHandlerType", ":", "loggerType", ".", "getSocketHandler", "(", ")", ")", "{", "logger", ".", "addHandler", "(", "createSocketHandler", "(", "ep", ",", "socketHandlerType", ",", "level", ")", ")", ";", "}", "}", "}", "catch", "(", "JAXBException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "ex", ")", ";", "}", "}" ]
Configures logging from xml file. @param configFile @throws IOException
[ "Configures", "logging", "from", "xml", "file", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/logging/JavaLogging.java#L222-L292
151,970
tvesalainen/util
vfs/src/main/java/org/vesalainen/vfs/attributes/FileAttributeName.java
FileAttributeName.impliedSet
public static final Set<String> impliedSet(String... views) { Set<String> set = new HashSet<>(); for (String view : views) { set.addAll(impliesMap.get(view)); } return set; }
java
public static final Set<String> impliedSet(String... views) { Set<String> set = new HashSet<>(); for (String view : views) { set.addAll(impliesMap.get(view)); } return set; }
[ "public", "static", "final", "Set", "<", "String", ">", "impliedSet", "(", "String", "...", "views", ")", "{", "Set", "<", "String", ">", "set", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "String", "view", ":", "views", ")", "{", "set", ".", "addAll", "(", "impliesMap", ".", "get", "(", "view", ")", ")", ";", "}", "return", "set", ";", "}" ]
Returns a set that contains given views as well as all implied views. @param views @return
[ "Returns", "a", "set", "that", "contains", "given", "views", "as", "well", "as", "all", "implied", "views", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/attributes/FileAttributeName.java#L204-L212
151,971
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/GridTable.java
GridTable.removeAll
public void removeAll() { if (m_gridList != null) m_gridList.removeAll(); if (m_gridBuffer != null) m_gridBuffer.removeAll(); if (m_gridNew != null) m_gridNew.removeAll(); m_iEndOfFileIndex = UNKNOWN_POSITION; m_iPhysicalFilePosition = UNKNOWN_POSITION; m_iLogicalFilePosition = UNKNOWN_POSITION; }
java
public void removeAll() { if (m_gridList != null) m_gridList.removeAll(); if (m_gridBuffer != null) m_gridBuffer.removeAll(); if (m_gridNew != null) m_gridNew.removeAll(); m_iEndOfFileIndex = UNKNOWN_POSITION; m_iPhysicalFilePosition = UNKNOWN_POSITION; m_iLogicalFilePosition = UNKNOWN_POSITION; }
[ "public", "void", "removeAll", "(", ")", "{", "if", "(", "m_gridList", "!=", "null", ")", "m_gridList", ".", "removeAll", "(", ")", ";", "if", "(", "m_gridBuffer", "!=", "null", ")", "m_gridBuffer", ".", "removeAll", "(", ")", ";", "if", "(", "m_gridNew", "!=", "null", ")", "m_gridNew", ".", "removeAll", "(", ")", ";", "m_iEndOfFileIndex", "=", "UNKNOWN_POSITION", ";", "m_iPhysicalFilePosition", "=", "UNKNOWN_POSITION", ";", "m_iLogicalFilePosition", "=", "UNKNOWN_POSITION", ";", "}" ]
Free the buffers in this grid table.
[ "Free", "the", "buffers", "in", "this", "grid", "table", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/GridTable.java#L186-L197
151,972
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/GridTable.java
GridTable.addRecordReference
public void addRecordReference(int iTargetPosition) { DataRecord bookmark = this.getNextTable().getDataRecord(m_bCacheRecordData, BaseBuffer.SELECTED_FIELDS); m_gridBuffer.addElement(iTargetPosition, bookmark, m_gridList); }
java
public void addRecordReference(int iTargetPosition) { DataRecord bookmark = this.getNextTable().getDataRecord(m_bCacheRecordData, BaseBuffer.SELECTED_FIELDS); m_gridBuffer.addElement(iTargetPosition, bookmark, m_gridList); }
[ "public", "void", "addRecordReference", "(", "int", "iTargetPosition", ")", "{", "DataRecord", "bookmark", "=", "this", ".", "getNextTable", "(", ")", ".", "getDataRecord", "(", "m_bCacheRecordData", ",", "BaseBuffer", ".", "SELECTED_FIELDS", ")", ";", "m_gridBuffer", ".", "addElement", "(", "iTargetPosition", ",", "bookmark", ",", "m_gridList", ")", ";", "}" ]
Add this record's unique info to the end of the recordset. The current record is at this logical position, cache it. @param iTargetPosition The position to add this record at.
[ "Add", "this", "record", "s", "unique", "info", "to", "the", "end", "of", "the", "recordset", ".", "The", "current", "record", "is", "at", "this", "logical", "position", "cache", "it", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/GridTable.java#L211-L215
151,973
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/GridTable.java
GridTable.lowestNonNullIndex
private int lowestNonNullIndex(int iTargetPosition) { Object bookmark = null; int iBookmarkIndex = iTargetPosition; while (bookmark == null) { int iArrayIndex = m_gridList.listToArrayIndex(iBookmarkIndex); iBookmarkIndex = m_gridList.arrayToListIndex(iArrayIndex); // Lowest valid bookmark bookmark = m_gridList.elementAt(iBookmarkIndex); if (bookmark == null) { if (iBookmarkIndex == 0) return -1; // None found iBookmarkIndex--; if (m_gridBuffer != null) bookmark = m_gridBuffer.elementAt(iBookmarkIndex); // Check to see if it's in this list } } return iBookmarkIndex; // Valid bookmark, return it. }
java
private int lowestNonNullIndex(int iTargetPosition) { Object bookmark = null; int iBookmarkIndex = iTargetPosition; while (bookmark == null) { int iArrayIndex = m_gridList.listToArrayIndex(iBookmarkIndex); iBookmarkIndex = m_gridList.arrayToListIndex(iArrayIndex); // Lowest valid bookmark bookmark = m_gridList.elementAt(iBookmarkIndex); if (bookmark == null) { if (iBookmarkIndex == 0) return -1; // None found iBookmarkIndex--; if (m_gridBuffer != null) bookmark = m_gridBuffer.elementAt(iBookmarkIndex); // Check to see if it's in this list } } return iBookmarkIndex; // Valid bookmark, return it. }
[ "private", "int", "lowestNonNullIndex", "(", "int", "iTargetPosition", ")", "{", "Object", "bookmark", "=", "null", ";", "int", "iBookmarkIndex", "=", "iTargetPosition", ";", "while", "(", "bookmark", "==", "null", ")", "{", "int", "iArrayIndex", "=", "m_gridList", ".", "listToArrayIndex", "(", "iBookmarkIndex", ")", ";", "iBookmarkIndex", "=", "m_gridList", ".", "arrayToListIndex", "(", "iArrayIndex", ")", ";", "// Lowest valid bookmark", "bookmark", "=", "m_gridList", ".", "elementAt", "(", "iBookmarkIndex", ")", ";", "if", "(", "bookmark", "==", "null", ")", "{", "if", "(", "iBookmarkIndex", "==", "0", ")", "return", "-", "1", ";", "// None found", "iBookmarkIndex", "--", ";", "if", "(", "m_gridBuffer", "!=", "null", ")", "bookmark", "=", "m_gridBuffer", ".", "elementAt", "(", "iBookmarkIndex", ")", ";", "// Check to see if it's in this list", "}", "}", "return", "iBookmarkIndex", ";", "// Valid bookmark, return it.", "}" ]
Search backwards from this position for the first non-null value. @param iTargetPosition The position to retrieve this bookmark from. @return index of non-null value or -1 if all lower values are null.
[ "Search", "backwards", "from", "this", "position", "for", "the", "first", "non", "-", "null", "value", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/GridTable.java#L432-L451
151,974
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/GridTable.java
GridTable.findElement
public int findElement(Object bookmark, int iHandleType) { if (bookmark == null) return -1; int iTargetPosition = m_gridBuffer.findElement(bookmark, iHandleType); if (iTargetPosition == -1) iTargetPosition = m_gridList.findElement(bookmark, iHandleType); return iTargetPosition; // Not found }
java
public int findElement(Object bookmark, int iHandleType) { if (bookmark == null) return -1; int iTargetPosition = m_gridBuffer.findElement(bookmark, iHandleType); if (iTargetPosition == -1) iTargetPosition = m_gridList.findElement(bookmark, iHandleType); return iTargetPosition; // Not found }
[ "public", "int", "findElement", "(", "Object", "bookmark", ",", "int", "iHandleType", ")", "{", "if", "(", "bookmark", "==", "null", ")", "return", "-", "1", ";", "int", "iTargetPosition", "=", "m_gridBuffer", ".", "findElement", "(", "bookmark", ",", "iHandleType", ")", ";", "if", "(", "iTargetPosition", "==", "-", "1", ")", "iTargetPosition", "=", "m_gridList", ".", "findElement", "(", "bookmark", ",", "iHandleType", ")", ";", "return", "iTargetPosition", ";", "// Not found", "}" ]
Find this bookmark in one of the lists. @return int index in table; or -1 if not found. @param bookmark java.lang.Object The bookmark to look for. @param iHandleType The type of bookmark to look for.
[ "Find", "this", "bookmark", "in", "one", "of", "the", "lists", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/GridTable.java#L458-L466
151,975
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/GridTable.java
GridTable.seek
public boolean seek(String strSeekSign) throws DBException { // NOTE: This extra logic deals with a very specific and obscure case: // If this GRID table is NOT currently being used for indexed access (ie., get(x)) // You can do a seek and I will cache the record. On a subsequent seek, I will return the cached // record. This is typically used for thin client accessing cached virtual fields in a table session. boolean bAutonomousSeek = false; if (m_iEndOfFileIndex == UNKNOWN_POSITION) if ((m_iPhysicalFilePosition == UNKNOWN_POSITION) || (m_iPhysicalFilePosition == ADD_NEW_POSITION)) if ((m_iLogicalFilePosition == UNKNOWN_POSITION) || (m_iLogicalFilePosition == ADD_NEW_POSITION)) bAutonomousSeek = true; if (bAutonomousSeek) { Object bookmark = this.getRecord().getHandle(DBConstants.BOOKMARK_HANDLE); int iPosition = this.findElement(bookmark, DBConstants.BOOKMARK_HANDLE); if (iPosition == 0) { DataRecord dataRecord = (DataRecord)this.elementAt(iPosition); return this.getNextTable().setDataRecord(dataRecord); // Success always. } } // Don't set m_iPhysicalFilePosition = UNKNOWN_POSITION, because tables use seek to do queries. boolean bSuccess = super.seek(strSeekSign); if (bAutonomousSeek) { if (bSuccess) this.addRecordReference(0); } return bSuccess; }
java
public boolean seek(String strSeekSign) throws DBException { // NOTE: This extra logic deals with a very specific and obscure case: // If this GRID table is NOT currently being used for indexed access (ie., get(x)) // You can do a seek and I will cache the record. On a subsequent seek, I will return the cached // record. This is typically used for thin client accessing cached virtual fields in a table session. boolean bAutonomousSeek = false; if (m_iEndOfFileIndex == UNKNOWN_POSITION) if ((m_iPhysicalFilePosition == UNKNOWN_POSITION) || (m_iPhysicalFilePosition == ADD_NEW_POSITION)) if ((m_iLogicalFilePosition == UNKNOWN_POSITION) || (m_iLogicalFilePosition == ADD_NEW_POSITION)) bAutonomousSeek = true; if (bAutonomousSeek) { Object bookmark = this.getRecord().getHandle(DBConstants.BOOKMARK_HANDLE); int iPosition = this.findElement(bookmark, DBConstants.BOOKMARK_HANDLE); if (iPosition == 0) { DataRecord dataRecord = (DataRecord)this.elementAt(iPosition); return this.getNextTable().setDataRecord(dataRecord); // Success always. } } // Don't set m_iPhysicalFilePosition = UNKNOWN_POSITION, because tables use seek to do queries. boolean bSuccess = super.seek(strSeekSign); if (bAutonomousSeek) { if (bSuccess) this.addRecordReference(0); } return bSuccess; }
[ "public", "boolean", "seek", "(", "String", "strSeekSign", ")", "throws", "DBException", "{", "// NOTE: This extra logic deals with a very specific and obscure case:", "// If this GRID table is NOT currently being used for indexed access (ie., get(x))", "// You can do a seek and I will cache the record. On a subsequent seek, I will return the cached", "// record. This is typically used for thin client accessing cached virtual fields in a table session.", "boolean", "bAutonomousSeek", "=", "false", ";", "if", "(", "m_iEndOfFileIndex", "==", "UNKNOWN_POSITION", ")", "if", "(", "(", "m_iPhysicalFilePosition", "==", "UNKNOWN_POSITION", ")", "||", "(", "m_iPhysicalFilePosition", "==", "ADD_NEW_POSITION", ")", ")", "if", "(", "(", "m_iLogicalFilePosition", "==", "UNKNOWN_POSITION", ")", "||", "(", "m_iLogicalFilePosition", "==", "ADD_NEW_POSITION", ")", ")", "bAutonomousSeek", "=", "true", ";", "if", "(", "bAutonomousSeek", ")", "{", "Object", "bookmark", "=", "this", ".", "getRecord", "(", ")", ".", "getHandle", "(", "DBConstants", ".", "BOOKMARK_HANDLE", ")", ";", "int", "iPosition", "=", "this", ".", "findElement", "(", "bookmark", ",", "DBConstants", ".", "BOOKMARK_HANDLE", ")", ";", "if", "(", "iPosition", "==", "0", ")", "{", "DataRecord", "dataRecord", "=", "(", "DataRecord", ")", "this", ".", "elementAt", "(", "iPosition", ")", ";", "return", "this", ".", "getNextTable", "(", ")", ".", "setDataRecord", "(", "dataRecord", ")", ";", "// Success always.", "}", "}", "// Don't set m_iPhysicalFilePosition = UNKNOWN_POSITION, because tables use seek to do queries.", "boolean", "bSuccess", "=", "super", ".", "seek", "(", "strSeekSign", ")", ";", "if", "(", "bAutonomousSeek", ")", "{", "if", "(", "bSuccess", ")", "this", ".", "addRecordReference", "(", "0", ")", ";", "}", "return", "bSuccess", ";", "}" ]
Read the record that matches this record's current key. For a GridTable, this method calls the inherited seek. @return true if successful, false if not found. @exception FILE_NOT_OPEN. @exception KEY_NOT_FOUND - The key was not found on read.
[ "Read", "the", "record", "that", "matches", "this", "record", "s", "current", "key", ".", "For", "a", "GridTable", "this", "method", "calls", "the", "inherited", "seek", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/GridTable.java#L596-L625
151,976
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/GridTable.java
GridTable.addNewBookmark
public int addNewBookmark(Object bookmark, int iHandleType) { if (bookmark == null) return -1; if (iHandleType != DBConstants.DATA_SOURCE_HANDLE) { // The only thing that I know for sure is the bookmark is correct. DataRecord dataRecord = new DataRecord(null); dataRecord.setHandle(bookmark, iHandleType); bookmark = dataRecord; } int iIndexAdded = m_iEndOfFileIndex; if (m_iEndOfFileIndex == -1) { // End of file has not been reached - add this record to the "Add" buffer. // Add code here } else { // Update the record cached at this location m_gridBuffer.addElement(m_iEndOfFileIndex, bookmark, m_gridList); m_iEndOfFileIndex++; } return iIndexAdded; }
java
public int addNewBookmark(Object bookmark, int iHandleType) { if (bookmark == null) return -1; if (iHandleType != DBConstants.DATA_SOURCE_HANDLE) { // The only thing that I know for sure is the bookmark is correct. DataRecord dataRecord = new DataRecord(null); dataRecord.setHandle(bookmark, iHandleType); bookmark = dataRecord; } int iIndexAdded = m_iEndOfFileIndex; if (m_iEndOfFileIndex == -1) { // End of file has not been reached - add this record to the "Add" buffer. // Add code here } else { // Update the record cached at this location m_gridBuffer.addElement(m_iEndOfFileIndex, bookmark, m_gridList); m_iEndOfFileIndex++; } return iIndexAdded; }
[ "public", "int", "addNewBookmark", "(", "Object", "bookmark", ",", "int", "iHandleType", ")", "{", "if", "(", "bookmark", "==", "null", ")", "return", "-", "1", ";", "if", "(", "iHandleType", "!=", "DBConstants", ".", "DATA_SOURCE_HANDLE", ")", "{", "// The only thing that I know for sure is the bookmark is correct.", "DataRecord", "dataRecord", "=", "new", "DataRecord", "(", "null", ")", ";", "dataRecord", ".", "setHandle", "(", "bookmark", ",", "iHandleType", ")", ";", "bookmark", "=", "dataRecord", ";", "}", "int", "iIndexAdded", "=", "m_iEndOfFileIndex", ";", "if", "(", "m_iEndOfFileIndex", "==", "-", "1", ")", "{", "// End of file has not been reached - add this record to the \"Add\" buffer.", "// Add code here", "}", "else", "{", "// Update the record cached at this location", "m_gridBuffer", ".", "addElement", "(", "m_iEndOfFileIndex", ",", "bookmark", ",", "m_gridList", ")", ";", "m_iEndOfFileIndex", "++", ";", "}", "return", "iIndexAdded", ";", "}" ]
Here is a bookmark for a brand new record, add it to the end of the list. @param bookmark The bookmark (usually a DataRecord) of the record to add. @param iHandleType The type of bookmark to add. @return the index of the new entry.
[ "Here", "is", "a", "bookmark", "for", "a", "brand", "new", "record", "add", "it", "to", "the", "end", "of", "the", "list", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/GridTable.java#L665-L688
151,977
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/GridTable.java
GridTable.updateGridToMessage
public int updateGridToMessage(BaseMessage message, boolean bReReadMessage, boolean bAddIfNotFound) { Record record = this.getRecord(); // Record changed int iHandleType = DBConstants.BOOKMARK_HANDLE; // OBJECT_ID_HANDLE; if (this.getNextTable() instanceof org.jbundle.base.db.shared.MultiTable) iHandleType = DBConstants.FULL_OBJECT_HANDLE; Object bookmark = ((RecordMessageHeader)message.getMessageHeader()).getBookmark(iHandleType); int iRecordMessageType = ((RecordMessageHeader)message.getMessageHeader()).getRecordMessageType(); // See if this record is currently displayed or buffered, if so, refresh and display. GridTable table = (GridTable)record.getTable(); int iIndex = -1; if (iRecordMessageType == -1) { iIndex = table.bookmarkToIndex(bookmark, iHandleType); // Find this bookmark in the table } else if (iRecordMessageType == DBConstants.CACHE_UPDATE_TYPE) { // No need to update anything as this is just a notification that the cache has been updaed already. iIndex = table.bookmarkToIndex(bookmark, iHandleType); // Find this bookmark in the table } else if (iRecordMessageType == DBConstants.SELECT_TYPE) { // A secondary record was selected, update the secondary field to the new value. // Don't need to update the table for a select } else if (iRecordMessageType == DBConstants.AFTER_ADD_TYPE) { iIndex = table.refreshBookmark(bookmark, iHandleType, false); // Double-check to see if it has already been added if (iIndex == -1) { if (bAddIfNotFound) { // Note: It might be nice to check this filter in the message on the server, then I don't change to read and check it. try { record = record.setHandle(bookmark, iHandleType); // Fake the handleCriteria to think this is a slave. NOTE: This is not cool in a multitasked environment. int iDBMasterSlave = record.getTable().getCurrentTable().getDatabase().getMasterSlave(); record.getTable().getCurrentTable().getDatabase().setMasterSlave(RecordOwner.MASTER | RecordOwner.SLAVE); boolean bMatch = record.handleRemoteCriteria(null, false, null); record.getTable().getCurrentTable().getDatabase().setMasterSlave(iDBMasterSlave); if (bMatch) { iHandleType = DBConstants.DATA_SOURCE_HANDLE; bookmark = this.getDataRecord(m_bCacheRecordData, BaseBuffer.SELECTED_FIELDS); } else bookmark = null; } catch (DBException e) { e.printStackTrace(); } if (bookmark != null) iIndex = table.addNewBookmark(bookmark, iHandleType); // Add this new record to the table } } } else { iIndex = table.refreshBookmark(bookmark, iHandleType, bReReadMessage); // Refresh the data for this bookmark } return iIndex; }
java
public int updateGridToMessage(BaseMessage message, boolean bReReadMessage, boolean bAddIfNotFound) { Record record = this.getRecord(); // Record changed int iHandleType = DBConstants.BOOKMARK_HANDLE; // OBJECT_ID_HANDLE; if (this.getNextTable() instanceof org.jbundle.base.db.shared.MultiTable) iHandleType = DBConstants.FULL_OBJECT_HANDLE; Object bookmark = ((RecordMessageHeader)message.getMessageHeader()).getBookmark(iHandleType); int iRecordMessageType = ((RecordMessageHeader)message.getMessageHeader()).getRecordMessageType(); // See if this record is currently displayed or buffered, if so, refresh and display. GridTable table = (GridTable)record.getTable(); int iIndex = -1; if (iRecordMessageType == -1) { iIndex = table.bookmarkToIndex(bookmark, iHandleType); // Find this bookmark in the table } else if (iRecordMessageType == DBConstants.CACHE_UPDATE_TYPE) { // No need to update anything as this is just a notification that the cache has been updaed already. iIndex = table.bookmarkToIndex(bookmark, iHandleType); // Find this bookmark in the table } else if (iRecordMessageType == DBConstants.SELECT_TYPE) { // A secondary record was selected, update the secondary field to the new value. // Don't need to update the table for a select } else if (iRecordMessageType == DBConstants.AFTER_ADD_TYPE) { iIndex = table.refreshBookmark(bookmark, iHandleType, false); // Double-check to see if it has already been added if (iIndex == -1) { if (bAddIfNotFound) { // Note: It might be nice to check this filter in the message on the server, then I don't change to read and check it. try { record = record.setHandle(bookmark, iHandleType); // Fake the handleCriteria to think this is a slave. NOTE: This is not cool in a multitasked environment. int iDBMasterSlave = record.getTable().getCurrentTable().getDatabase().getMasterSlave(); record.getTable().getCurrentTable().getDatabase().setMasterSlave(RecordOwner.MASTER | RecordOwner.SLAVE); boolean bMatch = record.handleRemoteCriteria(null, false, null); record.getTable().getCurrentTable().getDatabase().setMasterSlave(iDBMasterSlave); if (bMatch) { iHandleType = DBConstants.DATA_SOURCE_HANDLE; bookmark = this.getDataRecord(m_bCacheRecordData, BaseBuffer.SELECTED_FIELDS); } else bookmark = null; } catch (DBException e) { e.printStackTrace(); } if (bookmark != null) iIndex = table.addNewBookmark(bookmark, iHandleType); // Add this new record to the table } } } else { iIndex = table.refreshBookmark(bookmark, iHandleType, bReReadMessage); // Refresh the data for this bookmark } return iIndex; }
[ "public", "int", "updateGridToMessage", "(", "BaseMessage", "message", ",", "boolean", "bReReadMessage", ",", "boolean", "bAddIfNotFound", ")", "{", "Record", "record", "=", "this", ".", "getRecord", "(", ")", ";", "// Record changed", "int", "iHandleType", "=", "DBConstants", ".", "BOOKMARK_HANDLE", ";", "// OBJECT_ID_HANDLE;", "if", "(", "this", ".", "getNextTable", "(", ")", "instanceof", "org", ".", "jbundle", ".", "base", ".", "db", ".", "shared", ".", "MultiTable", ")", "iHandleType", "=", "DBConstants", ".", "FULL_OBJECT_HANDLE", ";", "Object", "bookmark", "=", "(", "(", "RecordMessageHeader", ")", "message", ".", "getMessageHeader", "(", ")", ")", ".", "getBookmark", "(", "iHandleType", ")", ";", "int", "iRecordMessageType", "=", "(", "(", "RecordMessageHeader", ")", "message", ".", "getMessageHeader", "(", ")", ")", ".", "getRecordMessageType", "(", ")", ";", "// See if this record is currently displayed or buffered, if so, refresh and display.", "GridTable", "table", "=", "(", "GridTable", ")", "record", ".", "getTable", "(", ")", ";", "int", "iIndex", "=", "-", "1", ";", "if", "(", "iRecordMessageType", "==", "-", "1", ")", "{", "iIndex", "=", "table", ".", "bookmarkToIndex", "(", "bookmark", ",", "iHandleType", ")", ";", "// Find this bookmark in the table", "}", "else", "if", "(", "iRecordMessageType", "==", "DBConstants", ".", "CACHE_UPDATE_TYPE", ")", "{", "// No need to update anything as this is just a notification that the cache has been updaed already.", "iIndex", "=", "table", ".", "bookmarkToIndex", "(", "bookmark", ",", "iHandleType", ")", ";", "// Find this bookmark in the table", "}", "else", "if", "(", "iRecordMessageType", "==", "DBConstants", ".", "SELECT_TYPE", ")", "{", "// A secondary record was selected, update the secondary field to the new value.", "// Don't need to update the table for a select", "}", "else", "if", "(", "iRecordMessageType", "==", "DBConstants", ".", "AFTER_ADD_TYPE", ")", "{", "iIndex", "=", "table", ".", "refreshBookmark", "(", "bookmark", ",", "iHandleType", ",", "false", ")", ";", "// Double-check to see if it has already been added", "if", "(", "iIndex", "==", "-", "1", ")", "{", "if", "(", "bAddIfNotFound", ")", "{", "// Note: It might be nice to check this filter in the message on the server, then I don't change to read and check it.", "try", "{", "record", "=", "record", ".", "setHandle", "(", "bookmark", ",", "iHandleType", ")", ";", "// Fake the handleCriteria to think this is a slave. NOTE: This is not cool in a multitasked environment.", "int", "iDBMasterSlave", "=", "record", ".", "getTable", "(", ")", ".", "getCurrentTable", "(", ")", ".", "getDatabase", "(", ")", ".", "getMasterSlave", "(", ")", ";", "record", ".", "getTable", "(", ")", ".", "getCurrentTable", "(", ")", ".", "getDatabase", "(", ")", ".", "setMasterSlave", "(", "RecordOwner", ".", "MASTER", "|", "RecordOwner", ".", "SLAVE", ")", ";", "boolean", "bMatch", "=", "record", ".", "handleRemoteCriteria", "(", "null", ",", "false", ",", "null", ")", ";", "record", ".", "getTable", "(", ")", ".", "getCurrentTable", "(", ")", ".", "getDatabase", "(", ")", ".", "setMasterSlave", "(", "iDBMasterSlave", ")", ";", "if", "(", "bMatch", ")", "{", "iHandleType", "=", "DBConstants", ".", "DATA_SOURCE_HANDLE", ";", "bookmark", "=", "this", ".", "getDataRecord", "(", "m_bCacheRecordData", ",", "BaseBuffer", ".", "SELECTED_FIELDS", ")", ";", "}", "else", "bookmark", "=", "null", ";", "}", "catch", "(", "DBException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "if", "(", "bookmark", "!=", "null", ")", "iIndex", "=", "table", ".", "addNewBookmark", "(", "bookmark", ",", "iHandleType", ")", ";", "// Add this new record to the table", "}", "}", "}", "else", "{", "iIndex", "=", "table", ".", "refreshBookmark", "(", "bookmark", ",", "iHandleType", ",", "bReReadMessage", ")", ";", "// Refresh the data for this bookmark", "}", "return", "iIndex", ";", "}" ]
Use this record update notification to update this gridtable. @param message A RecordMessage detailing an update to this gridtable. @param bAddIfNotFound Add the record to the end if not found @return The row that was updated, or -1 if none.
[ "Use", "this", "record", "update", "notification", "to", "update", "this", "gridtable", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/GridTable.java#L822-L879
151,978
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/ChangeTitleOnChangeHandler.java
ChangeTitleOnChangeHandler.getTitle
public String getTitle(ComponentParent screenMain) { String strScreenTitle = DBConstants.BLANK; if (screenMain != null) strScreenTitle = screenMain.getTitle(); return strScreenTitle; }
java
public String getTitle(ComponentParent screenMain) { String strScreenTitle = DBConstants.BLANK; if (screenMain != null) strScreenTitle = screenMain.getTitle(); return strScreenTitle; }
[ "public", "String", "getTitle", "(", "ComponentParent", "screenMain", ")", "{", "String", "strScreenTitle", "=", "DBConstants", ".", "BLANK", ";", "if", "(", "screenMain", "!=", "null", ")", "strScreenTitle", "=", "screenMain", ".", "getTitle", "(", ")", ";", "return", "strScreenTitle", ";", "}" ]
Get the default title for this screen. Calls the getTitle method of this screen. @param screenMain The screen to get the title string from. @return The returned title for this screen.
[ "Get", "the", "default", "title", "for", "this", "screen", ".", "Calls", "the", "getTitle", "method", "of", "this", "screen", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ChangeTitleOnChangeHandler.java#L110-L116
151,979
kirgor/enklib
ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java
Bean.createProxy
protected <T> T createProxy(Class<T> interfaceClass, Session session) throws Exception { return configBean.getConfig().getStoredProcedureProxyFactory().getProxy(interfaceClass, session); }
java
protected <T> T createProxy(Class<T> interfaceClass, Session session) throws Exception { return configBean.getConfig().getStoredProcedureProxyFactory().getProxy(interfaceClass, session); }
[ "protected", "<", "T", ">", "T", "createProxy", "(", "Class", "<", "T", ">", "interfaceClass", ",", "Session", "session", ")", "throws", "Exception", "{", "return", "configBean", ".", "getConfig", "(", ")", ".", "getStoredProcedureProxyFactory", "(", ")", ".", "getProxy", "(", "interfaceClass", ",", "session", ")", ";", "}" ]
Creates data proxy of specified class for specified session. @param interfaceClass Class of the proxy interface. @param session Session instance for the proxy. @param <T> Type of the proxy interface. @throws Exception
[ "Creates", "data", "proxy", "of", "specified", "class", "for", "specified", "session", "." ]
8a24db296dc43db5d8fe509cf64ace0a0c7be8f2
https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java#L189-L191
151,980
kirgor/enklib
ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java
Bean.createProxy
protected <T> T createProxy(Class<T> interfaceClass) throws Exception { return createProxy(interfaceClass, getSession()); }
java
protected <T> T createProxy(Class<T> interfaceClass) throws Exception { return createProxy(interfaceClass, getSession()); }
[ "protected", "<", "T", ">", "T", "createProxy", "(", "Class", "<", "T", ">", "interfaceClass", ")", "throws", "Exception", "{", "return", "createProxy", "(", "interfaceClass", ",", "getSession", "(", ")", ")", ";", "}" ]
Creates data proxy of specified class for current invocation SQL session. @param interfaceClass Class of proxy interface. @param <T> Type of the proxy interface. @throws Exception
[ "Creates", "data", "proxy", "of", "specified", "class", "for", "current", "invocation", "SQL", "session", "." ]
8a24db296dc43db5d8fe509cf64ace0a0c7be8f2
https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java#L200-L202
151,981
kirgor/enklib
ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java
Bean.ok
protected Response ok(Object entity) { entity = mapResponseEntity(entity); return buildResponse(Response.ok(entity)); }
java
protected Response ok(Object entity) { entity = mapResponseEntity(entity); return buildResponse(Response.ok(entity)); }
[ "protected", "Response", "ok", "(", "Object", "entity", ")", "{", "entity", "=", "mapResponseEntity", "(", "entity", ")", ";", "return", "buildResponse", "(", "Response", ".", "ok", "(", "entity", ")", ")", ";", "}" ]
This is shorthand method for simple response 200 OK with entity.
[ "This", "is", "shorthand", "method", "for", "simple", "response", "200", "OK", "with", "entity", "." ]
8a24db296dc43db5d8fe509cf64ace0a0c7be8f2
https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java#L243-L246
151,982
kirgor/enklib
ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java
Bean.ok
protected Response ok(List<Object> entityList) { for (int i = 0; i < entityList.size(); i++) { entityList.set(i, mapResponseEntity(entityList.get(i))); } return buildResponse(Response.ok(entityList)); }
java
protected Response ok(List<Object> entityList) { for (int i = 0; i < entityList.size(); i++) { entityList.set(i, mapResponseEntity(entityList.get(i))); } return buildResponse(Response.ok(entityList)); }
[ "protected", "Response", "ok", "(", "List", "<", "Object", ">", "entityList", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entityList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "entityList", ".", "set", "(", "i", ",", "mapResponseEntity", "(", "entityList", ".", "get", "(", "i", ")", ")", ")", ";", "}", "return", "buildResponse", "(", "Response", ".", "ok", "(", "entityList", ")", ")", ";", "}" ]
This is shorthand method for simple response 200 OK with list of entities.
[ "This", "is", "shorthand", "method", "for", "simple", "response", "200", "OK", "with", "list", "of", "entities", "." ]
8a24db296dc43db5d8fe509cf64ace0a0c7be8f2
https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java#L251-L256
151,983
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/MergeTableHandler.java
MergeTableHandler.fieldChanged
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { boolean flag = this.getOwner().getState(); if (flag) m_mergeRecord.getTable().addTable(m_subRecord.getTable()); else m_mergeRecord.getTable().removeTable(m_subRecord.getTable()); m_mergeRecord.close(); // Must requery on Add, should close on delete if (m_gridScreen == null) return DBConstants.NORMAL_RETURN; else return super.fieldChanged(bDisplayOption, iMoveMode); }
java
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { boolean flag = this.getOwner().getState(); if (flag) m_mergeRecord.getTable().addTable(m_subRecord.getTable()); else m_mergeRecord.getTable().removeTable(m_subRecord.getTable()); m_mergeRecord.close(); // Must requery on Add, should close on delete if (m_gridScreen == null) return DBConstants.NORMAL_RETURN; else return super.fieldChanged(bDisplayOption, iMoveMode); }
[ "public", "int", "fieldChanged", "(", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "boolean", "flag", "=", "this", ".", "getOwner", "(", ")", ".", "getState", "(", ")", ";", "if", "(", "flag", ")", "m_mergeRecord", ".", "getTable", "(", ")", ".", "addTable", "(", "m_subRecord", ".", "getTable", "(", ")", ")", ";", "else", "m_mergeRecord", ".", "getTable", "(", ")", ".", "removeTable", "(", "m_subRecord", ".", "getTable", "(", ")", ")", ";", "m_mergeRecord", ".", "close", "(", ")", ";", "// Must requery on Add, should close on delete", "if", "(", "m_gridScreen", "==", "null", ")", "return", "DBConstants", ".", "NORMAL_RETURN", ";", "else", "return", "super", ".", "fieldChanged", "(", "bDisplayOption", ",", "iMoveMode", ")", ";", "}" ]
The Field has Changed. If this field is true, add the table back to the grid query and requery the grid table. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay).
[ "The", "Field", "has", "Changed", ".", "If", "this", "field", "is", "true", "add", "the", "table", "back", "to", "the", "grid", "query", "and", "requery", "the", "grid", "table", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/MergeTableHandler.java#L111-L123
151,984
inkstand-io/scribble
scribble-inject/src/main/java/io/inkstand/scribble/inject/TypeUtil.java
TypeUtil.toPrimitive
private static Object toPrimitive(final String value, final Class<?> type) { final Class<?> objectType = objectTypeFor(type); final Object objectValue = valueOf(value, objectType); final Object primitiveValue; final String toValueMethodName = type.getSimpleName() + "Value"; try { final Method toValueMethod = objectType.getMethod(toValueMethodName); primitiveValue = toValueMethod.invoke(objectValue); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { //this should never happen throw new RuntimeException("Can not convert to primitive type", e); //NOSONAR } return primitiveValue; }
java
private static Object toPrimitive(final String value, final Class<?> type) { final Class<?> objectType = objectTypeFor(type); final Object objectValue = valueOf(value, objectType); final Object primitiveValue; final String toValueMethodName = type.getSimpleName() + "Value"; try { final Method toValueMethod = objectType.getMethod(toValueMethodName); primitiveValue = toValueMethod.invoke(objectValue); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { //this should never happen throw new RuntimeException("Can not convert to primitive type", e); //NOSONAR } return primitiveValue; }
[ "private", "static", "Object", "toPrimitive", "(", "final", "String", "value", ",", "final", "Class", "<", "?", ">", "type", ")", "{", "final", "Class", "<", "?", ">", "objectType", "=", "objectTypeFor", "(", "type", ")", ";", "final", "Object", "objectValue", "=", "valueOf", "(", "value", ",", "objectType", ")", ";", "final", "Object", "primitiveValue", ";", "final", "String", "toValueMethodName", "=", "type", ".", "getSimpleName", "(", ")", "+", "\"Value\"", ";", "try", "{", "final", "Method", "toValueMethod", "=", "objectType", ".", "getMethod", "(", "toValueMethodName", ")", ";", "primitiveValue", "=", "toValueMethod", ".", "invoke", "(", "objectValue", ")", ";", "}", "catch", "(", "NoSuchMethodException", "|", "InvocationTargetException", "|", "IllegalAccessException", "e", ")", "{", "//this should never happen", "throw", "new", "RuntimeException", "(", "\"Can not convert to primitive type\"", ",", "e", ")", ";", "//NOSONAR", "}", "return", "primitiveValue", ";", "}" ]
Converts the given value to it's given primitive type. @param value the value to be converted @param type a primitive type class (i.e. {@code int.class}) . @return the converted value (will be a wrapper type)
[ "Converts", "the", "given", "value", "to", "it", "s", "given", "primitive", "type", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-inject/src/main/java/io/inkstand/scribble/inject/TypeUtil.java#L123-L139
151,985
inkstand-io/scribble
scribble-inject/src/main/java/io/inkstand/scribble/inject/TypeUtil.java
TypeUtil.valueOf
private static Object valueOf(final String value, final Class<?> objectType) { if (objectType == Character.class) { return value.charAt(0); } try { final Constructor<?> constructor = objectType.getConstructor(String.class); return constructor.newInstance(value); } catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { //this should never happen throw new RuntimeException( //NOSONAR "Could not create instance of type " + objectType.getName() + " from value " + value, e); } }
java
private static Object valueOf(final String value, final Class<?> objectType) { if (objectType == Character.class) { return value.charAt(0); } try { final Constructor<?> constructor = objectType.getConstructor(String.class); return constructor.newInstance(value); } catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { //this should never happen throw new RuntimeException( //NOSONAR "Could not create instance of type " + objectType.getName() + " from value " + value, e); } }
[ "private", "static", "Object", "valueOf", "(", "final", "String", "value", ",", "final", "Class", "<", "?", ">", "objectType", ")", "{", "if", "(", "objectType", "==", "Character", ".", "class", ")", "{", "return", "value", ".", "charAt", "(", "0", ")", ";", "}", "try", "{", "final", "Constructor", "<", "?", ">", "constructor", "=", "objectType", ".", "getConstructor", "(", "String", ".", "class", ")", ";", "return", "constructor", ".", "newInstance", "(", "value", ")", ";", "}", "catch", "(", "InstantiationException", "|", "InvocationTargetException", "|", "NoSuchMethodException", "|", "IllegalAccessException", "e", ")", "{", "//this should never happen", "throw", "new", "RuntimeException", "(", "//NOSONAR", "\"Could not create instance of type \"", "+", "objectType", ".", "getName", "(", ")", "+", "\" from value \"", "+", "value", ",", "e", ")", ";", "}", "}" ]
Converts the given String value to a object type. The method assumes the object type has a constructor accepting a single String representation of the content. @param objectType the object type that MUST have a single String constructor, which is the case for any any primitive type. @param value the value as a string to be converted @return the converted value @throws RuntimeException if the object type has no valueOf method or the method can not be invoked.
[ "Converts", "the", "given", "String", "value", "to", "a", "object", "type", ".", "The", "method", "assumes", "the", "object", "type", "has", "a", "constructor", "accepting", "a", "single", "String", "representation", "of", "the", "content", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-inject/src/main/java/io/inkstand/scribble/inject/TypeUtil.java#L156-L173
151,986
tvesalainen/hoski-lib
src/main/java/fi/hoski/util/EntityReferences.java
EntityReferences.decode
public static final String decode(String str) { Matcher m = ENT.matcher(str); StringBuffer sb = new StringBuffer(); while (m.find()) { String entity = m.group(1); Matcher m2 = HENT.matcher(entity); Integer codePoint = null; if (m2.matches()) { codePoint = Integer.parseInt(m2.group(1)); } else { codePoint = codePointMap.get(entity); } if (codePoint == null) { m.appendReplacement(sb, m.group()); } else { String s = new String(new int[] {codePoint.intValue()}, 0, 1); m.appendReplacement(sb, s); } } m.appendTail(sb); return sb.toString(); }
java
public static final String decode(String str) { Matcher m = ENT.matcher(str); StringBuffer sb = new StringBuffer(); while (m.find()) { String entity = m.group(1); Matcher m2 = HENT.matcher(entity); Integer codePoint = null; if (m2.matches()) { codePoint = Integer.parseInt(m2.group(1)); } else { codePoint = codePointMap.get(entity); } if (codePoint == null) { m.appendReplacement(sb, m.group()); } else { String s = new String(new int[] {codePoint.intValue()}, 0, 1); m.appendReplacement(sb, s); } } m.appendTail(sb); return sb.toString(); }
[ "public", "static", "final", "String", "decode", "(", "String", "str", ")", "{", "Matcher", "m", "=", "ENT", ".", "matcher", "(", "str", ")", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "while", "(", "m", ".", "find", "(", ")", ")", "{", "String", "entity", "=", "m", ".", "group", "(", "1", ")", ";", "Matcher", "m2", "=", "HENT", ".", "matcher", "(", "entity", ")", ";", "Integer", "codePoint", "=", "null", ";", "if", "(", "m2", ".", "matches", "(", ")", ")", "{", "codePoint", "=", "Integer", ".", "parseInt", "(", "m2", ".", "group", "(", "1", ")", ")", ";", "}", "else", "{", "codePoint", "=", "codePointMap", ".", "get", "(", "entity", ")", ";", "}", "if", "(", "codePoint", "==", "null", ")", "{", "m", ".", "appendReplacement", "(", "sb", ",", "m", ".", "group", "(", ")", ")", ";", "}", "else", "{", "String", "s", "=", "new", "String", "(", "new", "int", "[", "]", "{", "codePoint", ".", "intValue", "(", ")", "}", ",", "0", ",", "1", ")", ";", "m", ".", "appendReplacement", "(", "sb", ",", "s", ")", ";", "}", "}", "m", ".", "appendTail", "(", "sb", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Decodes String from HTML format. &amp; -&gt; &amp; @param str @return
[ "Decodes", "String", "from", "HTML", "format", ".", "&amp", ";", "-", "&gt", ";", "&amp", ";" ]
9b5bab44113e0adb74bf1ee436013e8a7c608d00
https://github.com/tvesalainen/hoski-lib/blob/9b5bab44113e0adb74bf1ee436013e8a7c608d00/src/main/java/fi/hoski/util/EntityReferences.java#L387-L416
151,987
jbundle/jbundle
main/db/src/main/java/org/jbundle/main/user/db/UserLog.java
UserLog.log
public void log(int iUserID, int iUserLogTypeID, String strMessage) { try { this.addNew(); this.getField(UserLog.USER_ID).setValue(iUserID); this.getField(UserLog.USER_LOG_TYPE_ID).setValue(iUserLogTypeID); this.getField(UserLog.MESSAGE).setString(strMessage); this.add(); } catch (DBException ex) { ex.printStackTrace(); } }
java
public void log(int iUserID, int iUserLogTypeID, String strMessage) { try { this.addNew(); this.getField(UserLog.USER_ID).setValue(iUserID); this.getField(UserLog.USER_LOG_TYPE_ID).setValue(iUserLogTypeID); this.getField(UserLog.MESSAGE).setString(strMessage); this.add(); } catch (DBException ex) { ex.printStackTrace(); } }
[ "public", "void", "log", "(", "int", "iUserID", ",", "int", "iUserLogTypeID", ",", "String", "strMessage", ")", "{", "try", "{", "this", ".", "addNew", "(", ")", ";", "this", ".", "getField", "(", "UserLog", ".", "USER_ID", ")", ".", "setValue", "(", "iUserID", ")", ";", "this", ".", "getField", "(", "UserLog", ".", "USER_LOG_TYPE_ID", ")", ".", "setValue", "(", "iUserLogTypeID", ")", ";", "this", ".", "getField", "(", "UserLog", ".", "MESSAGE", ")", ".", "setString", "(", "strMessage", ")", ";", "this", ".", "add", "(", ")", ";", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Add this log entry.
[ "Add", "this", "log", "entry", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/user/db/UserLog.java#L134-L145
151,988
GII/broccoli
broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owl/OWLValueObject.java
OWLValueObject.buildFromObject
public static OWLValueObject buildFromObject(OWLModel model, Object object) throws NotYetImplementedException, OWLTranslationException { return buildFromClasAndObject(model, OWLURIClass.from(object), object); }
java
public static OWLValueObject buildFromObject(OWLModel model, Object object) throws NotYetImplementedException, OWLTranslationException { return buildFromClasAndObject(model, OWLURIClass.from(object), object); }
[ "public", "static", "OWLValueObject", "buildFromObject", "(", "OWLModel", "model", ",", "Object", "object", ")", "throws", "NotYetImplementedException", ",", "OWLTranslationException", "{", "return", "buildFromClasAndObject", "(", "model", ",", "OWLURIClass", ".", "from", "(", "object", ")", ",", "object", ")", ";", "}" ]
Builds an instance, from a given object @param model @param object @return @throws NotYetImplementedException @throws OWLTranslationException
[ "Builds", "an", "instance", "from", "a", "given", "object" ]
a3033a90322cbcee4dc0f1719143b84b822bc4ba
https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owl/OWLValueObject.java#L146-L148
151,989
GII/broccoli
broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owl/OWLValueObject.java
OWLValueObject.buildFromCollection
public static OWLValueObject buildFromCollection(OWLModel model, Collection col) throws NotYetImplementedException, OWLTranslationException { if (col.isEmpty()) { return null; } return buildFromClasAndCollection(model, OWLURIClass.from(col.iterator().next()), col); }
java
public static OWLValueObject buildFromCollection(OWLModel model, Collection col) throws NotYetImplementedException, OWLTranslationException { if (col.isEmpty()) { return null; } return buildFromClasAndCollection(model, OWLURIClass.from(col.iterator().next()), col); }
[ "public", "static", "OWLValueObject", "buildFromCollection", "(", "OWLModel", "model", ",", "Collection", "col", ")", "throws", "NotYetImplementedException", ",", "OWLTranslationException", "{", "if", "(", "col", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "return", "buildFromClasAndCollection", "(", "model", ",", "OWLURIClass", ".", "from", "(", "col", ".", "iterator", "(", ")", ".", "next", "(", ")", ")", ",", "col", ")", ";", "}" ]
Builds an instance, from a given collection @param model @param col @return @throws NotYetImplementedException @throws OWLTranslationException
[ "Builds", "an", "instance", "from", "a", "given", "collection" ]
a3033a90322cbcee4dc0f1719143b84b822bc4ba
https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owl/OWLValueObject.java#L159-L164
151,990
williamwebb/alogger
Utilities/src/main/java/com/jug6ernaut/android/utilites/lazyloader/ImageLoader.java
ImageLoader.decodeFile
private Bitmap decodeFile(File f){ try { //decode image size BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; BitmapFactory.decodeStream(new FileInputStream(f),null,o); //Find the correct scale value. It should be the power of 2. final int REQUIRED_SIZE=70; int width_tmp=o.outWidth, height_tmp=o.outHeight; int scale=1; while(true){ if(width_tmp/2<REQUIRED_SIZE || height_tmp/2<REQUIRED_SIZE) break; width_tmp/=2; height_tmp/=2; scale*=2; } //decode with inSampleSize BitmapFactory.Options o2 = new BitmapFactory.Options(); o2.inSampleSize=scale; return BitmapFactory.decodeStream(new FileInputStream(f), null, o2); } catch (FileNotFoundException e) {} return null; }
java
private Bitmap decodeFile(File f){ try { //decode image size BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; BitmapFactory.decodeStream(new FileInputStream(f),null,o); //Find the correct scale value. It should be the power of 2. final int REQUIRED_SIZE=70; int width_tmp=o.outWidth, height_tmp=o.outHeight; int scale=1; while(true){ if(width_tmp/2<REQUIRED_SIZE || height_tmp/2<REQUIRED_SIZE) break; width_tmp/=2; height_tmp/=2; scale*=2; } //decode with inSampleSize BitmapFactory.Options o2 = new BitmapFactory.Options(); o2.inSampleSize=scale; return BitmapFactory.decodeStream(new FileInputStream(f), null, o2); } catch (FileNotFoundException e) {} return null; }
[ "private", "Bitmap", "decodeFile", "(", "File", "f", ")", "{", "try", "{", "//decode image size", "BitmapFactory", ".", "Options", "o", "=", "new", "BitmapFactory", ".", "Options", "(", ")", ";", "o", ".", "inJustDecodeBounds", "=", "true", ";", "BitmapFactory", ".", "decodeStream", "(", "new", "FileInputStream", "(", "f", ")", ",", "null", ",", "o", ")", ";", "//Find the correct scale value. It should be the power of 2.", "final", "int", "REQUIRED_SIZE", "=", "70", ";", "int", "width_tmp", "=", "o", ".", "outWidth", ",", "height_tmp", "=", "o", ".", "outHeight", ";", "int", "scale", "=", "1", ";", "while", "(", "true", ")", "{", "if", "(", "width_tmp", "/", "2", "<", "REQUIRED_SIZE", "||", "height_tmp", "/", "2", "<", "REQUIRED_SIZE", ")", "break", ";", "width_tmp", "/=", "2", ";", "height_tmp", "/=", "2", ";", "scale", "*=", "2", ";", "}", "//decode with inSampleSize", "BitmapFactory", ".", "Options", "o2", "=", "new", "BitmapFactory", ".", "Options", "(", ")", ";", "o2", ".", "inSampleSize", "=", "scale", ";", "return", "BitmapFactory", ".", "decodeStream", "(", "new", "FileInputStream", "(", "f", ")", ",", "null", ",", "o2", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "}", "return", "null", ";", "}" ]
decodes image and scales it to reduce memory consumption
[ "decodes", "image", "and", "scales", "it", "to", "reduce", "memory", "consumption" ]
61fca49e0b8d9c3a76c40da8883ac354b240351e
https://github.com/williamwebb/alogger/blob/61fca49e0b8d9c3a76c40da8883ac354b240351e/Utilities/src/main/java/com/jug6ernaut/android/utilites/lazyloader/ImageLoader.java#L101-L126
151,991
PuyallupFoursquare/ccb-api-client-java
src/main/java/com/p4square/ccbapi/model/GetIndividualProfilesRequest.java
GetIndividualProfilesRequest.withIndividualId
public GetIndividualProfilesRequest withIndividualId(final int id) { this.id = id; this.password = new char[0]; this.login = this.accountNumber = this.routingNumber = null; return this; }
java
public GetIndividualProfilesRequest withIndividualId(final int id) { this.id = id; this.password = new char[0]; this.login = this.accountNumber = this.routingNumber = null; return this; }
[ "public", "GetIndividualProfilesRequest", "withIndividualId", "(", "final", "int", "id", ")", "{", "this", ".", "id", "=", "id", ";", "this", ".", "password", "=", "new", "char", "[", "0", "]", ";", "this", ".", "login", "=", "this", ".", "accountNumber", "=", "this", ".", "routingNumber", "=", "null", ";", "return", "this", ";", "}" ]
Request the IndividualProfile for the given individual id. This option is mutually exclusive with {@link #withLoginPassword(String, char[])} and {@link #withMICR(String, String)}. @param id The id. @return this.
[ "Request", "the", "IndividualProfile", "for", "the", "given", "individual", "id", "." ]
54a7a3184dc565fe513aa520e1344b2303ea6834
https://github.com/PuyallupFoursquare/ccb-api-client-java/blob/54a7a3184dc565fe513aa520e1344b2303ea6834/src/main/java/com/p4square/ccbapi/model/GetIndividualProfilesRequest.java#L41-L46
151,992
PuyallupFoursquare/ccb-api-client-java
src/main/java/com/p4square/ccbapi/model/GetIndividualProfilesRequest.java
GetIndividualProfilesRequest.withLoginPassword
public GetIndividualProfilesRequest withLoginPassword(final String login, final char[] password) { this.login = login; this.password = password; this.id = 0; this.accountNumber = this.routingNumber = null; return this; }
java
public GetIndividualProfilesRequest withLoginPassword(final String login, final char[] password) { this.login = login; this.password = password; this.id = 0; this.accountNumber = this.routingNumber = null; return this; }
[ "public", "GetIndividualProfilesRequest", "withLoginPassword", "(", "final", "String", "login", ",", "final", "char", "[", "]", "password", ")", "{", "this", ".", "login", "=", "login", ";", "this", ".", "password", "=", "password", ";", "this", ".", "id", "=", "0", ";", "this", ".", "accountNumber", "=", "this", ".", "routingNumber", "=", "null", ";", "return", "this", ";", "}" ]
Request the IndividualProfile for the given login and password. This option is mutually exclusive with {@link #withIndividualId(int)} and {@link #withMICR(String, String)}. @param login The individual's login. @param password The individual's password. @return this.
[ "Request", "the", "IndividualProfile", "for", "the", "given", "login", "and", "password", "." ]
54a7a3184dc565fe513aa520e1344b2303ea6834
https://github.com/PuyallupFoursquare/ccb-api-client-java/blob/54a7a3184dc565fe513aa520e1344b2303ea6834/src/main/java/com/p4square/ccbapi/model/GetIndividualProfilesRequest.java#L66-L72
151,993
PuyallupFoursquare/ccb-api-client-java
src/main/java/com/p4square/ccbapi/model/GetIndividualProfilesRequest.java
GetIndividualProfilesRequest.withMICR
public GetIndividualProfilesRequest withMICR(final String routingNumber, final String accountNumber) { this.routingNumber = routingNumber; this.accountNumber = accountNumber; return this; }
java
public GetIndividualProfilesRequest withMICR(final String routingNumber, final String accountNumber) { this.routingNumber = routingNumber; this.accountNumber = accountNumber; return this; }
[ "public", "GetIndividualProfilesRequest", "withMICR", "(", "final", "String", "routingNumber", ",", "final", "String", "accountNumber", ")", "{", "this", ".", "routingNumber", "=", "routingNumber", ";", "this", ".", "accountNumber", "=", "accountNumber", ";", "return", "this", ";", "}" ]
Request the IndividualProfile for the given bank account information. This option is mutually exclusive with {@link #withIndividualId(int)} and {@link #withLoginPassword(String, char[])}. @param routingNumber The individual's bank routing number. @param accountNumber The individual's bank account number. @return this.
[ "Request", "the", "IndividualProfile", "for", "the", "given", "bank", "account", "information", "." ]
54a7a3184dc565fe513aa520e1344b2303ea6834
https://github.com/PuyallupFoursquare/ccb-api-client-java/blob/54a7a3184dc565fe513aa520e1344b2303ea6834/src/main/java/com/p4square/ccbapi/model/GetIndividualProfilesRequest.java#L92-L96
151,994
tvesalainen/util
util/src/main/java/org/vesalainen/graph/DiGraph.java
DiGraph.traverse
public void traverse(X x, Function<? super X, ? extends Collection<X>> edges) { traverseS(x, (y)->edges.apply(y).stream()); }
java
public void traverse(X x, Function<? super X, ? extends Collection<X>> edges) { traverseS(x, (y)->edges.apply(y).stream()); }
[ "public", "void", "traverse", "(", "X", "x", ",", "Function", "<", "?", "super", "X", ",", "?", "extends", "Collection", "<", "X", ">", ">", "edges", ")", "{", "traverseS", "(", "x", ",", "(", "y", ")", "-", ">", "edges", ".", "apply", "(", "y", ")", ".", "stream", "(", ")", ")", ";", "}" ]
This algorithm traverses all vertices and all edges once. @param x @param edges
[ "This", "algorithm", "traverses", "all", "vertices", "and", "all", "edges", "once", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/graph/DiGraph.java#L92-L95
151,995
jbundle/jbundle
main/calendar/src/main/java/org/jbundle/main/calendar/db/CalendarEntry.java
CalendarEntry.getProperties
public Map<String,Object> getProperties() { Map<String,Object> properties = ((PropertiesField)this.getField(CalendarEntry.PROPERTIES)).getProperties(); if (!this.getField(Anniversary.ANNIV_MASTER_ID).isNull()) if (this.getField(Anniversary.ANNIV_MASTER_ID) instanceof ReferenceField) { Record recAnnivMaster = ((ReferenceField)this.getField(Anniversary.ANNIV_MASTER_ID)).getReference(); if ((recAnnivMaster != null) && ((recAnnivMaster.getEditMode() == DBConstants.EDIT_CURRENT) || (recAnnivMaster.getEditMode() == DBConstants.EDIT_IN_PROGRESS))) { Map<String,Object> propMaster = ((PropertiesField)recAnnivMaster.getField(AnnivMaster.PROPERTIES)).getProperties(); if (propMaster != null) { if (properties != null) propMaster.putAll(properties); // Merge them properties = propMaster; } } } return properties; }
java
public Map<String,Object> getProperties() { Map<String,Object> properties = ((PropertiesField)this.getField(CalendarEntry.PROPERTIES)).getProperties(); if (!this.getField(Anniversary.ANNIV_MASTER_ID).isNull()) if (this.getField(Anniversary.ANNIV_MASTER_ID) instanceof ReferenceField) { Record recAnnivMaster = ((ReferenceField)this.getField(Anniversary.ANNIV_MASTER_ID)).getReference(); if ((recAnnivMaster != null) && ((recAnnivMaster.getEditMode() == DBConstants.EDIT_CURRENT) || (recAnnivMaster.getEditMode() == DBConstants.EDIT_IN_PROGRESS))) { Map<String,Object> propMaster = ((PropertiesField)recAnnivMaster.getField(AnnivMaster.PROPERTIES)).getProperties(); if (propMaster != null) { if (properties != null) propMaster.putAll(properties); // Merge them properties = propMaster; } } } return properties; }
[ "public", "Map", "<", "String", ",", "Object", ">", "getProperties", "(", ")", "{", "Map", "<", "String", ",", "Object", ">", "properties", "=", "(", "(", "PropertiesField", ")", "this", ".", "getField", "(", "CalendarEntry", ".", "PROPERTIES", ")", ")", ".", "getProperties", "(", ")", ";", "if", "(", "!", "this", ".", "getField", "(", "Anniversary", ".", "ANNIV_MASTER_ID", ")", ".", "isNull", "(", ")", ")", "if", "(", "this", ".", "getField", "(", "Anniversary", ".", "ANNIV_MASTER_ID", ")", "instanceof", "ReferenceField", ")", "{", "Record", "recAnnivMaster", "=", "(", "(", "ReferenceField", ")", "this", ".", "getField", "(", "Anniversary", ".", "ANNIV_MASTER_ID", ")", ")", ".", "getReference", "(", ")", ";", "if", "(", "(", "recAnnivMaster", "!=", "null", ")", "&&", "(", "(", "recAnnivMaster", ".", "getEditMode", "(", ")", "==", "DBConstants", ".", "EDIT_CURRENT", ")", "||", "(", "recAnnivMaster", ".", "getEditMode", "(", ")", "==", "DBConstants", ".", "EDIT_IN_PROGRESS", ")", ")", ")", "{", "Map", "<", "String", ",", "Object", ">", "propMaster", "=", "(", "(", "PropertiesField", ")", "recAnnivMaster", ".", "getField", "(", "AnnivMaster", ".", "PROPERTIES", ")", ")", ".", "getProperties", "(", ")", ";", "if", "(", "propMaster", "!=", "null", ")", "{", "if", "(", "properties", "!=", "null", ")", "propMaster", ".", "putAll", "(", "properties", ")", ";", "// Merge them", "properties", "=", "propMaster", ";", "}", "}", "}", "return", "properties", ";", "}" ]
Get the properties from the Properties field, and merge with the properties from the Master field if it exists.
[ "Get", "the", "properties", "from", "the", "Properties", "field", "and", "merge", "with", "the", "properties", "from", "the", "Master", "field", "if", "it", "exists", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/calendar/src/main/java/org/jbundle/main/calendar/db/CalendarEntry.java#L198-L217
151,996
jbundle/jbundle
main/calendar/src/main/java/org/jbundle/main/calendar/db/CalendarEntry.java
CalendarEntry.getStartIcon
public Object getStartIcon() { Object iconStart = null; Record recCalendarCategory = ((ReferenceField)this.getField(CalendarEntry.CALENDAR_CATEGORY_ID)).getReference(); if ((recCalendarCategory == null) || (recCalendarCategory.getEditMode() != DBConstants.EDIT_CURRENT)) if (this.getField(Anniversary.ANNIV_MASTER_ID) instanceof ReferenceField) { // Record recAnnivMaster = ((ReferenceField)this.getField(Anniversary.ANNIV_MASTER_ID)).getReference(); // if ((recAnnivMaster != null) && ((recAnnivMaster.getEditMode() == DBConstants.EDIT_CURRENT) || (recAnnivMaster.getEditMode() == DBConstants.EDIT_IN_PROGRESS))) // recCalendarCategory = ((ReferenceField)recAnnivMaster.getField(AnnivMaster.CALENDAR_CATEGORY_ID)).getReference(); } if ((recCalendarCategory != null) && (recCalendarCategory.getEditMode() == DBConstants.EDIT_CURRENT)) iconStart = ((ImageField)recCalendarCategory.getField(CalendarCategory.ICON)).getImage().getImage(); if (iconStart == null) { if (this.getTask() instanceof BaseApplet) iconStart = ((BaseApplet)this.getTask()).loadImageIcon("Calendar"); } return iconStart; }
java
public Object getStartIcon() { Object iconStart = null; Record recCalendarCategory = ((ReferenceField)this.getField(CalendarEntry.CALENDAR_CATEGORY_ID)).getReference(); if ((recCalendarCategory == null) || (recCalendarCategory.getEditMode() != DBConstants.EDIT_CURRENT)) if (this.getField(Anniversary.ANNIV_MASTER_ID) instanceof ReferenceField) { // Record recAnnivMaster = ((ReferenceField)this.getField(Anniversary.ANNIV_MASTER_ID)).getReference(); // if ((recAnnivMaster != null) && ((recAnnivMaster.getEditMode() == DBConstants.EDIT_CURRENT) || (recAnnivMaster.getEditMode() == DBConstants.EDIT_IN_PROGRESS))) // recCalendarCategory = ((ReferenceField)recAnnivMaster.getField(AnnivMaster.CALENDAR_CATEGORY_ID)).getReference(); } if ((recCalendarCategory != null) && (recCalendarCategory.getEditMode() == DBConstants.EDIT_CURRENT)) iconStart = ((ImageField)recCalendarCategory.getField(CalendarCategory.ICON)).getImage().getImage(); if (iconStart == null) { if (this.getTask() instanceof BaseApplet) iconStart = ((BaseApplet)this.getTask()).loadImageIcon("Calendar"); } return iconStart; }
[ "public", "Object", "getStartIcon", "(", ")", "{", "Object", "iconStart", "=", "null", ";", "Record", "recCalendarCategory", "=", "(", "(", "ReferenceField", ")", "this", ".", "getField", "(", "CalendarEntry", ".", "CALENDAR_CATEGORY_ID", ")", ")", ".", "getReference", "(", ")", ";", "if", "(", "(", "recCalendarCategory", "==", "null", ")", "||", "(", "recCalendarCategory", ".", "getEditMode", "(", ")", "!=", "DBConstants", ".", "EDIT_CURRENT", ")", ")", "if", "(", "this", ".", "getField", "(", "Anniversary", ".", "ANNIV_MASTER_ID", ")", "instanceof", "ReferenceField", ")", "{", "// Record recAnnivMaster = ((ReferenceField)this.getField(Anniversary.ANNIV_MASTER_ID)).getReference();", "// if ((recAnnivMaster != null) && ((recAnnivMaster.getEditMode() == DBConstants.EDIT_CURRENT) || (recAnnivMaster.getEditMode() == DBConstants.EDIT_IN_PROGRESS)))", "// recCalendarCategory = ((ReferenceField)recAnnivMaster.getField(AnnivMaster.CALENDAR_CATEGORY_ID)).getReference();", "}", "if", "(", "(", "recCalendarCategory", "!=", "null", ")", "&&", "(", "recCalendarCategory", ".", "getEditMode", "(", ")", "==", "DBConstants", ".", "EDIT_CURRENT", ")", ")", "iconStart", "=", "(", "(", "ImageField", ")", "recCalendarCategory", ".", "getField", "(", "CalendarCategory", ".", "ICON", ")", ")", ".", "getImage", "(", ")", ".", "getImage", "(", ")", ";", "if", "(", "iconStart", "==", "null", ")", "{", "if", "(", "this", ".", "getTask", "(", ")", "instanceof", "BaseApplet", ")", "iconStart", "=", "(", "(", "BaseApplet", ")", "this", ".", "getTask", "(", ")", ")", ".", "loadImageIcon", "(", "\"Calendar\"", ")", ";", "}", "return", "iconStart", ";", "}" ]
Get the icon for the screen display.
[ "Get", "the", "icon", "for", "the", "screen", "display", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/calendar/src/main/java/org/jbundle/main/calendar/db/CalendarEntry.java#L221-L240
151,997
ocpsoft/common
api/src/main/java/org/ocpsoft/common/services/ServiceLoader.java
ServiceLoader.load
@SuppressWarnings("rawtypes") public static <S> ServiceLoader load(final Class<S> service) { return load(service, Thread.currentThread().getContextClassLoader()); }
java
@SuppressWarnings("rawtypes") public static <S> ServiceLoader load(final Class<S> service) { return load(service, Thread.currentThread().getContextClassLoader()); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "static", "<", "S", ">", "ServiceLoader", "load", "(", "final", "Class", "<", "S", ">", "service", ")", "{", "return", "load", "(", "service", ",", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ")", ";", "}" ]
Creates a new service loader for the given service type, using the current thread's context class loader. An invocation of this convenience method of the form {@code ServiceLoader.load(service)</code>} is equivalent to <code>ServiceLoader.load(service, Thread.currentThread().getContextClassLoader())</code> @param service The interface or abstract class representing the service @return A new service loader
[ "Creates", "a", "new", "service", "loader", "for", "the", "given", "service", "type", "using", "the", "current", "thread", "s", "context", "class", "loader", "." ]
ae926dfd6f9af278786520faee7ee3c2f1f52ca1
https://github.com/ocpsoft/common/blob/ae926dfd6f9af278786520faee7ee3c2f1f52ca1/api/src/main/java/org/ocpsoft/common/services/ServiceLoader.java#L72-L76
151,998
jbundle/jbundle
app/program/script/src/main/java/org/jbundle/app/program/script/db/Script.java
Script.execute
public boolean execute(Properties properties) { if (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS) { try { this.writeAndRefresh(); } catch (DBException ex) { ex.printStackTrace(); } } if (this.getEditMode() != DBConstants.EDIT_CURRENT) return false; RunScriptProcess process = new RunScriptProcess(this.getTask(), null, null); boolean bSuccess = (process.doCommand(this, null) == DBConstants.NORMAL_RETURN); process.free(); return bSuccess; }
java
public boolean execute(Properties properties) { if (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS) { try { this.writeAndRefresh(); } catch (DBException ex) { ex.printStackTrace(); } } if (this.getEditMode() != DBConstants.EDIT_CURRENT) return false; RunScriptProcess process = new RunScriptProcess(this.getTask(), null, null); boolean bSuccess = (process.doCommand(this, null) == DBConstants.NORMAL_RETURN); process.free(); return bSuccess; }
[ "public", "boolean", "execute", "(", "Properties", "properties", ")", "{", "if", "(", "this", ".", "getEditMode", "(", ")", "==", "DBConstants", ".", "EDIT_IN_PROGRESS", ")", "{", "try", "{", "this", ".", "writeAndRefresh", "(", ")", ";", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}", "if", "(", "this", ".", "getEditMode", "(", ")", "!=", "DBConstants", ".", "EDIT_CURRENT", ")", "return", "false", ";", "RunScriptProcess", "process", "=", "new", "RunScriptProcess", "(", "this", ".", "getTask", "(", ")", ",", "null", ",", "null", ")", ";", "boolean", "bSuccess", "=", "(", "process", ".", "doCommand", "(", "this", ",", "null", ")", "==", "DBConstants", ".", "NORMAL_RETURN", ")", ";", "process", ".", "free", "(", ")", ";", "return", "bSuccess", ";", "}" ]
Execute Method.
[ "Execute", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/db/Script.java#L199-L215
151,999
jbundle/jbundle
app/program/script/src/main/java/org/jbundle/app/program/script/db/Script.java
Script.getTargetRecord
public Record getTargetRecord(Map<String,Object> properties, String strParam) { String strRecordName = (String)properties.get(strParam); Record record = null; if ((strRecordName != null) && (strRecordName.length() > 0)) { String strTableName = strRecordName; if (strTableName.indexOf('.') != -1) strTableName = strTableName.substring(strTableName.lastIndexOf('.') + 1); if (this.getRecordOwner() != null) // Always record = (Record)this.getRecordOwner().getRecord(strTableName); if (record != null) return record; // Already open if (strRecordName.indexOf('.') == -1) if (properties.get("package") != null) strRecordName = (String)properties.get("package") + '.' + strRecordName; if (strRecordName.indexOf('.') == -1) { ClassInfo recClassInfo = new ClassInfo(this.getRecordOwner()); try { recClassInfo.getField(ClassInfo.CLASS_NAME).setString(strRecordName); recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY); if (recClassInfo.seek(null)) strRecordName = recClassInfo.getPackageName(null) + '.' + strRecordName; } catch (DBException ex) { ex.printStackTrace(); } finally { recClassInfo.free(); } } if (strRecordName.indexOf('.') != -1) { record = (Record)ClassServiceUtility.getClassService().makeObjectFromClassName(strRecordName); if (record != null) record.init(this.findRecordOwner()); } } return record; }
java
public Record getTargetRecord(Map<String,Object> properties, String strParam) { String strRecordName = (String)properties.get(strParam); Record record = null; if ((strRecordName != null) && (strRecordName.length() > 0)) { String strTableName = strRecordName; if (strTableName.indexOf('.') != -1) strTableName = strTableName.substring(strTableName.lastIndexOf('.') + 1); if (this.getRecordOwner() != null) // Always record = (Record)this.getRecordOwner().getRecord(strTableName); if (record != null) return record; // Already open if (strRecordName.indexOf('.') == -1) if (properties.get("package") != null) strRecordName = (String)properties.get("package") + '.' + strRecordName; if (strRecordName.indexOf('.') == -1) { ClassInfo recClassInfo = new ClassInfo(this.getRecordOwner()); try { recClassInfo.getField(ClassInfo.CLASS_NAME).setString(strRecordName); recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY); if (recClassInfo.seek(null)) strRecordName = recClassInfo.getPackageName(null) + '.' + strRecordName; } catch (DBException ex) { ex.printStackTrace(); } finally { recClassInfo.free(); } } if (strRecordName.indexOf('.') != -1) { record = (Record)ClassServiceUtility.getClassService().makeObjectFromClassName(strRecordName); if (record != null) record.init(this.findRecordOwner()); } } return record; }
[ "public", "Record", "getTargetRecord", "(", "Map", "<", "String", ",", "Object", ">", "properties", ",", "String", "strParam", ")", "{", "String", "strRecordName", "=", "(", "String", ")", "properties", ".", "get", "(", "strParam", ")", ";", "Record", "record", "=", "null", ";", "if", "(", "(", "strRecordName", "!=", "null", ")", "&&", "(", "strRecordName", ".", "length", "(", ")", ">", "0", ")", ")", "{", "String", "strTableName", "=", "strRecordName", ";", "if", "(", "strTableName", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "strTableName", "=", "strTableName", ".", "substring", "(", "strTableName", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ")", ";", "if", "(", "this", ".", "getRecordOwner", "(", ")", "!=", "null", ")", "// Always", "record", "=", "(", "Record", ")", "this", ".", "getRecordOwner", "(", ")", ".", "getRecord", "(", "strTableName", ")", ";", "if", "(", "record", "!=", "null", ")", "return", "record", ";", "// Already open", "if", "(", "strRecordName", ".", "indexOf", "(", "'", "'", ")", "==", "-", "1", ")", "if", "(", "properties", ".", "get", "(", "\"package\"", ")", "!=", "null", ")", "strRecordName", "=", "(", "String", ")", "properties", ".", "get", "(", "\"package\"", ")", "+", "'", "'", "+", "strRecordName", ";", "if", "(", "strRecordName", ".", "indexOf", "(", "'", "'", ")", "==", "-", "1", ")", "{", "ClassInfo", "recClassInfo", "=", "new", "ClassInfo", "(", "this", ".", "getRecordOwner", "(", ")", ")", ";", "try", "{", "recClassInfo", ".", "getField", "(", "ClassInfo", ".", "CLASS_NAME", ")", ".", "setString", "(", "strRecordName", ")", ";", "recClassInfo", ".", "setKeyArea", "(", "ClassInfo", ".", "CLASS_NAME_KEY", ")", ";", "if", "(", "recClassInfo", ".", "seek", "(", "null", ")", ")", "strRecordName", "=", "recClassInfo", ".", "getPackageName", "(", "null", ")", "+", "'", "'", "+", "strRecordName", ";", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "recClassInfo", ".", "free", "(", ")", ";", "}", "}", "if", "(", "strRecordName", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "{", "record", "=", "(", "Record", ")", "ClassServiceUtility", ".", "getClassService", "(", ")", ".", "makeObjectFromClassName", "(", "strRecordName", ")", ";", "if", "(", "record", "!=", "null", ")", "record", ".", "init", "(", "this", ".", "findRecordOwner", "(", ")", ")", ";", "}", "}", "return", "record", ";", "}" ]
GetTargetRecord Method.
[ "GetTargetRecord", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/db/Script.java#L219-L257