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
5,800
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
ClassFinder.instance
public static ClassFinder instance(Context context) { ClassFinder instance = context.get(classFinderKey); if (instance == null) instance = new ClassFinder(context); return instance; }
java
public static ClassFinder instance(Context context) { ClassFinder instance = context.get(classFinderKey); if (instance == null) instance = new ClassFinder(context); return instance; }
[ "public", "static", "ClassFinder", "instance", "(", "Context", "context", ")", "{", "ClassFinder", "instance", "=", "context", ".", "get", "(", "classFinderKey", ")", ";", "if", "(", "instance", "==", "null", ")", "instance", "=", "new", "ClassFinder", "(", "context", ")", ";", "return", "instance", ";", "}" ]
Get the ClassFinder instance for this invocation.
[ "Get", "the", "ClassFinder", "instance", "for", "this", "invocation", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java#L173-L178
5,801
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
ClassFinder.getSupplementaryFlags
long getSupplementaryFlags(ClassSymbol c) { if (jrtIndex == null || !jrtIndex.isInJRT(c.classfile) || c.name == names.module_info) { return 0; } if (supplementaryFlags == null) { supplementaryFlags = new HashMap<>(); } Long flags = supplementaryFlags.get(c.packge()); if (flags == null) { long newFlags = 0; try { JRTIndex.CtSym ctSym = jrtIndex.getCtSym(c.packge().flatName()); Profile minProfile = Profile.DEFAULT; if (ctSym.proprietary) newFlags |= PROPRIETARY; if (ctSym.minProfile != null) minProfile = Profile.lookup(ctSym.minProfile); if (profile != Profile.DEFAULT && minProfile.value > profile.value) { newFlags |= NOT_IN_PROFILE; } } catch (IOException ignore) { } supplementaryFlags.put(c.packge(), flags = newFlags); } return flags; }
java
long getSupplementaryFlags(ClassSymbol c) { if (jrtIndex == null || !jrtIndex.isInJRT(c.classfile) || c.name == names.module_info) { return 0; } if (supplementaryFlags == null) { supplementaryFlags = new HashMap<>(); } Long flags = supplementaryFlags.get(c.packge()); if (flags == null) { long newFlags = 0; try { JRTIndex.CtSym ctSym = jrtIndex.getCtSym(c.packge().flatName()); Profile minProfile = Profile.DEFAULT; if (ctSym.proprietary) newFlags |= PROPRIETARY; if (ctSym.minProfile != null) minProfile = Profile.lookup(ctSym.minProfile); if (profile != Profile.DEFAULT && minProfile.value > profile.value) { newFlags |= NOT_IN_PROFILE; } } catch (IOException ignore) { } supplementaryFlags.put(c.packge(), flags = newFlags); } return flags; }
[ "long", "getSupplementaryFlags", "(", "ClassSymbol", "c", ")", "{", "if", "(", "jrtIndex", "==", "null", "||", "!", "jrtIndex", ".", "isInJRT", "(", "c", ".", "classfile", ")", "||", "c", ".", "name", "==", "names", ".", "module_info", ")", "{", "return", "0", ";", "}", "if", "(", "supplementaryFlags", "==", "null", ")", "{", "supplementaryFlags", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "Long", "flags", "=", "supplementaryFlags", ".", "get", "(", "c", ".", "packge", "(", ")", ")", ";", "if", "(", "flags", "==", "null", ")", "{", "long", "newFlags", "=", "0", ";", "try", "{", "JRTIndex", ".", "CtSym", "ctSym", "=", "jrtIndex", ".", "getCtSym", "(", "c", ".", "packge", "(", ")", ".", "flatName", "(", ")", ")", ";", "Profile", "minProfile", "=", "Profile", ".", "DEFAULT", ";", "if", "(", "ctSym", ".", "proprietary", ")", "newFlags", "|=", "PROPRIETARY", ";", "if", "(", "ctSym", ".", "minProfile", "!=", "null", ")", "minProfile", "=", "Profile", ".", "lookup", "(", "ctSym", ".", "minProfile", ")", ";", "if", "(", "profile", "!=", "Profile", ".", "DEFAULT", "&&", "minProfile", ".", "value", ">", "profile", ".", "value", ")", "{", "newFlags", "|=", "NOT_IN_PROFILE", ";", "}", "}", "catch", "(", "IOException", "ignore", ")", "{", "}", "supplementaryFlags", ".", "put", "(", "c", ".", "packge", "(", ")", ",", "flags", "=", "newFlags", ")", ";", "}", "return", "flags", ";", "}" ]
Returns any extra flags for a class symbol. This information used to be provided using private annotations in the class file in ct.sym; in time, this information will be available from the module system.
[ "Returns", "any", "extra", "flags", "for", "a", "class", "symbol", ".", "This", "information", "used", "to", "be", "provided", "using", "private", "annotations", "in", "the", "class", "file", "in", "ct", ".", "sym", ";", "in", "time", "this", "information", "will", "be", "available", "from", "the", "module", "system", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java#L238-L265
5,802
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
ClassFinder.completeOwners
private void completeOwners(Symbol o) { if (o.kind != PCK) completeOwners(o.owner); o.complete(); }
java
private void completeOwners(Symbol o) { if (o.kind != PCK) completeOwners(o.owner); o.complete(); }
[ "private", "void", "completeOwners", "(", "Symbol", "o", ")", "{", "if", "(", "o", ".", "kind", "!=", "PCK", ")", "completeOwners", "(", "o", ".", "owner", ")", ";", "o", ".", "complete", "(", ")", ";", "}" ]
complete up through the enclosing package.
[ "complete", "up", "through", "the", "enclosing", "package", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java#L303-L306
5,803
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
ClassFinder.newCompletionFailure
private CompletionFailure newCompletionFailure(TypeSymbol c, JCDiagnostic diag) { if (!cacheCompletionFailure) { // log.warning("proc.messager", // Log.getLocalizedString("class.file.not.found", c.flatname)); // c.debug.printStackTrace(); return new CompletionFailure(c, diag); } else { CompletionFailure result = cachedCompletionFailure; result.sym = c; result.diag = diag; return result; } }
java
private CompletionFailure newCompletionFailure(TypeSymbol c, JCDiagnostic diag) { if (!cacheCompletionFailure) { // log.warning("proc.messager", // Log.getLocalizedString("class.file.not.found", c.flatname)); // c.debug.printStackTrace(); return new CompletionFailure(c, diag); } else { CompletionFailure result = cachedCompletionFailure; result.sym = c; result.diag = diag; return result; } }
[ "private", "CompletionFailure", "newCompletionFailure", "(", "TypeSymbol", "c", ",", "JCDiagnostic", "diag", ")", "{", "if", "(", "!", "cacheCompletionFailure", ")", "{", "// log.warning(\"proc.messager\",", "// Log.getLocalizedString(\"class.file.not.found\", c.flatname));", "// c.debug.printStackTrace();", "return", "new", "CompletionFailure", "(", "c", ",", "diag", ")", ";", "}", "else", "{", "CompletionFailure", "result", "=", "cachedCompletionFailure", ";", "result", ".", "sym", "=", "c", ";", "result", ".", "diag", "=", "diag", ";", "return", "result", ";", "}", "}" ]
Static factory for CompletionFailure objects. In practice, only one can be used at a time, so we share one to reduce the expense of allocating new exception objects.
[ "Static", "factory", "for", "CompletionFailure", "objects", ".", "In", "practice", "only", "one", "can", "be", "used", "at", "a", "time", "so", "we", "share", "one", "to", "reduce", "the", "expense", "of", "allocating", "new", "exception", "objects", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java#L375-L388
5,804
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
ClassFinder.preferredFileObject
protected JavaFileObject preferredFileObject(JavaFileObject a, JavaFileObject b) { if (preferSource) return (a.getKind() == JavaFileObject.Kind.SOURCE) ? a : b; else { long adate = a.getLastModified(); long bdate = b.getLastModified(); // 6449326: policy for bad lastModifiedTime in ClassReader //assert adate >= 0 && bdate >= 0; return (adate > bdate) ? a : b; } }
java
protected JavaFileObject preferredFileObject(JavaFileObject a, JavaFileObject b) { if (preferSource) return (a.getKind() == JavaFileObject.Kind.SOURCE) ? a : b; else { long adate = a.getLastModified(); long bdate = b.getLastModified(); // 6449326: policy for bad lastModifiedTime in ClassReader //assert adate >= 0 && bdate >= 0; return (adate > bdate) ? a : b; } }
[ "protected", "JavaFileObject", "preferredFileObject", "(", "JavaFileObject", "a", ",", "JavaFileObject", "b", ")", "{", "if", "(", "preferSource", ")", "return", "(", "a", ".", "getKind", "(", ")", "==", "JavaFileObject", ".", "Kind", ".", "SOURCE", ")", "?", "a", ":", "b", ";", "else", "{", "long", "adate", "=", "a", ".", "getLastModified", "(", ")", ";", "long", "bdate", "=", "b", ".", "getLastModified", "(", ")", ";", "// 6449326: policy for bad lastModifiedTime in ClassReader", "//assert adate >= 0 && bdate >= 0;", "return", "(", "adate", ">", "bdate", ")", "?", "a", ":", "b", ";", "}", "}" ]
Implement policy to choose to derive information from a source file or a class file when both are present. May be overridden by subclasses.
[ "Implement", "policy", "to", "choose", "to", "derive", "information", "from", "a", "source", "file", "or", "a", "class", "file", "when", "both", "are", "present", ".", "May", "be", "overridden", "by", "subclasses", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java#L471-L483
5,805
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
ClassFinder.scanModulePaths
private void scanModulePaths(PackageSymbol p, ModuleSymbol msym) throws IOException { Set<JavaFileObject.Kind> kinds = getPackageFileKinds(); Set<JavaFileObject.Kind> classKinds = EnumSet.copyOf(kinds); classKinds.remove(JavaFileObject.Kind.SOURCE); boolean wantClassFiles = !classKinds.isEmpty(); Set<JavaFileObject.Kind> sourceKinds = EnumSet.copyOf(kinds); sourceKinds.remove(JavaFileObject.Kind.CLASS); boolean wantSourceFiles = !sourceKinds.isEmpty(); String packageName = p.fullname.toString(); Location classLocn = msym.classLocation; Location sourceLocn = msym.sourceLocation; Location patchLocn = msym.patchLocation; Location patchOutLocn = msym.patchOutputLocation; boolean prevPreferCurrent = preferCurrent; try { preferCurrent = false; if (wantClassFiles && (patchOutLocn != null)) { fillIn(p, patchOutLocn, list(patchOutLocn, p, packageName, classKinds)); } if ((wantClassFiles || wantSourceFiles) && (patchLocn != null)) { Set<JavaFileObject.Kind> combined = EnumSet.noneOf(JavaFileObject.Kind.class); combined.addAll(classKinds); combined.addAll(sourceKinds); fillIn(p, patchLocn, list(patchLocn, p, packageName, combined)); } preferCurrent = true; if (wantClassFiles && (classLocn != null)) { fillIn(p, classLocn, list(classLocn, p, packageName, classKinds)); } if (wantSourceFiles && (sourceLocn != null)) { fillIn(p, sourceLocn, list(sourceLocn, p, packageName, sourceKinds)); } } finally { preferCurrent = prevPreferCurrent; } }
java
private void scanModulePaths(PackageSymbol p, ModuleSymbol msym) throws IOException { Set<JavaFileObject.Kind> kinds = getPackageFileKinds(); Set<JavaFileObject.Kind> classKinds = EnumSet.copyOf(kinds); classKinds.remove(JavaFileObject.Kind.SOURCE); boolean wantClassFiles = !classKinds.isEmpty(); Set<JavaFileObject.Kind> sourceKinds = EnumSet.copyOf(kinds); sourceKinds.remove(JavaFileObject.Kind.CLASS); boolean wantSourceFiles = !sourceKinds.isEmpty(); String packageName = p.fullname.toString(); Location classLocn = msym.classLocation; Location sourceLocn = msym.sourceLocation; Location patchLocn = msym.patchLocation; Location patchOutLocn = msym.patchOutputLocation; boolean prevPreferCurrent = preferCurrent; try { preferCurrent = false; if (wantClassFiles && (patchOutLocn != null)) { fillIn(p, patchOutLocn, list(patchOutLocn, p, packageName, classKinds)); } if ((wantClassFiles || wantSourceFiles) && (patchLocn != null)) { Set<JavaFileObject.Kind> combined = EnumSet.noneOf(JavaFileObject.Kind.class); combined.addAll(classKinds); combined.addAll(sourceKinds); fillIn(p, patchLocn, list(patchLocn, p, packageName, combined)); } preferCurrent = true; if (wantClassFiles && (classLocn != null)) { fillIn(p, classLocn, list(classLocn, p, packageName, classKinds)); } if (wantSourceFiles && (sourceLocn != null)) { fillIn(p, sourceLocn, list(sourceLocn, p, packageName, sourceKinds)); } } finally { preferCurrent = prevPreferCurrent; } }
[ "private", "void", "scanModulePaths", "(", "PackageSymbol", "p", ",", "ModuleSymbol", "msym", ")", "throws", "IOException", "{", "Set", "<", "JavaFileObject", ".", "Kind", ">", "kinds", "=", "getPackageFileKinds", "(", ")", ";", "Set", "<", "JavaFileObject", ".", "Kind", ">", "classKinds", "=", "EnumSet", ".", "copyOf", "(", "kinds", ")", ";", "classKinds", ".", "remove", "(", "JavaFileObject", ".", "Kind", ".", "SOURCE", ")", ";", "boolean", "wantClassFiles", "=", "!", "classKinds", ".", "isEmpty", "(", ")", ";", "Set", "<", "JavaFileObject", ".", "Kind", ">", "sourceKinds", "=", "EnumSet", ".", "copyOf", "(", "kinds", ")", ";", "sourceKinds", ".", "remove", "(", "JavaFileObject", ".", "Kind", ".", "CLASS", ")", ";", "boolean", "wantSourceFiles", "=", "!", "sourceKinds", ".", "isEmpty", "(", ")", ";", "String", "packageName", "=", "p", ".", "fullname", ".", "toString", "(", ")", ";", "Location", "classLocn", "=", "msym", ".", "classLocation", ";", "Location", "sourceLocn", "=", "msym", ".", "sourceLocation", ";", "Location", "patchLocn", "=", "msym", ".", "patchLocation", ";", "Location", "patchOutLocn", "=", "msym", ".", "patchOutputLocation", ";", "boolean", "prevPreferCurrent", "=", "preferCurrent", ";", "try", "{", "preferCurrent", "=", "false", ";", "if", "(", "wantClassFiles", "&&", "(", "patchOutLocn", "!=", "null", ")", ")", "{", "fillIn", "(", "p", ",", "patchOutLocn", ",", "list", "(", "patchOutLocn", ",", "p", ",", "packageName", ",", "classKinds", ")", ")", ";", "}", "if", "(", "(", "wantClassFiles", "||", "wantSourceFiles", ")", "&&", "(", "patchLocn", "!=", "null", ")", ")", "{", "Set", "<", "JavaFileObject", ".", "Kind", ">", "combined", "=", "EnumSet", ".", "noneOf", "(", "JavaFileObject", ".", "Kind", ".", "class", ")", ";", "combined", ".", "addAll", "(", "classKinds", ")", ";", "combined", ".", "addAll", "(", "sourceKinds", ")", ";", "fillIn", "(", "p", ",", "patchLocn", ",", "list", "(", "patchLocn", ",", "p", ",", "packageName", ",", "combined", ")", ")", ";", "}", "preferCurrent", "=", "true", ";", "if", "(", "wantClassFiles", "&&", "(", "classLocn", "!=", "null", ")", ")", "{", "fillIn", "(", "p", ",", "classLocn", ",", "list", "(", "classLocn", ",", "p", ",", "packageName", ",", "classKinds", ")", ")", ";", "}", "if", "(", "wantSourceFiles", "&&", "(", "sourceLocn", "!=", "null", ")", ")", "{", "fillIn", "(", "p", ",", "sourceLocn", ",", "list", "(", "sourceLocn", ",", "p", ",", "packageName", ",", "sourceKinds", ")", ")", ";", "}", "}", "finally", "{", "preferCurrent", "=", "prevPreferCurrent", ";", "}", "}" ]
is the same as the module's classLocation.
[ "is", "the", "same", "as", "the", "module", "s", "classLocation", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java#L541-L598
5,806
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
ClassFinder.scanUserPaths
private void scanUserPaths(PackageSymbol p, boolean includeSourcePath) throws IOException { Set<JavaFileObject.Kind> kinds = getPackageFileKinds(); Set<JavaFileObject.Kind> classKinds = EnumSet.copyOf(kinds); classKinds.remove(JavaFileObject.Kind.SOURCE); boolean wantClassFiles = !classKinds.isEmpty(); Set<JavaFileObject.Kind> sourceKinds = EnumSet.copyOf(kinds); sourceKinds.remove(JavaFileObject.Kind.CLASS); boolean wantSourceFiles = !sourceKinds.isEmpty(); boolean haveSourcePath = includeSourcePath && fileManager.hasLocation(SOURCE_PATH); if (verbose && verbosePath) { if (fileManager instanceof StandardJavaFileManager) { StandardJavaFileManager fm = (StandardJavaFileManager)fileManager; if (haveSourcePath && wantSourceFiles) { List<Path> path = List.nil(); for (Path sourcePath : fm.getLocationAsPaths(SOURCE_PATH)) { path = path.prepend(sourcePath); } log.printVerbose("sourcepath", path.reverse().toString()); } else if (wantSourceFiles) { List<Path> path = List.nil(); for (Path classPath : fm.getLocationAsPaths(CLASS_PATH)) { path = path.prepend(classPath); } log.printVerbose("sourcepath", path.reverse().toString()); } if (wantClassFiles) { List<Path> path = List.nil(); for (Path platformPath : fm.getLocationAsPaths(PLATFORM_CLASS_PATH)) { path = path.prepend(platformPath); } for (Path classPath : fm.getLocationAsPaths(CLASS_PATH)) { path = path.prepend(classPath); } log.printVerbose("classpath", path.reverse().toString()); } } } String packageName = p.fullname.toString(); if (wantSourceFiles && !haveSourcePath) { fillIn(p, CLASS_PATH, list(CLASS_PATH, p, packageName, kinds)); } else { if (wantClassFiles) fillIn(p, CLASS_PATH, list(CLASS_PATH, p, packageName, classKinds)); if (wantSourceFiles) fillIn(p, SOURCE_PATH, list(SOURCE_PATH, p, packageName, sourceKinds)); } }
java
private void scanUserPaths(PackageSymbol p, boolean includeSourcePath) throws IOException { Set<JavaFileObject.Kind> kinds = getPackageFileKinds(); Set<JavaFileObject.Kind> classKinds = EnumSet.copyOf(kinds); classKinds.remove(JavaFileObject.Kind.SOURCE); boolean wantClassFiles = !classKinds.isEmpty(); Set<JavaFileObject.Kind> sourceKinds = EnumSet.copyOf(kinds); sourceKinds.remove(JavaFileObject.Kind.CLASS); boolean wantSourceFiles = !sourceKinds.isEmpty(); boolean haveSourcePath = includeSourcePath && fileManager.hasLocation(SOURCE_PATH); if (verbose && verbosePath) { if (fileManager instanceof StandardJavaFileManager) { StandardJavaFileManager fm = (StandardJavaFileManager)fileManager; if (haveSourcePath && wantSourceFiles) { List<Path> path = List.nil(); for (Path sourcePath : fm.getLocationAsPaths(SOURCE_PATH)) { path = path.prepend(sourcePath); } log.printVerbose("sourcepath", path.reverse().toString()); } else if (wantSourceFiles) { List<Path> path = List.nil(); for (Path classPath : fm.getLocationAsPaths(CLASS_PATH)) { path = path.prepend(classPath); } log.printVerbose("sourcepath", path.reverse().toString()); } if (wantClassFiles) { List<Path> path = List.nil(); for (Path platformPath : fm.getLocationAsPaths(PLATFORM_CLASS_PATH)) { path = path.prepend(platformPath); } for (Path classPath : fm.getLocationAsPaths(CLASS_PATH)) { path = path.prepend(classPath); } log.printVerbose("classpath", path.reverse().toString()); } } } String packageName = p.fullname.toString(); if (wantSourceFiles && !haveSourcePath) { fillIn(p, CLASS_PATH, list(CLASS_PATH, p, packageName, kinds)); } else { if (wantClassFiles) fillIn(p, CLASS_PATH, list(CLASS_PATH, p, packageName, classKinds)); if (wantSourceFiles) fillIn(p, SOURCE_PATH, list(SOURCE_PATH, p, packageName, sourceKinds)); } }
[ "private", "void", "scanUserPaths", "(", "PackageSymbol", "p", ",", "boolean", "includeSourcePath", ")", "throws", "IOException", "{", "Set", "<", "JavaFileObject", ".", "Kind", ">", "kinds", "=", "getPackageFileKinds", "(", ")", ";", "Set", "<", "JavaFileObject", ".", "Kind", ">", "classKinds", "=", "EnumSet", ".", "copyOf", "(", "kinds", ")", ";", "classKinds", ".", "remove", "(", "JavaFileObject", ".", "Kind", ".", "SOURCE", ")", ";", "boolean", "wantClassFiles", "=", "!", "classKinds", ".", "isEmpty", "(", ")", ";", "Set", "<", "JavaFileObject", ".", "Kind", ">", "sourceKinds", "=", "EnumSet", ".", "copyOf", "(", "kinds", ")", ";", "sourceKinds", ".", "remove", "(", "JavaFileObject", ".", "Kind", ".", "CLASS", ")", ";", "boolean", "wantSourceFiles", "=", "!", "sourceKinds", ".", "isEmpty", "(", ")", ";", "boolean", "haveSourcePath", "=", "includeSourcePath", "&&", "fileManager", ".", "hasLocation", "(", "SOURCE_PATH", ")", ";", "if", "(", "verbose", "&&", "verbosePath", ")", "{", "if", "(", "fileManager", "instanceof", "StandardJavaFileManager", ")", "{", "StandardJavaFileManager", "fm", "=", "(", "StandardJavaFileManager", ")", "fileManager", ";", "if", "(", "haveSourcePath", "&&", "wantSourceFiles", ")", "{", "List", "<", "Path", ">", "path", "=", "List", ".", "nil", "(", ")", ";", "for", "(", "Path", "sourcePath", ":", "fm", ".", "getLocationAsPaths", "(", "SOURCE_PATH", ")", ")", "{", "path", "=", "path", ".", "prepend", "(", "sourcePath", ")", ";", "}", "log", ".", "printVerbose", "(", "\"sourcepath\"", ",", "path", ".", "reverse", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "else", "if", "(", "wantSourceFiles", ")", "{", "List", "<", "Path", ">", "path", "=", "List", ".", "nil", "(", ")", ";", "for", "(", "Path", "classPath", ":", "fm", ".", "getLocationAsPaths", "(", "CLASS_PATH", ")", ")", "{", "path", "=", "path", ".", "prepend", "(", "classPath", ")", ";", "}", "log", ".", "printVerbose", "(", "\"sourcepath\"", ",", "path", ".", "reverse", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "wantClassFiles", ")", "{", "List", "<", "Path", ">", "path", "=", "List", ".", "nil", "(", ")", ";", "for", "(", "Path", "platformPath", ":", "fm", ".", "getLocationAsPaths", "(", "PLATFORM_CLASS_PATH", ")", ")", "{", "path", "=", "path", ".", "prepend", "(", "platformPath", ")", ";", "}", "for", "(", "Path", "classPath", ":", "fm", ".", "getLocationAsPaths", "(", "CLASS_PATH", ")", ")", "{", "path", "=", "path", ".", "prepend", "(", "classPath", ")", ";", "}", "log", ".", "printVerbose", "(", "\"classpath\"", ",", "path", ".", "reverse", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "}", "}", "String", "packageName", "=", "p", ".", "fullname", ".", "toString", "(", ")", ";", "if", "(", "wantSourceFiles", "&&", "!", "haveSourcePath", ")", "{", "fillIn", "(", "p", ",", "CLASS_PATH", ",", "list", "(", "CLASS_PATH", ",", "p", ",", "packageName", ",", "kinds", ")", ")", ";", "}", "else", "{", "if", "(", "wantClassFiles", ")", "fillIn", "(", "p", ",", "CLASS_PATH", ",", "list", "(", "CLASS_PATH", ",", "p", ",", "packageName", ",", "classKinds", ")", ")", ";", "if", "(", "wantSourceFiles", ")", "fillIn", "(", "p", ",", "SOURCE_PATH", ",", "list", "(", "SOURCE_PATH", ",", "p", ",", "packageName", ",", "sourceKinds", ")", ")", ";", "}", "}" ]
Scans class path and source path for files in given package.
[ "Scans", "class", "path", "and", "source", "path", "for", "files", "in", "given", "package", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java#L603-L666
5,807
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
ClassFinder.scanPlatformPath
private void scanPlatformPath(PackageSymbol p) throws IOException { fillIn(p, PLATFORM_CLASS_PATH, list(PLATFORM_CLASS_PATH, p, p.fullname.toString(), allowSigFiles ? EnumSet.of(JavaFileObject.Kind.CLASS, JavaFileObject.Kind.OTHER) : EnumSet.of(JavaFileObject.Kind.CLASS))); }
java
private void scanPlatformPath(PackageSymbol p) throws IOException { fillIn(p, PLATFORM_CLASS_PATH, list(PLATFORM_CLASS_PATH, p, p.fullname.toString(), allowSigFiles ? EnumSet.of(JavaFileObject.Kind.CLASS, JavaFileObject.Kind.OTHER) : EnumSet.of(JavaFileObject.Kind.CLASS))); }
[ "private", "void", "scanPlatformPath", "(", "PackageSymbol", "p", ")", "throws", "IOException", "{", "fillIn", "(", "p", ",", "PLATFORM_CLASS_PATH", ",", "list", "(", "PLATFORM_CLASS_PATH", ",", "p", ",", "p", ".", "fullname", ".", "toString", "(", ")", ",", "allowSigFiles", "?", "EnumSet", ".", "of", "(", "JavaFileObject", ".", "Kind", ".", "CLASS", ",", "JavaFileObject", ".", "Kind", ".", "OTHER", ")", ":", "EnumSet", ".", "of", "(", "JavaFileObject", ".", "Kind", ".", "CLASS", ")", ")", ")", ";", "}" ]
Scans platform class path for files in given package.
[ "Scans", "platform", "class", "path", "for", "files", "in", "given", "package", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java#L671-L679
5,808
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java
MandatoryWarningHandler.logMandatoryWarning
private void logMandatoryWarning(DiagnosticPosition pos, String msg, Object... args) { // Note: the following log methods are safe if lintCategory is null. if (enforceMandatory) log.mandatoryWarning(lintCategory, pos, msg, args); else log.warning(lintCategory, pos, msg, args); }
java
private void logMandatoryWarning(DiagnosticPosition pos, String msg, Object... args) { // Note: the following log methods are safe if lintCategory is null. if (enforceMandatory) log.mandatoryWarning(lintCategory, pos, msg, args); else log.warning(lintCategory, pos, msg, args); }
[ "private", "void", "logMandatoryWarning", "(", "DiagnosticPosition", "pos", ",", "String", "msg", ",", "Object", "...", "args", ")", "{", "// Note: the following log methods are safe if lintCategory is null.", "if", "(", "enforceMandatory", ")", "log", ".", "mandatoryWarning", "(", "lintCategory", ",", "pos", ",", "msg", ",", "args", ")", ";", "else", "log", ".", "warning", "(", "lintCategory", ",", "pos", ",", "msg", ",", "args", ")", ";", "}" ]
Reports a mandatory warning to the log. If mandatory warnings are not being enforced, treat this as an ordinary warning.
[ "Reports", "a", "mandatory", "warning", "to", "the", "log", ".", "If", "mandatory", "warnings", "are", "not", "being", "enforced", "treat", "this", "as", "an", "ordinary", "warning", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java#L251-L258
5,809
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java
MandatoryWarningHandler.logMandatoryNote
private void logMandatoryNote(JavaFileObject file, String msg, Object... args) { if (enforceMandatory) log.mandatoryNote(file, msg, args); else log.note(file, msg, args); }
java
private void logMandatoryNote(JavaFileObject file, String msg, Object... args) { if (enforceMandatory) log.mandatoryNote(file, msg, args); else log.note(file, msg, args); }
[ "private", "void", "logMandatoryNote", "(", "JavaFileObject", "file", ",", "String", "msg", ",", "Object", "...", "args", ")", "{", "if", "(", "enforceMandatory", ")", "log", ".", "mandatoryNote", "(", "file", ",", "msg", ",", "args", ")", ";", "else", "log", ".", "note", "(", "file", ",", "msg", ",", "args", ")", ";", "}" ]
Reports a mandatory note to the log. If mandatory notes are not being enforced, treat this as an ordinary note.
[ "Reports", "a", "mandatory", "note", "to", "the", "log", ".", "If", "mandatory", "notes", "are", "not", "being", "enforced", "treat", "this", "as", "an", "ordinary", "note", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java#L264-L269
5,810
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
JavacFileManager.isValidFile
private boolean isValidFile(String s, Set<JavaFileObject.Kind> fileKinds) { JavaFileObject.Kind kind = getKind(s); return fileKinds.contains(kind); }
java
private boolean isValidFile(String s, Set<JavaFileObject.Kind> fileKinds) { JavaFileObject.Kind kind = getKind(s); return fileKinds.contains(kind); }
[ "private", "boolean", "isValidFile", "(", "String", "s", ",", "Set", "<", "JavaFileObject", ".", "Kind", ">", "fileKinds", ")", "{", "JavaFileObject", ".", "Kind", "kind", "=", "getKind", "(", "s", ")", ";", "return", "fileKinds", ".", "contains", "(", "kind", ")", ";", "}" ]
container is a directory, a zip file, or a non-existent path.
[ "container", "is", "a", "directory", "a", "zip", "file", "or", "a", "non", "-", "existent", "path", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java#L613-L616
5,811
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
JavacFileManager.getRelativeName
public static String getRelativeName(File file) { if (!file.isAbsolute()) { String result = file.getPath().replace(File.separatorChar, '/'); if (isRelativeUri(result)) return result; } throw new IllegalArgumentException("Invalid relative path: " + file); }
java
public static String getRelativeName(File file) { if (!file.isAbsolute()) { String result = file.getPath().replace(File.separatorChar, '/'); if (isRelativeUri(result)) return result; } throw new IllegalArgumentException("Invalid relative path: " + file); }
[ "public", "static", "String", "getRelativeName", "(", "File", "file", ")", "{", "if", "(", "!", "file", ".", "isAbsolute", "(", ")", ")", "{", "String", "result", "=", "file", ".", "getPath", "(", ")", ".", "replace", "(", "File", ".", "separatorChar", ",", "'", "'", ")", ";", "if", "(", "isRelativeUri", "(", "result", ")", ")", "return", "result", ";", "}", "throw", "new", "IllegalArgumentException", "(", "\"Invalid relative path: \"", "+", "file", ")", ";", "}" ]
Converts a relative file name to a relative URI. This is different from File.toURI as this method does not canonicalize the file before creating the URI. Furthermore, no schema is used. @param file a relative file name @return a relative URI @throws IllegalArgumentException if the file name is not relative according to the definition given in {@link javax.tools.JavaFileManager#getFileForInput}
[ "Converts", "a", "relative", "file", "name", "to", "a", "relative", "URI", ".", "This", "is", "different", "from", "File", ".", "toURI", "as", "this", "method", "does", "not", "canonicalize", "the", "file", "before", "creating", "the", "URI", ".", "Furthermore", "no", "schema", "is", "used", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java#L1069-L1076
5,812
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
PackageSummaryBuilder.buildSummary
public void buildSummary(XMLNode node, Content packageContentTree) { Content summaryContentTree = packageWriter.getSummaryHeader(); buildChildren(node, summaryContentTree); packageContentTree.addContent(summaryContentTree); }
java
public void buildSummary(XMLNode node, Content packageContentTree) { Content summaryContentTree = packageWriter.getSummaryHeader(); buildChildren(node, summaryContentTree); packageContentTree.addContent(summaryContentTree); }
[ "public", "void", "buildSummary", "(", "XMLNode", "node", ",", "Content", "packageContentTree", ")", "{", "Content", "summaryContentTree", "=", "packageWriter", ".", "getSummaryHeader", "(", ")", ";", "buildChildren", "(", "node", ",", "summaryContentTree", ")", ";", "packageContentTree", ".", "addContent", "(", "summaryContentTree", ")", ";", "}" ]
Build the package summary. @param node the XML element that specifies which components to document @param packageContentTree the package content tree to which the summaries will be added
[ "Build", "the", "package", "summary", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java#L151-L155
5,813
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getTargetModulePackageLink
public Content getTargetModulePackageLink(PackageElement pkg, String target, Content label, ModuleElement mdle) { return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), label, "", target); }
java
public Content getTargetModulePackageLink(PackageElement pkg, String target, Content label, ModuleElement mdle) { return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), label, "", target); }
[ "public", "Content", "getTargetModulePackageLink", "(", "PackageElement", "pkg", ",", "String", "target", ",", "Content", "label", ",", "ModuleElement", "mdle", ")", "{", "return", "getHyperLink", "(", "pathString", "(", "pkg", ",", "DocPaths", ".", "PACKAGE_SUMMARY", ")", ",", "label", ",", "\"\"", ",", "target", ")", ";", "}" ]
Get Module Package link, with target frame. @param pkg the PackageElement @param target name of the target frame @param label tag for the link @param mdle the module being documented @return a content for the target module packages link
[ "Get", "Module", "Package", "link", "with", "target", "frame", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L372-L376
5,814
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getTargetModuleLink
public Content getTargetModuleLink(String target, Content label, ModuleElement mdle) { return getHyperLink(pathToRoot.resolve( DocPaths.moduleSummary(mdle)), label, "", target); }
java
public Content getTargetModuleLink(String target, Content label, ModuleElement mdle) { return getHyperLink(pathToRoot.resolve( DocPaths.moduleSummary(mdle)), label, "", target); }
[ "public", "Content", "getTargetModuleLink", "(", "String", "target", ",", "Content", "label", ",", "ModuleElement", "mdle", ")", "{", "return", "getHyperLink", "(", "pathToRoot", ".", "resolve", "(", "DocPaths", ".", "moduleSummary", "(", "mdle", ")", ")", ",", "label", ",", "\"\"", ",", "target", ")", ";", "}" ]
Get Module link, with target frame. @param target name of the target frame @param label tag for the link @param mdle the module being documented @return a content for the target module link
[ "Get", "Module", "link", "with", "target", "frame", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L386-L389
5,815
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getNavLinkModule
protected Content getNavLinkModule(ModuleElement mdle) { Content linkContent = getModuleLink(mdle, contents.moduleLabel); Content li = HtmlTree.LI(linkContent); return li; }
java
protected Content getNavLinkModule(ModuleElement mdle) { Content linkContent = getModuleLink(mdle, contents.moduleLabel); Content li = HtmlTree.LI(linkContent); return li; }
[ "protected", "Content", "getNavLinkModule", "(", "ModuleElement", "mdle", ")", "{", "Content", "linkContent", "=", "getModuleLink", "(", "mdle", ",", "contents", ".", "moduleLabel", ")", ";", "Content", "li", "=", "HtmlTree", ".", "LI", "(", "linkContent", ")", ";", "return", "li", ";", "}" ]
Get link to the module summary page for the module passed. @param mdle Module to which link will be generated @return a content tree for the link
[ "Get", "link", "to", "the", "module", "summary", "page", "for", "the", "module", "passed", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L712-L716
5,816
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getNavLinkPrevious
public Content getNavLinkPrevious(DocPath prev) { Content li; if (prev != null) { li = HtmlTree.LI(getHyperLink(prev, contents.prevLabel, "", "")); } else li = HtmlTree.LI(contents.prevLabel); return li; }
java
public Content getNavLinkPrevious(DocPath prev) { Content li; if (prev != null) { li = HtmlTree.LI(getHyperLink(prev, contents.prevLabel, "", "")); } else li = HtmlTree.LI(contents.prevLabel); return li; }
[ "public", "Content", "getNavLinkPrevious", "(", "DocPath", "prev", ")", "{", "Content", "li", ";", "if", "(", "prev", "!=", "null", ")", "{", "li", "=", "HtmlTree", ".", "LI", "(", "getHyperLink", "(", "prev", ",", "contents", ".", "prevLabel", ",", "\"\"", ",", "\"\"", ")", ")", ";", "}", "else", "li", "=", "HtmlTree", ".", "LI", "(", "contents", ".", "prevLabel", ")", ";", "return", "li", ";", "}" ]
Get link for previous file. @param prev File name for the prev link @return a content tree for the link
[ "Get", "link", "for", "previous", "file", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L766-L774
5,817
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getNavLinkDeprecated
protected Content getNavLinkDeprecated() { Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST), contents.deprecatedLabel, "", ""); Content li = HtmlTree.LI(linkContent); return li; }
java
protected Content getNavLinkDeprecated() { Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST), contents.deprecatedLabel, "", ""); Content li = HtmlTree.LI(linkContent); return li; }
[ "protected", "Content", "getNavLinkDeprecated", "(", ")", "{", "Content", "linkContent", "=", "getHyperLink", "(", "pathToRoot", ".", "resolve", "(", "DocPaths", ".", "DEPRECATED_LIST", ")", ",", "contents", ".", "deprecatedLabel", ",", "\"\"", ",", "\"\"", ")", ";", "Content", "li", "=", "HtmlTree", ".", "LI", "(", "linkContent", ")", ";", "return", "li", ";", "}" ]
Get "Deprecated" API link in the navigation bar. @return a content tree for the link
[ "Get", "Deprecated", "API", "link", "in", "the", "navigation", "bar", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L871-L876
5,818
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getTableCaption
public Content getTableCaption(Content title) { Content captionSpan = HtmlTree.SPAN(title); Content space = Contents.SPACE; Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, space); Content caption = HtmlTree.CAPTION(captionSpan); caption.addContent(tabSpan); return caption; }
java
public Content getTableCaption(Content title) { Content captionSpan = HtmlTree.SPAN(title); Content space = Contents.SPACE; Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, space); Content caption = HtmlTree.CAPTION(captionSpan); caption.addContent(tabSpan); return caption; }
[ "public", "Content", "getTableCaption", "(", "Content", "title", ")", "{", "Content", "captionSpan", "=", "HtmlTree", ".", "SPAN", "(", "title", ")", ";", "Content", "space", "=", "Contents", ".", "SPACE", ";", "Content", "tabSpan", "=", "HtmlTree", ".", "SPAN", "(", "HtmlStyle", ".", "tabEnd", ",", "space", ")", ";", "Content", "caption", "=", "HtmlTree", ".", "CAPTION", "(", "captionSpan", ")", ";", "caption", ".", "addContent", "(", "tabSpan", ")", ";", "return", "caption", ";", "}" ]
Get table caption. @param rawText the caption for the table which could be raw Html @return a content tree for the caption
[ "Get", "table", "caption", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L979-L986
5,819
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.pathString
protected DocPath pathString(TypeElement te, DocPath name) { return pathString(utils.containingPackage(te), name); }
java
protected DocPath pathString(TypeElement te, DocPath name) { return pathString(utils.containingPackage(te), name); }
[ "protected", "DocPath", "pathString", "(", "TypeElement", "te", ",", "DocPath", "name", ")", "{", "return", "pathString", "(", "utils", ".", "containingPackage", "(", "te", ")", ",", "name", ")", ";", "}" ]
Return the path to the class page for a typeElement. @param te TypeElement for which the path is requested. @param name Name of the file(doesn't include path).
[ "Return", "the", "path", "to", "the", "class", "page", "for", "a", "typeElement", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L1061-L1063
5,820
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getModuleLink
public Content getModuleLink(ModuleElement mdle, Content label) { boolean included = utils.isIncluded(mdle); return (included) ? getHyperLink(pathToRoot.resolve(DocPaths.moduleSummary(mdle)), label, "", "") : label; }
java
public Content getModuleLink(ModuleElement mdle, Content label) { boolean included = utils.isIncluded(mdle); return (included) ? getHyperLink(pathToRoot.resolve(DocPaths.moduleSummary(mdle)), label, "", "") : label; }
[ "public", "Content", "getModuleLink", "(", "ModuleElement", "mdle", ",", "Content", "label", ")", "{", "boolean", "included", "=", "utils", ".", "isIncluded", "(", "mdle", ")", ";", "return", "(", "included", ")", "?", "getHyperLink", "(", "pathToRoot", ".", "resolve", "(", "DocPaths", ".", "moduleSummary", "(", "mdle", ")", ")", ",", "label", ",", "\"\"", ",", "\"\"", ")", ":", "label", ";", "}" ]
Get Module link. @param mdle the module being documented @param label tag for the link @return a content for the module link
[ "Get", "Module", "link", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L1144-L1149
5,821
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getDeprecatedPhrase
public Content getDeprecatedPhrase(Element e) { return (utils.isDeprecatedForRemoval(e)) ? contents.deprecatedForRemovalPhrase : contents.deprecatedPhrase; }
java
public Content getDeprecatedPhrase(Element e) { return (utils.isDeprecatedForRemoval(e)) ? contents.deprecatedForRemovalPhrase : contents.deprecatedPhrase; }
[ "public", "Content", "getDeprecatedPhrase", "(", "Element", "e", ")", "{", "return", "(", "utils", ".", "isDeprecatedForRemoval", "(", "e", ")", ")", "?", "contents", ".", "deprecatedForRemovalPhrase", ":", "contents", ".", "deprecatedPhrase", ";", "}" ]
Get the deprecated phrase as content. @param e the Element for which the inline deprecated comment will be added @return a content tree for the deprecated phrase.
[ "Get", "the", "deprecated", "phrase", "as", "content", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L1634-L1638
5,822
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addScriptProperties
public void addScriptProperties(Content head) { HtmlTree javascript = HtmlTree.SCRIPT(pathToRoot.resolve(DocPaths.JAVASCRIPT).getPath()); head.addContent(javascript); if (configuration.createindex) { if (pathToRoot != null && script != null) { String ptrPath = pathToRoot.isEmpty() ? "." : pathToRoot.getPath(); script.addContent(new RawHtml("var pathtoroot = \"" + ptrPath + "/\";loadScripts(document, \'script\');")); } addJQueryFile(head, DocPaths.JSZIP_MIN); addJQueryFile(head, DocPaths.JSZIPUTILS_MIN); head.addContent(new RawHtml("<!--[if IE]>")); addJQueryFile(head, DocPaths.JSZIPUTILS_IE_MIN); head.addContent(new RawHtml("<![endif]-->")); addJQueryFile(head, DocPaths.JQUERY_JS_1_10); addJQueryFile(head, DocPaths.JQUERY_JS); } }
java
public void addScriptProperties(Content head) { HtmlTree javascript = HtmlTree.SCRIPT(pathToRoot.resolve(DocPaths.JAVASCRIPT).getPath()); head.addContent(javascript); if (configuration.createindex) { if (pathToRoot != null && script != null) { String ptrPath = pathToRoot.isEmpty() ? "." : pathToRoot.getPath(); script.addContent(new RawHtml("var pathtoroot = \"" + ptrPath + "/\";loadScripts(document, \'script\');")); } addJQueryFile(head, DocPaths.JSZIP_MIN); addJQueryFile(head, DocPaths.JSZIPUTILS_MIN); head.addContent(new RawHtml("<!--[if IE]>")); addJQueryFile(head, DocPaths.JSZIPUTILS_IE_MIN); head.addContent(new RawHtml("<![endif]-->")); addJQueryFile(head, DocPaths.JQUERY_JS_1_10); addJQueryFile(head, DocPaths.JQUERY_JS); } }
[ "public", "void", "addScriptProperties", "(", "Content", "head", ")", "{", "HtmlTree", "javascript", "=", "HtmlTree", ".", "SCRIPT", "(", "pathToRoot", ".", "resolve", "(", "DocPaths", ".", "JAVASCRIPT", ")", ".", "getPath", "(", ")", ")", ";", "head", ".", "addContent", "(", "javascript", ")", ";", "if", "(", "configuration", ".", "createindex", ")", "{", "if", "(", "pathToRoot", "!=", "null", "&&", "script", "!=", "null", ")", "{", "String", "ptrPath", "=", "pathToRoot", ".", "isEmpty", "(", ")", "?", "\".\"", ":", "pathToRoot", ".", "getPath", "(", ")", ";", "script", ".", "addContent", "(", "new", "RawHtml", "(", "\"var pathtoroot = \\\"\"", "+", "ptrPath", "+", "\"/\\\";loadScripts(document, \\'script\\');\"", ")", ")", ";", "}", "addJQueryFile", "(", "head", ",", "DocPaths", ".", "JSZIP_MIN", ")", ";", "addJQueryFile", "(", "head", ",", "DocPaths", ".", "JSZIPUTILS_MIN", ")", ";", "head", ".", "addContent", "(", "new", "RawHtml", "(", "\"<!--[if IE]>\"", ")", ")", ";", "addJQueryFile", "(", "head", ",", "DocPaths", ".", "JSZIPUTILS_IE_MIN", ")", ";", "head", ".", "addContent", "(", "new", "RawHtml", "(", "\"<![endif]-->\"", ")", ")", ";", "addJQueryFile", "(", "head", ",", "DocPaths", ".", "JQUERY_JS_1_10", ")", ";", "addJQueryFile", "(", "head", ",", "DocPaths", ".", "JQUERY_JS", ")", ";", "}", "}" ]
Add a link to the JavaScript file. @param head the content tree to which the files will be added
[ "Add", "a", "link", "to", "the", "JavaScript", "file", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L2163-L2179
5,823
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addAnnotationInfo
public void addAnnotationInfo(PackageElement packageElement, Content htmltree) { addAnnotationInfo(packageElement, packageElement.getAnnotationMirrors(), htmltree); }
java
public void addAnnotationInfo(PackageElement packageElement, Content htmltree) { addAnnotationInfo(packageElement, packageElement.getAnnotationMirrors(), htmltree); }
[ "public", "void", "addAnnotationInfo", "(", "PackageElement", "packageElement", ",", "Content", "htmltree", ")", "{", "addAnnotationInfo", "(", "packageElement", ",", "packageElement", ".", "getAnnotationMirrors", "(", ")", ",", "htmltree", ")", ";", "}" ]
Adds the annotation types for the given packageElement. @param packageElement the package to write annotations for. @param htmltree the documentation tree to which the annotation info will be added
[ "Adds", "the", "annotation", "types", "for", "the", "given", "packageElement", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L2209-L2211
5,824
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addAnnotationInfo
public void addAnnotationInfo(Element element, Content htmltree) { addAnnotationInfo(element, element.getAnnotationMirrors(), htmltree); }
java
public void addAnnotationInfo(Element element, Content htmltree) { addAnnotationInfo(element, element.getAnnotationMirrors(), htmltree); }
[ "public", "void", "addAnnotationInfo", "(", "Element", "element", ",", "Content", "htmltree", ")", "{", "addAnnotationInfo", "(", "element", ",", "element", ".", "getAnnotationMirrors", "(", ")", ",", "htmltree", ")", ";", "}" ]
Adds the annotatation types for the given element. @param element the package to write annotations for @param htmltree the content tree to which the annotation types will be added
[ "Adds", "the", "annotatation", "types", "for", "the", "given", "element", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L2243-L2245
5,825
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addAnnotationInfo
public boolean addAnnotationInfo(int indent, Element element, VariableElement param, Content tree) { return addAnnotationInfo(indent, element, param.getAnnotationMirrors(), false, tree); }
java
public boolean addAnnotationInfo(int indent, Element element, VariableElement param, Content tree) { return addAnnotationInfo(indent, element, param.getAnnotationMirrors(), false, tree); }
[ "public", "boolean", "addAnnotationInfo", "(", "int", "indent", ",", "Element", "element", ",", "VariableElement", "param", ",", "Content", "tree", ")", "{", "return", "addAnnotationInfo", "(", "indent", ",", "element", ",", "param", ".", "getAnnotationMirrors", "(", ")", ",", "false", ",", "tree", ")", ";", "}" ]
Add the annotatation types for the given element and parameter. @param indent the number of spaces to indent the parameters. @param element the element to write annotations for. @param param the parameter to write annotations for. @param tree the content tree to which the annotation types will be added
[ "Add", "the", "annotatation", "types", "for", "the", "given", "element", "and", "parameter", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L2255-L2258
5,826
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addAnnotationInfo
private void addAnnotationInfo(Element element, List<? extends AnnotationMirror> descList, Content htmltree) { addAnnotationInfo(0, element, descList, true, htmltree); }
java
private void addAnnotationInfo(Element element, List<? extends AnnotationMirror> descList, Content htmltree) { addAnnotationInfo(0, element, descList, true, htmltree); }
[ "private", "void", "addAnnotationInfo", "(", "Element", "element", ",", "List", "<", "?", "extends", "AnnotationMirror", ">", "descList", ",", "Content", "htmltree", ")", "{", "addAnnotationInfo", "(", "0", ",", "element", ",", "descList", ",", "true", ",", "htmltree", ")", ";", "}" ]
Adds the annotatation types for the given Element. @param element the element to write annotations for. @param descList the array of {@link AnnotationDesc}. @param htmltree the documentation tree to which the annotation info will be added
[ "Adds", "the", "annotatation", "types", "for", "the", "given", "Element", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L2268-L2271
5,827
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addAnnotationInfo
private boolean addAnnotationInfo(int indent, Element element, List<? extends AnnotationMirror> descList, boolean lineBreak, Content htmltree) { List<Content> annotations = getAnnotations(indent, descList, lineBreak); String sep = ""; if (annotations.isEmpty()) { return false; } for (Content annotation: annotations) { htmltree.addContent(sep); htmltree.addContent(annotation); if (!lineBreak) { sep = " "; } } return true; }
java
private boolean addAnnotationInfo(int indent, Element element, List<? extends AnnotationMirror> descList, boolean lineBreak, Content htmltree) { List<Content> annotations = getAnnotations(indent, descList, lineBreak); String sep = ""; if (annotations.isEmpty()) { return false; } for (Content annotation: annotations) { htmltree.addContent(sep); htmltree.addContent(annotation); if (!lineBreak) { sep = " "; } } return true; }
[ "private", "boolean", "addAnnotationInfo", "(", "int", "indent", ",", "Element", "element", ",", "List", "<", "?", "extends", "AnnotationMirror", ">", "descList", ",", "boolean", "lineBreak", ",", "Content", "htmltree", ")", "{", "List", "<", "Content", ">", "annotations", "=", "getAnnotations", "(", "indent", ",", "descList", ",", "lineBreak", ")", ";", "String", "sep", "=", "\"\"", ";", "if", "(", "annotations", ".", "isEmpty", "(", ")", ")", "{", "return", "false", ";", "}", "for", "(", "Content", "annotation", ":", "annotations", ")", "{", "htmltree", ".", "addContent", "(", "sep", ")", ";", "htmltree", ".", "addContent", "(", "annotation", ")", ";", "if", "(", "!", "lineBreak", ")", "{", "sep", "=", "\" \"", ";", "}", "}", "return", "true", ";", "}" ]
Adds the annotation types for the given element. @param indent the number of extra spaces to indent the annotations. @param element the element to write annotations for. @param descList the array of {@link AnnotationDesc}. @param htmltree the documentation tree to which the annotation info will be added
[ "Adds", "the", "annotation", "types", "for", "the", "given", "element", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L2282-L2297
5,828
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java
DocTreeMaker.instance
public static DocTreeMaker instance(Context context) { DocTreeMaker instance = context.get(treeMakerKey); if (instance == null) instance = new DocTreeMaker(context); return instance; }
java
public static DocTreeMaker instance(Context context) { DocTreeMaker instance = context.get(treeMakerKey); if (instance == null) instance = new DocTreeMaker(context); return instance; }
[ "public", "static", "DocTreeMaker", "instance", "(", "Context", "context", ")", "{", "DocTreeMaker", "instance", "=", "context", ".", "get", "(", "treeMakerKey", ")", ";", "if", "(", "instance", "==", "null", ")", "instance", "=", "new", "DocTreeMaker", "(", "context", ")", ";", "return", "instance", ";", "}" ]
Get the TreeMaker instance.
[ "Get", "the", "TreeMaker", "instance", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java#L117-L122
5,829
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java
DocTreeMaker.at
public DocTreeMaker at(DiagnosticPosition pos) { this.pos = (pos == null ? Position.NOPOS : pos.getStartPosition()); return this; }
java
public DocTreeMaker at(DiagnosticPosition pos) { this.pos = (pos == null ? Position.NOPOS : pos.getStartPosition()); return this; }
[ "public", "DocTreeMaker", "at", "(", "DiagnosticPosition", "pos", ")", "{", "this", ".", "pos", "=", "(", "pos", "==", "null", "?", "Position", ".", "NOPOS", ":", "pos", ".", "getStartPosition", "(", ")", ")", ";", "return", "this", ";", "}" ]
Reassign current position.
[ "Reassign", "current", "position", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java#L157-L160
5,830
DeveloperPaul123/FilePickerLibrary
library/src/main/java/com/github/developerpaul123/filepickerlibrary/adapter/FileRecyclerViewAdapter.java
FileRecyclerViewAdapter.fileExt
private String fileExt(String url) { if (url.indexOf("?") > -1) { url = url.substring(0, url.indexOf("?")); } if (url.lastIndexOf(".") == -1) { return null; } else { String ext = url.substring(url.lastIndexOf(".")); if (ext.indexOf("%") > -1) { ext = ext.substring(0, ext.indexOf("%")); } if (ext.indexOf("/") > -1) { ext = ext.substring(0, ext.indexOf("/")); } return ext.toLowerCase(); } }
java
private String fileExt(String url) { if (url.indexOf("?") > -1) { url = url.substring(0, url.indexOf("?")); } if (url.lastIndexOf(".") == -1) { return null; } else { String ext = url.substring(url.lastIndexOf(".")); if (ext.indexOf("%") > -1) { ext = ext.substring(0, ext.indexOf("%")); } if (ext.indexOf("/") > -1) { ext = ext.substring(0, ext.indexOf("/")); } return ext.toLowerCase(); } }
[ "private", "String", "fileExt", "(", "String", "url", ")", "{", "if", "(", "url", ".", "indexOf", "(", "\"?\"", ")", ">", "-", "1", ")", "{", "url", "=", "url", ".", "substring", "(", "0", ",", "url", ".", "indexOf", "(", "\"?\"", ")", ")", ";", "}", "if", "(", "url", ".", "lastIndexOf", "(", "\".\"", ")", "==", "-", "1", ")", "{", "return", "null", ";", "}", "else", "{", "String", "ext", "=", "url", ".", "substring", "(", "url", ".", "lastIndexOf", "(", "\".\"", ")", ")", ";", "if", "(", "ext", ".", "indexOf", "(", "\"%\"", ")", ">", "-", "1", ")", "{", "ext", "=", "ext", ".", "substring", "(", "0", ",", "ext", ".", "indexOf", "(", "\"%\"", ")", ")", ";", "}", "if", "(", "ext", ".", "indexOf", "(", "\"/\"", ")", ">", "-", "1", ")", "{", "ext", "=", "ext", ".", "substring", "(", "0", ",", "ext", ".", "indexOf", "(", "\"/\"", ")", ")", ";", "}", "return", "ext", ".", "toLowerCase", "(", ")", ";", "}", "}" ]
Returns the file extension of a file. @param url the file path @return
[ "Returns", "the", "file", "extension", "of", "a", "file", "." ]
320fe48d478d1c7f961327483271db5a5e91da5b
https://github.com/DeveloperPaul123/FilePickerLibrary/blob/320fe48d478d1c7f961327483271db5a5e91da5b/library/src/main/java/com/github/developerpaul123/filepickerlibrary/adapter/FileRecyclerViewAdapter.java#L83-L100
5,831
DeveloperPaul123/FilePickerLibrary
library/src/main/java/com/github/developerpaul123/filepickerlibrary/adapter/FileRecyclerViewAdapter.java
FileRecyclerViewAdapter.decodeSampledBitmapFromByteArray
public static Bitmap decodeSampledBitmapFromByteArray(byte[] picture, int reqWidth, int reqHeight) { // First decode with inJustDecodeBounds=true to check dimensions BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(picture, 0, picture.length, options); // Calculate inSampleSize options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); // Decode bitmap with inSampleSize set options.inJustDecodeBounds = false; return BitmapFactory.decodeByteArray(picture, 0, picture.length, options); }
java
public static Bitmap decodeSampledBitmapFromByteArray(byte[] picture, int reqWidth, int reqHeight) { // First decode with inJustDecodeBounds=true to check dimensions BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(picture, 0, picture.length, options); // Calculate inSampleSize options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); // Decode bitmap with inSampleSize set options.inJustDecodeBounds = false; return BitmapFactory.decodeByteArray(picture, 0, picture.length, options); }
[ "public", "static", "Bitmap", "decodeSampledBitmapFromByteArray", "(", "byte", "[", "]", "picture", ",", "int", "reqWidth", ",", "int", "reqHeight", ")", "{", "// First decode with inJustDecodeBounds=true to check dimensions", "BitmapFactory", ".", "Options", "options", "=", "new", "BitmapFactory", ".", "Options", "(", ")", ";", "options", ".", "inJustDecodeBounds", "=", "true", ";", "BitmapFactory", ".", "decodeByteArray", "(", "picture", ",", "0", ",", "picture", ".", "length", ",", "options", ")", ";", "// Calculate inSampleSize", "options", ".", "inSampleSize", "=", "calculateInSampleSize", "(", "options", ",", "reqWidth", ",", "reqHeight", ")", ";", "// Decode bitmap with inSampleSize set", "options", ".", "inJustDecodeBounds", "=", "false", ";", "return", "BitmapFactory", ".", "decodeByteArray", "(", "picture", ",", "0", ",", "picture", ".", "length", ",", "options", ")", ";", "}" ]
From the google examples, decodes a bitmap as a byte array and then resizes it for the required width and hieght. @param picture the picture byte array @param reqWidth the required width @param reqHeight the required height @return a Bitmap
[ "From", "the", "google", "examples", "decodes", "a", "bitmap", "as", "a", "byte", "array", "and", "then", "resizes", "it", "for", "the", "required", "width", "and", "hieght", "." ]
320fe48d478d1c7f961327483271db5a5e91da5b
https://github.com/DeveloperPaul123/FilePickerLibrary/blob/320fe48d478d1c7f961327483271db5a5e91da5b/library/src/main/java/com/github/developerpaul123/filepickerlibrary/adapter/FileRecyclerViewAdapter.java#L111-L125
5,832
DeveloperPaul123/FilePickerLibrary
library/src/main/java/com/github/developerpaul123/filepickerlibrary/adapter/FileRecyclerViewAdapter.java
FileRecyclerViewAdapter.encodeBitmapToArray
public static byte[] encodeBitmapToArray(Bitmap bitmap, Bitmap.CompressFormat format) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); bitmap.compress(format, 0, outputStream); return outputStream.toByteArray(); }
java
public static byte[] encodeBitmapToArray(Bitmap bitmap, Bitmap.CompressFormat format) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); bitmap.compress(format, 0, outputStream); return outputStream.toByteArray(); }
[ "public", "static", "byte", "[", "]", "encodeBitmapToArray", "(", "Bitmap", "bitmap", ",", "Bitmap", ".", "CompressFormat", "format", ")", "{", "ByteArrayOutputStream", "outputStream", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "bitmap", ".", "compress", "(", "format", ",", "0", ",", "outputStream", ")", ";", "return", "outputStream", ".", "toByteArray", "(", ")", ";", "}" ]
Encodes a bitmap to a byte array. @param bitmap the bitmap to compress @param format the compression format for the Bitmap @return {@code byte[]} object
[ "Encodes", "a", "bitmap", "to", "a", "byte", "array", "." ]
320fe48d478d1c7f961327483271db5a5e91da5b
https://github.com/DeveloperPaul123/FilePickerLibrary/blob/320fe48d478d1c7f961327483271db5a5e91da5b/library/src/main/java/com/github/developerpaul123/filepickerlibrary/adapter/FileRecyclerViewAdapter.java#L156-L161
5,833
DeveloperPaul123/FilePickerLibrary
library/src/main/java/com/github/developerpaul123/filepickerlibrary/adapter/FileRecyclerViewAdapter.java
FileRecyclerViewAdapter.directoryExists
public boolean directoryExists(File[] files) { for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { return true; } } return false; }
java
public boolean directoryExists(File[] files) { for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { return true; } } return false; }
[ "public", "boolean", "directoryExists", "(", "File", "[", "]", "files", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "files", ".", "length", ";", "i", "++", ")", "{", "if", "(", "files", "[", "i", "]", ".", "isDirectory", "(", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks if the files contain a directory. @param files the files. @return a boolean, true if there is a file that is a directory.
[ "Checks", "if", "the", "files", "contain", "a", "directory", "." ]
320fe48d478d1c7f961327483271db5a5e91da5b
https://github.com/DeveloperPaul123/FilePickerLibrary/blob/320fe48d478d1c7f961327483271db5a5e91da5b/library/src/main/java/com/github/developerpaul123/filepickerlibrary/adapter/FileRecyclerViewAdapter.java#L306-L313
5,834
DeveloperPaul123/FilePickerLibrary
library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePicker.java
FilePicker.toggleButton
public void toggleButton(final boolean visible) { if (isFabShowing != visible) { isFabShowing = visible; int height = fab.getHeight(); if (height == 0) { ViewTreeObserver vto = fab.getViewTreeObserver(); if (vto.isAlive()) { vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { ViewTreeObserver currentVto = fab.getViewTreeObserver(); if (currentVto.isAlive()) { currentVto.removeOnPreDrawListener(this); } toggleButton(visible); return true; } }); return; } } int translationY = visible ? 0 : height; fab.animate().setInterpolator(interpolator) .setDuration(350) .translationY(translationY); // On pre-Honeycomb a translated view is still clickable, so we need to disable clicks manually fab.setClickable(visible); } }
java
public void toggleButton(final boolean visible) { if (isFabShowing != visible) { isFabShowing = visible; int height = fab.getHeight(); if (height == 0) { ViewTreeObserver vto = fab.getViewTreeObserver(); if (vto.isAlive()) { vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { ViewTreeObserver currentVto = fab.getViewTreeObserver(); if (currentVto.isAlive()) { currentVto.removeOnPreDrawListener(this); } toggleButton(visible); return true; } }); return; } } int translationY = visible ? 0 : height; fab.animate().setInterpolator(interpolator) .setDuration(350) .translationY(translationY); // On pre-Honeycomb a translated view is still clickable, so we need to disable clicks manually fab.setClickable(visible); } }
[ "public", "void", "toggleButton", "(", "final", "boolean", "visible", ")", "{", "if", "(", "isFabShowing", "!=", "visible", ")", "{", "isFabShowing", "=", "visible", ";", "int", "height", "=", "fab", ".", "getHeight", "(", ")", ";", "if", "(", "height", "==", "0", ")", "{", "ViewTreeObserver", "vto", "=", "fab", ".", "getViewTreeObserver", "(", ")", ";", "if", "(", "vto", ".", "isAlive", "(", ")", ")", "{", "vto", ".", "addOnPreDrawListener", "(", "new", "ViewTreeObserver", ".", "OnPreDrawListener", "(", ")", "{", "@", "Override", "public", "boolean", "onPreDraw", "(", ")", "{", "ViewTreeObserver", "currentVto", "=", "fab", ".", "getViewTreeObserver", "(", ")", ";", "if", "(", "currentVto", ".", "isAlive", "(", ")", ")", "{", "currentVto", ".", "removeOnPreDrawListener", "(", "this", ")", ";", "}", "toggleButton", "(", "visible", ")", ";", "return", "true", ";", "}", "}", ")", ";", "return", ";", "}", "}", "int", "translationY", "=", "visible", "?", "0", ":", "height", ";", "fab", ".", "animate", "(", ")", ".", "setInterpolator", "(", "interpolator", ")", ".", "setDuration", "(", "350", ")", ".", "translationY", "(", "translationY", ")", ";", "// On pre-Honeycomb a translated view is still clickable, so we need to disable clicks manually", "fab", ".", "setClickable", "(", "visible", ")", ";", "}", "}" ]
Toggles the material floating action button. @param visible
[ "Toggles", "the", "material", "floating", "action", "button", "." ]
320fe48d478d1c7f961327483271db5a5e91da5b
https://github.com/DeveloperPaul123/FilePickerLibrary/blob/320fe48d478d1c7f961327483271db5a5e91da5b/library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePicker.java#L383-L412
5,835
DeveloperPaul123/FilePickerLibrary
library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePicker.java
FilePicker.init
private void init() { curDirectory = new File(Environment.getExternalStorageDirectory().getPath()); currentFile = new File(curDirectory.getPath()); lastDirectory = curDirectory.getParentFile(); if (curDirectory.isDirectory()) { new UpdateFilesTask(this).execute(curDirectory); } else { try { throw new Exception(getString(R.string.file_picker_directory_error)); } catch (Exception e) { e.printStackTrace(); } } }
java
private void init() { curDirectory = new File(Environment.getExternalStorageDirectory().getPath()); currentFile = new File(curDirectory.getPath()); lastDirectory = curDirectory.getParentFile(); if (curDirectory.isDirectory()) { new UpdateFilesTask(this).execute(curDirectory); } else { try { throw new Exception(getString(R.string.file_picker_directory_error)); } catch (Exception e) { e.printStackTrace(); } } }
[ "private", "void", "init", "(", ")", "{", "curDirectory", "=", "new", "File", "(", "Environment", ".", "getExternalStorageDirectory", "(", ")", ".", "getPath", "(", ")", ")", ";", "currentFile", "=", "new", "File", "(", "curDirectory", ".", "getPath", "(", ")", ")", ";", "lastDirectory", "=", "curDirectory", ".", "getParentFile", "(", ")", ";", "if", "(", "curDirectory", ".", "isDirectory", "(", ")", ")", "{", "new", "UpdateFilesTask", "(", "this", ")", ".", "execute", "(", "curDirectory", ")", ";", "}", "else", "{", "try", "{", "throw", "new", "Exception", "(", "getString", "(", "R", ".", "string", ".", "file_picker_directory_error", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}" ]
Initialize the current directory.
[ "Initialize", "the", "current", "directory", "." ]
320fe48d478d1c7f961327483271db5a5e91da5b
https://github.com/DeveloperPaul123/FilePickerLibrary/blob/320fe48d478d1c7f961327483271db5a5e91da5b/library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePicker.java#L444-L458
5,836
DeveloperPaul123/FilePickerLibrary
library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePicker.java
FilePicker.showButtons
private void showButtons() { if (!areButtonsShowing) { buttonContainer.clearAnimation(); buttonContainer.startAnimation(slideUp); buttonContainer.setVisibility(View.VISIBLE); areButtonsShowing = true; } }
java
private void showButtons() { if (!areButtonsShowing) { buttonContainer.clearAnimation(); buttonContainer.startAnimation(slideUp); buttonContainer.setVisibility(View.VISIBLE); areButtonsShowing = true; } }
[ "private", "void", "showButtons", "(", ")", "{", "if", "(", "!", "areButtonsShowing", ")", "{", "buttonContainer", ".", "clearAnimation", "(", ")", ";", "buttonContainer", ".", "startAnimation", "(", "slideUp", ")", ";", "buttonContainer", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "areButtonsShowing", "=", "true", ";", "}", "}" ]
Method that shows the sliding panel
[ "Method", "that", "shows", "the", "sliding", "panel" ]
320fe48d478d1c7f961327483271db5a5e91da5b
https://github.com/DeveloperPaul123/FilePickerLibrary/blob/320fe48d478d1c7f961327483271db5a5e91da5b/library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePicker.java#L588-L595
5,837
DeveloperPaul123/FilePickerLibrary
library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePicker.java
FilePicker.hideButtons
private void hideButtons() { if (areButtonsShowing) { buttonContainer.clearAnimation(); buttonContainer.startAnimation(slideDown); buttonContainer.setVisibility(View.INVISIBLE); areButtonsShowing = false; } }
java
private void hideButtons() { if (areButtonsShowing) { buttonContainer.clearAnimation(); buttonContainer.startAnimation(slideDown); buttonContainer.setVisibility(View.INVISIBLE); areButtonsShowing = false; } }
[ "private", "void", "hideButtons", "(", ")", "{", "if", "(", "areButtonsShowing", ")", "{", "buttonContainer", ".", "clearAnimation", "(", ")", ";", "buttonContainer", ".", "startAnimation", "(", "slideDown", ")", ";", "buttonContainer", ".", "setVisibility", "(", "View", ".", "INVISIBLE", ")", ";", "areButtonsShowing", "=", "false", ";", "}", "}" ]
Method that hides the sliding panel
[ "Method", "that", "hides", "the", "sliding", "panel" ]
320fe48d478d1c7f961327483271db5a5e91da5b
https://github.com/DeveloperPaul123/FilePickerLibrary/blob/320fe48d478d1c7f961327483271db5a5e91da5b/library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePicker.java#L600-L607
5,838
DeveloperPaul123/FilePickerLibrary
library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePickerActivity.java
FilePickerActivity.setHeaderBackground
private void setHeaderBackground(int colorResId, int drawableResId) { if (drawableResId == -1) { try { header.setBackgroundColor(getResources().getColor(colorResId)); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } else { try { header.setBackgroundDrawable(getResources().getDrawable(drawableResId)); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } }
java
private void setHeaderBackground(int colorResId, int drawableResId) { if (drawableResId == -1) { try { header.setBackgroundColor(getResources().getColor(colorResId)); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } else { try { header.setBackgroundDrawable(getResources().getDrawable(drawableResId)); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } }
[ "private", "void", "setHeaderBackground", "(", "int", "colorResId", ",", "int", "drawableResId", ")", "{", "if", "(", "drawableResId", "==", "-", "1", ")", "{", "try", "{", "header", ".", "setBackgroundColor", "(", "getResources", "(", ")", ".", "getColor", "(", "colorResId", ")", ")", ";", "}", "catch", "(", "Resources", ".", "NotFoundException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "else", "{", "try", "{", "header", ".", "setBackgroundDrawable", "(", "getResources", "(", ")", ".", "getDrawable", "(", "drawableResId", ")", ")", ";", "}", "catch", "(", "Resources", ".", "NotFoundException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}" ]
Set the background color of the header @param colorResId Resource Id of the color @param drawableResId Resource Id of the drawable
[ "Set", "the", "background", "color", "of", "the", "header" ]
320fe48d478d1c7f961327483271db5a5e91da5b
https://github.com/DeveloperPaul123/FilePickerLibrary/blob/320fe48d478d1c7f961327483271db5a5e91da5b/library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePickerActivity.java#L529-L544
5,839
DeveloperPaul123/FilePickerLibrary
library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePickerActivity.java
FilePickerActivity.setThemeType
public void setThemeType(ThemeType themeType) { if (themeType == ThemeType.ACTIVITY) { setTheme(android.R.style.Theme_Holo_Light); } else if (themeType == ThemeType.DIALOG) { setTheme(android.R.style.Theme_Holo_Light_Dialog); } else if (themeType == ThemeType.DIALOG_NO_ACTION_BAR) { setTheme(android.R.style.Theme_Holo_Light_Dialog_NoActionBar); } }
java
public void setThemeType(ThemeType themeType) { if (themeType == ThemeType.ACTIVITY) { setTheme(android.R.style.Theme_Holo_Light); } else if (themeType == ThemeType.DIALOG) { setTheme(android.R.style.Theme_Holo_Light_Dialog); } else if (themeType == ThemeType.DIALOG_NO_ACTION_BAR) { setTheme(android.R.style.Theme_Holo_Light_Dialog_NoActionBar); } }
[ "public", "void", "setThemeType", "(", "ThemeType", "themeType", ")", "{", "if", "(", "themeType", "==", "ThemeType", ".", "ACTIVITY", ")", "{", "setTheme", "(", "android", ".", "R", ".", "style", ".", "Theme_Holo_Light", ")", ";", "}", "else", "if", "(", "themeType", "==", "ThemeType", ".", "DIALOG", ")", "{", "setTheme", "(", "android", ".", "R", ".", "style", ".", "Theme_Holo_Light_Dialog", ")", ";", "}", "else", "if", "(", "themeType", "==", "ThemeType", ".", "DIALOG_NO_ACTION_BAR", ")", "{", "setTheme", "(", "android", ".", "R", ".", "style", ".", "Theme_Holo_Light_Dialog_NoActionBar", ")", ";", "}", "}" ]
Sets the theme for this activity @param themeType the {@code ThemeType} enum set in the calling intent.
[ "Sets", "the", "theme", "for", "this", "activity" ]
320fe48d478d1c7f961327483271db5a5e91da5b
https://github.com/DeveloperPaul123/FilePickerLibrary/blob/320fe48d478d1c7f961327483271db5a5e91da5b/library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePickerActivity.java#L646-L654
5,840
DeveloperPaul123/FilePickerLibrary
library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePickerBuilder.java
FilePickerBuilder.build
public Intent build() { Intent filePicker = new Intent(mContext, useMaterial ? FilePicker.class : FilePickerActivity.class); filePicker.putExtra(FilePicker.SCOPE, mScope); filePicker.putExtra(FilePicker.REQUEST, requestCode); filePicker.putExtra(FilePicker.INTENT_EXTRA_COLOR_ID, color); filePicker.putExtra(FilePicker.MIME_TYPE, mimeType); return filePicker; }
java
public Intent build() { Intent filePicker = new Intent(mContext, useMaterial ? FilePicker.class : FilePickerActivity.class); filePicker.putExtra(FilePicker.SCOPE, mScope); filePicker.putExtra(FilePicker.REQUEST, requestCode); filePicker.putExtra(FilePicker.INTENT_EXTRA_COLOR_ID, color); filePicker.putExtra(FilePicker.MIME_TYPE, mimeType); return filePicker; }
[ "public", "Intent", "build", "(", ")", "{", "Intent", "filePicker", "=", "new", "Intent", "(", "mContext", ",", "useMaterial", "?", "FilePicker", ".", "class", ":", "FilePickerActivity", ".", "class", ")", ";", "filePicker", ".", "putExtra", "(", "FilePicker", ".", "SCOPE", ",", "mScope", ")", ";", "filePicker", ".", "putExtra", "(", "FilePicker", ".", "REQUEST", ",", "requestCode", ")", ";", "filePicker", ".", "putExtra", "(", "FilePicker", ".", "INTENT_EXTRA_COLOR_ID", ",", "color", ")", ";", "filePicker", ".", "putExtra", "(", "FilePicker", ".", "MIME_TYPE", ",", "mimeType", ")", ";", "return", "filePicker", ";", "}" ]
Build the current intent. @return a filepicker intent.
[ "Build", "the", "current", "intent", "." ]
320fe48d478d1c7f961327483271db5a5e91da5b
https://github.com/DeveloperPaul123/FilePickerLibrary/blob/320fe48d478d1c7f961327483271db5a5e91da5b/library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePickerBuilder.java#L107-L114
5,841
softlayer/softlayer-java
gen/src/main/java/com/softlayer/api/gen/MetaConverter.java
MetaConverter.getValidJavaIdentifier
public String getValidJavaIdentifier(String name) { if (!Character.isJavaIdentifierStart(name.charAt(0))) { name = "z" + name; } return name; }
java
public String getValidJavaIdentifier(String name) { if (!Character.isJavaIdentifierStart(name.charAt(0))) { name = "z" + name; } return name; }
[ "public", "String", "getValidJavaIdentifier", "(", "String", "name", ")", "{", "if", "(", "!", "Character", ".", "isJavaIdentifierStart", "(", "name", ".", "charAt", "(", "0", ")", ")", ")", "{", "name", "=", "\"z\"", "+", "name", ";", "}", "return", "name", ";", "}" ]
Provides a valid java identifier from the given name. Currently only checks for a valid start character and adds 'z' if the name has an invalid character at the start. @param name The identifier name to use. @return The new name after validating.
[ "Provides", "a", "valid", "java", "identifier", "from", "the", "given", "name", ".", "Currently", "only", "checks", "for", "a", "valid", "start", "character", "and", "adds", "z", "if", "the", "name", "has", "an", "invalid", "character", "at", "the", "start", "." ]
0bb17f4b520aae0d0878f3dcaad0d9ee96472363
https://github.com/softlayer/softlayer-java/blob/0bb17f4b520aae0d0878f3dcaad0d9ee96472363/gen/src/main/java/com/softlayer/api/gen/MetaConverter.java#L93-L98
5,842
softlayer/softlayer-java
src/main/java/com/softlayer/api/RestApiClient.java
RestApiClient.getFullUrl
protected String getFullUrl(String serviceName, String methodName, String id, ResultLimit resultLimit, String maskString) { StringBuilder url = new StringBuilder(baseUrl + serviceName); // ID present? add it if (id != null) { url.append('/').append(id); } // Some method names are not included, others can have the "get" stripped if (methodName.startsWith("get") && !"getObject".equals(methodName)) { url.append('/').append(methodName.substring(3)); } else if (!IMPLICIT_SERVICE_METHODS.contains(methodName)) { url.append('/').append(methodName); } url.append(".json"); if (resultLimit != null) { url.append("?resultLimit=").append(resultLimit.offset).append(',').append(resultLimit.limit); } if (maskString != null && !maskString.isEmpty()) { url.append(resultLimit == null ? '?' : '&'); try { url.append("objectMask=").append(URLEncoder.encode(maskString, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } return url.toString(); }
java
protected String getFullUrl(String serviceName, String methodName, String id, ResultLimit resultLimit, String maskString) { StringBuilder url = new StringBuilder(baseUrl + serviceName); // ID present? add it if (id != null) { url.append('/').append(id); } // Some method names are not included, others can have the "get" stripped if (methodName.startsWith("get") && !"getObject".equals(methodName)) { url.append('/').append(methodName.substring(3)); } else if (!IMPLICIT_SERVICE_METHODS.contains(methodName)) { url.append('/').append(methodName); } url.append(".json"); if (resultLimit != null) { url.append("?resultLimit=").append(resultLimit.offset).append(',').append(resultLimit.limit); } if (maskString != null && !maskString.isEmpty()) { url.append(resultLimit == null ? '?' : '&'); try { url.append("objectMask=").append(URLEncoder.encode(maskString, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } return url.toString(); }
[ "protected", "String", "getFullUrl", "(", "String", "serviceName", ",", "String", "methodName", ",", "String", "id", ",", "ResultLimit", "resultLimit", ",", "String", "maskString", ")", "{", "StringBuilder", "url", "=", "new", "StringBuilder", "(", "baseUrl", "+", "serviceName", ")", ";", "// ID present? add it", "if", "(", "id", "!=", "null", ")", "{", "url", ".", "append", "(", "'", "'", ")", ".", "append", "(", "id", ")", ";", "}", "// Some method names are not included, others can have the \"get\" stripped", "if", "(", "methodName", ".", "startsWith", "(", "\"get\"", ")", "&&", "!", "\"getObject\"", ".", "equals", "(", "methodName", ")", ")", "{", "url", ".", "append", "(", "'", "'", ")", ".", "append", "(", "methodName", ".", "substring", "(", "3", ")", ")", ";", "}", "else", "if", "(", "!", "IMPLICIT_SERVICE_METHODS", ".", "contains", "(", "methodName", ")", ")", "{", "url", ".", "append", "(", "'", "'", ")", ".", "append", "(", "methodName", ")", ";", "}", "url", ".", "append", "(", "\".json\"", ")", ";", "if", "(", "resultLimit", "!=", "null", ")", "{", "url", ".", "append", "(", "\"?resultLimit=\"", ")", ".", "append", "(", "resultLimit", ".", "offset", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "resultLimit", ".", "limit", ")", ";", "}", "if", "(", "maskString", "!=", "null", "&&", "!", "maskString", ".", "isEmpty", "(", ")", ")", "{", "url", ".", "append", "(", "resultLimit", "==", "null", "?", "'", "'", ":", "'", "'", ")", ";", "try", "{", "url", ".", "append", "(", "\"objectMask=\"", ")", ".", "append", "(", "URLEncoder", ".", "encode", "(", "maskString", ",", "\"UTF-8\"", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "return", "url", ".", "toString", "(", ")", ";", "}" ]
Get the full REST URL required to make a request. @param serviceName The name of the API service. @param methodName The name of the method on the service to call. @param id The identifier of the object to make a call to, otherwise null if not making a request to a specific object. @param resultLimit The number of results to limit the request to. @param maskString The mask, in string form, to use on the request. @return String
[ "Get", "the", "full", "REST", "URL", "required", "to", "make", "a", "request", "." ]
0bb17f4b520aae0d0878f3dcaad0d9ee96472363
https://github.com/softlayer/softlayer-java/blob/0bb17f4b520aae0d0878f3dcaad0d9ee96472363/src/main/java/com/softlayer/api/RestApiClient.java#L168-L195
5,843
softlayer/softlayer-java
gen/src/main/java/com/softlayer/api/gen/Meta.java
Meta.fromUrl
public static Meta fromUrl(URL url) { InputStream stream = null; try { stream = url.openStream(); Gson gson = new GsonBuilder().registerTypeAdapter(PropertyForm.class, new TypeAdapter<PropertyForm>() { @Override public void write(JsonWriter out, PropertyForm value) throws IOException { out.value(value.name().toLowerCase()); } @Override public PropertyForm read(JsonReader in) throws IOException { return PropertyForm.valueOf(in.nextString().toUpperCase()); } }).create(); Map<String, Type> types = gson.fromJson( new InputStreamReader(stream), new TypeToken<Map<String, Type>>(){ }.getType() ); return new Meta(types); } catch (IOException e) { throw new RuntimeException(e); } finally { if (stream != null) { try { stream.close(); } catch (Exception e) { } } } }
java
public static Meta fromUrl(URL url) { InputStream stream = null; try { stream = url.openStream(); Gson gson = new GsonBuilder().registerTypeAdapter(PropertyForm.class, new TypeAdapter<PropertyForm>() { @Override public void write(JsonWriter out, PropertyForm value) throws IOException { out.value(value.name().toLowerCase()); } @Override public PropertyForm read(JsonReader in) throws IOException { return PropertyForm.valueOf(in.nextString().toUpperCase()); } }).create(); Map<String, Type> types = gson.fromJson( new InputStreamReader(stream), new TypeToken<Map<String, Type>>(){ }.getType() ); return new Meta(types); } catch (IOException e) { throw new RuntimeException(e); } finally { if (stream != null) { try { stream.close(); } catch (Exception e) { } } } }
[ "public", "static", "Meta", "fromUrl", "(", "URL", "url", ")", "{", "InputStream", "stream", "=", "null", ";", "try", "{", "stream", "=", "url", ".", "openStream", "(", ")", ";", "Gson", "gson", "=", "new", "GsonBuilder", "(", ")", ".", "registerTypeAdapter", "(", "PropertyForm", ".", "class", ",", "new", "TypeAdapter", "<", "PropertyForm", ">", "(", ")", "{", "@", "Override", "public", "void", "write", "(", "JsonWriter", "out", ",", "PropertyForm", "value", ")", "throws", "IOException", "{", "out", ".", "value", "(", "value", ".", "name", "(", ")", ".", "toLowerCase", "(", ")", ")", ";", "}", "@", "Override", "public", "PropertyForm", "read", "(", "JsonReader", "in", ")", "throws", "IOException", "{", "return", "PropertyForm", ".", "valueOf", "(", "in", ".", "nextString", "(", ")", ".", "toUpperCase", "(", ")", ")", ";", "}", "}", ")", ".", "create", "(", ")", ";", "Map", "<", "String", ",", "Type", ">", "types", "=", "gson", ".", "fromJson", "(", "new", "InputStreamReader", "(", "stream", ")", ",", "new", "TypeToken", "<", "Map", "<", "String", ",", "Type", ">", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ")", ";", "return", "new", "Meta", "(", "types", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "finally", "{", "if", "(", "stream", "!=", "null", ")", "{", "try", "{", "stream", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "}", "}" ]
Reads a JSON object from the given metadata URL and generates a new Meta object containing all types. @param url The API metadata URL. @return Meta
[ "Reads", "a", "JSON", "object", "from", "the", "given", "metadata", "URL", "and", "generates", "a", "new", "Meta", "object", "containing", "all", "types", "." ]
0bb17f4b520aae0d0878f3dcaad0d9ee96472363
https://github.com/softlayer/softlayer-java/blob/0bb17f4b520aae0d0878f3dcaad0d9ee96472363/gen/src/main/java/com/softlayer/api/gen/Meta.java#L30-L57
5,844
softlayer/softlayer-java
src/main/java/com/softlayer/api/http/HttpBasicAuthCredentials.java
HttpBasicAuthCredentials.getHeader
public String getHeader() { String authPair = username + ':' + apiKey; return "Basic " + Base64.getEncoder().encodeToString(authPair.getBytes()); }
java
public String getHeader() { String authPair = username + ':' + apiKey; return "Basic " + Base64.getEncoder().encodeToString(authPair.getBytes()); }
[ "public", "String", "getHeader", "(", ")", "{", "String", "authPair", "=", "username", "+", "'", "'", "+", "apiKey", ";", "return", "\"Basic \"", "+", "Base64", ".", "getEncoder", "(", ")", ".", "encodeToString", "(", "authPair", ".", "getBytes", "(", ")", ")", ";", "}" ]
Gets the encoded representation of the basic authentication credentials for use in an HTTP Authorization header. @return String
[ "Gets", "the", "encoded", "representation", "of", "the", "basic", "authentication", "credentials", "for", "use", "in", "an", "HTTP", "Authorization", "header", "." ]
0bb17f4b520aae0d0878f3dcaad0d9ee96472363
https://github.com/softlayer/softlayer-java/blob/0bb17f4b520aae0d0878f3dcaad0d9ee96472363/src/main/java/com/softlayer/api/http/HttpBasicAuthCredentials.java#L22-L25
5,845
softlayer/softlayer-java
src/main/java/com/softlayer/api/Type.java
Type.setUnknownProperties
public void setUnknownProperties(Map<String, Object> unknownProperties) { this.unknownProperties = Collections.unmodifiableMap( new HashMap<>(unknownProperties)); }
java
public void setUnknownProperties(Map<String, Object> unknownProperties) { this.unknownProperties = Collections.unmodifiableMap( new HashMap<>(unknownProperties)); }
[ "public", "void", "setUnknownProperties", "(", "Map", "<", "String", ",", "Object", ">", "unknownProperties", ")", "{", "this", ".", "unknownProperties", "=", "Collections", ".", "unmodifiableMap", "(", "new", "HashMap", "<>", "(", "unknownProperties", ")", ")", ";", "}" ]
Set the unknown properties for this type. The values are copied to an immutable map. Note, these values are NOT serialized into the type.
[ "Set", "the", "unknown", "properties", "for", "this", "type", ".", "The", "values", "are", "copied", "to", "an", "immutable", "map", ".", "Note", "these", "values", "are", "NOT", "serialized", "into", "the", "type", "." ]
0bb17f4b520aae0d0878f3dcaad0d9ee96472363
https://github.com/softlayer/softlayer-java/blob/0bb17f4b520aae0d0878f3dcaad0d9ee96472363/src/main/java/com/softlayer/api/Type.java#L26-L29
5,846
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/events/EventBase.java
EventBase.createEventFromString
public static Event createEventFromString(final String in) throws AppPlatformException { JSONObject jsonObj = null; try { jsonObj = (JSONObject) new JSONParser().parse(in); } catch (final org.json.simple.parser.ParseException e) { throw new AppPlatformException(e); } final EventType eventType = EventType.getEnum((String) jsonObj .get("eventType")); Event event = null; switch (eventType) { case INCOMINGCALL: event = new IncomingCallEvent(jsonObj); break; case ANSWER: event = new AnswerEvent(jsonObj); break; case SPEAK: event = new SpeakEvent(jsonObj); break; case PLAYBACK: event = new PlaybackEvent(jsonObj); break; case GATHER: event = new GatherEvent(jsonObj); break; case HANGUP: event = new HangupEvent(jsonObj); break; case DTMF: event = new DtmfEvent(jsonObj); break; case REJECT: event = new RejectEvent(jsonObj); break; case RECORDING: event = new RecordingEvent(jsonObj); break; case TRANSCRIPTION: event = new TranscriptionEvent(jsonObj); break; case SMS: event = new SmsEvent(jsonObj); break; case TIMEOUT: event = new TimeoutEvent(jsonObj); break; case CONFERENCE: event = new ConferenceEvent(jsonObj); break; case CONFERENCE_MEMBER: event = new ConferenceMemberEvent(jsonObj); break; case CONFERENCE_PLAYBACK: event = new ConferencePlaybackEvent(jsonObj); break; case CONFERENCE_SPEAK: event = new ConferenceSpeakEvent(jsonObj); break; default: event = new EventBase(jsonObj); } return event; }
java
public static Event createEventFromString(final String in) throws AppPlatformException { JSONObject jsonObj = null; try { jsonObj = (JSONObject) new JSONParser().parse(in); } catch (final org.json.simple.parser.ParseException e) { throw new AppPlatformException(e); } final EventType eventType = EventType.getEnum((String) jsonObj .get("eventType")); Event event = null; switch (eventType) { case INCOMINGCALL: event = new IncomingCallEvent(jsonObj); break; case ANSWER: event = new AnswerEvent(jsonObj); break; case SPEAK: event = new SpeakEvent(jsonObj); break; case PLAYBACK: event = new PlaybackEvent(jsonObj); break; case GATHER: event = new GatherEvent(jsonObj); break; case HANGUP: event = new HangupEvent(jsonObj); break; case DTMF: event = new DtmfEvent(jsonObj); break; case REJECT: event = new RejectEvent(jsonObj); break; case RECORDING: event = new RecordingEvent(jsonObj); break; case TRANSCRIPTION: event = new TranscriptionEvent(jsonObj); break; case SMS: event = new SmsEvent(jsonObj); break; case TIMEOUT: event = new TimeoutEvent(jsonObj); break; case CONFERENCE: event = new ConferenceEvent(jsonObj); break; case CONFERENCE_MEMBER: event = new ConferenceMemberEvent(jsonObj); break; case CONFERENCE_PLAYBACK: event = new ConferencePlaybackEvent(jsonObj); break; case CONFERENCE_SPEAK: event = new ConferenceSpeakEvent(jsonObj); break; default: event = new EventBase(jsonObj); } return event; }
[ "public", "static", "Event", "createEventFromString", "(", "final", "String", "in", ")", "throws", "AppPlatformException", "{", "JSONObject", "jsonObj", "=", "null", ";", "try", "{", "jsonObj", "=", "(", "JSONObject", ")", "new", "JSONParser", "(", ")", ".", "parse", "(", "in", ")", ";", "}", "catch", "(", "final", "org", ".", "json", ".", "simple", ".", "parser", ".", "ParseException", "e", ")", "{", "throw", "new", "AppPlatformException", "(", "e", ")", ";", "}", "final", "EventType", "eventType", "=", "EventType", ".", "getEnum", "(", "(", "String", ")", "jsonObj", ".", "get", "(", "\"eventType\"", ")", ")", ";", "Event", "event", "=", "null", ";", "switch", "(", "eventType", ")", "{", "case", "INCOMINGCALL", ":", "event", "=", "new", "IncomingCallEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "ANSWER", ":", "event", "=", "new", "AnswerEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "SPEAK", ":", "event", "=", "new", "SpeakEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "PLAYBACK", ":", "event", "=", "new", "PlaybackEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "GATHER", ":", "event", "=", "new", "GatherEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "HANGUP", ":", "event", "=", "new", "HangupEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "DTMF", ":", "event", "=", "new", "DtmfEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "REJECT", ":", "event", "=", "new", "RejectEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "RECORDING", ":", "event", "=", "new", "RecordingEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "TRANSCRIPTION", ":", "event", "=", "new", "TranscriptionEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "SMS", ":", "event", "=", "new", "SmsEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "TIMEOUT", ":", "event", "=", "new", "TimeoutEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "CONFERENCE", ":", "event", "=", "new", "ConferenceEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "CONFERENCE_MEMBER", ":", "event", "=", "new", "ConferenceMemberEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "CONFERENCE_PLAYBACK", ":", "event", "=", "new", "ConferencePlaybackEvent", "(", "jsonObj", ")", ";", "break", ";", "case", "CONFERENCE_SPEAK", ":", "event", "=", "new", "ConferenceSpeakEvent", "(", "jsonObj", ")", ";", "break", ";", "default", ":", "event", "=", "new", "EventBase", "(", "jsonObj", ")", ";", "}", "return", "event", ";", "}" ]
This method creates an event from a json string. Given an event from the App Plotform API, the whole body can be passed in and the appropriate Event subclass will be returned. @param in the json representation @return the event @throws AppPlatformException API Exception
[ "This", "method", "creates", "an", "event", "from", "a", "json", "string", ".", "Given", "an", "event", "from", "the", "App", "Plotform", "API", "the", "whole", "body", "can", "be", "passed", "in", "and", "the", "appropriate", "Event", "subclass", "will", "be", "returned", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/events/EventBase.java#L26-L109
5,847
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Message.java
Message.get
public static Message get(final BandwidthClient client, final String id) throws Exception { final String messagesUri = client.getUserResourceInstanceUri(BandwidthConstants.MESSAGES_URI_PATH, id); final JSONObject jsonObject = toJSONObject(client.get(messagesUri, null)); return new Message(client, jsonObject); }
java
public static Message get(final BandwidthClient client, final String id) throws Exception { final String messagesUri = client.getUserResourceInstanceUri(BandwidthConstants.MESSAGES_URI_PATH, id); final JSONObject jsonObject = toJSONObject(client.get(messagesUri, null)); return new Message(client, jsonObject); }
[ "public", "static", "Message", "get", "(", "final", "BandwidthClient", "client", ",", "final", "String", "id", ")", "throws", "Exception", "{", "final", "String", "messagesUri", "=", "client", ".", "getUserResourceInstanceUri", "(", "BandwidthConstants", ".", "MESSAGES_URI_PATH", ",", "id", ")", ";", "final", "JSONObject", "jsonObject", "=", "toJSONObject", "(", "client", ".", "get", "(", "messagesUri", ",", "null", ")", ")", ";", "return", "new", "Message", "(", "client", ",", "jsonObject", ")", ";", "}" ]
Gets information about a previously sent or received message. @param client the client. @param id message id @return information about message @throws IOException unexpected error
[ "Gets", "information", "about", "a", "previously", "sent", "or", "received", "message", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Message.java#L39-L45
5,848
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Message.java
Message.create
public static Message create(final String to, final String from, final String text) throws Exception { final Map<String, Object> params = new HashMap<String, Object>(); params.put("to", to); params.put("from", from); params.put("text", text); return create(params); }
java
public static Message create(final String to, final String from, final String text) throws Exception { final Map<String, Object> params = new HashMap<String, Object>(); params.put("to", to); params.put("from", from); params.put("text", text); return create(params); }
[ "public", "static", "Message", "create", "(", "final", "String", "to", ",", "final", "String", "from", ",", "final", "String", "text", ")", "throws", "Exception", "{", "final", "Map", "<", "String", ",", "Object", ">", "params", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "params", ".", "put", "(", "\"to\"", ",", "to", ")", ";", "params", ".", "put", "(", "\"from\"", ",", "from", ")", ";", "params", ".", "put", "(", "\"text\"", ",", "text", ")", ";", "return", "create", "(", "params", ")", ";", "}" ]
Convenience factory method to send a message, given the to number, the from number and the text @param to the from number @param from the to number @param text the text @return the message @throws IOException unexpected error
[ "Convenience", "factory", "method", "to", "send", "a", "message", "given", "the", "to", "number", "the", "from", "number", "and", "the", "text" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Message.java#L101-L109
5,849
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Message.java
Message.create
public static Message create(final String to, final String from, final String text, final ReceiptRequest receiptRequest) throws Exception { final Map<String, Object> params = new HashMap<String, Object>(); params.put("to", to); params.put("from", from); params.put("text", text); if (receiptRequest != null) { params.put("receiptRequested", receiptRequest.toString()); } else { params.put("receiptRequested", ReceiptRequest.NONE.toString()); } return create(params); }
java
public static Message create(final String to, final String from, final String text, final ReceiptRequest receiptRequest) throws Exception { final Map<String, Object> params = new HashMap<String, Object>(); params.put("to", to); params.put("from", from); params.put("text", text); if (receiptRequest != null) { params.put("receiptRequested", receiptRequest.toString()); } else { params.put("receiptRequested", ReceiptRequest.NONE.toString()); } return create(params); }
[ "public", "static", "Message", "create", "(", "final", "String", "to", ",", "final", "String", "from", ",", "final", "String", "text", ",", "final", "ReceiptRequest", "receiptRequest", ")", "throws", "Exception", "{", "final", "Map", "<", "String", ",", "Object", ">", "params", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "params", ".", "put", "(", "\"to\"", ",", "to", ")", ";", "params", ".", "put", "(", "\"from\"", ",", "from", ")", ";", "params", ".", "put", "(", "\"text\"", ",", "text", ")", ";", "if", "(", "receiptRequest", "!=", "null", ")", "{", "params", ".", "put", "(", "\"receiptRequested\"", ",", "receiptRequest", ".", "toString", "(", ")", ")", ";", "}", "else", "{", "params", ".", "put", "(", "\"receiptRequested\"", ",", "ReceiptRequest", ".", "NONE", ".", "toString", "(", ")", ")", ";", "}", "return", "create", "(", "params", ")", ";", "}" ]
Convenience factory method to send a message with receipt, given the to number, the from number and the text @param to the from number @param from the to number @param text the text @param receiptRequest the receipt request option @return the message @throws IOException unexpected error
[ "Convenience", "factory", "method", "to", "send", "a", "message", "with", "receipt", "given", "the", "to", "number", "the", "from", "number", "and", "the", "text" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Message.java#L120-L133
5,850
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Message.java
Message.create
public static Message create(final BandwidthClient client, final Map<String, Object> params) throws Exception { final String messageUri = client.getUserResourceUri(BandwidthConstants.MESSAGES_URI_PATH); final RestResponse response = client.post(messageUri, params); final String messageId = response.getLocation().substring(client.getPath(messageUri).length() + 1); return get(client, messageId); }
java
public static Message create(final BandwidthClient client, final Map<String, Object> params) throws Exception { final String messageUri = client.getUserResourceUri(BandwidthConstants.MESSAGES_URI_PATH); final RestResponse response = client.post(messageUri, params); final String messageId = response.getLocation().substring(client.getPath(messageUri).length() + 1); return get(client, messageId); }
[ "public", "static", "Message", "create", "(", "final", "BandwidthClient", "client", ",", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "Exception", "{", "final", "String", "messageUri", "=", "client", ".", "getUserResourceUri", "(", "BandwidthConstants", ".", "MESSAGES_URI_PATH", ")", ";", "final", "RestResponse", "response", "=", "client", ".", "post", "(", "messageUri", ",", "params", ")", ";", "final", "String", "messageId", "=", "response", ".", "getLocation", "(", ")", ".", "substring", "(", "client", ".", "getPath", "(", "messageUri", ")", ".", "length", "(", ")", "+", "1", ")", ";", "return", "get", "(", "client", ",", "messageId", ")", ";", "}" ]
Factory method to send a message from a params object, given a client instance @param client the client @param params the params @return the message @throws IOException unexpected error
[ "Factory", "method", "to", "send", "a", "message", "from", "a", "params", "object", "given", "a", "client", "instance" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Message.java#L198-L204
5,851
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/PhoneNumber.java
PhoneNumber.create
public static PhoneNumber create(final BandwidthClient client, final Map<String, Object> params) throws Exception { final String uri = client.getUserResourceUri(BandwidthConstants.PHONE_NUMBER_URI_PATH); final RestResponse createResponse = client.post(uri, params); final RestResponse getResponse = client.get(createResponse.getLocation(), null); final JSONObject jsonObject = toJSONObject(getResponse); return new PhoneNumber(client, jsonObject); }
java
public static PhoneNumber create(final BandwidthClient client, final Map<String, Object> params) throws Exception { final String uri = client.getUserResourceUri(BandwidthConstants.PHONE_NUMBER_URI_PATH); final RestResponse createResponse = client.post(uri, params); final RestResponse getResponse = client.get(createResponse.getLocation(), null); final JSONObject jsonObject = toJSONObject(getResponse); return new PhoneNumber(client, jsonObject); }
[ "public", "static", "PhoneNumber", "create", "(", "final", "BandwidthClient", "client", ",", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "Exception", "{", "final", "String", "uri", "=", "client", ".", "getUserResourceUri", "(", "BandwidthConstants", ".", "PHONE_NUMBER_URI_PATH", ")", ";", "final", "RestResponse", "createResponse", "=", "client", ".", "post", "(", "uri", ",", "params", ")", ";", "final", "RestResponse", "getResponse", "=", "client", ".", "get", "(", "createResponse", ".", "getLocation", "(", ")", ",", "null", ")", ";", "final", "JSONObject", "jsonObject", "=", "toJSONObject", "(", "getResponse", ")", ";", "return", "new", "PhoneNumber", "(", "client", ",", "jsonObject", ")", ";", "}" ]
Factory method to allocate a phone number given a set of params. Note that this assumes that the phone number has been previously search for as an AvailableNumber @param client the client @param params the params @return the PhoneNumber @throws IOException unexpected error.
[ "Factory", "method", "to", "allocate", "a", "phone", "number", "given", "a", "set", "of", "params", ".", "Note", "that", "this", "assumes", "that", "the", "phone", "number", "has", "been", "previously", "search", "for", "as", "an", "AvailableNumber" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/PhoneNumber.java#L80-L86
5,852
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/PhoneNumber.java
PhoneNumber.commit
public void commit() throws Exception { final Map<String, Object> params = new HashMap<String, Object>(); final String applicationId = getPropertyAsString("applicationId"); if (applicationId != null) params.put("applicationId", applicationId); final String name = getName(); if (name != null) params.put("name", name); final String fallbackNumber = getFallbackNumber(); if (fallbackNumber != null) params.put("fallbackNumber", fallbackNumber); final String uri = getUri(); client.post(uri, params); final JSONObject object = toJSONObject(client.get(uri, null)); updateProperties(object); }
java
public void commit() throws Exception { final Map<String, Object> params = new HashMap<String, Object>(); final String applicationId = getPropertyAsString("applicationId"); if (applicationId != null) params.put("applicationId", applicationId); final String name = getName(); if (name != null) params.put("name", name); final String fallbackNumber = getFallbackNumber(); if (fallbackNumber != null) params.put("fallbackNumber", fallbackNumber); final String uri = getUri(); client.post(uri, params); final JSONObject object = toJSONObject(client.get(uri, null)); updateProperties(object); }
[ "public", "void", "commit", "(", ")", "throws", "Exception", "{", "final", "Map", "<", "String", ",", "Object", ">", "params", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "final", "String", "applicationId", "=", "getPropertyAsString", "(", "\"applicationId\"", ")", ";", "if", "(", "applicationId", "!=", "null", ")", "params", ".", "put", "(", "\"applicationId\"", ",", "applicationId", ")", ";", "final", "String", "name", "=", "getName", "(", ")", ";", "if", "(", "name", "!=", "null", ")", "params", ".", "put", "(", "\"name\"", ",", "name", ")", ";", "final", "String", "fallbackNumber", "=", "getFallbackNumber", "(", ")", ";", "if", "(", "fallbackNumber", "!=", "null", ")", "params", ".", "put", "(", "\"fallbackNumber\"", ",", "fallbackNumber", ")", ";", "final", "String", "uri", "=", "getUri", "(", ")", ";", "client", ".", "post", "(", "uri", ",", "params", ")", ";", "final", "JSONObject", "object", "=", "toJSONObject", "(", "client", ".", "get", "(", "uri", ",", "null", ")", ")", ";", "updateProperties", "(", "object", ")", ";", "}" ]
Makes changes to a number you have. @throws IOException unexpected error.
[ "Makes", "changes", "to", "a", "number", "you", "have", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/PhoneNumber.java#L144-L161
5,853
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Application.java
Application.get
public static Application get(final String id) throws Exception { assert(id != null); final BandwidthClient client = BandwidthClient.getInstance(); return Application.get(client ,id); }
java
public static Application get(final String id) throws Exception { assert(id != null); final BandwidthClient client = BandwidthClient.getInstance(); return Application.get(client ,id); }
[ "public", "static", "Application", "get", "(", "final", "String", "id", ")", "throws", "Exception", "{", "assert", "(", "id", "!=", "null", ")", ";", "final", "BandwidthClient", "client", "=", "BandwidthClient", ".", "getInstance", "(", ")", ";", "return", "Application", ".", "get", "(", "client", ",", "id", ")", ";", "}" ]
Factory method for Application. Returns Application object from id @param id the application id @return the application @throws IOException unexpected error.
[ "Factory", "method", "for", "Application", ".", "Returns", "Application", "object", "from", "id" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Application.java#L26-L31
5,854
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Application.java
Application.get
public static Application get(final BandwidthClient client, final String id) throws Exception { assert(id != null); final String applicationUri = client.getUserResourceInstanceUri(BandwidthConstants.APPLICATIONS_URI_PATH, id); final JSONObject applicationObj = toJSONObject( client.get(applicationUri, null) ); final Application application = new Application(client, applicationObj); return application; }
java
public static Application get(final BandwidthClient client, final String id) throws Exception { assert(id != null); final String applicationUri = client.getUserResourceInstanceUri(BandwidthConstants.APPLICATIONS_URI_PATH, id); final JSONObject applicationObj = toJSONObject( client.get(applicationUri, null) ); final Application application = new Application(client, applicationObj); return application; }
[ "public", "static", "Application", "get", "(", "final", "BandwidthClient", "client", ",", "final", "String", "id", ")", "throws", "Exception", "{", "assert", "(", "id", "!=", "null", ")", ";", "final", "String", "applicationUri", "=", "client", ".", "getUserResourceInstanceUri", "(", "BandwidthConstants", ".", "APPLICATIONS_URI_PATH", ",", "id", ")", ";", "final", "JSONObject", "applicationObj", "=", "toJSONObject", "(", "client", ".", "get", "(", "applicationUri", ",", "null", ")", ")", ";", "final", "Application", "application", "=", "new", "Application", "(", "client", ",", "applicationObj", ")", ";", "return", "application", ";", "}" ]
Factory method for Application, returns Application object @param client the client @param id the application id @return the application @throws IOException unexpected error.
[ "Factory", "method", "for", "Application", "returns", "Application", "object" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Application.java#L40-L47
5,855
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Application.java
Application.list
public static ResourceList<Application> list(final int page, final int size) throws IOException { final BandwidthClient client = BandwidthClient.getInstance(); return list(client, page, size); }
java
public static ResourceList<Application> list(final int page, final int size) throws IOException { final BandwidthClient client = BandwidthClient.getInstance(); return list(client, page, size); }
[ "public", "static", "ResourceList", "<", "Application", ">", "list", "(", "final", "int", "page", ",", "final", "int", "size", ")", "throws", "IOException", "{", "final", "BandwidthClient", "client", "=", "BandwidthClient", ".", "getInstance", "(", ")", ";", "return", "list", "(", "client", ",", "page", ",", "size", ")", ";", "}" ]
Factory method for Application list. Returns a list of Application object with page and size preferences @param page the page @param size the page size @return the list @throws IOException unexpected error.
[ "Factory", "method", "for", "Application", "list", ".", "Returns", "a", "list", "of", "Application", "object", "with", "page", "and", "size", "preferences" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Application.java#L67-L72
5,856
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Application.java
Application.list
public static ResourceList<Application> list(final BandwidthClient client, final int page, final int size) throws IOException { final String applicationUri = client.getUserResourceUri(BandwidthConstants.APPLICATIONS_URI_PATH); final ResourceList<Application> applications = new ResourceList<Application>(page, size, applicationUri, Application.class); applications.setClient(client); applications.initialize(); return applications; }
java
public static ResourceList<Application> list(final BandwidthClient client, final int page, final int size) throws IOException { final String applicationUri = client.getUserResourceUri(BandwidthConstants.APPLICATIONS_URI_PATH); final ResourceList<Application> applications = new ResourceList<Application>(page, size, applicationUri, Application.class); applications.setClient(client); applications.initialize(); return applications; }
[ "public", "static", "ResourceList", "<", "Application", ">", "list", "(", "final", "BandwidthClient", "client", ",", "final", "int", "page", ",", "final", "int", "size", ")", "throws", "IOException", "{", "final", "String", "applicationUri", "=", "client", ".", "getUserResourceUri", "(", "BandwidthConstants", ".", "APPLICATIONS_URI_PATH", ")", ";", "final", "ResourceList", "<", "Application", ">", "applications", "=", "new", "ResourceList", "<", "Application", ">", "(", "page", ",", "size", ",", "applicationUri", ",", "Application", ".", "class", ")", ";", "applications", ".", "setClient", "(", "client", ")", ";", "applications", ".", "initialize", "(", ")", ";", "return", "applications", ";", "}" ]
Factory method for Application list. Returns a list of Application object with page and size preferences Allow different Client implementaitons @param client the client @param page the page @param size the page size @return the list @throws IOException unexpected error.
[ "Factory", "method", "for", "Application", "list", ".", "Returns", "a", "list", "of", "Application", "object", "with", "page", "and", "size", "preferences", "Allow", "different", "Client", "implementaitons" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Application.java#L83-L93
5,857
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Application.java
Application.create
public static Application create(final String name) throws Exception{ final Map<String, Object> params = new HashMap<String, Object>(); params.put("name", name); return create(params); }
java
public static Application create(final String name) throws Exception{ final Map<String, Object> params = new HashMap<String, Object>(); params.put("name", name); return create(params); }
[ "public", "static", "Application", "create", "(", "final", "String", "name", ")", "throws", "Exception", "{", "final", "Map", "<", "String", ",", "Object", ">", "params", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "params", ".", "put", "(", "\"name\"", ",", "name", ")", ";", "return", "create", "(", "params", ")", ";", "}" ]
Convenience factory method to create an Application object with a given name @param name the name @return the application @throws Exception error
[ "Convenience", "factory", "method", "to", "create", "an", "Application", "object", "with", "a", "given", "name" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Application.java#L101-L106
5,858
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Application.java
Application.create
public static Application create(final Map<String, Object>params) throws Exception{ return create(BandwidthClient.getInstance(), params); }
java
public static Application create(final Map<String, Object>params) throws Exception{ return create(BandwidthClient.getInstance(), params); }
[ "public", "static", "Application", "create", "(", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "Exception", "{", "return", "create", "(", "BandwidthClient", ".", "getInstance", "(", ")", ",", "params", ")", ";", "}" ]
Convenience factory method to create an Application object from a set of params @param params the params @return the application @throws Exception error
[ "Convenience", "factory", "method", "to", "create", "an", "Application", "object", "from", "a", "set", "of", "params" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Application.java#L114-L117
5,859
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Application.java
Application.create
public static Application create(final BandwidthClient client, final Map<String, Object>params) throws Exception { assert(client != null); String uri = client.getUserResourceUri(BandwidthConstants.APPLICATIONS_URI_PATH); RestResponse response = client.post(uri, params); RestResponse getResponse = client.get(response.getLocation(), null); return new Application(client, toJSONObject(getResponse)); }
java
public static Application create(final BandwidthClient client, final Map<String, Object>params) throws Exception { assert(client != null); String uri = client.getUserResourceUri(BandwidthConstants.APPLICATIONS_URI_PATH); RestResponse response = client.post(uri, params); RestResponse getResponse = client.get(response.getLocation(), null); return new Application(client, toJSONObject(getResponse)); }
[ "public", "static", "Application", "create", "(", "final", "BandwidthClient", "client", ",", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "Exception", "{", "assert", "(", "client", "!=", "null", ")", ";", "String", "uri", "=", "client", ".", "getUserResourceUri", "(", "BandwidthConstants", ".", "APPLICATIONS_URI_PATH", ")", ";", "RestResponse", "response", "=", "client", ".", "post", "(", "uri", ",", "params", ")", ";", "RestResponse", "getResponse", "=", "client", ".", "get", "(", "response", ".", "getLocation", "(", ")", ",", "null", ")", ";", "return", "new", "Application", "(", "client", ",", "toJSONObject", "(", "getResponse", ")", ")", ";", "}" ]
Convenience factory method to create an Application object from a set of params with a given client @param client the client @param params the params @return the application @throws Exception error
[ "Convenience", "factory", "method", "to", "create", "an", "Application", "object", "from", "a", "set", "of", "params", "with", "a", "given", "client" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Application.java#L126-L137
5,860
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Application.java
Application.commit
public void commit() throws IOException, AppPlatformException { final Map<String, Object> params = toMap(); params.remove("id"); client.post(getUri(), params); }
java
public void commit() throws IOException, AppPlatformException { final Map<String, Object> params = toMap(); params.remove("id"); client.post(getUri(), params); }
[ "public", "void", "commit", "(", ")", "throws", "IOException", ",", "AppPlatformException", "{", "final", "Map", "<", "String", ",", "Object", ">", "params", "=", "toMap", "(", ")", ";", "params", ".", "remove", "(", "\"id\"", ")", ";", "client", ".", "post", "(", "getUri", "(", ")", ",", "params", ")", ";", "}" ]
Makes changes of the application. @throws IOException unexpected error. @throws AppPlatformException unexpected exception.
[ "Makes", "changes", "of", "the", "application", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Application.java#L226-L231
5,861
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.validateCredentials
private static void validateCredentials() { try { Account.get().getAccountInfo(); } catch (Exception e) { if (e instanceof AppPlatformException) { AppPlatformException appEx = (AppPlatformException) e; if (appEx.getStatus() == 401){ throw new InvalidCredentialsException(); } } else { throw new RuntimeException(e); } } }
java
private static void validateCredentials() { try { Account.get().getAccountInfo(); } catch (Exception e) { if (e instanceof AppPlatformException) { AppPlatformException appEx = (AppPlatformException) e; if (appEx.getStatus() == 401){ throw new InvalidCredentialsException(); } } else { throw new RuntimeException(e); } } }
[ "private", "static", "void", "validateCredentials", "(", ")", "{", "try", "{", "Account", ".", "get", "(", ")", ".", "getAccountInfo", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "e", "instanceof", "AppPlatformException", ")", "{", "AppPlatformException", "appEx", "=", "(", "AppPlatformException", ")", "e", ";", "if", "(", "appEx", ".", "getStatus", "(", ")", "==", "401", ")", "{", "throw", "new", "InvalidCredentialsException", "(", ")", ";", "}", "}", "else", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "}" ]
Validate if the credentials are set and has access to catapult
[ "Validate", "if", "the", "credentials", "are", "set", "and", "has", "access", "to", "catapult" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L222-L236
5,862
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.getUserResourceInstanceUri
public String getUserResourceInstanceUri(final String path, final String instanceId){ if(StringUtils.isEmpty(path) || StringUtils.isEmpty(instanceId)) { throw new IllegalArgumentException("Path and Instance Id cannot be null"); } return getUserResourceUri(path) + "/" + instanceId; }
java
public String getUserResourceInstanceUri(final String path, final String instanceId){ if(StringUtils.isEmpty(path) || StringUtils.isEmpty(instanceId)) { throw new IllegalArgumentException("Path and Instance Id cannot be null"); } return getUserResourceUri(path) + "/" + instanceId; }
[ "public", "String", "getUserResourceInstanceUri", "(", "final", "String", "path", ",", "final", "String", "instanceId", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "path", ")", "||", "StringUtils", ".", "isEmpty", "(", "instanceId", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Path and Instance Id cannot be null\"", ")", ";", "}", "return", "getUserResourceUri", "(", "path", ")", "+", "\"/\"", "+", "instanceId", ";", "}" ]
Convenience method that returns the resource instance uri. E.g. @param path the path. @param instanceId the instance id. @return The user Instance URI.
[ "Convenience", "method", "that", "returns", "the", "resource", "instance", "uri", ".", "E", ".", "g", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L278-L283
5,863
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.get
public RestResponse get(final String uri, final Map<String, Object> params) throws Exception { final String path = getPath(uri); final RestResponse response = request(path, HttpGet.METHOD_NAME, params); if (response.isError()) { throw new IOException(response.getResponseText()); } return response; }
java
public RestResponse get(final String uri, final Map<String, Object> params) throws Exception { final String path = getPath(uri); final RestResponse response = request(path, HttpGet.METHOD_NAME, params); if (response.isError()) { throw new IOException(response.getResponseText()); } return response; }
[ "public", "RestResponse", "get", "(", "final", "String", "uri", ",", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "Exception", "{", "final", "String", "path", "=", "getPath", "(", "uri", ")", ";", "final", "RestResponse", "response", "=", "request", "(", "path", ",", "HttpGet", ".", "METHOD_NAME", ",", "params", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "IOException", "(", "response", ".", "getResponseText", "(", ")", ")", ";", "}", "return", "response", ";", "}" ]
This method implements an HTTP GET. Use this method to retrieve a resource. @param uri the URI. @param params the parameters. @return the get response. @throws Exception unexpected exception.
[ "This", "method", "implements", "an", "HTTP", "GET", ".", "Use", "this", "method", "to", "retrieve", "a", "resource", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L368-L375
5,864
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.put
public RestResponse put(final String uri, final Map<String, Object> params) throws IOException, AppPlatformException { return request(getPath(uri), HttpPut.METHOD_NAME, params); }
java
public RestResponse put(final String uri, final Map<String, Object> params) throws IOException, AppPlatformException { return request(getPath(uri), HttpPut.METHOD_NAME, params); }
[ "public", "RestResponse", "put", "(", "final", "String", "uri", ",", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "IOException", ",", "AppPlatformException", "{", "return", "request", "(", "getPath", "(", "uri", ")", ",", "HttpPut", ".", "METHOD_NAME", ",", "params", ")", ";", "}" ]
This method implements an HTTP put. Use this method to update a resource. @param uri the URI @param params the parameters. @return the put response. @throws IOException unexpected exception. @throws AppPlatformException unexpected exception.
[ "This", "method", "implements", "an", "HTTP", "put", ".", "Use", "this", "method", "to", "update", "a", "resource", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L386-L389
5,865
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.delete
public RestResponse delete(final String uri) throws IOException, AppPlatformException { return request(getPath(uri), HttpDelete.METHOD_NAME); }
java
public RestResponse delete(final String uri) throws IOException, AppPlatformException { return request(getPath(uri), HttpDelete.METHOD_NAME); }
[ "public", "RestResponse", "delete", "(", "final", "String", "uri", ")", "throws", "IOException", ",", "AppPlatformException", "{", "return", "request", "(", "getPath", "(", "uri", ")", ",", "HttpDelete", ".", "METHOD_NAME", ")", ";", "}" ]
This method implements an HTTP delete. Use this method to remove a resource. @param uri the URI. @return the response. @throws IOException unexpected exception. @throws AppPlatformException unexpected exception.
[ "This", "method", "implements", "an", "HTTP", "delete", ".", "Use", "this", "method", "to", "remove", "a", "resource", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L398-L400
5,866
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.upload
public void upload(final String uri, final File sourceFile, final String contentType) throws IOException, AppPlatformException { final String path = getPath(uri); final HttpPut request = (HttpPut) setupRequest(path, HttpPut.METHOD_NAME, null); request.setEntity(contentType == null ? new FileEntity(sourceFile) : new FileEntity(sourceFile, ContentType.parse(contentType))); performRequest(request); }
java
public void upload(final String uri, final File sourceFile, final String contentType) throws IOException, AppPlatformException { final String path = getPath(uri); final HttpPut request = (HttpPut) setupRequest(path, HttpPut.METHOD_NAME, null); request.setEntity(contentType == null ? new FileEntity(sourceFile) : new FileEntity(sourceFile, ContentType.parse(contentType))); performRequest(request); }
[ "public", "void", "upload", "(", "final", "String", "uri", ",", "final", "File", "sourceFile", ",", "final", "String", "contentType", ")", "throws", "IOException", ",", "AppPlatformException", "{", "final", "String", "path", "=", "getPath", "(", "uri", ")", ";", "final", "HttpPut", "request", "=", "(", "HttpPut", ")", "setupRequest", "(", "path", ",", "HttpPut", ".", "METHOD_NAME", ",", "null", ")", ";", "request", ".", "setEntity", "(", "contentType", "==", "null", "?", "new", "FileEntity", "(", "sourceFile", ")", ":", "new", "FileEntity", "(", "sourceFile", ",", "ContentType", ".", "parse", "(", "contentType", ")", ")", ")", ";", "performRequest", "(", "request", ")", ";", "}" ]
Convenience method to upload files to the server. User to upload media. @param uri the URI @param sourceFile the source file @param contentType the content type. @throws IOException unexpected exception. @throws AppPlatformException unexpected exception.
[ "Convenience", "method", "to", "upload", "files", "to", "the", "server", ".", "User", "to", "upload", "media", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L411-L417
5,867
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.download
public void download(final String uri, final File destFile) throws IOException { final String path = getPath(uri); final HttpGet request = (HttpGet) setupRequest(path, HttpGet.METHOD_NAME, Collections.<String, Object>emptyMap()); HttpResponse response; OutputStream outputStream = null; try { response = httpClient.execute(request); final HttpEntity entity = response.getEntity(); final StatusLine status = response.getStatusLine(); final int statusCode = status.getStatusCode(); if (statusCode >= 400) { throw new IOException(EntityUtils.toString(entity)); } outputStream = new BufferedOutputStream(new FileOutputStream(destFile)); entity.writeTo(outputStream); } catch (final ClientProtocolException e1) { throw new IOException(e1); } catch (final IOException e1) { throw new IOException(e1); } finally { try { if (outputStream != null) { outputStream.close(); } } catch (final IOException ignore) { } } }
java
public void download(final String uri, final File destFile) throws IOException { final String path = getPath(uri); final HttpGet request = (HttpGet) setupRequest(path, HttpGet.METHOD_NAME, Collections.<String, Object>emptyMap()); HttpResponse response; OutputStream outputStream = null; try { response = httpClient.execute(request); final HttpEntity entity = response.getEntity(); final StatusLine status = response.getStatusLine(); final int statusCode = status.getStatusCode(); if (statusCode >= 400) { throw new IOException(EntityUtils.toString(entity)); } outputStream = new BufferedOutputStream(new FileOutputStream(destFile)); entity.writeTo(outputStream); } catch (final ClientProtocolException e1) { throw new IOException(e1); } catch (final IOException e1) { throw new IOException(e1); } finally { try { if (outputStream != null) { outputStream.close(); } } catch (final IOException ignore) { } } }
[ "public", "void", "download", "(", "final", "String", "uri", ",", "final", "File", "destFile", ")", "throws", "IOException", "{", "final", "String", "path", "=", "getPath", "(", "uri", ")", ";", "final", "HttpGet", "request", "=", "(", "HttpGet", ")", "setupRequest", "(", "path", ",", "HttpGet", ".", "METHOD_NAME", ",", "Collections", ".", "<", "String", ",", "Object", ">", "emptyMap", "(", ")", ")", ";", "HttpResponse", "response", ";", "OutputStream", "outputStream", "=", "null", ";", "try", "{", "response", "=", "httpClient", ".", "execute", "(", "request", ")", ";", "final", "HttpEntity", "entity", "=", "response", ".", "getEntity", "(", ")", ";", "final", "StatusLine", "status", "=", "response", ".", "getStatusLine", "(", ")", ";", "final", "int", "statusCode", "=", "status", ".", "getStatusCode", "(", ")", ";", "if", "(", "statusCode", ">=", "400", ")", "{", "throw", "new", "IOException", "(", "EntityUtils", ".", "toString", "(", "entity", ")", ")", ";", "}", "outputStream", "=", "new", "BufferedOutputStream", "(", "new", "FileOutputStream", "(", "destFile", ")", ")", ";", "entity", ".", "writeTo", "(", "outputStream", ")", ";", "}", "catch", "(", "final", "ClientProtocolException", "e1", ")", "{", "throw", "new", "IOException", "(", "e1", ")", ";", "}", "catch", "(", "final", "IOException", "e1", ")", "{", "throw", "new", "IOException", "(", "e1", ")", ";", "}", "finally", "{", "try", "{", "if", "(", "outputStream", "!=", "null", ")", "{", "outputStream", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "final", "IOException", "ignore", ")", "{", "}", "}", "}" ]
Convenience method to download files from the server. Used to retrieve media files. @param uri the URI. @param destFile the destination file. @throws IOException unexpected exception.
[ "Convenience", "method", "to", "download", "files", "from", "the", "server", ".", "Used", "to", "retrieve", "media", "files", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L426-L455
5,868
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.performRequest
protected RestResponse performRequest(final HttpUriRequest request) throws IOException, AppPlatformException { if (this.usersUri == null || this.usersUri.isEmpty() || this.token == null || this.token.isEmpty() || this.secret == null || this.secret.isEmpty()) { throw new MissingCredentialsException(); } RestResponse restResponse = RestResponse.createRestResponse(httpClient.execute(request)); if (restResponse.getStatus() >= 400) { throw new AppPlatformException(restResponse.getResponseText(), restResponse.getStatus()); } return restResponse; }
java
protected RestResponse performRequest(final HttpUriRequest request) throws IOException, AppPlatformException { if (this.usersUri == null || this.usersUri.isEmpty() || this.token == null || this.token.isEmpty() || this.secret == null || this.secret.isEmpty()) { throw new MissingCredentialsException(); } RestResponse restResponse = RestResponse.createRestResponse(httpClient.execute(request)); if (restResponse.getStatus() >= 400) { throw new AppPlatformException(restResponse.getResponseText(), restResponse.getStatus()); } return restResponse; }
[ "protected", "RestResponse", "performRequest", "(", "final", "HttpUriRequest", "request", ")", "throws", "IOException", ",", "AppPlatformException", "{", "if", "(", "this", ".", "usersUri", "==", "null", "||", "this", ".", "usersUri", ".", "isEmpty", "(", ")", "||", "this", ".", "token", "==", "null", "||", "this", ".", "token", ".", "isEmpty", "(", ")", "||", "this", ".", "secret", "==", "null", "||", "this", ".", "secret", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "MissingCredentialsException", "(", ")", ";", "}", "RestResponse", "restResponse", "=", "RestResponse", ".", "createRestResponse", "(", "httpClient", ".", "execute", "(", "request", ")", ")", ";", "if", "(", "restResponse", ".", "getStatus", "(", ")", ">=", "400", ")", "{", "throw", "new", "AppPlatformException", "(", "restResponse", ".", "getResponseText", "(", ")", ",", "restResponse", ".", "getStatus", "(", ")", ")", ";", "}", "return", "restResponse", ";", "}" ]
Helper method that executes the request on the server. @param request the request. @return the response. @throws IOException unexpected exception. @throws AppPlatformException unexpected exception.
[ "Helper", "method", "that", "executes", "the", "request", "on", "the", "server", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L513-L529
5,869
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.buildMethod
protected HttpUriRequest buildMethod(final String method, final String path, final Map<String, Object> params) { if (StringUtils.equalsIgnoreCase(method, HttpGet.METHOD_NAME)) { return generateGetRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpPost.METHOD_NAME)) { return generatePostRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpPut.METHOD_NAME)) { return generatePutRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpDelete.METHOD_NAME)) { return generateDeleteRequest(path); } else { throw new RuntimeException("Must not be here."); } }
java
protected HttpUriRequest buildMethod(final String method, final String path, final Map<String, Object> params) { if (StringUtils.equalsIgnoreCase(method, HttpGet.METHOD_NAME)) { return generateGetRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpPost.METHOD_NAME)) { return generatePostRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpPut.METHOD_NAME)) { return generatePutRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpDelete.METHOD_NAME)) { return generateDeleteRequest(path); } else { throw new RuntimeException("Must not be here."); } }
[ "protected", "HttpUriRequest", "buildMethod", "(", "final", "String", "method", ",", "final", "String", "path", ",", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "{", "if", "(", "StringUtils", ".", "equalsIgnoreCase", "(", "method", ",", "HttpGet", ".", "METHOD_NAME", ")", ")", "{", "return", "generateGetRequest", "(", "path", ",", "params", ")", ";", "}", "else", "if", "(", "StringUtils", ".", "equalsIgnoreCase", "(", "method", ",", "HttpPost", ".", "METHOD_NAME", ")", ")", "{", "return", "generatePostRequest", "(", "path", ",", "params", ")", ";", "}", "else", "if", "(", "StringUtils", ".", "equalsIgnoreCase", "(", "method", ",", "HttpPut", ".", "METHOD_NAME", ")", ")", "{", "return", "generatePutRequest", "(", "path", ",", "params", ")", ";", "}", "else", "if", "(", "StringUtils", ".", "equalsIgnoreCase", "(", "method", ",", "HttpDelete", ".", "METHOD_NAME", ")", ")", "{", "return", "generateDeleteRequest", "(", "path", ")", ";", "}", "else", "{", "throw", "new", "RuntimeException", "(", "\"Must not be here.\"", ")", ";", "}", "}" ]
Helper method that builds the request to the server. @param method the method. @param path the path. @param params the parameters. @return the request.
[ "Helper", "method", "that", "builds", "the", "request", "to", "the", "server", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L571-L583
5,870
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.generateGetRequest
protected HttpGet generateGetRequest(final String path, final Map<String, Object> paramMap) { final List<NameValuePair> pairs = new ArrayList<NameValuePair>(); for (final String key : paramMap.keySet()) { pairs.add(new BasicNameValuePair(key, paramMap.get(key).toString())); } final URI uri = buildUri(path, pairs); return new HttpGet(uri); }
java
protected HttpGet generateGetRequest(final String path, final Map<String, Object> paramMap) { final List<NameValuePair> pairs = new ArrayList<NameValuePair>(); for (final String key : paramMap.keySet()) { pairs.add(new BasicNameValuePair(key, paramMap.get(key).toString())); } final URI uri = buildUri(path, pairs); return new HttpGet(uri); }
[ "protected", "HttpGet", "generateGetRequest", "(", "final", "String", "path", ",", "final", "Map", "<", "String", ",", "Object", ">", "paramMap", ")", "{", "final", "List", "<", "NameValuePair", ">", "pairs", "=", "new", "ArrayList", "<", "NameValuePair", ">", "(", ")", ";", "for", "(", "final", "String", "key", ":", "paramMap", ".", "keySet", "(", ")", ")", "{", "pairs", ".", "add", "(", "new", "BasicNameValuePair", "(", "key", ",", "paramMap", ".", "get", "(", "key", ")", ".", "toString", "(", ")", ")", ")", ";", "}", "final", "URI", "uri", "=", "buildUri", "(", "path", ",", "pairs", ")", ";", "return", "new", "HttpGet", "(", "uri", ")", ";", "}" ]
Helper method to build the GET request for the server. @param path the path. @param paramMap the parameters map. @return the get object.
[ "Helper", "method", "to", "build", "the", "GET", "request", "for", "the", "server", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L610-L617
5,871
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.generatePutRequest
protected HttpPut generatePutRequest(final String path, final Map<String, Object> paramMap) { final HttpPut put = new HttpPut(buildUri(path)); if (paramMap != null) { put.setEntity(new StringEntity(JSONObject.toJSONString(paramMap), ContentType.APPLICATION_JSON)); } return put; }
java
protected HttpPut generatePutRequest(final String path, final Map<String, Object> paramMap) { final HttpPut put = new HttpPut(buildUri(path)); if (paramMap != null) { put.setEntity(new StringEntity(JSONObject.toJSONString(paramMap), ContentType.APPLICATION_JSON)); } return put; }
[ "protected", "HttpPut", "generatePutRequest", "(", "final", "String", "path", ",", "final", "Map", "<", "String", ",", "Object", ">", "paramMap", ")", "{", "final", "HttpPut", "put", "=", "new", "HttpPut", "(", "buildUri", "(", "path", ")", ")", ";", "if", "(", "paramMap", "!=", "null", ")", "{", "put", ".", "setEntity", "(", "new", "StringEntity", "(", "JSONObject", ".", "toJSONString", "(", "paramMap", ")", ",", "ContentType", ".", "APPLICATION_JSON", ")", ")", ";", "}", "return", "put", ";", "}" ]
Helper method to build the PUT request for the server. @param path the path @param paramMap the parameters map. @return the put object.
[ "Helper", "method", "to", "build", "the", "PUT", "request", "for", "the", "server", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L652-L658
5,872
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.buildUri
protected URI buildUri(final String path, final List<NameValuePair> queryStringParams) { final StringBuilder sb = new StringBuilder(); sb.append(path); if (queryStringParams != null && queryStringParams.size() > 0) { sb.append("?").append(URLEncodedUtils.format(queryStringParams, "UTF-8")); } try { return new URI(sb.toString()); } catch (final URISyntaxException e) { throw new IllegalStateException("Invalid uri", e); } }
java
protected URI buildUri(final String path, final List<NameValuePair> queryStringParams) { final StringBuilder sb = new StringBuilder(); sb.append(path); if (queryStringParams != null && queryStringParams.size() > 0) { sb.append("?").append(URLEncodedUtils.format(queryStringParams, "UTF-8")); } try { return new URI(sb.toString()); } catch (final URISyntaxException e) { throw new IllegalStateException("Invalid uri", e); } }
[ "protected", "URI", "buildUri", "(", "final", "String", "path", ",", "final", "List", "<", "NameValuePair", ">", "queryStringParams", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "path", ")", ";", "if", "(", "queryStringParams", "!=", "null", "&&", "queryStringParams", ".", "size", "(", ")", ">", "0", ")", "{", "sb", ".", "append", "(", "\"?\"", ")", ".", "append", "(", "URLEncodedUtils", ".", "format", "(", "queryStringParams", ",", "\"UTF-8\"", ")", ")", ";", "}", "try", "{", "return", "new", "URI", "(", "sb", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "final", "URISyntaxException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Invalid uri\"", ",", "e", ")", ";", "}", "}" ]
Helper method to return URI query parameters @param path the path. @param queryStringParams the query string parameters. @return the URI object.
[ "Helper", "method", "to", "return", "URI", "query", "parameters" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L687-L700
5,873
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Bridge.java
Bridge.get
public static Bridge get(final String id) throws Exception { final BandwidthClient client = BandwidthClient.getInstance(); return get(client, id); }
java
public static Bridge get(final String id) throws Exception { final BandwidthClient client = BandwidthClient.getInstance(); return get(client, id); }
[ "public", "static", "Bridge", "get", "(", "final", "String", "id", ")", "throws", "Exception", "{", "final", "BandwidthClient", "client", "=", "BandwidthClient", ".", "getInstance", "(", ")", ";", "return", "get", "(", "client", ",", "id", ")", ";", "}" ]
Convenience method to get information about a specific bridge. Returns a Bridge object given an id @param id bridge id @return information about a specific bridge @throws IOException unexpected error.
[ "Convenience", "method", "to", "get", "information", "about", "a", "specific", "bridge", ".", "Returns", "a", "Bridge", "object", "given", "an", "id" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Bridge.java#L30-L34
5,874
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Bridge.java
Bridge.get
public static Bridge get(final BandwidthClient client, final String id) throws Exception { assert(client != null); final String bridgesUri = client.getUserResourceInstanceUri(BandwidthConstants.BRIDGES_URI_PATH, id); final JSONObject jsonObject = toJSONObject(client.get(bridgesUri, null)); return new Bridge(client, jsonObject); }
java
public static Bridge get(final BandwidthClient client, final String id) throws Exception { assert(client != null); final String bridgesUri = client.getUserResourceInstanceUri(BandwidthConstants.BRIDGES_URI_PATH, id); final JSONObject jsonObject = toJSONObject(client.get(bridgesUri, null)); return new Bridge(client, jsonObject); }
[ "public", "static", "Bridge", "get", "(", "final", "BandwidthClient", "client", ",", "final", "String", "id", ")", "throws", "Exception", "{", "assert", "(", "client", "!=", "null", ")", ";", "final", "String", "bridgesUri", "=", "client", ".", "getUserResourceInstanceUri", "(", "BandwidthConstants", ".", "BRIDGES_URI_PATH", ",", "id", ")", ";", "final", "JSONObject", "jsonObject", "=", "toJSONObject", "(", "client", ".", "get", "(", "bridgesUri", ",", "null", ")", ")", ";", "return", "new", "Bridge", "(", "client", ",", "jsonObject", ")", ";", "}" ]
Convenience method to return a bridge object given a client and an id @param client the client @param id the call id @return the Bridge @throws IOException unexpected error.
[ "Convenience", "method", "to", "return", "a", "bridge", "object", "given", "a", "client", "and", "an", "id" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Bridge.java#L44-L50
5,875
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Bridge.java
Bridge.create
public static Bridge create(final Call call1, final Call call2) throws Exception { assert (call1 != null); final String callId1 = call1.getId(); final String callId2 = call2.getId(); return Bridge.create(callId1, callId2); }
java
public static Bridge create(final Call call1, final Call call2) throws Exception { assert (call1 != null); final String callId1 = call1.getId(); final String callId2 = call2.getId(); return Bridge.create(callId1, callId2); }
[ "public", "static", "Bridge", "create", "(", "final", "Call", "call1", ",", "final", "Call", "call2", ")", "throws", "Exception", "{", "assert", "(", "call1", "!=", "null", ")", ";", "final", "String", "callId1", "=", "call1", ".", "getId", "(", ")", ";", "final", "String", "callId2", "=", "call2", ".", "getId", "(", ")", ";", "return", "Bridge", ".", "create", "(", "callId1", ",", "callId2", ")", ";", "}" ]
Convenience factory method to create a Bridge object from two Call objects @param call1 the call id @param call2 the call id @return the Bridge @throws IOException unexpected error.
[ "Convenience", "factory", "method", "to", "create", "a", "Bridge", "object", "from", "two", "Call", "objects" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Bridge.java#L71-L77
5,876
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Bridge.java
Bridge.create
public static Bridge create(final String callId1, final String callId2) throws Exception { assert (callId1 != null); final BandwidthClient client = BandwidthClient.getInstance(); return create(client, callId1, callId2); }
java
public static Bridge create(final String callId1, final String callId2) throws Exception { assert (callId1 != null); final BandwidthClient client = BandwidthClient.getInstance(); return create(client, callId1, callId2); }
[ "public", "static", "Bridge", "create", "(", "final", "String", "callId1", ",", "final", "String", "callId2", ")", "throws", "Exception", "{", "assert", "(", "callId1", "!=", "null", ")", ";", "final", "BandwidthClient", "client", "=", "BandwidthClient", ".", "getInstance", "(", ")", ";", "return", "create", "(", "client", ",", "callId1", ",", "callId2", ")", ";", "}" ]
Convenience factory method to create a Bridge object from two call ids @param callId1 the call id @param callId2 the call id @return the Bridge @throws IOException unexpected error.
[ "Convenience", "factory", "method", "to", "create", "a", "Bridge", "object", "from", "two", "call", "ids" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Bridge.java#L86-L91
5,877
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Bridge.java
Bridge.create
public static Bridge create(final BandwidthClient client, final String callId1, final String callId2) throws Exception { assert (callId1 != null); final HashMap<String, Object> params = new HashMap<String, Object>(); params.put("bridgeAudio", "true"); String[] callIds = null; if (callId1 != null && callId2 != null) { callIds = new String[] { callId1, callId2 }; } else if (callId1 != null && callId2 == null) { callIds = new String[] { callId1 }; } else if (callId1 == null && callId2 != null) { callIds = new String[] { callId2 }; } params.put("callIds", callIds == null ? Collections.emptyList() : Arrays.asList(callIds)); return create(client, params); }
java
public static Bridge create(final BandwidthClient client, final String callId1, final String callId2) throws Exception { assert (callId1 != null); final HashMap<String, Object> params = new HashMap<String, Object>(); params.put("bridgeAudio", "true"); String[] callIds = null; if (callId1 != null && callId2 != null) { callIds = new String[] { callId1, callId2 }; } else if (callId1 != null && callId2 == null) { callIds = new String[] { callId1 }; } else if (callId1 == null && callId2 != null) { callIds = new String[] { callId2 }; } params.put("callIds", callIds == null ? Collections.emptyList() : Arrays.asList(callIds)); return create(client, params); }
[ "public", "static", "Bridge", "create", "(", "final", "BandwidthClient", "client", ",", "final", "String", "callId1", ",", "final", "String", "callId2", ")", "throws", "Exception", "{", "assert", "(", "callId1", "!=", "null", ")", ";", "final", "HashMap", "<", "String", ",", "Object", ">", "params", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "params", ".", "put", "(", "\"bridgeAudio\"", ",", "\"true\"", ")", ";", "String", "[", "]", "callIds", "=", "null", ";", "if", "(", "callId1", "!=", "null", "&&", "callId2", "!=", "null", ")", "{", "callIds", "=", "new", "String", "[", "]", "{", "callId1", ",", "callId2", "}", ";", "}", "else", "if", "(", "callId1", "!=", "null", "&&", "callId2", "==", "null", ")", "{", "callIds", "=", "new", "String", "[", "]", "{", "callId1", "}", ";", "}", "else", "if", "(", "callId1", "==", "null", "&&", "callId2", "!=", "null", ")", "{", "callIds", "=", "new", "String", "[", "]", "{", "callId2", "}", ";", "}", "params", ".", "put", "(", "\"callIds\"", ",", "callIds", "==", "null", "?", "Collections", ".", "emptyList", "(", ")", ":", "Arrays", ".", "asList", "(", "callIds", ")", ")", ";", "return", "create", "(", "client", ",", "params", ")", ";", "}" ]
Convenience method to create a Bridge object from two call ids @param client the client @param callId1 the call id @param callId2 the call id @return the Bridge @throws IOException unexpected error.
[ "Convenience", "method", "to", "create", "a", "Bridge", "object", "from", "two", "call", "ids" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Bridge.java#L101-L124
5,878
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Bridge.java
Bridge.create
public static Bridge create(final BandwidthClient client, final Map<String, Object>params) throws Exception { assert (client!= null && params != null); final String bridgesUri = client.getUserResourceUri(BandwidthConstants.BRIDGES_URI_PATH); final RestResponse response = client.post(bridgesUri, params); final JSONObject callObj = toJSONObject(client.get(response.getLocation(), null)); final Bridge bridge = new Bridge(client, callObj); return bridge; }
java
public static Bridge create(final BandwidthClient client, final Map<String, Object>params) throws Exception { assert (client!= null && params != null); final String bridgesUri = client.getUserResourceUri(BandwidthConstants.BRIDGES_URI_PATH); final RestResponse response = client.post(bridgesUri, params); final JSONObject callObj = toJSONObject(client.get(response.getLocation(), null)); final Bridge bridge = new Bridge(client, callObj); return bridge; }
[ "public", "static", "Bridge", "create", "(", "final", "BandwidthClient", "client", ",", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "Exception", "{", "assert", "(", "client", "!=", "null", "&&", "params", "!=", "null", ")", ";", "final", "String", "bridgesUri", "=", "client", ".", "getUserResourceUri", "(", "BandwidthConstants", ".", "BRIDGES_URI_PATH", ")", ";", "final", "RestResponse", "response", "=", "client", ".", "post", "(", "bridgesUri", ",", "params", ")", ";", "final", "JSONObject", "callObj", "=", "toJSONObject", "(", "client", ".", "get", "(", "response", ".", "getLocation", "(", ")", ",", "null", ")", ")", ";", "final", "Bridge", "bridge", "=", "new", "Bridge", "(", "client", ",", "callObj", ")", ";", "return", "bridge", ";", "}" ]
Convenience factory method to create a Bridge object from a params maps @param client the client @param params the params @return the Bridge @throws IOException unexpected error.
[ "Convenience", "factory", "method", "to", "create", "a", "Bridge", "object", "from", "a", "params", "maps" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Bridge.java#L133-L142
5,879
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Bridge.java
Bridge.getBridgeCalls
public List<Call> getBridgeCalls() throws Exception { final String callsPath = StringUtils.join(new String[]{ getUri(), "calls" }, '/'); final JSONArray jsonArray = toJSONArray(client.get(callsPath, null)); final List<Call> callList = new ArrayList<Call>(); for (final Object obj : jsonArray) { callList.add(new Call(client, (JSONObject) obj)); } return callList; }
java
public List<Call> getBridgeCalls() throws Exception { final String callsPath = StringUtils.join(new String[]{ getUri(), "calls" }, '/'); final JSONArray jsonArray = toJSONArray(client.get(callsPath, null)); final List<Call> callList = new ArrayList<Call>(); for (final Object obj : jsonArray) { callList.add(new Call(client, (JSONObject) obj)); } return callList; }
[ "public", "List", "<", "Call", ">", "getBridgeCalls", "(", ")", "throws", "Exception", "{", "final", "String", "callsPath", "=", "StringUtils", ".", "join", "(", "new", "String", "[", "]", "{", "getUri", "(", ")", ",", "\"calls\"", "}", ",", "'", "'", ")", ";", "final", "JSONArray", "jsonArray", "=", "toJSONArray", "(", "client", ".", "get", "(", "callsPath", ",", "null", ")", ")", ";", "final", "List", "<", "Call", ">", "callList", "=", "new", "ArrayList", "<", "Call", ">", "(", ")", ";", "for", "(", "final", "Object", "obj", ":", "jsonArray", ")", "{", "callList", ".", "add", "(", "new", "Call", "(", "client", ",", "(", "JSONObject", ")", "obj", ")", ")", ";", "}", "return", "callList", ";", "}" ]
Gets list of calls that are on the bridge @return list of calls @throws IOException unexpected error.
[ "Gets", "list", "of", "calls", "that", "are", "on", "the", "bridge" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Bridge.java#L213-L225
5,880
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Bridge.java
Bridge.commit
public void commit() throws IOException, AppPlatformException { final Map<String, Object> params = new HashMap<String, Object>(); params.put("bridgeAudio", isBridgeAudio()); final String[] callIds = getCallIds(); params.put("callIds", callIds == null ? Collections.emptyList() : Arrays.asList(callIds)); client.post(getUri(), params); }
java
public void commit() throws IOException, AppPlatformException { final Map<String, Object> params = new HashMap<String, Object>(); params.put("bridgeAudio", isBridgeAudio()); final String[] callIds = getCallIds(); params.put("callIds", callIds == null ? Collections.emptyList() : Arrays.asList(callIds)); client.post(getUri(), params); }
[ "public", "void", "commit", "(", ")", "throws", "IOException", ",", "AppPlatformException", "{", "final", "Map", "<", "String", ",", "Object", ">", "params", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "params", ".", "put", "(", "\"bridgeAudio\"", ",", "isBridgeAudio", "(", ")", ")", ";", "final", "String", "[", "]", "callIds", "=", "getCallIds", "(", ")", ";", "params", ".", "put", "(", "\"callIds\"", ",", "callIds", "==", "null", "?", "Collections", ".", "emptyList", "(", ")", ":", "Arrays", ".", "asList", "(", "callIds", ")", ")", ";", "client", ".", "post", "(", "getUri", "(", ")", ",", "params", ")", ";", "}" ]
Makes changes ob the bridge. @throws IOException unexpected error. @throws AppPlatformException unexpected exception.
[ "Makes", "changes", "ob", "the", "bridge", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Bridge.java#L250-L258
5,881
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Error.java
Error.get
public static Error get(final BandwidthClient client, final String id) throws Exception { final String errorsUri = client.getUserResourceInstanceUri(BandwidthConstants.ERRORS_URI_PATH, id); final JSONObject jsonObject = toJSONObject(client.get(errorsUri, null)); return new Error(client, errorsUri, jsonObject); }
java
public static Error get(final BandwidthClient client, final String id) throws Exception { final String errorsUri = client.getUserResourceInstanceUri(BandwidthConstants.ERRORS_URI_PATH, id); final JSONObject jsonObject = toJSONObject(client.get(errorsUri, null)); return new Error(client, errorsUri, jsonObject); }
[ "public", "static", "Error", "get", "(", "final", "BandwidthClient", "client", ",", "final", "String", "id", ")", "throws", "Exception", "{", "final", "String", "errorsUri", "=", "client", ".", "getUserResourceInstanceUri", "(", "BandwidthConstants", ".", "ERRORS_URI_PATH", ",", "id", ")", ";", "final", "JSONObject", "jsonObject", "=", "toJSONObject", "(", "client", ".", "get", "(", "errorsUri", ",", "null", ")", ")", ";", "return", "new", "Error", "(", "client", ",", "errorsUri", ",", "jsonObject", ")", ";", "}" ]
Factory method for Error. Returns Error object from id. @param client the client @param id error id @return information about one user error @throws IOException unexpected error.
[ "Factory", "method", "for", "Error", ".", "Returns", "Error", "object", "from", "id", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Error.java#L38-L43
5,882
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/AvailableNumber.java
AvailableNumber.list
public static ResourceList<AvailableNumber> list(final int page, final int size) throws IOException { return list(BandwidthClient.getInstance(), page, size); }
java
public static ResourceList<AvailableNumber> list(final int page, final int size) throws IOException { return list(BandwidthClient.getInstance(), page, size); }
[ "public", "static", "ResourceList", "<", "AvailableNumber", ">", "list", "(", "final", "int", "page", ",", "final", "int", "size", ")", "throws", "IOException", "{", "return", "list", "(", "BandwidthClient", ".", "getInstance", "(", ")", ",", "page", ",", "size", ")", ";", "}" ]
Factory method for AvailableNumber list, returns list of AvailableNumber objects with page, size preferences @param page the page @param size the page size @return the list @throws IOException unexpected error.
[ "Factory", "method", "for", "AvailableNumber", "list", "returns", "list", "of", "AvailableNumber", "objects", "with", "page", "size", "preferences" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/AvailableNumber.java#L39-L42
5,883
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/AvailableNumber.java
AvailableNumber.list
public static ResourceList<AvailableNumber> list(final BandwidthClient client, final int page, final int size) throws IOException { final String availableNumbersUri = client.getUserResourceUri(BandwidthConstants.AVAILABLE_NUMBERS_URI_PATH); // TODO add new ResourceList ctor to allow arbitrary params final ResourceList<AvailableNumber> availableNumbers = new ResourceList<AvailableNumber>(page, size, availableNumbersUri, AvailableNumber.class); availableNumbers.setClient(client); availableNumbers.initialize(); return availableNumbers; }
java
public static ResourceList<AvailableNumber> list(final BandwidthClient client, final int page, final int size) throws IOException { final String availableNumbersUri = client.getUserResourceUri(BandwidthConstants.AVAILABLE_NUMBERS_URI_PATH); // TODO add new ResourceList ctor to allow arbitrary params final ResourceList<AvailableNumber> availableNumbers = new ResourceList<AvailableNumber>(page, size, availableNumbersUri, AvailableNumber.class); availableNumbers.setClient(client); availableNumbers.initialize(); return availableNumbers; }
[ "public", "static", "ResourceList", "<", "AvailableNumber", ">", "list", "(", "final", "BandwidthClient", "client", ",", "final", "int", "page", ",", "final", "int", "size", ")", "throws", "IOException", "{", "final", "String", "availableNumbersUri", "=", "client", ".", "getUserResourceUri", "(", "BandwidthConstants", ".", "AVAILABLE_NUMBERS_URI_PATH", ")", ";", "// TODO add new ResourceList ctor to allow arbitrary params", "final", "ResourceList", "<", "AvailableNumber", ">", "availableNumbers", "=", "new", "ResourceList", "<", "AvailableNumber", ">", "(", "page", ",", "size", ",", "availableNumbersUri", ",", "AvailableNumber", ".", "class", ")", ";", "availableNumbers", ".", "setClient", "(", "client", ")", ";", "availableNumbers", ".", "initialize", "(", ")", ";", "return", "availableNumbers", ";", "}" ]
Factory method for AvailableNumber list, returns list of AvailableNumber objects with page, size preferences, with a given client @param client the client @param page the page @param size the page size @return the list @throws IOException unexpected error.
[ "Factory", "method", "for", "AvailableNumber", "list", "returns", "list", "of", "AvailableNumber", "objects", "with", "page", "size", "preferences", "with", "a", "given", "client" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/AvailableNumber.java#L53-L64
5,884
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/AvailableNumber.java
AvailableNumber.searchLocal
public static List<AvailableNumber> searchLocal(final Map<String, Object>params) throws Exception { return searchLocal(BandwidthClient.getInstance(), params); }
java
public static List<AvailableNumber> searchLocal(final Map<String, Object>params) throws Exception { return searchLocal(BandwidthClient.getInstance(), params); }
[ "public", "static", "List", "<", "AvailableNumber", ">", "searchLocal", "(", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "Exception", "{", "return", "searchLocal", "(", "BandwidthClient", ".", "getInstance", "(", ")", ",", "params", ")", ";", "}" ]
Convenience factory method to return local numbers based on a given search criteria @param params the params @return the list @throws IOException unexpected error.
[ "Convenience", "factory", "method", "to", "return", "local", "numbers", "based", "on", "a", "given", "search", "criteria" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/AvailableNumber.java#L103-L105
5,885
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/AvailableNumber.java
AvailableNumber.searchLocal
public static List<AvailableNumber> searchLocal(final BandwidthClient client, final Map<String, Object>params) throws Exception { final String tollFreeUri = BandwidthConstants.AVAILABLE_NUMBERS_LOCAL_URI_PATH; final JSONArray array = toJSONArray(client.get(tollFreeUri, params)); final List<AvailableNumber> numbers = new ArrayList<AvailableNumber>(); for (final Object obj : array) { numbers.add(new AvailableNumber(client, (JSONObject) obj)); } return numbers; }
java
public static List<AvailableNumber> searchLocal(final BandwidthClient client, final Map<String, Object>params) throws Exception { final String tollFreeUri = BandwidthConstants.AVAILABLE_NUMBERS_LOCAL_URI_PATH; final JSONArray array = toJSONArray(client.get(tollFreeUri, params)); final List<AvailableNumber> numbers = new ArrayList<AvailableNumber>(); for (final Object obj : array) { numbers.add(new AvailableNumber(client, (JSONObject) obj)); } return numbers; }
[ "public", "static", "List", "<", "AvailableNumber", ">", "searchLocal", "(", "final", "BandwidthClient", "client", ",", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "Exception", "{", "final", "String", "tollFreeUri", "=", "BandwidthConstants", ".", "AVAILABLE_NUMBERS_LOCAL_URI_PATH", ";", "final", "JSONArray", "array", "=", "toJSONArray", "(", "client", ".", "get", "(", "tollFreeUri", ",", "params", ")", ")", ";", "final", "List", "<", "AvailableNumber", ">", "numbers", "=", "new", "ArrayList", "<", "AvailableNumber", ">", "(", ")", ";", "for", "(", "final", "Object", "obj", ":", "array", ")", "{", "numbers", ".", "add", "(", "new", "AvailableNumber", "(", "client", ",", "(", "JSONObject", ")", "obj", ")", ")", ";", "}", "return", "numbers", ";", "}" ]
Convenience factory method to return local numbers based on a given search criteria for a given client @param client the client @param params the params @return the list @throws IOException unexpected error.
[ "Convenience", "factory", "method", "to", "return", "local", "numbers", "based", "on", "a", "given", "search", "criteria", "for", "a", "given", "client" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/AvailableNumber.java#L114-L125
5,886
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Conference.java
Conference.createConference
public static Conference createConference(final Map<String, Object> params) throws Exception { return createConference(BandwidthClient.getInstance(), params); }
java
public static Conference createConference(final Map<String, Object> params) throws Exception { return createConference(BandwidthClient.getInstance(), params); }
[ "public", "static", "Conference", "createConference", "(", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "Exception", "{", "return", "createConference", "(", "BandwidthClient", ".", "getInstance", "(", ")", ",", "params", ")", ";", "}" ]
Factory method to create a conference given a set of params @param params the params @return the conference @throws IOException unexpected error.
[ "Factory", "method", "to", "create", "a", "conference", "given", "a", "set", "of", "params" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Conference.java#L58-L61
5,887
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Conference.java
Conference.createConference
public static Conference createConference(final BandwidthClient client, final Map<String, Object> params) throws Exception { final String conferencesUri = client.getUserResourceUri(BandwidthConstants.CONFERENCES_URI_PATH); final RestResponse response = client.post(conferencesUri, params); final String id = response.getLocation().substring(client.getPath(conferencesUri).length() + 1); return getConference(client, id); }
java
public static Conference createConference(final BandwidthClient client, final Map<String, Object> params) throws Exception { final String conferencesUri = client.getUserResourceUri(BandwidthConstants.CONFERENCES_URI_PATH); final RestResponse response = client.post(conferencesUri, params); final String id = response.getLocation().substring(client.getPath(conferencesUri).length() + 1); return getConference(client, id); }
[ "public", "static", "Conference", "createConference", "(", "final", "BandwidthClient", "client", ",", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "Exception", "{", "final", "String", "conferencesUri", "=", "client", ".", "getUserResourceUri", "(", "BandwidthConstants", ".", "CONFERENCES_URI_PATH", ")", ";", "final", "RestResponse", "response", "=", "client", ".", "post", "(", "conferencesUri", ",", "params", ")", ";", "final", "String", "id", "=", "response", ".", "getLocation", "(", ")", ".", "substring", "(", "client", ".", "getPath", "(", "conferencesUri", ")", ".", "length", "(", ")", "+", "1", ")", ";", "return", "getConference", "(", "client", ",", "id", ")", ";", "}" ]
Factory method to create a conference given a set of params and a client object @param client the bandwidth client configuration. @param params the params @return the conference @throws IOException unexpected error.
[ "Factory", "method", "to", "create", "a", "conference", "given", "a", "set", "of", "params", "and", "a", "client", "object" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Conference.java#L70-L77
5,888
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Conference.java
Conference.getMembers
public List<ConferenceMember> getMembers() throws Exception { final String membersPath = StringUtils.join(new String[]{ getUri(), "members" }, '/'); final JSONArray array = toJSONArray(client.get(membersPath, null)); final List<ConferenceMember> members = new ArrayList<ConferenceMember>(); for (final Object obj : array) { members.add(new ConferenceMember(client, (JSONObject) obj)); } return members; }
java
public List<ConferenceMember> getMembers() throws Exception { final String membersPath = StringUtils.join(new String[]{ getUri(), "members" }, '/'); final JSONArray array = toJSONArray(client.get(membersPath, null)); final List<ConferenceMember> members = new ArrayList<ConferenceMember>(); for (final Object obj : array) { members.add(new ConferenceMember(client, (JSONObject) obj)); } return members; }
[ "public", "List", "<", "ConferenceMember", ">", "getMembers", "(", ")", "throws", "Exception", "{", "final", "String", "membersPath", "=", "StringUtils", ".", "join", "(", "new", "String", "[", "]", "{", "getUri", "(", ")", ",", "\"members\"", "}", ",", "'", "'", ")", ";", "final", "JSONArray", "array", "=", "toJSONArray", "(", "client", ".", "get", "(", "membersPath", ",", "null", ")", ")", ";", "final", "List", "<", "ConferenceMember", ">", "members", "=", "new", "ArrayList", "<", "ConferenceMember", ">", "(", ")", ";", "for", "(", "final", "Object", "obj", ":", "array", ")", "{", "members", ".", "add", "(", "new", "ConferenceMember", "(", "client", ",", "(", "JSONObject", ")", "obj", ")", ")", ";", "}", "return", "members", ";", "}" ]
Gets list all members from a conference. If a member had already hung up or removed from conference it will be displayed as completed. @return list of members @throws IOException unexpected error.
[ "Gets", "list", "all", "members", "from", "a", "conference", ".", "If", "a", "member", "had", "already", "hung", "up", "or", "removed", "from", "conference", "it", "will", "be", "displayed", "as", "completed", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Conference.java#L165-L177
5,889
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/EndpointToken.java
EndpointToken.delete
public static void delete(final BandwidthClient client, final String domainId, final String endpointId, final String token) throws AppPlatformException, ParseException, IOException { assert(client != null && domainId != null && endpointId != null && endpointId != null); deleteToken(client, domainId, endpointId, token); }
java
public static void delete(final BandwidthClient client, final String domainId, final String endpointId, final String token) throws AppPlatformException, ParseException, IOException { assert(client != null && domainId != null && endpointId != null && endpointId != null); deleteToken(client, domainId, endpointId, token); }
[ "public", "static", "void", "delete", "(", "final", "BandwidthClient", "client", ",", "final", "String", "domainId", ",", "final", "String", "endpointId", ",", "final", "String", "token", ")", "throws", "AppPlatformException", ",", "ParseException", ",", "IOException", "{", "assert", "(", "client", "!=", "null", "&&", "domainId", "!=", "null", "&&", "endpointId", "!=", "null", "&&", "endpointId", "!=", "null", ")", ";", "deleteToken", "(", "client", ",", "domainId", ",", "endpointId", ",", "token", ")", ";", "}" ]
Permanently deletes the Endpoint token. @param client the bandwidth client. @param domainId the domain id. @param endpointId the Endpoint id. @param token @throws AppPlatformException API Exception @throws IOException unexpected error
[ "Permanently", "deletes", "the", "Endpoint", "token", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/EndpointToken.java#L125-L128
5,890
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.get
public static Call get(final String callId) throws Exception { final BandwidthClient client = BandwidthClient.getInstance(); return get(client, callId); }
java
public static Call get(final String callId) throws Exception { final BandwidthClient client = BandwidthClient.getInstance(); return get(client, callId); }
[ "public", "static", "Call", "get", "(", "final", "String", "callId", ")", "throws", "Exception", "{", "final", "BandwidthClient", "client", "=", "BandwidthClient", ".", "getInstance", "(", ")", ";", "return", "get", "(", "client", ",", "callId", ")", ";", "}" ]
Factory method for Call, returns information about an active or completed call. @param callId call id @return the call @throws IOException unexpected error.
[ "Factory", "method", "for", "Call", "returns", "information", "about", "an", "active", "or", "completed", "call", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L30-L35
5,891
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.get
public static Call get(final BandwidthClient client, final String callId) throws Exception { final String callsUri = client.getUserResourceInstanceUri(BandwidthConstants.CALLS_URI_PATH, callId); final JSONObject jsonObject = toJSONObject(client.get(callsUri, null)); return new Call(client, jsonObject); }
java
public static Call get(final BandwidthClient client, final String callId) throws Exception { final String callsUri = client.getUserResourceInstanceUri(BandwidthConstants.CALLS_URI_PATH, callId); final JSONObject jsonObject = toJSONObject(client.get(callsUri, null)); return new Call(client, jsonObject); }
[ "public", "static", "Call", "get", "(", "final", "BandwidthClient", "client", ",", "final", "String", "callId", ")", "throws", "Exception", "{", "final", "String", "callsUri", "=", "client", ".", "getUserResourceInstanceUri", "(", "BandwidthConstants", ".", "CALLS_URI_PATH", ",", "callId", ")", ";", "final", "JSONObject", "jsonObject", "=", "toJSONObject", "(", "client", ".", "get", "(", "callsUri", ",", "null", ")", ")", ";", "return", "new", "Call", "(", "client", ",", "jsonObject", ")", ";", "}" ]
Convenience factory method for Call, returns a Call object given an id @param client the client @param callId the call id @return the call @throws Exception error.
[ "Convenience", "factory", "method", "for", "Call", "returns", "a", "Call", "object", "given", "an", "id" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L44-L51
5,892
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.create
public static Call create(final String to, final String from) throws Exception { return create(to, from, "none", null); }
java
public static Call create(final String to, final String from) throws Exception { return create(to, from, "none", null); }
[ "public", "static", "Call", "create", "(", "final", "String", "to", ",", "final", "String", "from", ")", "throws", "Exception", "{", "return", "create", "(", "to", ",", "from", ",", "\"none\"", ",", "null", ")", ";", "}" ]
Convenience factory method to make an outbound call @param to the to number @param from the from number @return the call @throws Exception error.
[ "Convenience", "factory", "method", "to", "make", "an", "outbound", "call" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L105-L107
5,893
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.create
public static Call create(final String to, final String from, final String callbackUrl, final String tag) throws Exception { assert(to != null && from != null); final Map<String, Object> params = new HashMap<String, Object>(); params.put("to", to); params.put("from", from); params.put("callbackUrl", callbackUrl); params.put("tag", tag); final Call call = create(params); return call; }
java
public static Call create(final String to, final String from, final String callbackUrl, final String tag) throws Exception { assert(to != null && from != null); final Map<String, Object> params = new HashMap<String, Object>(); params.put("to", to); params.put("from", from); params.put("callbackUrl", callbackUrl); params.put("tag", tag); final Call call = create(params); return call; }
[ "public", "static", "Call", "create", "(", "final", "String", "to", ",", "final", "String", "from", ",", "final", "String", "callbackUrl", ",", "final", "String", "tag", ")", "throws", "Exception", "{", "assert", "(", "to", "!=", "null", "&&", "from", "!=", "null", ")", ";", "final", "Map", "<", "String", ",", "Object", ">", "params", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "params", ".", "put", "(", "\"to\"", ",", "to", ")", ";", "params", ".", "put", "(", "\"from\"", ",", "from", ")", ";", "params", ".", "put", "(", "\"callbackUrl\"", ",", "callbackUrl", ")", ";", "params", ".", "put", "(", "\"tag\"", ",", "tag", ")", ";", "final", "Call", "call", "=", "create", "(", "params", ")", ";", "return", "call", ";", "}" ]
Convenience method to dials a call from a phone number to a phone number @param to the to number @param from the from number @param callbackUrl the callback URL @param tag the call tag @return the call @throws IOException unexpected error.
[ "Convenience", "method", "to", "dials", "a", "call", "from", "a", "phone", "number", "to", "a", "phone", "number" ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L118-L131
5,894
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.getRecordings
public List<Recording> getRecordings() throws Exception { final String recordingsPath = StringUtils.join(new String[]{ getUri(), "recordings" }, '/'); final JSONArray array = toJSONArray(client.get(recordingsPath, null)); final List<Recording> list = new ArrayList<Recording>(); for (final Object object : array) { list.add(new Recording(client, recordingsPath, (JSONObject) object)); } return list; }
java
public List<Recording> getRecordings() throws Exception { final String recordingsPath = StringUtils.join(new String[]{ getUri(), "recordings" }, '/'); final JSONArray array = toJSONArray(client.get(recordingsPath, null)); final List<Recording> list = new ArrayList<Recording>(); for (final Object object : array) { list.add(new Recording(client, recordingsPath, (JSONObject) object)); } return list; }
[ "public", "List", "<", "Recording", ">", "getRecordings", "(", ")", "throws", "Exception", "{", "final", "String", "recordingsPath", "=", "StringUtils", ".", "join", "(", "new", "String", "[", "]", "{", "getUri", "(", ")", ",", "\"recordings\"", "}", ",", "'", "'", ")", ";", "final", "JSONArray", "array", "=", "toJSONArray", "(", "client", ".", "get", "(", "recordingsPath", ",", "null", ")", ")", ";", "final", "List", "<", "Recording", ">", "list", "=", "new", "ArrayList", "<", "Recording", ">", "(", ")", ";", "for", "(", "final", "Object", "object", ":", "array", ")", "{", "list", ".", "add", "(", "new", "Recording", "(", "client", ",", "recordingsPath", ",", "(", "JSONObject", ")", "object", ")", ")", ";", "}", "return", "list", ";", "}" ]
Retrieve all recordings related to the call. @return recordings the recordings @throws IOException unexpected error.
[ "Retrieve", "all", "recordings", "related", "to", "the", "call", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L304-L316
5,895
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.getEventsList
public List<EventBase> getEventsList() throws Exception { final String eventsPath = StringUtils.join(new String[]{ getUri(), "events" }, '/'); final JSONArray array = toJSONArray(client.get(eventsPath, null)); final List<EventBase> list = new ArrayList<EventBase>(); for (final Object object : array) { list.add(new EventBase((JSONObject) object)); } return list; }
java
public List<EventBase> getEventsList() throws Exception { final String eventsPath = StringUtils.join(new String[]{ getUri(), "events" }, '/'); final JSONArray array = toJSONArray(client.get(eventsPath, null)); final List<EventBase> list = new ArrayList<EventBase>(); for (final Object object : array) { list.add(new EventBase((JSONObject) object)); } return list; }
[ "public", "List", "<", "EventBase", ">", "getEventsList", "(", ")", "throws", "Exception", "{", "final", "String", "eventsPath", "=", "StringUtils", ".", "join", "(", "new", "String", "[", "]", "{", "getUri", "(", ")", ",", "\"events\"", "}", ",", "'", "'", ")", ";", "final", "JSONArray", "array", "=", "toJSONArray", "(", "client", ".", "get", "(", "eventsPath", ",", "null", ")", ")", ";", "final", "List", "<", "EventBase", ">", "list", "=", "new", "ArrayList", "<", "EventBase", ">", "(", ")", ";", "for", "(", "final", "Object", "object", ":", "array", ")", "{", "list", ".", "add", "(", "new", "EventBase", "(", "(", "JSONObject", ")", "object", ")", ")", ";", "}", "return", "list", ";", "}" ]
Gets the events that occurred during the call. @return events the events list @throws IOException unexpected error.
[ "Gets", "the", "events", "that", "occurred", "during", "the", "call", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L324-L336
5,896
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.getEvent
public EventBase getEvent(final String eventId) throws Exception { final String eventPath = StringUtils.join(new String[]{ getUri(), "events", eventId }, '/'); final JSONObject jsonObject = toJSONObject(client.get(eventPath, null)); return new EventBase(jsonObject); }
java
public EventBase getEvent(final String eventId) throws Exception { final String eventPath = StringUtils.join(new String[]{ getUri(), "events", eventId }, '/'); final JSONObject jsonObject = toJSONObject(client.get(eventPath, null)); return new EventBase(jsonObject); }
[ "public", "EventBase", "getEvent", "(", "final", "String", "eventId", ")", "throws", "Exception", "{", "final", "String", "eventPath", "=", "StringUtils", ".", "join", "(", "new", "String", "[", "]", "{", "getUri", "(", ")", ",", "\"events\"", ",", "eventId", "}", ",", "'", "'", ")", ";", "final", "JSONObject", "jsonObject", "=", "toJSONObject", "(", "client", ".", "get", "(", "eventPath", ",", "null", ")", ")", ";", "return", "new", "EventBase", "(", "jsonObject", ")", ";", "}" ]
Gets information about one call event. @param eventId event id @return information about event @throws IOException unexpected error.
[ "Gets", "information", "about", "one", "call", "event", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L345-L353
5,897
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.hangUp
public void hangUp() throws Exception { final Map<String, Object> params = new HashMap<String, Object>(); params.put("state", "completed"); final String uri = getUri(); client.post(uri, params); final JSONObject jsonObject = toJSONObject(client.get(uri, null)); updateProperties(jsonObject); }
java
public void hangUp() throws Exception { final Map<String, Object> params = new HashMap<String, Object>(); params.put("state", "completed"); final String uri = getUri(); client.post(uri, params); final JSONObject jsonObject = toJSONObject(client.get(uri, null)); updateProperties(jsonObject); }
[ "public", "void", "hangUp", "(", ")", "throws", "Exception", "{", "final", "Map", "<", "String", ",", "Object", ">", "params", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "params", ".", "put", "(", "\"state\"", ",", "\"completed\"", ")", ";", "final", "String", "uri", "=", "getUri", "(", ")", ";", "client", ".", "post", "(", "uri", ",", "params", ")", ";", "final", "JSONObject", "jsonObject", "=", "toJSONObject", "(", "client", ".", "get", "(", "uri", ",", "null", ")", ")", ";", "updateProperties", "(", "jsonObject", ")", ";", "}" ]
Hang up a phone call. @throws IOException unexpected error.
[ "Hang", "up", "a", "phone", "call", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L360-L369
5,898
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.sendDtmf
public void sendDtmf(final String dtmf) throws IOException, AppPlatformException { final Map<String, Object> params = new HashMap<String, Object>(); params.put("dtmfOut", dtmf); final String uri = StringUtils.join(new String[]{ getUri(), "dtmf" }, '/'); client.post(uri, params); }
java
public void sendDtmf(final String dtmf) throws IOException, AppPlatformException { final Map<String, Object> params = new HashMap<String, Object>(); params.put("dtmfOut", dtmf); final String uri = StringUtils.join(new String[]{ getUri(), "dtmf" }, '/'); client.post(uri, params); }
[ "public", "void", "sendDtmf", "(", "final", "String", "dtmf", ")", "throws", "IOException", ",", "AppPlatformException", "{", "final", "Map", "<", "String", ",", "Object", ">", "params", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "params", ".", "put", "(", "\"dtmfOut\"", ",", "dtmf", ")", ";", "final", "String", "uri", "=", "StringUtils", ".", "join", "(", "new", "String", "[", "]", "{", "getUri", "(", ")", ",", "\"dtmf\"", "}", ",", "'", "'", ")", ";", "client", ".", "post", "(", "uri", ",", "params", ")", ";", "}" ]
Sends DTMF. @param dtmf DTMF value @throws IOException unexpected error. @throws AppPlatformException unexpected exception.
[ "Sends", "DTMF", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L485-L494
5,899
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.getGather
public Gather getGather(final String gatherId) throws Exception { final String gatherPath = StringUtils.join(new String[]{ getUri(), "gather", gatherId }, '/'); final JSONObject jsonObject = toJSONObject(client.get(gatherPath, null)); return new Gather(client,jsonObject); }
java
public Gather getGather(final String gatherId) throws Exception { final String gatherPath = StringUtils.join(new String[]{ getUri(), "gather", gatherId }, '/'); final JSONObject jsonObject = toJSONObject(client.get(gatherPath, null)); return new Gather(client,jsonObject); }
[ "public", "Gather", "getGather", "(", "final", "String", "gatherId", ")", "throws", "Exception", "{", "final", "String", "gatherPath", "=", "StringUtils", ".", "join", "(", "new", "String", "[", "]", "{", "getUri", "(", ")", ",", "\"gather\"", ",", "gatherId", "}", ",", "'", "'", ")", ";", "final", "JSONObject", "jsonObject", "=", "toJSONObject", "(", "client", ".", "get", "(", "gatherPath", ",", "null", ")", ")", ";", "return", "new", "Gather", "(", "client", ",", "jsonObject", ")", ";", "}" ]
Gets the gather DTMF parameters and results. @param gatherId gather id @return gather DTMF parameters and results @throws IOException unexpected error.
[ "Gets", "the", "gather", "DTMF", "parameters", "and", "results", "." ]
2124c85148ad6a54d2f2949cb952eb3985830e2a
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L514-L522