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 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.updateBuildpackInstallations | public void updateBuildpackInstallations(String appName, List<String> buildpacks) {
connection.execute(new BuildpackInstallationUpdate(appName, buildpacks), apiKey);
} | java | public void updateBuildpackInstallations(String appName, List<String> buildpacks) {
connection.execute(new BuildpackInstallationUpdate(appName, buildpacks), apiKey);
} | [
"public",
"void",
"updateBuildpackInstallations",
"(",
"String",
"appName",
",",
"List",
"<",
"String",
">",
"buildpacks",
")",
"{",
"connection",
".",
"execute",
"(",
"new",
"BuildpackInstallationUpdate",
"(",
"appName",
",",
"buildpacks",
")",
",",
"apiKey",
"... | Update the list of buildpacks installed on an app
@param appName See {@link #listApps} for a list of apps that can be used.
@param buildpacks the new list of buildpack names or URLs. | [
"Update",
"the",
"list",
"of",
"buildpacks",
"installed",
"on",
"an",
"app"
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L518-L520 | train |
revapi/revapi | revapi-maven-plugin/src/main/java/org/revapi/maven/Analyzer.java | Analyzer.resolveConstrained | static Artifact resolveConstrained(MavenProject project, String gav, Pattern versionRegex,
ArtifactResolver resolver)
throws VersionRangeResolutionException, ArtifactResolutionException {
boolean latest = gav.endsWith(":LATEST");
if (latest || gav.endsWith(":RELEASE")) {
Artifact a = new DefaultArtifact(gav);
if (latest) {
versionRegex = versionRegex == null ? ANY : versionRegex;
} else {
versionRegex = versionRegex == null ? ANY_NON_SNAPSHOT : versionRegex;
}
String upTo = project.getGroupId().equals(a.getGroupId()) && project.getArtifactId().equals(a.getArtifactId())
? project.getVersion()
: null;
return resolver.resolveNewestMatching(gav, upTo, versionRegex, latest, latest);
} else {
String projectGav = getProjectArtifactCoordinates(project, null);
Artifact ret = null;
if (projectGav.equals(gav)) {
ret = findProjectArtifact(project);
}
return ret == null ? resolver.resolveArtifact(gav) : ret;
}
} | java | static Artifact resolveConstrained(MavenProject project, String gav, Pattern versionRegex,
ArtifactResolver resolver)
throws VersionRangeResolutionException, ArtifactResolutionException {
boolean latest = gav.endsWith(":LATEST");
if (latest || gav.endsWith(":RELEASE")) {
Artifact a = new DefaultArtifact(gav);
if (latest) {
versionRegex = versionRegex == null ? ANY : versionRegex;
} else {
versionRegex = versionRegex == null ? ANY_NON_SNAPSHOT : versionRegex;
}
String upTo = project.getGroupId().equals(a.getGroupId()) && project.getArtifactId().equals(a.getArtifactId())
? project.getVersion()
: null;
return resolver.resolveNewestMatching(gav, upTo, versionRegex, latest, latest);
} else {
String projectGav = getProjectArtifactCoordinates(project, null);
Artifact ret = null;
if (projectGav.equals(gav)) {
ret = findProjectArtifact(project);
}
return ret == null ? resolver.resolveArtifact(gav) : ret;
}
} | [
"static",
"Artifact",
"resolveConstrained",
"(",
"MavenProject",
"project",
",",
"String",
"gav",
",",
"Pattern",
"versionRegex",
",",
"ArtifactResolver",
"resolver",
")",
"throws",
"VersionRangeResolutionException",
",",
"ArtifactResolutionException",
"{",
"boolean",
"la... | Resolves the gav using the resolver. If the gav corresponds to the project artifact and is an unresolved version
for a RELEASE or LATEST, the gav is resolved such it a release not newer than the project version is found that
optionally corresponds to the provided version regex, if provided.
<p>If the gav exactly matches the current project, the file of the artifact is found on the filesystem in
target directory and the resolver is ignored.
@param project the project to restrict by, if applicable
@param gav the gav to resolve
@param versionRegex the optional regex the version must match to be considered.
@param resolver the version resolver to use
@return the resolved artifact matching the criteria.
@throws VersionRangeResolutionException on error
@throws ArtifactResolutionException on error | [
"Resolves",
"the",
"gav",
"using",
"the",
"resolver",
".",
"If",
"the",
"gav",
"corresponds",
"to",
"the",
"project",
"artifact",
"and",
"is",
"an",
"unresolved",
"version",
"for",
"a",
"RELEASE",
"or",
"LATEST",
"the",
"gav",
"is",
"resolved",
"such",
"it... | e070b136d977441ab96fdce067a13e7e0423295b | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi-maven-plugin/src/main/java/org/revapi/maven/Analyzer.java#L226-L254 | train |
revapi/revapi | revapi/src/main/java/org/revapi/ServiceTypeLoader.java | ServiceTypeLoader.load | public static <X> ServiceTypeLoader<X> load(Class<X> serviceType) {
return load(serviceType, Thread.currentThread().getContextClassLoader());
} | java | public static <X> ServiceTypeLoader<X> load(Class<X> serviceType) {
return load(serviceType, Thread.currentThread().getContextClassLoader());
} | [
"public",
"static",
"<",
"X",
">",
"ServiceTypeLoader",
"<",
"X",
">",
"load",
"(",
"Class",
"<",
"X",
">",
"serviceType",
")",
"{",
"return",
"load",
"(",
"serviceType",
",",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
"... | Locates the services in the context classloader of the current thread.
@param serviceType the type of the services to locate
@param <X> the type of the service
@return the service type loader | [
"Locates",
"the",
"services",
"in",
"the",
"context",
"classloader",
"of",
"the",
"current",
"thread",
"."
] | e070b136d977441ab96fdce067a13e7e0423295b | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi/src/main/java/org/revapi/ServiceTypeLoader.java#L63-L65 | train |
revapi/revapi | revapi/src/main/java/org/revapi/configuration/JSONUtil.java | JSONUtil.stringifyJavascriptObject | public static String stringifyJavascriptObject(Object object) {
StringBuilder bld = new StringBuilder();
stringify(object, bld);
return bld.toString();
} | java | public static String stringifyJavascriptObject(Object object) {
StringBuilder bld = new StringBuilder();
stringify(object, bld);
return bld.toString();
} | [
"public",
"static",
"String",
"stringifyJavascriptObject",
"(",
"Object",
"object",
")",
"{",
"StringBuilder",
"bld",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"stringify",
"(",
"object",
",",
"bld",
")",
";",
"return",
"bld",
".",
"toString",
"(",
")",
... | Converts the provided javascript object to JSON string.
<p>If the object is a Map instance, it is stringified as key-value pairs, if it is a list, it is stringified as
a list, otherwise the object is merely converted to string using the {@code toString()} method.
@param object the object to stringify.
@return the object as a JSON string | [
"Converts",
"the",
"provided",
"javascript",
"object",
"to",
"JSON",
"string",
"."
] | e070b136d977441ab96fdce067a13e7e0423295b | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi/src/main/java/org/revapi/configuration/JSONUtil.java#L238-L242 | train |
revapi/revapi | revapi-java-spi/src/main/java/org/revapi/java/spi/CheckBase.java | CheckBase.popIfActive | @Nullable
@SuppressWarnings("unchecked")
protected <T extends JavaElement> ActiveElements<T> popIfActive() {
return (ActiveElements<T>) (!activations.isEmpty() && activations.peek().depth == depth ? activations.pop() :
null);
} | java | @Nullable
@SuppressWarnings("unchecked")
protected <T extends JavaElement> ActiveElements<T> popIfActive() {
return (ActiveElements<T>) (!activations.isEmpty() && activations.peek().depth == depth ? activations.pop() :
null);
} | [
"@",
"Nullable",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"<",
"T",
"extends",
"JavaElement",
">",
"ActiveElements",
"<",
"T",
">",
"popIfActive",
"(",
")",
"{",
"return",
"(",
"ActiveElements",
"<",
"T",
">",
")",
"(",
"!",
"activa... | Pops the top of the stack of active elements if the current position in the call stack corresponds to the one
that pushed the active elements.
<p>This method does not do any type checks, so take care to retrieve the elements with the same types used to push
to them onto the stack.
@param <T> the type of the elements
@return the active elements or null if the current call stack did not push any active elements onto the stack | [
"Pops",
"the",
"top",
"of",
"the",
"stack",
"of",
"active",
"elements",
"if",
"the",
"current",
"position",
"in",
"the",
"call",
"stack",
"corresponds",
"to",
"the",
"one",
"that",
"pushed",
"the",
"active",
"elements",
"."
] | e070b136d977441ab96fdce067a13e7e0423295b | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi-java-spi/src/main/java/org/revapi/java/spi/CheckBase.java#L360-L365 | train |
revapi/revapi | revapi/src/main/java/org/revapi/AnalysisContext.java | AnalysisContext.builder | @Nonnull
public static Builder builder(Revapi revapi) {
List<String> knownExtensionIds = new ArrayList<>();
addExtensionIds(revapi.getPipelineConfiguration().getApiAnalyzerTypes(), knownExtensionIds);
addExtensionIds(revapi.getPipelineConfiguration().getTransformTypes(), knownExtensionIds);
addExtensionIds(revapi.getPipelineConfiguration().getFilterTypes(), knownExtensionIds);
addExtensionIds(revapi.getPipelineConfiguration().getReporterTypes(), knownExtensionIds);
return new Builder(knownExtensionIds);
} | java | @Nonnull
public static Builder builder(Revapi revapi) {
List<String> knownExtensionIds = new ArrayList<>();
addExtensionIds(revapi.getPipelineConfiguration().getApiAnalyzerTypes(), knownExtensionIds);
addExtensionIds(revapi.getPipelineConfiguration().getTransformTypes(), knownExtensionIds);
addExtensionIds(revapi.getPipelineConfiguration().getFilterTypes(), knownExtensionIds);
addExtensionIds(revapi.getPipelineConfiguration().getReporterTypes(), knownExtensionIds);
return new Builder(knownExtensionIds);
} | [
"@",
"Nonnull",
"public",
"static",
"Builder",
"builder",
"(",
"Revapi",
"revapi",
")",
"{",
"List",
"<",
"String",
">",
"knownExtensionIds",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"addExtensionIds",
"(",
"revapi",
".",
"getPipelineConfiguration",
"(",
... | Returns a new analysis context builder that extracts the information about the available extensions from
the provided Revapi instance.
<p>The extensions have to be known so that both old and new style of configuration can be usefully worked with.
@param revapi the revapi instance to read the available extensions from
@return a new analysis context builder | [
"Returns",
"a",
"new",
"analysis",
"context",
"builder",
"that",
"extracts",
"the",
"information",
"about",
"the",
"available",
"extensions",
"from",
"the",
"provided",
"Revapi",
"instance",
"."
] | e070b136d977441ab96fdce067a13e7e0423295b | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi/src/main/java/org/revapi/AnalysisContext.java#L165-L175 | train |
revapi/revapi | revapi/src/main/java/org/revapi/AnalysisContext.java | AnalysisContext.copyWithConfiguration | public AnalysisContext copyWithConfiguration(ModelNode configuration) {
return new AnalysisContext(this.locale, configuration, this.oldApi, this.newApi, this.data);
} | java | public AnalysisContext copyWithConfiguration(ModelNode configuration) {
return new AnalysisContext(this.locale, configuration, this.oldApi, this.newApi, this.data);
} | [
"public",
"AnalysisContext",
"copyWithConfiguration",
"(",
"ModelNode",
"configuration",
")",
"{",
"return",
"new",
"AnalysisContext",
"(",
"this",
".",
"locale",
",",
"configuration",
",",
"this",
".",
"oldApi",
",",
"this",
".",
"newApi",
",",
"this",
".",
"... | This is generally only useful for extensions that delegate some of their functionality to other "internal"
extensions of their own that they need to configure.
@param configuration the configuration to be supplied with the returned analysis context.
@return an analysis context that is a clone of this instance but its configuration is replaced with the provided
one. | [
"This",
"is",
"generally",
"only",
"useful",
"for",
"extensions",
"that",
"delegate",
"some",
"of",
"their",
"functionality",
"to",
"other",
"internal",
"extensions",
"of",
"their",
"own",
"that",
"they",
"need",
"to",
"configure",
"."
] | e070b136d977441ab96fdce067a13e7e0423295b | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi/src/main/java/org/revapi/AnalysisContext.java#L195-L197 | train |
revapi/revapi | revapi/src/main/java/org/revapi/PipelineConfiguration.java | PipelineConfiguration.parse | public static PipelineConfiguration.Builder parse(ModelNode json) {
ModelNode analyzerIncludeNode = json.get("analyzers").get("include");
ModelNode analyzerExcludeNode = json.get("analyzers").get("exclude");
ModelNode filterIncludeNode = json.get("filters").get("include");
ModelNode filterExcludeNode = json.get("filters").get("exclude");
ModelNode transformIncludeNode = json.get("transforms").get("include");
ModelNode transformExcludeNode = json.get("transforms").get("exclude");
ModelNode reporterIncludeNode = json.get("reporters").get("include");
ModelNode reporterExcludeNode = json.get("reporters").get("exclude");
return builder()
.withTransformationBlocks(json.get("transformBlocks"))
.withAnalyzerExtensionIdsInclude(asStringList(analyzerIncludeNode))
.withAnalyzerExtensionIdsExclude(asStringList(analyzerExcludeNode))
.withFilterExtensionIdsInclude(asStringList(filterIncludeNode))
.withFilterExtensionIdsExclude(asStringList(filterExcludeNode))
.withTransformExtensionIdsInclude(asStringList(transformIncludeNode))
.withTransformExtensionIdsExclude(asStringList(transformExcludeNode))
.withReporterExtensionIdsInclude(asStringList(reporterIncludeNode))
.withReporterExtensionIdsExclude(asStringList(reporterExcludeNode));
} | java | public static PipelineConfiguration.Builder parse(ModelNode json) {
ModelNode analyzerIncludeNode = json.get("analyzers").get("include");
ModelNode analyzerExcludeNode = json.get("analyzers").get("exclude");
ModelNode filterIncludeNode = json.get("filters").get("include");
ModelNode filterExcludeNode = json.get("filters").get("exclude");
ModelNode transformIncludeNode = json.get("transforms").get("include");
ModelNode transformExcludeNode = json.get("transforms").get("exclude");
ModelNode reporterIncludeNode = json.get("reporters").get("include");
ModelNode reporterExcludeNode = json.get("reporters").get("exclude");
return builder()
.withTransformationBlocks(json.get("transformBlocks"))
.withAnalyzerExtensionIdsInclude(asStringList(analyzerIncludeNode))
.withAnalyzerExtensionIdsExclude(asStringList(analyzerExcludeNode))
.withFilterExtensionIdsInclude(asStringList(filterIncludeNode))
.withFilterExtensionIdsExclude(asStringList(filterExcludeNode))
.withTransformExtensionIdsInclude(asStringList(transformIncludeNode))
.withTransformExtensionIdsExclude(asStringList(transformExcludeNode))
.withReporterExtensionIdsInclude(asStringList(reporterIncludeNode))
.withReporterExtensionIdsExclude(asStringList(reporterExcludeNode));
} | [
"public",
"static",
"PipelineConfiguration",
".",
"Builder",
"parse",
"(",
"ModelNode",
"json",
")",
"{",
"ModelNode",
"analyzerIncludeNode",
"=",
"json",
".",
"get",
"(",
"\"analyzers\"",
")",
".",
"get",
"(",
"\"include\"",
")",
";",
"ModelNode",
"analyzerExcl... | Parses the configuration node and provides a pipeline configuration without any extensions marked for loading.
The configuration node is supposed to conform to the pipeline configuration JSON schema.
<p>The caller is supposed to use the methods from the builder to add/find extension classes that will be used in
the analysis.
<p>Note that the returned pipeline configuration might not contain all the extensions available in
the classloader depending on the include/exclude filters in the configuration.
@param json the configuration node
@return a pipeline configuration parsed from the configuration
@see Builder#build() | [
"Parses",
"the",
"configuration",
"node",
"and",
"provides",
"a",
"pipeline",
"configuration",
"without",
"any",
"extensions",
"marked",
"for",
"loading",
".",
"The",
"configuration",
"node",
"is",
"supposed",
"to",
"conform",
"to",
"the",
"pipeline",
"configurati... | e070b136d977441ab96fdce067a13e7e0423295b | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi/src/main/java/org/revapi/PipelineConfiguration.java#L107-L127 | train |
revapi/revapi | revapi-java-spi/src/main/java/org/revapi/java/spi/Util.java | Util.firstDotConstellation | private static void firstDotConstellation(int[] dollarPositions, int[] dotPositions, int nestingLevel) {
int i = 0;
int unassigned = dotPositions.length - nestingLevel;
for (; i < unassigned; ++i) {
dotPositions[i] = -1;
}
for (; i < dotPositions.length; ++i) {
dotPositions[i] = dollarPositions[i];
}
} | java | private static void firstDotConstellation(int[] dollarPositions, int[] dotPositions, int nestingLevel) {
int i = 0;
int unassigned = dotPositions.length - nestingLevel;
for (; i < unassigned; ++i) {
dotPositions[i] = -1;
}
for (; i < dotPositions.length; ++i) {
dotPositions[i] = dollarPositions[i];
}
} | [
"private",
"static",
"void",
"firstDotConstellation",
"(",
"int",
"[",
"]",
"dollarPositions",
",",
"int",
"[",
"]",
"dotPositions",
",",
"int",
"nestingLevel",
")",
"{",
"int",
"i",
"=",
"0",
";",
"int",
"unassigned",
"=",
"dotPositions",
".",
"length",
"... | This will set the last nestingLevel elements in the dotPositions to the values present in the dollarPositions.
The rest will be set to -1.
<p>In another words the dotPositions array will contain the rightmost dollar positions.
@param dollarPositions the positions of the $ in the binary class name
@param dotPositions the positions of the dots to initialize from the dollarPositions
@param nestingLevel the number of dots (i.e. how deep is the nesting of the classes) | [
"This",
"will",
"set",
"the",
"last",
"nestingLevel",
"elements",
"in",
"the",
"dotPositions",
"to",
"the",
"values",
"present",
"in",
"the",
"dollarPositions",
".",
"The",
"rest",
"will",
"be",
"set",
"to",
"-",
"1",
"."
] | e070b136d977441ab96fdce067a13e7e0423295b | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi-java-spi/src/main/java/org/revapi/java/spi/Util.java#L1161-L1172 | train |
revapi/revapi | revapi/src/main/java/org/revapi/AnalysisResult.java | AnalysisResult.fakeSuccess | public static AnalysisResult fakeSuccess() {
return new AnalysisResult(null, new Extensions(Collections.emptyMap(), Collections.emptyMap(),
Collections.emptyMap(), Collections.emptyMap()));
} | java | public static AnalysisResult fakeSuccess() {
return new AnalysisResult(null, new Extensions(Collections.emptyMap(), Collections.emptyMap(),
Collections.emptyMap(), Collections.emptyMap()));
} | [
"public",
"static",
"AnalysisResult",
"fakeSuccess",
"(",
")",
"{",
"return",
"new",
"AnalysisResult",
"(",
"null",
",",
"new",
"Extensions",
"(",
"Collections",
".",
"emptyMap",
"(",
")",
",",
"Collections",
".",
"emptyMap",
"(",
")",
",",
"Collections",
".... | A factory method for users that need to report success without actually running any analysis. The returned
result will be successful, but will not contain the actual configurations of extensions.
@return a "fake" successful analysis result | [
"A",
"factory",
"method",
"for",
"users",
"that",
"need",
"to",
"report",
"success",
"without",
"actually",
"running",
"any",
"analysis",
".",
"The",
"returned",
"result",
"will",
"be",
"successful",
"but",
"will",
"not",
"contain",
"the",
"actual",
"configura... | e070b136d977441ab96fdce067a13e7e0423295b | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi/src/main/java/org/revapi/AnalysisResult.java#L58-L61 | train |
revapi/revapi | revapi-maven-plugin/src/main/java/org/revapi/maven/SchemaDrivenJSONToXmlConverter.java | SchemaDrivenJSONToXmlConverter.convert | static PlexusConfiguration convert(ModelNode configuration, ModelNode jsonSchema, String extensionId, String id) {
ConversionContext ctx = new ConversionContext();
ctx.currentSchema = jsonSchema;
ctx.rootSchema = jsonSchema;
ctx.pushTag(extensionId);
ctx.id = id;
return convert(configuration, ctx);
} | java | static PlexusConfiguration convert(ModelNode configuration, ModelNode jsonSchema, String extensionId, String id) {
ConversionContext ctx = new ConversionContext();
ctx.currentSchema = jsonSchema;
ctx.rootSchema = jsonSchema;
ctx.pushTag(extensionId);
ctx.id = id;
return convert(configuration, ctx);
} | [
"static",
"PlexusConfiguration",
"convert",
"(",
"ModelNode",
"configuration",
",",
"ModelNode",
"jsonSchema",
",",
"String",
"extensionId",
",",
"String",
"id",
")",
"{",
"ConversionContext",
"ctx",
"=",
"new",
"ConversionContext",
"(",
")",
";",
"ctx",
".",
"c... | visibility increased for testing | [
"visibility",
"increased",
"for",
"testing"
] | e070b136d977441ab96fdce067a13e7e0423295b | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi-maven-plugin/src/main/java/org/revapi/maven/SchemaDrivenJSONToXmlConverter.java#L58-L65 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java | TypeDescriptor.getAnnotation | @SuppressWarnings("unchecked")
public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
for (Annotation annotation : this.annotations) {
if (annotation.annotationType().equals(annotationType)) {
return (T) annotation;
}
}
for (Annotation metaAnn : this.annotations) {
T ann = metaAnn.annotationType().getAnnotation(annotationType);
if (ann != null) {
return ann;
}
}
return null;
} | java | @SuppressWarnings("unchecked")
public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
for (Annotation annotation : this.annotations) {
if (annotation.annotationType().equals(annotationType)) {
return (T) annotation;
}
}
for (Annotation metaAnn : this.annotations) {
T ann = metaAnn.annotationType().getAnnotation(annotationType);
if (ann != null) {
return ann;
}
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"getAnnotation",
"(",
"Class",
"<",
"T",
">",
"annotationType",
")",
"{",
"for",
"(",
"Annotation",
"annotation",
":",
"this",
".",
"annotations",
")",... | Obtain the annotation associated with this type descriptor of the specified type.
@param annotationType the annotation type
@return the annotation, or {@code null} if no such annotation exists on this type descriptor | [
"Obtain",
"the",
"annotation",
"associated",
"with",
"this",
"type",
"descriptor",
"of",
"the",
"specified",
"type",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java#L359-L373 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodeScheme | public static String encodeScheme(String scheme, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(scheme, encoding, HierarchicalUriComponents.Type.SCHEME);
} | java | public static String encodeScheme(String scheme, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(scheme, encoding, HierarchicalUriComponents.Type.SCHEME);
} | [
"public",
"static",
"String",
"encodeScheme",
"(",
"String",
"scheme",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"scheme",
",",
"encoding",
",",
"HierarchicalUriC... | Encodes the given URI scheme with the given encoding.
@param scheme the scheme to be encoded
@param encoding the character encoding to encode to
@return the encoded scheme
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"scheme",
"with",
"the",
"given",
"encoding",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L219-L221 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodeAuthority | public static String encodeAuthority(String authority, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(authority, encoding, HierarchicalUriComponents.Type.AUTHORITY);
} | java | public static String encodeAuthority(String authority, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(authority, encoding, HierarchicalUriComponents.Type.AUTHORITY);
} | [
"public",
"static",
"String",
"encodeAuthority",
"(",
"String",
"authority",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"authority",
",",
"encoding",
",",
"Hierarc... | Encodes the given URI authority with the given encoding.
@param authority the authority to be encoded
@param encoding the character encoding to encode to
@return the encoded authority
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"authority",
"with",
"the",
"given",
"encoding",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L230-L232 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodeUserInfo | public static String encodeUserInfo(String userInfo, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(userInfo, encoding, HierarchicalUriComponents.Type.USER_INFO);
} | java | public static String encodeUserInfo(String userInfo, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(userInfo, encoding, HierarchicalUriComponents.Type.USER_INFO);
} | [
"public",
"static",
"String",
"encodeUserInfo",
"(",
"String",
"userInfo",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"userInfo",
",",
"encoding",
",",
"Hierarchic... | Encodes the given URI user info with the given encoding.
@param userInfo the user info to be encoded
@param encoding the character encoding to encode to
@return the encoded user info
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"user",
"info",
"with",
"the",
"given",
"encoding",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L241-L243 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodeHost | public static String encodeHost(String host, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(host, encoding, HierarchicalUriComponents.Type.HOST_IPV4);
} | java | public static String encodeHost(String host, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(host, encoding, HierarchicalUriComponents.Type.HOST_IPV4);
} | [
"public",
"static",
"String",
"encodeHost",
"(",
"String",
"host",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"host",
",",
"encoding",
",",
"HierarchicalUriCompone... | Encodes the given URI host with the given encoding.
@param host the host to be encoded
@param encoding the character encoding to encode to
@return the encoded host
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"host",
"with",
"the",
"given",
"encoding",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L252-L254 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodePort | public static String encodePort(String port, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(port, encoding, HierarchicalUriComponents.Type.PORT);
} | java | public static String encodePort(String port, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(port, encoding, HierarchicalUriComponents.Type.PORT);
} | [
"public",
"static",
"String",
"encodePort",
"(",
"String",
"port",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"port",
",",
"encoding",
",",
"HierarchicalUriCompone... | Encodes the given URI port with the given encoding.
@param port the port to be encoded
@param encoding the character encoding to encode to
@return the encoded port
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"port",
"with",
"the",
"given",
"encoding",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L263-L265 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodePath | public static String encodePath(String path, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(path, encoding, HierarchicalUriComponents.Type.PATH);
} | java | public static String encodePath(String path, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(path, encoding, HierarchicalUriComponents.Type.PATH);
} | [
"public",
"static",
"String",
"encodePath",
"(",
"String",
"path",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"path",
",",
"encoding",
",",
"HierarchicalUriCompone... | Encodes the given URI path with the given encoding.
@param path the path to be encoded
@param encoding the character encoding to encode to
@return the encoded path
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"path",
"with",
"the",
"given",
"encoding",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L274-L276 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodePathSegment | public static String encodePathSegment(String segment, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(segment, encoding, HierarchicalUriComponents.Type.PATH_SEGMENT);
} | java | public static String encodePathSegment(String segment, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(segment, encoding, HierarchicalUriComponents.Type.PATH_SEGMENT);
} | [
"public",
"static",
"String",
"encodePathSegment",
"(",
"String",
"segment",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"segment",
",",
"encoding",
",",
"Hierarchi... | Encodes the given URI path segment with the given encoding.
@param segment the segment to be encoded
@param encoding the character encoding to encode to
@return the encoded segment
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"path",
"segment",
"with",
"the",
"given",
"encoding",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L285-L287 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodeQuery | public static String encodeQuery(String query, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(query, encoding, HierarchicalUriComponents.Type.QUERY);
} | java | public static String encodeQuery(String query, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(query, encoding, HierarchicalUriComponents.Type.QUERY);
} | [
"public",
"static",
"String",
"encodeQuery",
"(",
"String",
"query",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"query",
",",
"encoding",
",",
"HierarchicalUriComp... | Encodes the given URI query with the given encoding.
@param query the query to be encoded
@param encoding the character encoding to encode to
@return the encoded query
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"query",
"with",
"the",
"given",
"encoding",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L296-L298 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodeQueryParam | public static String encodeQueryParam(String queryParam, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(queryParam, encoding, HierarchicalUriComponents.Type.QUERY_PARAM);
} | java | public static String encodeQueryParam(String queryParam, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(queryParam, encoding, HierarchicalUriComponents.Type.QUERY_PARAM);
} | [
"public",
"static",
"String",
"encodeQueryParam",
"(",
"String",
"queryParam",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"queryParam",
",",
"encoding",
",",
"Hier... | Encodes the given URI query parameter with the given encoding.
@param queryParam the query parameter to be encoded
@param encoding the character encoding to encode to
@return the encoded query parameter
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"query",
"parameter",
"with",
"the",
"given",
"encoding",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L307-L309 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodeFragment | public static String encodeFragment(String fragment, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(fragment, encoding, HierarchicalUriComponents.Type.FRAGMENT);
} | java | public static String encodeFragment(String fragment, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(fragment, encoding, HierarchicalUriComponents.Type.FRAGMENT);
} | [
"public",
"static",
"String",
"encodeFragment",
"(",
"String",
"fragment",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"fragment",
",",
"encoding",
",",
"Hierarchic... | Encodes the given URI fragment with the given encoding.
@param fragment the fragment to be encoded
@param encoding the character encoding to encode to
@return the encoded fragment
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"fragment",
"with",
"the",
"given",
"encoding",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L318-L320 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/client/OkHttp3ClientHttpRequestFactory.java | OkHttp3ClientHttpRequestFactory.setReadTimeout | public void setReadTimeout(int readTimeout) {
this.client = this.client.newBuilder()
.readTimeout(readTimeout, TimeUnit.MILLISECONDS)
.build();
} | java | public void setReadTimeout(int readTimeout) {
this.client = this.client.newBuilder()
.readTimeout(readTimeout, TimeUnit.MILLISECONDS)
.build();
} | [
"public",
"void",
"setReadTimeout",
"(",
"int",
"readTimeout",
")",
"{",
"this",
".",
"client",
"=",
"this",
".",
"client",
".",
"newBuilder",
"(",
")",
".",
"readTimeout",
"(",
"readTimeout",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
".",
"build",
"(",
... | Sets the underlying read timeout in milliseconds.
A value of 0 specifies an infinite timeout.
@see okhttp3.OkHttpClient.Builder#readTimeout(long, TimeUnit) | [
"Sets",
"the",
"underlying",
"read",
"timeout",
"in",
"milliseconds",
".",
"A",
"value",
"of",
"0",
"specifies",
"an",
"infinite",
"timeout",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/client/OkHttp3ClientHttpRequestFactory.java#L69-L73 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/client/OkHttp3ClientHttpRequestFactory.java | OkHttp3ClientHttpRequestFactory.setWriteTimeout | public void setWriteTimeout(int writeTimeout) {
this.client = this.client.newBuilder()
.writeTimeout(writeTimeout, TimeUnit.MILLISECONDS)
.build();
} | java | public void setWriteTimeout(int writeTimeout) {
this.client = this.client.newBuilder()
.writeTimeout(writeTimeout, TimeUnit.MILLISECONDS)
.build();
} | [
"public",
"void",
"setWriteTimeout",
"(",
"int",
"writeTimeout",
")",
"{",
"this",
".",
"client",
"=",
"this",
".",
"client",
".",
"newBuilder",
"(",
")",
".",
"writeTimeout",
"(",
"writeTimeout",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
".",
"build",
"(... | Sets the underlying write timeout in milliseconds.
A value of 0 specifies an infinite timeout.
@see okhttp3.OkHttpClient.Builder#writeTimeout(long, TimeUnit) | [
"Sets",
"the",
"underlying",
"write",
"timeout",
"in",
"milliseconds",
".",
"A",
"value",
"of",
"0",
"specifies",
"an",
"infinite",
"timeout",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/client/OkHttp3ClientHttpRequestFactory.java#L80-L84 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/client/OkHttp3ClientHttpRequestFactory.java | OkHttp3ClientHttpRequestFactory.setConnectTimeout | public void setConnectTimeout(int connectTimeout) {
this.client = this.client.newBuilder()
.connectTimeout(connectTimeout, TimeUnit.MILLISECONDS)
.build();
} | java | public void setConnectTimeout(int connectTimeout) {
this.client = this.client.newBuilder()
.connectTimeout(connectTimeout, TimeUnit.MILLISECONDS)
.build();
} | [
"public",
"void",
"setConnectTimeout",
"(",
"int",
"connectTimeout",
")",
"{",
"this",
".",
"client",
"=",
"this",
".",
"client",
".",
"newBuilder",
"(",
")",
".",
"connectTimeout",
"(",
"connectTimeout",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
".",
"buil... | Sets the underlying connect timeout in milliseconds.
A value of 0 specifies an infinite timeout.
@see okhttp3.OkHttpClient.Builder#connectTimeout(long, TimeUnit) | [
"Sets",
"the",
"underlying",
"connect",
"timeout",
"in",
"milliseconds",
".",
"A",
"value",
"of",
"0",
"specifies",
"an",
"infinite",
"timeout",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/client/OkHttp3ClientHttpRequestFactory.java#L91-L95 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/comparator/CompoundComparator.java | CompoundComparator.addComparator | public void addComparator(Comparator<T> comparator, boolean ascending) {
this.comparators.add(new InvertibleComparator<T>(comparator, ascending));
} | java | public void addComparator(Comparator<T> comparator, boolean ascending) {
this.comparators.add(new InvertibleComparator<T>(comparator, ascending));
} | [
"public",
"void",
"addComparator",
"(",
"Comparator",
"<",
"T",
">",
"comparator",
",",
"boolean",
"ascending",
")",
"{",
"this",
".",
"comparators",
".",
"add",
"(",
"new",
"InvertibleComparator",
"<",
"T",
">",
"(",
"comparator",
",",
"ascending",
")",
"... | Add a Comparator to the end of the chain using the provided sort order.
@param comparator the Comparator to add to the end of the chain
@param ascending the sort order: ascending (true) or descending (false) | [
"Add",
"a",
"Comparator",
"to",
"the",
"end",
"of",
"the",
"chain",
"using",
"the",
"provided",
"sort",
"order",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/comparator/CompoundComparator.java#L93-L95 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/FileCopyUtils.java | FileCopyUtils.copy | public static void copy(String in, Writer out) throws IOException {
Assert.notNull(in, "No input String specified");
Assert.notNull(out, "No Writer specified");
try {
out.write(in);
}
finally {
try {
out.close();
}
catch (IOException ex) {
}
}
} | java | public static void copy(String in, Writer out) throws IOException {
Assert.notNull(in, "No input String specified");
Assert.notNull(out, "No Writer specified");
try {
out.write(in);
}
finally {
try {
out.close();
}
catch (IOException ex) {
}
}
} | [
"public",
"static",
"void",
"copy",
"(",
"String",
"in",
",",
"Writer",
"out",
")",
"throws",
"IOException",
"{",
"Assert",
".",
"notNull",
"(",
"in",
",",
"\"No input String specified\"",
")",
";",
"Assert",
".",
"notNull",
"(",
"out",
",",
"\"No Writer spe... | Copy the contents of the given String to the given output Writer.
Closes the writer when done.
@param in the String to copy from
@param out the Writer to copy to
@throws IOException in case of I/O errors | [
"Copy",
"the",
"contents",
"of",
"the",
"given",
"String",
"to",
"the",
"given",
"output",
"Writer",
".",
"Closes",
"the",
"writer",
"when",
"done",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/FileCopyUtils.java#L208-L221 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriTemplate.java | UriTemplate.matches | public boolean matches(String uri) {
if (uri == null) {
return false;
}
Matcher matcher = this.matchPattern.matcher(uri);
return matcher.matches();
} | java | public boolean matches(String uri) {
if (uri == null) {
return false;
}
Matcher matcher = this.matchPattern.matcher(uri);
return matcher.matches();
} | [
"public",
"boolean",
"matches",
"(",
"String",
"uri",
")",
"{",
"if",
"(",
"uri",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"Matcher",
"matcher",
"=",
"this",
".",
"matchPattern",
".",
"matcher",
"(",
"uri",
")",
";",
"return",
"matcher",
... | Indicate whether the given URI matches this template.
@param uri the URI to match to
@return {@code true} if it matches; {@code false} otherwise | [
"Indicate",
"whether",
"the",
"given",
"URI",
"matches",
"this",
"template",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriTemplate.java#L129-L135 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/io/AbstractResource.java | AbstractResource.exists | public boolean exists() {
// Try file existence: can we find the file in the file system?
try {
return getFile().exists();
}
catch (IOException ex) {
// Fall back to stream existence: can we open the stream?
try {
InputStream is = getInputStream();
is.close();
return true;
}
catch (Throwable isEx) {
return false;
}
}
} | java | public boolean exists() {
// Try file existence: can we find the file in the file system?
try {
return getFile().exists();
}
catch (IOException ex) {
// Fall back to stream existence: can we open the stream?
try {
InputStream is = getInputStream();
is.close();
return true;
}
catch (Throwable isEx) {
return false;
}
}
} | [
"public",
"boolean",
"exists",
"(",
")",
"{",
"// Try file existence: can we find the file in the file system?",
"try",
"{",
"return",
"getFile",
"(",
")",
".",
"exists",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"// Fall back to stream existe... | This implementation checks whether a File can be opened,
falling back to whether an InputStream can be opened.
This will cover both directories and content resources. | [
"This",
"implementation",
"checks",
"whether",
"a",
"File",
"can",
"be",
"opened",
"falling",
"back",
"to",
"whether",
"an",
"InputStream",
"can",
"be",
"opened",
".",
"This",
"will",
"cover",
"both",
"directories",
"and",
"content",
"resources",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/io/AbstractResource.java#L49-L65 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriComponents.java | UriComponents.expandUriComponent | static String expandUriComponent(String source, UriTemplateVariables uriVariables) {
if (source == null) {
return null;
}
if (source.indexOf('{') == -1) {
return source;
}
Matcher matcher = NAMES_PATTERN.matcher(source);
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
String match = matcher.group(1);
String variableName = getVariableName(match);
Object variableValue = uriVariables.getValue(variableName);
if (UriTemplateVariables.SKIP_VALUE.equals(variableValue)) {
continue;
}
String variableValueString = getVariableValueAsString(variableValue);
String replacement = Matcher.quoteReplacement(variableValueString);
matcher.appendReplacement(sb, replacement);
}
matcher.appendTail(sb);
return sb.toString();
} | java | static String expandUriComponent(String source, UriTemplateVariables uriVariables) {
if (source == null) {
return null;
}
if (source.indexOf('{') == -1) {
return source;
}
Matcher matcher = NAMES_PATTERN.matcher(source);
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
String match = matcher.group(1);
String variableName = getVariableName(match);
Object variableValue = uriVariables.getValue(variableName);
if (UriTemplateVariables.SKIP_VALUE.equals(variableValue)) {
continue;
}
String variableValueString = getVariableValueAsString(variableValue);
String replacement = Matcher.quoteReplacement(variableValueString);
matcher.appendReplacement(sb, replacement);
}
matcher.appendTail(sb);
return sb.toString();
} | [
"static",
"String",
"expandUriComponent",
"(",
"String",
"source",
",",
"UriTemplateVariables",
"uriVariables",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"source",
".",
"indexOf",
"(",
"'",
"'",
")",
"=... | static expansion helpers | [
"static",
"expansion",
"helpers"
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriComponents.java#L209-L231 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/TypeUtils.java | TypeUtils.isAssignable | public static boolean isAssignable(Type lhsType, Type rhsType) {
Assert.notNull(lhsType, "Left-hand side type must not be null");
Assert.notNull(rhsType, "Right-hand side type must not be null");
// all types are assignable to themselves and to class Object
if (lhsType.equals(rhsType) || lhsType.equals(Object.class)) {
return true;
}
if (lhsType instanceof Class<?>) {
Class<?> lhsClass = (Class<?>) lhsType;
// just comparing two classes
if (rhsType instanceof Class<?>) {
return ClassUtils.isAssignable(lhsClass, (Class<?>) rhsType);
}
if (rhsType instanceof ParameterizedType) {
Type rhsRaw = ((ParameterizedType) rhsType).getRawType();
// a parameterized type is always assignable to its raw class type
if (rhsRaw instanceof Class<?>) {
return ClassUtils.isAssignable(lhsClass, (Class<?>) rhsRaw);
}
}
else if (lhsClass.isArray() && rhsType instanceof GenericArrayType) {
Type rhsComponent = ((GenericArrayType) rhsType).getGenericComponentType();
return isAssignable(lhsClass.getComponentType(), rhsComponent);
}
}
// parameterized types are only assignable to other parameterized types and class types
if (lhsType instanceof ParameterizedType) {
if (rhsType instanceof Class<?>) {
Type lhsRaw = ((ParameterizedType) lhsType).getRawType();
if (lhsRaw instanceof Class<?>) {
return ClassUtils.isAssignable((Class<?>) lhsRaw, (Class<?>) rhsType);
}
}
else if (rhsType instanceof ParameterizedType) {
return isAssignable((ParameterizedType) lhsType, (ParameterizedType) rhsType);
}
}
if (lhsType instanceof GenericArrayType) {
Type lhsComponent = ((GenericArrayType) lhsType).getGenericComponentType();
if (rhsType instanceof Class<?>) {
Class<?> rhsClass = (Class<?>) rhsType;
if (rhsClass.isArray()) {
return isAssignable(lhsComponent, rhsClass.getComponentType());
}
}
else if (rhsType instanceof GenericArrayType) {
Type rhsComponent = ((GenericArrayType) rhsType).getGenericComponentType();
return isAssignable(lhsComponent, rhsComponent);
}
}
if (lhsType instanceof WildcardType) {
return isAssignable((WildcardType) lhsType, rhsType);
}
return false;
} | java | public static boolean isAssignable(Type lhsType, Type rhsType) {
Assert.notNull(lhsType, "Left-hand side type must not be null");
Assert.notNull(rhsType, "Right-hand side type must not be null");
// all types are assignable to themselves and to class Object
if (lhsType.equals(rhsType) || lhsType.equals(Object.class)) {
return true;
}
if (lhsType instanceof Class<?>) {
Class<?> lhsClass = (Class<?>) lhsType;
// just comparing two classes
if (rhsType instanceof Class<?>) {
return ClassUtils.isAssignable(lhsClass, (Class<?>) rhsType);
}
if (rhsType instanceof ParameterizedType) {
Type rhsRaw = ((ParameterizedType) rhsType).getRawType();
// a parameterized type is always assignable to its raw class type
if (rhsRaw instanceof Class<?>) {
return ClassUtils.isAssignable(lhsClass, (Class<?>) rhsRaw);
}
}
else if (lhsClass.isArray() && rhsType instanceof GenericArrayType) {
Type rhsComponent = ((GenericArrayType) rhsType).getGenericComponentType();
return isAssignable(lhsClass.getComponentType(), rhsComponent);
}
}
// parameterized types are only assignable to other parameterized types and class types
if (lhsType instanceof ParameterizedType) {
if (rhsType instanceof Class<?>) {
Type lhsRaw = ((ParameterizedType) lhsType).getRawType();
if (lhsRaw instanceof Class<?>) {
return ClassUtils.isAssignable((Class<?>) lhsRaw, (Class<?>) rhsType);
}
}
else if (rhsType instanceof ParameterizedType) {
return isAssignable((ParameterizedType) lhsType, (ParameterizedType) rhsType);
}
}
if (lhsType instanceof GenericArrayType) {
Type lhsComponent = ((GenericArrayType) lhsType).getGenericComponentType();
if (rhsType instanceof Class<?>) {
Class<?> rhsClass = (Class<?>) rhsType;
if (rhsClass.isArray()) {
return isAssignable(lhsComponent, rhsClass.getComponentType());
}
}
else if (rhsType instanceof GenericArrayType) {
Type rhsComponent = ((GenericArrayType) rhsType).getGenericComponentType();
return isAssignable(lhsComponent, rhsComponent);
}
}
if (lhsType instanceof WildcardType) {
return isAssignable((WildcardType) lhsType, rhsType);
}
return false;
} | [
"public",
"static",
"boolean",
"isAssignable",
"(",
"Type",
"lhsType",
",",
"Type",
"rhsType",
")",
"{",
"Assert",
".",
"notNull",
"(",
"lhsType",
",",
"\"Left-hand side type must not be null\"",
")",
";",
"Assert",
".",
"notNull",
"(",
"rhsType",
",",
"\"Right-... | Check if the right-hand side type may be assigned to the left-hand side
type following the Java generics rules.
@param lhsType the target type
@param rhsType the value type that should be assigned to the target type
@return true if rhs is assignable to lhs | [
"Check",
"if",
"the",
"right",
"-",
"hand",
"side",
"type",
"may",
"be",
"assigned",
"to",
"the",
"left",
"-",
"hand",
"side",
"type",
"following",
"the",
"Java",
"generics",
"rules",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/TypeUtils.java#L44-L112 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/HierarchicalUriComponents.java | HierarchicalUriComponents.encodeUriComponent | static String encodeUriComponent(String source, String encoding, Type type) throws UnsupportedEncodingException {
if (source == null) {
return null;
}
Assert.hasLength(encoding, "Encoding must not be empty");
byte[] bytes = encodeBytes(source.getBytes(encoding), type);
return new String(bytes, "US-ASCII");
} | java | static String encodeUriComponent(String source, String encoding, Type type) throws UnsupportedEncodingException {
if (source == null) {
return null;
}
Assert.hasLength(encoding, "Encoding must not be empty");
byte[] bytes = encodeBytes(source.getBytes(encoding), type);
return new String(bytes, "US-ASCII");
} | [
"static",
"String",
"encodeUriComponent",
"(",
"String",
"source",
",",
"String",
"encoding",
",",
"Type",
"type",
")",
"throws",
"UnsupportedEncodingException",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Assert",
".",
"ha... | Encodes the given source into an encoded String using the rules specified
by the given component and with the given options.
@param source the source string
@param encoding the encoding of the source string
@param type the URI component for the source
@return the encoded URI
@throws IllegalArgumentException when the given uri parameter is not a valid URI | [
"Encodes",
"the",
"given",
"source",
"into",
"an",
"encoded",
"String",
"using",
"the",
"rules",
"specified",
"by",
"the",
"given",
"component",
"and",
"with",
"the",
"given",
"options",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/HierarchicalUriComponents.java#L220-L227 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/client/HttpComponentsAndroidClientHttpRequestFactory.java | HttpComponentsAndroidClientHttpRequestFactory.createHttpRequest | protected HttpUriRequest createHttpRequest(HttpMethod httpMethod, URI uri) {
switch (httpMethod) {
case GET:
return new HttpGet(uri);
case DELETE:
return new HttpDelete(uri);
case HEAD:
return new HttpHead(uri);
case OPTIONS:
return new HttpOptions(uri);
case POST:
return new HttpPost(uri);
case PUT:
return new HttpPut(uri);
case TRACE:
return new HttpTrace(uri);
default:
throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
}
} | java | protected HttpUriRequest createHttpRequest(HttpMethod httpMethod, URI uri) {
switch (httpMethod) {
case GET:
return new HttpGet(uri);
case DELETE:
return new HttpDelete(uri);
case HEAD:
return new HttpHead(uri);
case OPTIONS:
return new HttpOptions(uri);
case POST:
return new HttpPost(uri);
case PUT:
return new HttpPut(uri);
case TRACE:
return new HttpTrace(uri);
default:
throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
}
} | [
"protected",
"HttpUriRequest",
"createHttpRequest",
"(",
"HttpMethod",
"httpMethod",
",",
"URI",
"uri",
")",
"{",
"switch",
"(",
"httpMethod",
")",
"{",
"case",
"GET",
":",
"return",
"new",
"HttpGet",
"(",
"uri",
")",
";",
"case",
"DELETE",
":",
"return",
... | Create a HttpComponents HttpUriRequest object for the given HTTP method and URI specification.
@param httpMethod the HTTP method
@param uri the URI
@return the HttpComponents HttpUriRequest object | [
"Create",
"a",
"HttpComponents",
"HttpUriRequest",
"object",
"for",
"the",
"given",
"HTTP",
"method",
"and",
"URI",
"specification",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/client/HttpComponentsAndroidClientHttpRequestFactory.java#L147-L166 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/convert/support/ConversionServiceFactory.java | ConversionServiceFactory.registerConverters | public static void registerConverters(Set<?> converters, ConverterRegistry registry) {
if (converters != null) {
for (Object converter : converters) {
if (converter instanceof GenericConverter) {
registry.addConverter((GenericConverter) converter);
}
else if (converter instanceof Converter<?, ?>) {
registry.addConverter((Converter<?, ?>) converter);
}
else if (converter instanceof ConverterFactory<?, ?>) {
registry.addConverterFactory((ConverterFactory<?, ?>) converter);
}
else {
throw new IllegalArgumentException("Each converter object must implement one of the " +
"Converter, ConverterFactory, or GenericConverter interfaces");
}
}
}
} | java | public static void registerConverters(Set<?> converters, ConverterRegistry registry) {
if (converters != null) {
for (Object converter : converters) {
if (converter instanceof GenericConverter) {
registry.addConverter((GenericConverter) converter);
}
else if (converter instanceof Converter<?, ?>) {
registry.addConverter((Converter<?, ?>) converter);
}
else if (converter instanceof ConverterFactory<?, ?>) {
registry.addConverterFactory((ConverterFactory<?, ?>) converter);
}
else {
throw new IllegalArgumentException("Each converter object must implement one of the " +
"Converter, ConverterFactory, or GenericConverter interfaces");
}
}
}
} | [
"public",
"static",
"void",
"registerConverters",
"(",
"Set",
"<",
"?",
">",
"converters",
",",
"ConverterRegistry",
"registry",
")",
"{",
"if",
"(",
"converters",
"!=",
"null",
")",
"{",
"for",
"(",
"Object",
"converter",
":",
"converters",
")",
"{",
"if"... | Register the given Converter objects with the given target ConverterRegistry.
@param converters the converter objects: implementing {@link Converter},
{@link ConverterFactory}, or {@link GenericConverter}
@param registry the target registry | [
"Register",
"the",
"given",
"Converter",
"objects",
"with",
"the",
"given",
"target",
"ConverterRegistry",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/convert/support/ConversionServiceFactory.java#L43-L61 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/CollectionUtils.java | CollectionUtils.unmodifiableMultiValueMap | public static <K,V> MultiValueMap<K,V> unmodifiableMultiValueMap(MultiValueMap<? extends K, ? extends V> map) {
Assert.notNull(map, "'map' must not be null");
Map<K, List<V>> result = new LinkedHashMap<K, List<V>>(map.size());
for (Map.Entry<? extends K, ? extends List<? extends V>> entry : map.entrySet()) {
List<V> values = Collections.unmodifiableList(entry.getValue());
result.put(entry.getKey(), values);
}
Map<K, List<V>> unmodifiableMap = Collections.unmodifiableMap(result);
return toMultiValueMap(unmodifiableMap);
} | java | public static <K,V> MultiValueMap<K,V> unmodifiableMultiValueMap(MultiValueMap<? extends K, ? extends V> map) {
Assert.notNull(map, "'map' must not be null");
Map<K, List<V>> result = new LinkedHashMap<K, List<V>>(map.size());
for (Map.Entry<? extends K, ? extends List<? extends V>> entry : map.entrySet()) {
List<V> values = Collections.unmodifiableList(entry.getValue());
result.put(entry.getKey(), values);
}
Map<K, List<V>> unmodifiableMap = Collections.unmodifiableMap(result);
return toMultiValueMap(unmodifiableMap);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"MultiValueMap",
"<",
"K",
",",
"V",
">",
"unmodifiableMultiValueMap",
"(",
"MultiValueMap",
"<",
"?",
"extends",
"K",
",",
"?",
"extends",
"V",
">",
"map",
")",
"{",
"Assert",
".",
"notNull",
"(",
"map",
... | Returns an unmodifiable view of the specified multi-value map.
@param map the map for which an unmodifiable view is to be returned.
@return an unmodifiable view of the specified multi-value map. | [
"Returns",
"an",
"unmodifiable",
"view",
"of",
"the",
"specified",
"multi",
"-",
"value",
"map",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/CollectionUtils.java#L349-L358 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/StreamUtils.java | StreamUtils.copyToString | public static String copyToString(InputStream in, Charset charset) throws IOException {
Assert.notNull(in, "No InputStream specified");
StringBuilder out = new StringBuilder();
InputStreamReader reader = new InputStreamReader(in, charset);
char[] buffer = new char[BUFFER_SIZE];
int bytesRead = -1;
while ((bytesRead = reader.read(buffer)) != -1) {
out.append(buffer, 0, bytesRead);
}
return out.toString();
} | java | public static String copyToString(InputStream in, Charset charset) throws IOException {
Assert.notNull(in, "No InputStream specified");
StringBuilder out = new StringBuilder();
InputStreamReader reader = new InputStreamReader(in, charset);
char[] buffer = new char[BUFFER_SIZE];
int bytesRead = -1;
while ((bytesRead = reader.read(buffer)) != -1) {
out.append(buffer, 0, bytesRead);
}
return out.toString();
} | [
"public",
"static",
"String",
"copyToString",
"(",
"InputStream",
"in",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"Assert",
".",
"notNull",
"(",
"in",
",",
"\"No InputStream specified\"",
")",
";",
"StringBuilder",
"out",
"=",
"new",
"StringB... | Copy the contents of the given InputStream into a String.
Leaves the stream open when done.
@param in the InputStream to copy from
@return the String that has been copied to
@throws IOException in case of I/O errors | [
"Copy",
"the",
"contents",
"of",
"the",
"given",
"InputStream",
"into",
"a",
"String",
".",
"Leaves",
"the",
"stream",
"open",
"when",
"done",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/StreamUtils.java#L68-L78 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/StreamUtils.java | StreamUtils.copy | public static void copy(byte[] in, OutputStream out) throws IOException {
Assert.notNull(in, "No input byte array specified");
Assert.notNull(out, "No OutputStream specified");
out.write(in);
} | java | public static void copy(byte[] in, OutputStream out) throws IOException {
Assert.notNull(in, "No input byte array specified");
Assert.notNull(out, "No OutputStream specified");
out.write(in);
} | [
"public",
"static",
"void",
"copy",
"(",
"byte",
"[",
"]",
"in",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"Assert",
".",
"notNull",
"(",
"in",
",",
"\"No input byte array specified\"",
")",
";",
"Assert",
".",
"notNull",
"(",
"out",
"... | Copy the contents of the given byte array to the given OutputStream.
Leaves the stream open when done.
@param in the byte array to copy from
@param out the OutputStream to copy to
@throws IOException in case of I/O errors | [
"Copy",
"the",
"contents",
"of",
"the",
"given",
"byte",
"array",
"to",
"the",
"given",
"OutputStream",
".",
"Leaves",
"the",
"stream",
"open",
"when",
"done",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/StreamUtils.java#L87-L91 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/client/SimpleClientHttpResponse.java | SimpleClientHttpResponse.handleIOException | private int handleIOException(IOException ex) throws IOException {
if (AUTH_ERROR.equals(ex.getMessage()) || AUTH_ERROR_JELLY_BEAN.equals(ex.getMessage())) {
return HttpStatus.UNAUTHORIZED.value();
} else if (PROXY_AUTH_ERROR.equals(ex.getMessage())) {
return HttpStatus.PROXY_AUTHENTICATION_REQUIRED.value();
} else {
throw ex;
}
} | java | private int handleIOException(IOException ex) throws IOException {
if (AUTH_ERROR.equals(ex.getMessage()) || AUTH_ERROR_JELLY_BEAN.equals(ex.getMessage())) {
return HttpStatus.UNAUTHORIZED.value();
} else if (PROXY_AUTH_ERROR.equals(ex.getMessage())) {
return HttpStatus.PROXY_AUTHENTICATION_REQUIRED.value();
} else {
throw ex;
}
} | [
"private",
"int",
"handleIOException",
"(",
"IOException",
"ex",
")",
"throws",
"IOException",
"{",
"if",
"(",
"AUTH_ERROR",
".",
"equals",
"(",
"ex",
".",
"getMessage",
"(",
")",
")",
"||",
"AUTH_ERROR_JELLY_BEAN",
".",
"equals",
"(",
"ex",
".",
"getMessage... | If credentials are incorrect or not provided for Basic Auth, then Android
may throw this exception when an HTTP 401 is received. A separate exception
is thrown for proxy authentication errors. Checking for this response and
returning the proper status.
@param ex the exception raised from Android
@return HTTP Status Code | [
"If",
"credentials",
"are",
"incorrect",
"or",
"not",
"provided",
"for",
"Basic",
"Auth",
"then",
"Android",
"may",
"throw",
"this",
"exception",
"when",
"an",
"HTTP",
"401",
"is",
"received",
".",
"A",
"separate",
"exception",
"is",
"thrown",
"for",
"proxy"... | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/client/SimpleClientHttpResponse.java#L70-L78 | train |
spring-projects/spring-android | spring-android-auth/src/main/java/org/springframework/security/crypto/encrypt/AndroidEncryptors.java | AndroidEncryptors.queryableText | public static TextEncryptor queryableText(CharSequence password, CharSequence salt) {
return new HexEncodingTextEncryptor(new AndroidAesBytesEncryptor(password.toString(), salt, AndroidKeyGenerators.shared(16)));
} | java | public static TextEncryptor queryableText(CharSequence password, CharSequence salt) {
return new HexEncodingTextEncryptor(new AndroidAesBytesEncryptor(password.toString(), salt, AndroidKeyGenerators.shared(16)));
} | [
"public",
"static",
"TextEncryptor",
"queryableText",
"(",
"CharSequence",
"password",
",",
"CharSequence",
"salt",
")",
"{",
"return",
"new",
"HexEncodingTextEncryptor",
"(",
"new",
"AndroidAesBytesEncryptor",
"(",
"password",
".",
"toString",
"(",
")",
",",
"salt"... | Creates an encryptor for queryable text strings that uses standard password-based encryption. Uses a shared, or
constant 16 byte initialization vector so encrypting the same data results in the same encryption result. This is
done to allow encrypted data to be queried against. Encrypted text is hex-encoded.
@param password the password used to generate the encryptor's secret key; should not be shared
@param salt a hex-encoded, random, site-global salt value to use to generate the secret key | [
"Creates",
"an",
"encryptor",
"for",
"queryable",
"text",
"strings",
"that",
"uses",
"standard",
"password",
"-",
"based",
"encryption",
".",
"Uses",
"a",
"shared",
"or",
"constant",
"16",
"byte",
"initialization",
"vector",
"so",
"encrypting",
"the",
"same",
... | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-auth/src/main/java/org/springframework/security/crypto/encrypt/AndroidEncryptors.java#L63-L65 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriComponentsBuilder.java | UriComponentsBuilder.fromPath | public static UriComponentsBuilder fromPath(String path) {
UriComponentsBuilder builder = new UriComponentsBuilder();
builder.path(path);
return builder;
} | java | public static UriComponentsBuilder fromPath(String path) {
UriComponentsBuilder builder = new UriComponentsBuilder();
builder.path(path);
return builder;
} | [
"public",
"static",
"UriComponentsBuilder",
"fromPath",
"(",
"String",
"path",
")",
"{",
"UriComponentsBuilder",
"builder",
"=",
"new",
"UriComponentsBuilder",
"(",
")",
";",
"builder",
".",
"path",
"(",
"path",
")",
";",
"return",
"builder",
";",
"}"
] | Returns a builder that is initialized with the given path.
@param path the path to initialize with
@return the new {@code UriComponentsBuilder} | [
"Returns",
"a",
"builder",
"that",
"is",
"initialized",
"with",
"the",
"given",
"path",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriComponentsBuilder.java#L133-L137 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriComponentsBuilder.java | UriComponentsBuilder.uri | public UriComponentsBuilder uri(URI uri) {
Assert.notNull(uri, "'uri' must not be null");
this.scheme = uri.getScheme();
if (uri.isOpaque()) {
this.ssp = uri.getRawSchemeSpecificPart();
resetHierarchicalComponents();
}
else {
if (uri.getRawUserInfo() != null) {
this.userInfo = uri.getRawUserInfo();
}
if (uri.getHost() != null) {
this.host = uri.getHost();
}
if (uri.getPort() != -1) {
this.port = String.valueOf(uri.getPort());
}
if (StringUtils.hasLength(uri.getRawPath())) {
this.pathBuilder = new CompositePathComponentBuilder(uri.getRawPath());
}
if (StringUtils.hasLength(uri.getRawQuery())) {
this.queryParams.clear();
query(uri.getRawQuery());
}
resetSchemeSpecificPart();
}
if (uri.getRawFragment() != null) {
this.fragment = uri.getRawFragment();
}
return this;
} | java | public UriComponentsBuilder uri(URI uri) {
Assert.notNull(uri, "'uri' must not be null");
this.scheme = uri.getScheme();
if (uri.isOpaque()) {
this.ssp = uri.getRawSchemeSpecificPart();
resetHierarchicalComponents();
}
else {
if (uri.getRawUserInfo() != null) {
this.userInfo = uri.getRawUserInfo();
}
if (uri.getHost() != null) {
this.host = uri.getHost();
}
if (uri.getPort() != -1) {
this.port = String.valueOf(uri.getPort());
}
if (StringUtils.hasLength(uri.getRawPath())) {
this.pathBuilder = new CompositePathComponentBuilder(uri.getRawPath());
}
if (StringUtils.hasLength(uri.getRawQuery())) {
this.queryParams.clear();
query(uri.getRawQuery());
}
resetSchemeSpecificPart();
}
if (uri.getRawFragment() != null) {
this.fragment = uri.getRawFragment();
}
return this;
} | [
"public",
"UriComponentsBuilder",
"uri",
"(",
"URI",
"uri",
")",
"{",
"Assert",
".",
"notNull",
"(",
"uri",
",",
"\"'uri' must not be null\"",
")",
";",
"this",
".",
"scheme",
"=",
"uri",
".",
"getScheme",
"(",
")",
";",
"if",
"(",
"uri",
".",
"isOpaque"... | Initialize all components of this URI builder with the components of the given URI.
@param uri the URI
@return this UriComponentsBuilder | [
"Initialize",
"all",
"components",
"of",
"this",
"URI",
"builder",
"with",
"the",
"components",
"of",
"the",
"given",
"URI",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriComponentsBuilder.java#L319-L349 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriComponentsBuilder.java | UriComponentsBuilder.pathSegment | public UriComponentsBuilder pathSegment(String... pathSegments) throws IllegalArgumentException {
Assert.notNull(pathSegments, "'segments' must not be null");
this.pathBuilder.addPathSegments(pathSegments);
resetSchemeSpecificPart();
return this;
} | java | public UriComponentsBuilder pathSegment(String... pathSegments) throws IllegalArgumentException {
Assert.notNull(pathSegments, "'segments' must not be null");
this.pathBuilder.addPathSegments(pathSegments);
resetSchemeSpecificPart();
return this;
} | [
"public",
"UriComponentsBuilder",
"pathSegment",
"(",
"String",
"...",
"pathSegments",
")",
"throws",
"IllegalArgumentException",
"{",
"Assert",
".",
"notNull",
"(",
"pathSegments",
",",
"\"'segments' must not be null\"",
")",
";",
"this",
".",
"pathBuilder",
".",
"ad... | Append the given path segments to the existing path of this builder.
Each given path segment may contain URI template variables.
@param pathSegments the URI path segments
@return this UriComponentsBuilder | [
"Append",
"the",
"given",
"path",
"segments",
"to",
"the",
"existing",
"path",
"of",
"this",
"builder",
".",
"Each",
"given",
"path",
"segment",
"may",
"contain",
"URI",
"template",
"variables",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriComponentsBuilder.java#L510-L515 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriComponentsBuilder.java | UriComponentsBuilder.queryParams | public UriComponentsBuilder queryParams(MultiValueMap<String, String> params) {
Assert.notNull(params, "'params' must not be null");
this.queryParams.putAll(params);
return this;
} | java | public UriComponentsBuilder queryParams(MultiValueMap<String, String> params) {
Assert.notNull(params, "'params' must not be null");
this.queryParams.putAll(params);
return this;
} | [
"public",
"UriComponentsBuilder",
"queryParams",
"(",
"MultiValueMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"Assert",
".",
"notNull",
"(",
"params",
",",
"\"'params' must not be null\"",
")",
";",
"this",
".",
"queryParams",
".",
"putAll",
"(",... | Add the given query parameters.
@param params the params
@return this UriComponentsBuilder | [
"Add",
"the",
"given",
"query",
"parameters",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriComponentsBuilder.java#L590-L594 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriComponentsBuilder.java | UriComponentsBuilder.replaceQueryParam | public UriComponentsBuilder replaceQueryParam(String name, Object... values) {
Assert.notNull(name, "'name' must not be null");
this.queryParams.remove(name);
if (!ObjectUtils.isEmpty(values)) {
queryParam(name, values);
}
resetSchemeSpecificPart();
return this;
} | java | public UriComponentsBuilder replaceQueryParam(String name, Object... values) {
Assert.notNull(name, "'name' must not be null");
this.queryParams.remove(name);
if (!ObjectUtils.isEmpty(values)) {
queryParam(name, values);
}
resetSchemeSpecificPart();
return this;
} | [
"public",
"UriComponentsBuilder",
"replaceQueryParam",
"(",
"String",
"name",
",",
"Object",
"...",
"values",
")",
"{",
"Assert",
".",
"notNull",
"(",
"name",
",",
"\"'name' must not be null\"",
")",
";",
"this",
".",
"queryParams",
".",
"remove",
"(",
"name",
... | Set the query parameter values overriding all existing query values for
the same parameter. If no values are given, the query parameter is removed.
@param name the query parameter name
@param values the query parameter values
@return this UriComponentsBuilder | [
"Set",
"the",
"query",
"parameter",
"values",
"overriding",
"all",
"existing",
"query",
"values",
"for",
"the",
"same",
"parameter",
".",
"If",
"no",
"values",
"are",
"given",
"the",
"query",
"parameter",
"is",
"removed",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriComponentsBuilder.java#L603-L611 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ClassUtils.java | ClassUtils.registerCommonClasses | private static void registerCommonClasses(Class<?>... commonClasses) {
for (Class<?> clazz : commonClasses) {
commonClassCache.put(clazz.getName(), clazz);
}
} | java | private static void registerCommonClasses(Class<?>... commonClasses) {
for (Class<?> clazz : commonClasses) {
commonClassCache.put(clazz.getName(), clazz);
}
} | [
"private",
"static",
"void",
"registerCommonClasses",
"(",
"Class",
"<",
"?",
">",
"...",
"commonClasses",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
">",
"clazz",
":",
"commonClasses",
")",
"{",
"commonClassCache",
".",
"put",
"(",
"clazz",
".",
"getName",
... | Register the given common classes with the ClassUtils cache. | [
"Register",
"the",
"given",
"common",
"classes",
"with",
"the",
"ClassUtils",
"cache",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L132-L136 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ClassUtils.java | ClassUtils.overrideThreadContextClassLoader | public static ClassLoader overrideThreadContextClassLoader(ClassLoader classLoaderToUse) {
Thread currentThread = Thread.currentThread();
ClassLoader threadContextClassLoader = currentThread.getContextClassLoader();
if (classLoaderToUse != null && !classLoaderToUse.equals(threadContextClassLoader)) {
currentThread.setContextClassLoader(classLoaderToUse);
return threadContextClassLoader;
}
else {
return null;
}
} | java | public static ClassLoader overrideThreadContextClassLoader(ClassLoader classLoaderToUse) {
Thread currentThread = Thread.currentThread();
ClassLoader threadContextClassLoader = currentThread.getContextClassLoader();
if (classLoaderToUse != null && !classLoaderToUse.equals(threadContextClassLoader)) {
currentThread.setContextClassLoader(classLoaderToUse);
return threadContextClassLoader;
}
else {
return null;
}
} | [
"public",
"static",
"ClassLoader",
"overrideThreadContextClassLoader",
"(",
"ClassLoader",
"classLoaderToUse",
")",
"{",
"Thread",
"currentThread",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"ClassLoader",
"threadContextClassLoader",
"=",
"currentThread",
".",
... | Override the thread context ClassLoader with the environment's bean ClassLoader
if necessary, i.e. if the bean ClassLoader is not equivalent to the thread
context ClassLoader already.
@param classLoaderToUse the actual ClassLoader to use for the thread context
@return the original thread context ClassLoader, or {@code null} if not overridden | [
"Override",
"the",
"thread",
"context",
"ClassLoader",
"with",
"the",
"environment",
"s",
"bean",
"ClassLoader",
"if",
"necessary",
"i",
".",
"e",
".",
"if",
"the",
"bean",
"ClassLoader",
"is",
"not",
"equivalent",
"to",
"the",
"thread",
"context",
"ClassLoade... | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L183-L193 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ClassUtils.java | ClassUtils.isCacheSafe | public static boolean isCacheSafe(Class<?> clazz, ClassLoader classLoader) {
Assert.notNull(clazz, "Class must not be null");
try {
ClassLoader target = clazz.getClassLoader();
if (target == null) {
return true;
}
ClassLoader cur = classLoader;
if (cur == target) {
return true;
}
while (cur != null) {
cur = cur.getParent();
if (cur == target) {
return true;
}
}
return false;
}
catch (SecurityException ex) {
// Probably from the system ClassLoader - let's consider it safe.
return true;
}
} | java | public static boolean isCacheSafe(Class<?> clazz, ClassLoader classLoader) {
Assert.notNull(clazz, "Class must not be null");
try {
ClassLoader target = clazz.getClassLoader();
if (target == null) {
return true;
}
ClassLoader cur = classLoader;
if (cur == target) {
return true;
}
while (cur != null) {
cur = cur.getParent();
if (cur == target) {
return true;
}
}
return false;
}
catch (SecurityException ex) {
// Probably from the system ClassLoader - let's consider it safe.
return true;
}
} | [
"public",
"static",
"boolean",
"isCacheSafe",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"ClassLoader",
"classLoader",
")",
"{",
"Assert",
".",
"notNull",
"(",
"clazz",
",",
"\"Class must not be null\"",
")",
";",
"try",
"{",
"ClassLoader",
"target",
"=",
"c... | Check whether the given class is cache-safe in the given context,
i.e. whether it is loaded by the given ClassLoader or a parent of it.
@param clazz the class to analyze
@param classLoader the ClassLoader to potentially cache metadata in | [
"Check",
"whether",
"the",
"given",
"class",
"is",
"cache",
"-",
"safe",
"in",
"the",
"given",
"context",
"i",
".",
"e",
".",
"whether",
"it",
"is",
"loaded",
"by",
"the",
"given",
"ClassLoader",
"or",
"a",
"parent",
"of",
"it",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L396-L419 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ClassUtils.java | ClassUtils.getShortName | public static String getShortName(String className) {
Assert.hasLength(className, "Class name must not be empty");
int lastDotIndex = className.lastIndexOf(PACKAGE_SEPARATOR);
int nameEndIndex = className.indexOf(CGLIB_CLASS_SEPARATOR);
if (nameEndIndex == -1) {
nameEndIndex = className.length();
}
String shortName = className.substring(lastDotIndex + 1, nameEndIndex);
shortName = shortName.replace(INNER_CLASS_SEPARATOR, PACKAGE_SEPARATOR);
return shortName;
} | java | public static String getShortName(String className) {
Assert.hasLength(className, "Class name must not be empty");
int lastDotIndex = className.lastIndexOf(PACKAGE_SEPARATOR);
int nameEndIndex = className.indexOf(CGLIB_CLASS_SEPARATOR);
if (nameEndIndex == -1) {
nameEndIndex = className.length();
}
String shortName = className.substring(lastDotIndex + 1, nameEndIndex);
shortName = shortName.replace(INNER_CLASS_SEPARATOR, PACKAGE_SEPARATOR);
return shortName;
} | [
"public",
"static",
"String",
"getShortName",
"(",
"String",
"className",
")",
"{",
"Assert",
".",
"hasLength",
"(",
"className",
",",
"\"Class name must not be empty\"",
")",
";",
"int",
"lastDotIndex",
"=",
"className",
".",
"lastIndexOf",
"(",
"PACKAGE_SEPARATOR"... | Get the class name without the qualified package name.
@param className the className to get the short name for
@return the class name of the class without the package name
@throws IllegalArgumentException if the className is empty | [
"Get",
"the",
"class",
"name",
"without",
"the",
"qualified",
"package",
"name",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L428-L438 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ClassUtils.java | ClassUtils.getStaticMethod | public static Method getStaticMethod(Class<?> clazz, String methodName, Class<?>... args) {
Assert.notNull(clazz, "Class must not be null");
Assert.notNull(methodName, "Method name must not be null");
try {
Method method = clazz.getMethod(methodName, args);
return Modifier.isStatic(method.getModifiers()) ? method : null;
}
catch (NoSuchMethodException ex) {
return null;
}
} | java | public static Method getStaticMethod(Class<?> clazz, String methodName, Class<?>... args) {
Assert.notNull(clazz, "Class must not be null");
Assert.notNull(methodName, "Method name must not be null");
try {
Method method = clazz.getMethod(methodName, args);
return Modifier.isStatic(method.getModifiers()) ? method : null;
}
catch (NoSuchMethodException ex) {
return null;
}
} | [
"public",
"static",
"Method",
"getStaticMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"args",
")",
"{",
"Assert",
".",
"notNull",
"(",
"clazz",
",",
"\"Class must not be null\"",
")",
";",
... | Return a public static method of a class.
@param methodName the static method name
@param clazz the class which defines the method
@param args the parameter types to the method
@return the static method, or {@code null} if no static method was found
@throws IllegalArgumentException if the method name is blank or the clazz is null | [
"Return",
"a",
"public",
"static",
"method",
"of",
"a",
"class",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L823-L833 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ClassUtils.java | ClassUtils.isPrimitiveArray | public static boolean isPrimitiveArray(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isArray() && clazz.getComponentType().isPrimitive());
} | java | public static boolean isPrimitiveArray(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isArray() && clazz.getComponentType().isPrimitive());
} | [
"public",
"static",
"boolean",
"isPrimitiveArray",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Assert",
".",
"notNull",
"(",
"clazz",
",",
"\"Class must not be null\"",
")",
";",
"return",
"(",
"clazz",
".",
"isArray",
"(",
")",
"&&",
"clazz",
".",
... | Check if the given class represents an array of primitives,
i.e. boolean, byte, char, short, int, long, float, or double.
@param clazz the class to check
@return whether the given class is a primitive array class | [
"Check",
"if",
"the",
"given",
"class",
"represents",
"an",
"array",
"of",
"primitives",
"i",
".",
"e",
".",
"boolean",
"byte",
"char",
"short",
"int",
"long",
"float",
"or",
"double",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L865-L868 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ClassUtils.java | ClassUtils.isPrimitiveWrapperArray | public static boolean isPrimitiveWrapperArray(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isArray() && isPrimitiveWrapper(clazz.getComponentType()));
} | java | public static boolean isPrimitiveWrapperArray(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isArray() && isPrimitiveWrapper(clazz.getComponentType()));
} | [
"public",
"static",
"boolean",
"isPrimitiveWrapperArray",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Assert",
".",
"notNull",
"(",
"clazz",
",",
"\"Class must not be null\"",
")",
";",
"return",
"(",
"clazz",
".",
"isArray",
"(",
")",
"&&",
"isPrimitiv... | Check if the given class represents an array of primitive wrappers,
i.e. Boolean, Byte, Character, Short, Integer, Long, Float, or Double.
@param clazz the class to check
@return whether the given class is a primitive wrapper array class | [
"Check",
"if",
"the",
"given",
"class",
"represents",
"an",
"array",
"of",
"primitive",
"wrappers",
"i",
".",
"e",
".",
"Boolean",
"Byte",
"Character",
"Short",
"Integer",
"Long",
"Float",
"or",
"Double",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L876-L879 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ClassUtils.java | ClassUtils.resolvePrimitiveIfNecessary | public static Class<?> resolvePrimitiveIfNecessary(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isPrimitive() && clazz != void.class? primitiveTypeToWrapperMap.get(clazz) : clazz);
} | java | public static Class<?> resolvePrimitiveIfNecessary(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isPrimitive() && clazz != void.class? primitiveTypeToWrapperMap.get(clazz) : clazz);
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"resolvePrimitiveIfNecessary",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Assert",
".",
"notNull",
"(",
"clazz",
",",
"\"Class must not be null\"",
")",
";",
"return",
"(",
"clazz",
".",
"isPrimitive",
"(",
... | Resolve the given class if it is a primitive class,
returning the corresponding primitive wrapper type instead.
@param clazz the class to check
@return the original class, or a primitive wrapper for the original primitive type | [
"Resolve",
"the",
"given",
"class",
"if",
"it",
"is",
"a",
"primitive",
"class",
"returning",
"the",
"corresponding",
"primitive",
"wrapper",
"type",
"instead",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L887-L890 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ClassUtils.java | ClassUtils.toClassArray | public static Class<?>[] toClassArray(Collection<Class<?>> collection) {
if (collection == null) {
return null;
}
return collection.toArray(new Class<?>[collection.size()]);
} | java | public static Class<?>[] toClassArray(Collection<Class<?>> collection) {
if (collection == null) {
return null;
}
return collection.toArray(new Class<?>[collection.size()]);
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"[",
"]",
"toClassArray",
"(",
"Collection",
"<",
"Class",
"<",
"?",
">",
">",
"collection",
")",
"{",
"if",
"(",
"collection",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"collection",
".... | Copy the given Collection into a Class array.
The Collection must contain Class elements only.
@param collection the Collection to copy
@return the Class array ({@code null} if the passed-in
Collection was {@code null}) | [
"Copy",
"the",
"given",
"Collection",
"into",
"a",
"Class",
"array",
".",
"The",
"Collection",
"must",
"contain",
"Class",
"elements",
"only",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L1052-L1057 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ClassUtils.java | ClassUtils.determineCommonAncestor | public static Class<?> determineCommonAncestor(Class<?> clazz1, Class<?> clazz2) {
if (clazz1 == null) {
return clazz2;
}
if (clazz2 == null) {
return clazz1;
}
if (clazz1.isAssignableFrom(clazz2)) {
return clazz1;
}
if (clazz2.isAssignableFrom(clazz1)) {
return clazz2;
}
Class<?> ancestor = clazz1;
do {
ancestor = ancestor.getSuperclass();
if (ancestor == null || Object.class.equals(ancestor)) {
return null;
}
}
while (!ancestor.isAssignableFrom(clazz2));
return ancestor;
} | java | public static Class<?> determineCommonAncestor(Class<?> clazz1, Class<?> clazz2) {
if (clazz1 == null) {
return clazz2;
}
if (clazz2 == null) {
return clazz1;
}
if (clazz1.isAssignableFrom(clazz2)) {
return clazz1;
}
if (clazz2.isAssignableFrom(clazz1)) {
return clazz2;
}
Class<?> ancestor = clazz1;
do {
ancestor = ancestor.getSuperclass();
if (ancestor == null || Object.class.equals(ancestor)) {
return null;
}
}
while (!ancestor.isAssignableFrom(clazz2));
return ancestor;
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"determineCommonAncestor",
"(",
"Class",
"<",
"?",
">",
"clazz1",
",",
"Class",
"<",
"?",
">",
"clazz2",
")",
"{",
"if",
"(",
"clazz1",
"==",
"null",
")",
"{",
"return",
"clazz2",
";",
"}",
"if",
"(",
"cl... | Determine the common ancestor of the given classes, if any.
@param clazz1 the class to introspect
@param clazz2 the other class to introspect
@return the common ancestor (i.e. common superclass, one interface
extending the other), or {@code null} if none found. If any of the
given classes is {@code null}, the other class will be returned.
@since 2.0 | [
"Determine",
"the",
"common",
"ancestor",
"of",
"the",
"given",
"classes",
"if",
"any",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L1166-L1188 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java | GenericTypeResolver.resolveReturnType | public static Class<?> resolveReturnType(Method method, Class<?> clazz) {
Assert.notNull(method, "Method must not be null");
Type genericType = method.getGenericReturnType();
Assert.notNull(clazz, "Class must not be null");
Map<TypeVariable, Type> typeVariableMap = getTypeVariableMap(clazz);
Type rawType = getRawType(genericType, typeVariableMap);
return (rawType instanceof Class ? (Class<?>) rawType : method.getReturnType());
} | java | public static Class<?> resolveReturnType(Method method, Class<?> clazz) {
Assert.notNull(method, "Method must not be null");
Type genericType = method.getGenericReturnType();
Assert.notNull(clazz, "Class must not be null");
Map<TypeVariable, Type> typeVariableMap = getTypeVariableMap(clazz);
Type rawType = getRawType(genericType, typeVariableMap);
return (rawType instanceof Class ? (Class<?>) rawType : method.getReturnType());
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"resolveReturnType",
"(",
"Method",
"method",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Assert",
".",
"notNull",
"(",
"method",
",",
"\"Method must not be null\"",
")",
";",
"Type",
"genericType",
"=",
"me... | Determine the target type for the generic return type of the given method,
where formal type variables are declared on the given class.
@param method the method to introspect
@param clazz the class to resolve type variables against
@return the corresponding generic parameter or return type
@see #resolveReturnTypeForGenericMethod | [
"Determine",
"the",
"target",
"type",
"for",
"the",
"generic",
"return",
"type",
"of",
"the",
"given",
"method",
"where",
"formal",
"type",
"variables",
"are",
"declared",
"on",
"the",
"given",
"class",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java#L101-L108 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java | GenericTypeResolver.resolveReturnTypeArgument | public static Class<?> resolveReturnTypeArgument(Method method, Class<?> genericIfc) {
Assert.notNull(method, "method must not be null");
Type returnType = method.getReturnType();
Type genericReturnType = method.getGenericReturnType();
if (returnType.equals(genericIfc)) {
if (genericReturnType instanceof ParameterizedType) {
ParameterizedType targetType = (ParameterizedType) genericReturnType;
Type[] actualTypeArguments = targetType.getActualTypeArguments();
Type typeArg = actualTypeArguments[0];
if (!(typeArg instanceof WildcardType)) {
return (Class<?>) typeArg;
}
}
else {
return null;
}
}
return resolveTypeArgument((Class<?>) returnType, genericIfc);
} | java | public static Class<?> resolveReturnTypeArgument(Method method, Class<?> genericIfc) {
Assert.notNull(method, "method must not be null");
Type returnType = method.getReturnType();
Type genericReturnType = method.getGenericReturnType();
if (returnType.equals(genericIfc)) {
if (genericReturnType instanceof ParameterizedType) {
ParameterizedType targetType = (ParameterizedType) genericReturnType;
Type[] actualTypeArguments = targetType.getActualTypeArguments();
Type typeArg = actualTypeArguments[0];
if (!(typeArg instanceof WildcardType)) {
return (Class<?>) typeArg;
}
}
else {
return null;
}
}
return resolveTypeArgument((Class<?>) returnType, genericIfc);
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"resolveReturnTypeArgument",
"(",
"Method",
"method",
",",
"Class",
"<",
"?",
">",
"genericIfc",
")",
"{",
"Assert",
".",
"notNull",
"(",
"method",
",",
"\"method must not be null\"",
")",
";",
"Type",
"returnType",
... | Resolve the single type argument of the given generic interface against the given
target method which is assumed to return the given interface or an implementation
of it.
@param method the target method to check the return type of
@param genericIfc the generic interface or superclass to resolve the type argument from
@return the resolved parameter type of the method return type, or {@code null}
if not resolvable or if the single argument is of type {@link WildcardType}. | [
"Resolve",
"the",
"single",
"type",
"argument",
"of",
"the",
"given",
"generic",
"interface",
"against",
"the",
"given",
"target",
"method",
"which",
"is",
"assumed",
"to",
"return",
"the",
"given",
"interface",
"or",
"an",
"implementation",
"of",
"it",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java#L209-L227 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java | GenericTypeResolver.resolveTypeArgument | public static Class<?> resolveTypeArgument(Class<?> clazz, Class<?> genericIfc) {
Class<?>[] typeArgs = resolveTypeArguments(clazz, genericIfc);
if (typeArgs == null) {
return null;
}
if (typeArgs.length != 1) {
throw new IllegalArgumentException("Expected 1 type argument on generic interface [" +
genericIfc.getName() + "] but found " + typeArgs.length);
}
return typeArgs[0];
} | java | public static Class<?> resolveTypeArgument(Class<?> clazz, Class<?> genericIfc) {
Class<?>[] typeArgs = resolveTypeArguments(clazz, genericIfc);
if (typeArgs == null) {
return null;
}
if (typeArgs.length != 1) {
throw new IllegalArgumentException("Expected 1 type argument on generic interface [" +
genericIfc.getName() + "] but found " + typeArgs.length);
}
return typeArgs[0];
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"resolveTypeArgument",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"genericIfc",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"typeArgs",
"=",
"resolveTypeArguments",
"(",
"clazz",
",",
... | Resolve the single type argument of the given generic interface against
the given target class which is assumed to implement the generic interface
and possibly declare a concrete type for its type variable.
@param clazz the target class to check against
@param genericIfc the generic interface or superclass to resolve the type argument from
@return the resolved type of the argument, or {@code null} if not resolvable | [
"Resolve",
"the",
"single",
"type",
"argument",
"of",
"the",
"given",
"generic",
"interface",
"against",
"the",
"given",
"target",
"class",
"which",
"is",
"assumed",
"to",
"implement",
"the",
"generic",
"interface",
"and",
"possibly",
"declare",
"a",
"concrete",... | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java#L237-L247 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java | GenericTypeResolver.extractClass | private static Class<?> extractClass(Class<?> ownerClass, Type arg) {
if (arg instanceof ParameterizedType) {
return extractClass(ownerClass, ((ParameterizedType) arg).getRawType());
}
else if (arg instanceof GenericArrayType) {
GenericArrayType gat = (GenericArrayType) arg;
Type gt = gat.getGenericComponentType();
Class<?> componentClass = extractClass(ownerClass, gt);
return Array.newInstance(componentClass, 0).getClass();
}
else if (arg instanceof TypeVariable) {
TypeVariable tv = (TypeVariable) arg;
arg = getTypeVariableMap(ownerClass).get(tv);
if (arg == null) {
arg = extractBoundForTypeVariable(tv);
if (arg instanceof ParameterizedType) {
return extractClass(ownerClass, ((ParameterizedType) arg).getRawType());
}
}
else {
return extractClass(ownerClass, arg);
}
}
return (arg instanceof Class ? (Class) arg : Object.class);
} | java | private static Class<?> extractClass(Class<?> ownerClass, Type arg) {
if (arg instanceof ParameterizedType) {
return extractClass(ownerClass, ((ParameterizedType) arg).getRawType());
}
else if (arg instanceof GenericArrayType) {
GenericArrayType gat = (GenericArrayType) arg;
Type gt = gat.getGenericComponentType();
Class<?> componentClass = extractClass(ownerClass, gt);
return Array.newInstance(componentClass, 0).getClass();
}
else if (arg instanceof TypeVariable) {
TypeVariable tv = (TypeVariable) arg;
arg = getTypeVariableMap(ownerClass).get(tv);
if (arg == null) {
arg = extractBoundForTypeVariable(tv);
if (arg instanceof ParameterizedType) {
return extractClass(ownerClass, ((ParameterizedType) arg).getRawType());
}
}
else {
return extractClass(ownerClass, arg);
}
}
return (arg instanceof Class ? (Class) arg : Object.class);
} | [
"private",
"static",
"Class",
"<",
"?",
">",
"extractClass",
"(",
"Class",
"<",
"?",
">",
"ownerClass",
",",
"Type",
"arg",
")",
"{",
"if",
"(",
"arg",
"instanceof",
"ParameterizedType",
")",
"{",
"return",
"extractClass",
"(",
"ownerClass",
",",
"(",
"(... | Extract a Class from the given Type. | [
"Extract",
"a",
"Class",
"from",
"the",
"given",
"Type",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java#L316-L340 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java | GenericTypeResolver.getRawType | static Type getRawType(Type genericType, Map<TypeVariable, Type> typeVariableMap) {
Type resolvedType = genericType;
if (genericType instanceof TypeVariable) {
TypeVariable tv = (TypeVariable) genericType;
resolvedType = typeVariableMap.get(tv);
if (resolvedType == null) {
resolvedType = extractBoundForTypeVariable(tv);
}
}
if (resolvedType instanceof ParameterizedType) {
return ((ParameterizedType) resolvedType).getRawType();
}
else {
return resolvedType;
}
} | java | static Type getRawType(Type genericType, Map<TypeVariable, Type> typeVariableMap) {
Type resolvedType = genericType;
if (genericType instanceof TypeVariable) {
TypeVariable tv = (TypeVariable) genericType;
resolvedType = typeVariableMap.get(tv);
if (resolvedType == null) {
resolvedType = extractBoundForTypeVariable(tv);
}
}
if (resolvedType instanceof ParameterizedType) {
return ((ParameterizedType) resolvedType).getRawType();
}
else {
return resolvedType;
}
} | [
"static",
"Type",
"getRawType",
"(",
"Type",
"genericType",
",",
"Map",
"<",
"TypeVariable",
",",
"Type",
">",
"typeVariableMap",
")",
"{",
"Type",
"resolvedType",
"=",
"genericType",
";",
"if",
"(",
"genericType",
"instanceof",
"TypeVariable",
")",
"{",
"Type... | Determine the raw type for the given generic parameter type.
@param genericType the generic type to resolve
@param typeVariableMap the TypeVariable Map to resolved against
@return the resolved raw type | [
"Determine",
"the",
"raw",
"type",
"for",
"the",
"given",
"generic",
"parameter",
"type",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java#L364-L379 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java | GenericCollectionTypeResolver.getMapValueFieldType | public static Class<?> getMapValueFieldType(Field mapField, int nestingLevel) {
return getGenericFieldType(mapField, Map.class, 1, null, nestingLevel);
} | java | public static Class<?> getMapValueFieldType(Field mapField, int nestingLevel) {
return getGenericFieldType(mapField, Map.class, 1, null, nestingLevel);
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"getMapValueFieldType",
"(",
"Field",
"mapField",
",",
"int",
"nestingLevel",
")",
"{",
"return",
"getGenericFieldType",
"(",
"mapField",
",",
"Map",
".",
"class",
",",
"1",
",",
"null",
",",
"nestingLevel",
")",
... | Determine the generic value type of the given Map field.
@param mapField the map field to introspect
@param nestingLevel the nesting level of the target type
(typically 1; e.g. in case of a List of Lists, 1 would indicate the
nested List, whereas 2 would indicate the element of the nested List)
@return the generic type, or {@code null} if none | [
"Determine",
"the",
"generic",
"value",
"type",
"of",
"the",
"given",
"Map",
"field",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java#L160-L162 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java | GenericCollectionTypeResolver.getGenericReturnType | private static Class<?> getGenericReturnType(Method method, Class<?> source, int typeIndex, int nestingLevel) {
return extractType(method.getGenericReturnType(), source, typeIndex, null, null, nestingLevel, 1);
} | java | private static Class<?> getGenericReturnType(Method method, Class<?> source, int typeIndex, int nestingLevel) {
return extractType(method.getGenericReturnType(), source, typeIndex, null, null, nestingLevel, 1);
} | [
"private",
"static",
"Class",
"<",
"?",
">",
"getGenericReturnType",
"(",
"Method",
"method",
",",
"Class",
"<",
"?",
">",
"source",
",",
"int",
"typeIndex",
",",
"int",
"nestingLevel",
")",
"{",
"return",
"extractType",
"(",
"method",
".",
"getGenericReturn... | Extract the generic return type from the given method.
@param method the method to check the return type for
@param source the source class/interface defining the generic parameter types
@param typeIndex the index of the type (e.g. 0 for Collections,
0 for Map keys, 1 for Map values)
@param nestingLevel the nesting level of the target type
@return the generic type, or {@code null} if none | [
"Extract",
"the",
"generic",
"return",
"type",
"from",
"the",
"given",
"method",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java#L307-L309 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java | GenericCollectionTypeResolver.extractTypeFromClass | private static Class<?> extractTypeFromClass(Class<?> clazz, Class<?> source, int typeIndex,
Map<TypeVariable, Type> typeVariableMap, Map<Integer, Integer> typeIndexesPerLevel,
int nestingLevel, int currentLevel) {
if (clazz.getName().startsWith("java.util.")) {
return null;
}
if (clazz.getSuperclass() != null && isIntrospectionCandidate(clazz.getSuperclass())) {
try {
return extractType(clazz.getGenericSuperclass(), source, typeIndex, typeVariableMap,
typeIndexesPerLevel, nestingLevel, currentLevel);
}
catch (MalformedParameterizedTypeException ex) {
// from getGenericSuperclass() - ignore and continue with interface introspection
}
}
Type[] ifcs = clazz.getGenericInterfaces();
if (ifcs != null) {
for (Type ifc : ifcs) {
Type rawType = ifc;
if (ifc instanceof ParameterizedType) {
rawType = ((ParameterizedType) ifc).getRawType();
}
if (rawType instanceof Class && isIntrospectionCandidate((Class) rawType)) {
return extractType(ifc, source, typeIndex, typeVariableMap, typeIndexesPerLevel, nestingLevel, currentLevel);
}
}
}
return null;
} | java | private static Class<?> extractTypeFromClass(Class<?> clazz, Class<?> source, int typeIndex,
Map<TypeVariable, Type> typeVariableMap, Map<Integer, Integer> typeIndexesPerLevel,
int nestingLevel, int currentLevel) {
if (clazz.getName().startsWith("java.util.")) {
return null;
}
if (clazz.getSuperclass() != null && isIntrospectionCandidate(clazz.getSuperclass())) {
try {
return extractType(clazz.getGenericSuperclass(), source, typeIndex, typeVariableMap,
typeIndexesPerLevel, nestingLevel, currentLevel);
}
catch (MalformedParameterizedTypeException ex) {
// from getGenericSuperclass() - ignore and continue with interface introspection
}
}
Type[] ifcs = clazz.getGenericInterfaces();
if (ifcs != null) {
for (Type ifc : ifcs) {
Type rawType = ifc;
if (ifc instanceof ParameterizedType) {
rawType = ((ParameterizedType) ifc).getRawType();
}
if (rawType instanceof Class && isIntrospectionCandidate((Class) rawType)) {
return extractType(ifc, source, typeIndex, typeVariableMap, typeIndexesPerLevel, nestingLevel, currentLevel);
}
}
}
return null;
} | [
"private",
"static",
"Class",
"<",
"?",
">",
"extractTypeFromClass",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"source",
",",
"int",
"typeIndex",
",",
"Map",
"<",
"TypeVariable",
",",
"Type",
">",
"typeVariableMap",
",",
"Map",
... | Extract the generic type from the given Class object.
@param clazz the Class to check
@param source the expected raw source type (can be {@code null})
@param typeIndex the index of the actual type argument
@param nestingLevel the nesting level of the target type
@param currentLevel the current nested level
@return the generic type as Class, or {@code null} if none | [
"Extract",
"the",
"generic",
"type",
"from",
"the",
"given",
"Class",
"object",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java#L442-L471 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/io/AssetResource.java | AssetResource.exists | @Override
public boolean exists() {
try {
InputStream inputStream = this.assetManager.open(this.fileName);
if (inputStream != null) {
return true;
} else {
return false;
}
} catch (IOException e) {
return false;
}
} | java | @Override
public boolean exists() {
try {
InputStream inputStream = this.assetManager.open(this.fileName);
if (inputStream != null) {
return true;
} else {
return false;
}
} catch (IOException e) {
return false;
}
} | [
"@",
"Override",
"public",
"boolean",
"exists",
"(",
")",
"{",
"try",
"{",
"InputStream",
"inputStream",
"=",
"this",
".",
"assetManager",
".",
"open",
"(",
"this",
".",
"fileName",
")",
";",
"if",
"(",
"inputStream",
"!=",
"null",
")",
"{",
"return",
... | This implementation returns whether the underlying asset exists. | [
"This",
"implementation",
"returns",
"whether",
"the",
"underlying",
"asset",
"exists",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/io/AssetResource.java#L57-L69 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequest.java | HttpComponentsClientHttpRequest.addHeaders | static void addHeaders(HttpUriRequest httpRequest, HttpHeaders headers) {
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
String headerName = entry.getKey();
if (HttpHeaders.COOKIE.equalsIgnoreCase(headerName)) { // RFC 6265
String headerValue = StringUtils.collectionToDelimitedString(entry.getValue(), "; ");
httpRequest.addHeader(headerName, headerValue);
}
else if (!HTTP.CONTENT_LEN.equalsIgnoreCase(headerName) &&
!HTTP.TRANSFER_ENCODING.equalsIgnoreCase(headerName)) {
for (String headerValue : entry.getValue()) {
httpRequest.addHeader(headerName, headerValue);
}
}
}
} | java | static void addHeaders(HttpUriRequest httpRequest, HttpHeaders headers) {
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
String headerName = entry.getKey();
if (HttpHeaders.COOKIE.equalsIgnoreCase(headerName)) { // RFC 6265
String headerValue = StringUtils.collectionToDelimitedString(entry.getValue(), "; ");
httpRequest.addHeader(headerName, headerValue);
}
else if (!HTTP.CONTENT_LEN.equalsIgnoreCase(headerName) &&
!HTTP.TRANSFER_ENCODING.equalsIgnoreCase(headerName)) {
for (String headerValue : entry.getValue()) {
httpRequest.addHeader(headerName, headerValue);
}
}
}
} | [
"static",
"void",
"addHeaders",
"(",
"HttpUriRequest",
"httpRequest",
",",
"HttpHeaders",
"headers",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"entry",
":",
"headers",
".",
"entrySet",
"(",
")",
")",
... | Add the given headers to the given HTTP request.
@param httpRequest the request to add the headers to
@param headers the headers to add | [
"Add",
"the",
"given",
"headers",
"to",
"the",
"given",
"HTTP",
"request",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequest.java#L101-L115 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java | GenericConversionService.canBypassConvert | public boolean canBypassConvert(TypeDescriptor sourceType, TypeDescriptor targetType) {
Assert.notNull(targetType, "The targetType to convert to cannot be null");
if (sourceType == null) {
return true;
}
GenericConverter converter = getConverter(sourceType, targetType);
return (converter == NO_OP_CONVERTER);
} | java | public boolean canBypassConvert(TypeDescriptor sourceType, TypeDescriptor targetType) {
Assert.notNull(targetType, "The targetType to convert to cannot be null");
if (sourceType == null) {
return true;
}
GenericConverter converter = getConverter(sourceType, targetType);
return (converter == NO_OP_CONVERTER);
} | [
"public",
"boolean",
"canBypassConvert",
"(",
"TypeDescriptor",
"sourceType",
",",
"TypeDescriptor",
"targetType",
")",
"{",
"Assert",
".",
"notNull",
"(",
"targetType",
",",
"\"The targetType to convert to cannot be null\"",
")",
";",
"if",
"(",
"sourceType",
"==",
"... | Returns true if conversion between the sourceType and targetType can be bypassed.
More precisely this method will return true if objects of sourceType can be
converted to the targetType by returning the source object unchanged.
@param sourceType context about the source type to convert from (may be null if source is null)
@param targetType context about the target type to convert to (required)
@return true if conversion can be bypassed
@throws IllegalArgumentException if targetType is null | [
"Returns",
"true",
"if",
"conversion",
"between",
"the",
"sourceType",
"and",
"targetType",
"can",
"be",
"bypassed",
".",
"More",
"precisely",
"this",
"method",
"will",
"return",
"true",
"if",
"objects",
"of",
"sourceType",
"can",
"be",
"converted",
"to",
"the... | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java#L140-L147 | train |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ConcurrentReferenceHashMap.java | ConcurrentReferenceHashMap.calculateShift | protected static int calculateShift(int minimumValue, int maximumValue) {
int shift = 0;
int value = 1;
while (value < minimumValue && value < maximumValue) {
value <<= 1;
shift++;
}
return shift;
} | java | protected static int calculateShift(int minimumValue, int maximumValue) {
int shift = 0;
int value = 1;
while (value < minimumValue && value < maximumValue) {
value <<= 1;
shift++;
}
return shift;
} | [
"protected",
"static",
"int",
"calculateShift",
"(",
"int",
"minimumValue",
",",
"int",
"maximumValue",
")",
"{",
"int",
"shift",
"=",
"0",
";",
"int",
"value",
"=",
"1",
";",
"while",
"(",
"value",
"<",
"minimumValue",
"&&",
"value",
"<",
"maximumValue",
... | Calculate a shift value that can be used to create a power-of-two value between
the specified maximum and minimum values.
@param minimumValue the minimum value
@param maximumValue the maximum value
@return the calculated shift (use {@code 1 << shift} to obtain a value) | [
"Calculate",
"a",
"shift",
"value",
"that",
"can",
"be",
"used",
"to",
"create",
"a",
"power",
"-",
"of",
"-",
"two",
"value",
"between",
"the",
"specified",
"maximum",
"and",
"minimum",
"values",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ConcurrentReferenceHashMap.java#L383-L391 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/MediaType.java | MediaType.copyQualityValue | public MediaType copyQualityValue(MediaType mediaType) {
if (!mediaType.parameters.containsKey(PARAM_QUALITY_FACTOR)) {
return this;
}
Map<String, String> params = new LinkedHashMap<String, String>(this.parameters);
params.put(PARAM_QUALITY_FACTOR, mediaType.parameters.get(PARAM_QUALITY_FACTOR));
return new MediaType(this, params);
} | java | public MediaType copyQualityValue(MediaType mediaType) {
if (!mediaType.parameters.containsKey(PARAM_QUALITY_FACTOR)) {
return this;
}
Map<String, String> params = new LinkedHashMap<String, String>(this.parameters);
params.put(PARAM_QUALITY_FACTOR, mediaType.parameters.get(PARAM_QUALITY_FACTOR));
return new MediaType(this, params);
} | [
"public",
"MediaType",
"copyQualityValue",
"(",
"MediaType",
"mediaType",
")",
"{",
"if",
"(",
"!",
"mediaType",
".",
"parameters",
".",
"containsKey",
"(",
"PARAM_QUALITY_FACTOR",
")",
")",
"{",
"return",
"this",
";",
"}",
"Map",
"<",
"String",
",",
"String... | Return a replica of this instance with the quality value of the given MediaType.
@return the same instance if the given MediaType doesn't have a quality value, or a new one otherwise | [
"Return",
"a",
"replica",
"of",
"this",
"instance",
"with",
"the",
"quality",
"value",
"of",
"the",
"given",
"MediaType",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/MediaType.java#L582-L589 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/MediaType.java | MediaType.removeQualityValue | public MediaType removeQualityValue() {
if (!this.parameters.containsKey(PARAM_QUALITY_FACTOR)) {
return this;
}
Map<String, String> params = new LinkedHashMap<String, String>(this.parameters);
params.remove(PARAM_QUALITY_FACTOR);
return new MediaType(this, params);
} | java | public MediaType removeQualityValue() {
if (!this.parameters.containsKey(PARAM_QUALITY_FACTOR)) {
return this;
}
Map<String, String> params = new LinkedHashMap<String, String>(this.parameters);
params.remove(PARAM_QUALITY_FACTOR);
return new MediaType(this, params);
} | [
"public",
"MediaType",
"removeQualityValue",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"parameters",
".",
"containsKey",
"(",
"PARAM_QUALITY_FACTOR",
")",
")",
"{",
"return",
"this",
";",
"}",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"n... | Return a replica of this instance with its quality value removed.
@return the same instance if the media type doesn't contain a quality value, or a new one otherwise | [
"Return",
"a",
"replica",
"of",
"this",
"instance",
"with",
"its",
"quality",
"value",
"removed",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/MediaType.java#L595-L602 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java | HttpHeaders.getFirst | @Override
public String getFirst(String headerName) {
List<String> headerValues = headers.get(headerName);
return headerValues != null ? headerValues.get(0) : null;
} | java | @Override
public String getFirst(String headerName) {
List<String> headerValues = headers.get(headerName);
return headerValues != null ? headerValues.get(0) : null;
} | [
"@",
"Override",
"public",
"String",
"getFirst",
"(",
"String",
"headerName",
")",
"{",
"List",
"<",
"String",
">",
"headerValues",
"=",
"headers",
".",
"get",
"(",
"headerName",
")",
";",
"return",
"headerValues",
"!=",
"null",
"?",
"headerValues",
".",
"... | Return the first header value for the given header name, if any.
@param headerName the header name
@return the first header value, or {@code null} if none | [
"Return",
"the",
"first",
"header",
"value",
"for",
"the",
"given",
"header",
"name",
"if",
"any",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java#L921-L925 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java | HttpHeaders.add | @Override
public void add(String headerName, String headerValue) {
List<String> headerValues = headers.get(headerName);
if (headerValues == null) {
headerValues = new LinkedList<String>();
this.headers.put(headerName, headerValues);
}
headerValues.add(headerValue);
} | java | @Override
public void add(String headerName, String headerValue) {
List<String> headerValues = headers.get(headerName);
if (headerValues == null) {
headerValues = new LinkedList<String>();
this.headers.put(headerName, headerValues);
}
headerValues.add(headerValue);
} | [
"@",
"Override",
"public",
"void",
"add",
"(",
"String",
"headerName",
",",
"String",
"headerValue",
")",
"{",
"List",
"<",
"String",
">",
"headerValues",
"=",
"headers",
".",
"get",
"(",
"headerName",
")",
";",
"if",
"(",
"headerValues",
"==",
"null",
"... | Add the given, single header value under the given name.
@param headerName the header name
@param headerValue the header value
@throws UnsupportedOperationException if adding headers is not supported
@see #put(String, List)
@see #set(String, String) | [
"Add",
"the",
"given",
"single",
"header",
"value",
"under",
"the",
"given",
"name",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java#L935-L943 | train |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java | HttpHeaders.set | @Override
public void set(String headerName, String headerValue) {
List<String> headerValues = new LinkedList<String>();
headerValues.add(headerValue);
headers.put(headerName, headerValues);
} | java | @Override
public void set(String headerName, String headerValue) {
List<String> headerValues = new LinkedList<String>();
headerValues.add(headerValue);
headers.put(headerName, headerValues);
} | [
"@",
"Override",
"public",
"void",
"set",
"(",
"String",
"headerName",
",",
"String",
"headerValue",
")",
"{",
"List",
"<",
"String",
">",
"headerValues",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"headerValues",
".",
"add",
"(",
"head... | Set the given, single header value under the given name.
@param headerName the header name
@param headerValue the header value
@throws UnsupportedOperationException if adding headers is not supported
@see #put(String, List)
@see #add(String, String) | [
"Set",
"the",
"given",
"single",
"header",
"value",
"under",
"the",
"given",
"name",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java#L953-L958 | train |
Trinea/android-auto-scroll-view-pager | src/cn/trinea/android/view/autoscrollviewpager/AutoScrollViewPager.java | AutoScrollViewPager.setViewPagerScroller | private void setViewPagerScroller() {
try {
Field scrollerField = ViewPager.class.getDeclaredField("mScroller");
scrollerField.setAccessible(true);
Field interpolatorField = ViewPager.class.getDeclaredField("sInterpolator");
interpolatorField.setAccessible(true);
scroller = new CustomDurationScroller(getContext(), (Interpolator)interpolatorField.get(null));
scrollerField.set(this, scroller);
} catch (Exception e) {
e.printStackTrace();
}
} | java | private void setViewPagerScroller() {
try {
Field scrollerField = ViewPager.class.getDeclaredField("mScroller");
scrollerField.setAccessible(true);
Field interpolatorField = ViewPager.class.getDeclaredField("sInterpolator");
interpolatorField.setAccessible(true);
scroller = new CustomDurationScroller(getContext(), (Interpolator)interpolatorField.get(null));
scrollerField.set(this, scroller);
} catch (Exception e) {
e.printStackTrace();
}
} | [
"private",
"void",
"setViewPagerScroller",
"(",
")",
"{",
"try",
"{",
"Field",
"scrollerField",
"=",
"ViewPager",
".",
"class",
".",
"getDeclaredField",
"(",
"\"mScroller\"",
")",
";",
"scrollerField",
".",
"setAccessible",
"(",
"true",
")",
";",
"Field",
"int... | set ViewPager scroller to change animation duration when sliding | [
"set",
"ViewPager",
"scroller",
"to",
"change",
"animation",
"duration",
"when",
"sliding"
] | 6dcbf643236a347b5c4ca15ad62b444c60783d05 | https://github.com/Trinea/android-auto-scroll-view-pager/blob/6dcbf643236a347b5c4ca15ad62b444c60783d05/src/cn/trinea/android/view/autoscrollviewpager/AutoScrollViewPager.java#L140-L152 | train |
Trinea/android-auto-scroll-view-pager | src/cn/trinea/android/view/autoscrollviewpager/AutoScrollViewPager.java | AutoScrollViewPager.scrollOnce | public void scrollOnce() {
PagerAdapter adapter = getAdapter();
int currentItem = getCurrentItem();
int totalCount;
if (adapter == null || (totalCount = adapter.getCount()) <= 1) {
return;
}
int nextItem = (direction == LEFT) ? --currentItem : ++currentItem;
if (nextItem < 0) {
if (isCycle) {
setCurrentItem(totalCount - 1, isBorderAnimation);
}
} else if (nextItem == totalCount) {
if (isCycle) {
setCurrentItem(0, isBorderAnimation);
}
} else {
setCurrentItem(nextItem, true);
}
} | java | public void scrollOnce() {
PagerAdapter adapter = getAdapter();
int currentItem = getCurrentItem();
int totalCount;
if (adapter == null || (totalCount = adapter.getCount()) <= 1) {
return;
}
int nextItem = (direction == LEFT) ? --currentItem : ++currentItem;
if (nextItem < 0) {
if (isCycle) {
setCurrentItem(totalCount - 1, isBorderAnimation);
}
} else if (nextItem == totalCount) {
if (isCycle) {
setCurrentItem(0, isBorderAnimation);
}
} else {
setCurrentItem(nextItem, true);
}
} | [
"public",
"void",
"scrollOnce",
"(",
")",
"{",
"PagerAdapter",
"adapter",
"=",
"getAdapter",
"(",
")",
";",
"int",
"currentItem",
"=",
"getCurrentItem",
"(",
")",
";",
"int",
"totalCount",
";",
"if",
"(",
"adapter",
"==",
"null",
"||",
"(",
"totalCount",
... | scroll only once | [
"scroll",
"only",
"once"
] | 6dcbf643236a347b5c4ca15ad62b444c60783d05 | https://github.com/Trinea/android-auto-scroll-view-pager/blob/6dcbf643236a347b5c4ca15ad62b444c60783d05/src/cn/trinea/android/view/autoscrollviewpager/AutoScrollViewPager.java#L157-L177 | train |
neokree/MaterialNavigationDrawer | MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java | MaterialNavigationDrawer.setHomeAsUpIndicator | public void setHomeAsUpIndicator(Drawable indicator) {
if(!deviceSupportMultiPane()) {
pulsante.setHomeAsUpIndicator(indicator);
}
else {
actionBar.setHomeAsUpIndicator(indicator);
}
} | java | public void setHomeAsUpIndicator(Drawable indicator) {
if(!deviceSupportMultiPane()) {
pulsante.setHomeAsUpIndicator(indicator);
}
else {
actionBar.setHomeAsUpIndicator(indicator);
}
} | [
"public",
"void",
"setHomeAsUpIndicator",
"(",
"Drawable",
"indicator",
")",
"{",
"if",
"(",
"!",
"deviceSupportMultiPane",
"(",
")",
")",
"{",
"pulsante",
".",
"setHomeAsUpIndicator",
"(",
"indicator",
")",
";",
"}",
"else",
"{",
"actionBar",
".",
"setHomeAsU... | Set the HomeAsUpIndicator that is visible when user navigate to a fragment child
@param indicator the resource drawable to use as indicator | [
"Set",
"the",
"HomeAsUpIndicator",
"that",
"is",
"visible",
"when",
"user",
"navigate",
"to",
"a",
"fragment",
"child"
] | 86e355f6190dcb7255c6b9c28c1e54cf96f46358 | https://github.com/neokree/MaterialNavigationDrawer/blob/86e355f6190dcb7255c6b9c28c1e54cf96f46358/MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java#L1444-L1451 | train |
neokree/MaterialNavigationDrawer | MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java | MaterialNavigationDrawer.getSectionByTitle | public MaterialSection getSectionByTitle(String title) {
for(MaterialSection section : sectionList) {
if(section.getTitle().equals(title)) {
return section;
}
}
for(MaterialSection section : bottomSectionList) {
if(section.getTitle().equals(title))
return section;
}
return null;
} | java | public MaterialSection getSectionByTitle(String title) {
for(MaterialSection section : sectionList) {
if(section.getTitle().equals(title)) {
return section;
}
}
for(MaterialSection section : bottomSectionList) {
if(section.getTitle().equals(title))
return section;
}
return null;
} | [
"public",
"MaterialSection",
"getSectionByTitle",
"(",
"String",
"title",
")",
"{",
"for",
"(",
"MaterialSection",
"section",
":",
"sectionList",
")",
"{",
"if",
"(",
"section",
".",
"getTitle",
"(",
")",
".",
"equals",
"(",
"title",
")",
")",
"{",
"return... | Get a setted section knowing his title
N.B. this search only into section list and bottom section list.
@param title is the title of the section
@return the section with title or null if the section is not founded | [
"Get",
"a",
"setted",
"section",
"knowing",
"his",
"title"
] | 86e355f6190dcb7255c6b9c28c1e54cf96f46358 | https://github.com/neokree/MaterialNavigationDrawer/blob/86e355f6190dcb7255c6b9c28c1e54cf96f46358/MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java#L1964-L1978 | train |
neokree/MaterialNavigationDrawer | MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java | MaterialNavigationDrawer.getSectionList | public List<MaterialSection> getSectionList() {
List<MaterialSection> list = new LinkedList<>();
for(MaterialSection section : sectionList)
list.add(section);
for(MaterialSection section : bottomSectionList)
list.add(section);
return list;
} | java | public List<MaterialSection> getSectionList() {
List<MaterialSection> list = new LinkedList<>();
for(MaterialSection section : sectionList)
list.add(section);
for(MaterialSection section : bottomSectionList)
list.add(section);
return list;
} | [
"public",
"List",
"<",
"MaterialSection",
">",
"getSectionList",
"(",
")",
"{",
"List",
"<",
"MaterialSection",
">",
"list",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"for",
"(",
"MaterialSection",
"section",
":",
"sectionList",
")",
"list",
".",
"(",... | Get the section list
N.B. The section list contains the bottom sections
@return the list of sections setted | [
"Get",
"the",
"section",
"list"
] | 86e355f6190dcb7255c6b9c28c1e54cf96f46358 | https://github.com/neokree/MaterialNavigationDrawer/blob/86e355f6190dcb7255c6b9c28c1e54cf96f46358/MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java#L1986-L1996 | train |
neokree/MaterialNavigationDrawer | MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java | MaterialNavigationDrawer.getAccountAtCurrentPosition | public MaterialAccount getAccountAtCurrentPosition(int position) {
if (position < 0 || position >= accountManager.size())
throw new RuntimeException("Account Index Overflow");
return findAccountNumber(position);
} | java | public MaterialAccount getAccountAtCurrentPosition(int position) {
if (position < 0 || position >= accountManager.size())
throw new RuntimeException("Account Index Overflow");
return findAccountNumber(position);
} | [
"public",
"MaterialAccount",
"getAccountAtCurrentPosition",
"(",
"int",
"position",
")",
"{",
"if",
"(",
"position",
"<",
"0",
"||",
"position",
">=",
"accountManager",
".",
"size",
"(",
")",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Account Index Overflow\... | Get the account knowing his position
@param position the position of the account (it can change at runtime!)
@return the account | [
"Get",
"the",
"account",
"knowing",
"his",
"position"
] | 86e355f6190dcb7255c6b9c28c1e54cf96f46358 | https://github.com/neokree/MaterialNavigationDrawer/blob/86e355f6190dcb7255c6b9c28c1e54cf96f46358/MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java#L2019-L2025 | train |
neokree/MaterialNavigationDrawer | MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java | MaterialNavigationDrawer.getAccountByTitle | public MaterialAccount getAccountByTitle(String title) {
for(MaterialAccount account : accountManager)
if(currentAccount.getTitle().equals(title))
return account;
return null;
} | java | public MaterialAccount getAccountByTitle(String title) {
for(MaterialAccount account : accountManager)
if(currentAccount.getTitle().equals(title))
return account;
return null;
} | [
"public",
"MaterialAccount",
"getAccountByTitle",
"(",
"String",
"title",
")",
"{",
"for",
"(",
"MaterialAccount",
"account",
":",
"accountManager",
")",
"if",
"(",
"currentAccount",
".",
"getTitle",
"(",
")",
".",
"equals",
"(",
"title",
")",
")",
"return",
... | Get the account knowing his title
@param title the title of the account (it can change at runtime!)
@return the account founded or null if the account not exists | [
"Get",
"the",
"account",
"knowing",
"his",
"title"
] | 86e355f6190dcb7255c6b9c28c1e54cf96f46358 | https://github.com/neokree/MaterialNavigationDrawer/blob/86e355f6190dcb7255c6b9c28c1e54cf96f46358/MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java#L2032-L2038 | train |
neokree/MaterialNavigationDrawer | MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/elements/MaterialSection.java | MaterialSection.onTouch | @Override
@SuppressLint("NewApi")
public boolean onTouch(View v, MotionEvent event) {
if(touchable) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
view.setBackgroundColor(colorPressed);
return true;
}
if (event.getAction() == MotionEvent.ACTION_CANCEL) {
if (isSelected)
view.setBackgroundColor(colorSelected);
else
view.setBackgroundColor(colorUnpressed);
return true;
}
if (event.getAction() == MotionEvent.ACTION_UP) {
view.setBackgroundColor(colorSelected);
afterClick();
return true;
}
}
return false;
} | java | @Override
@SuppressLint("NewApi")
public boolean onTouch(View v, MotionEvent event) {
if(touchable) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
view.setBackgroundColor(colorPressed);
return true;
}
if (event.getAction() == MotionEvent.ACTION_CANCEL) {
if (isSelected)
view.setBackgroundColor(colorSelected);
else
view.setBackgroundColor(colorUnpressed);
return true;
}
if (event.getAction() == MotionEvent.ACTION_UP) {
view.setBackgroundColor(colorSelected);
afterClick();
return true;
}
}
return false;
} | [
"@",
"Override",
"@",
"SuppressLint",
"(",
"\"NewApi\"",
")",
"public",
"boolean",
"onTouch",
"(",
"View",
"v",
",",
"MotionEvent",
"event",
")",
"{",
"if",
"(",
"touchable",
")",
"{",
"if",
"(",
"event",
".",
"getAction",
"(",
")",
"==",
"MotionEvent",
... | touch event without ripple support | [
"touch",
"event",
"without",
"ripple",
"support"
] | 86e355f6190dcb7255c6b9c28c1e54cf96f46358 | https://github.com/neokree/MaterialNavigationDrawer/blob/86e355f6190dcb7255c6b9c28c1e54cf96f46358/MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/elements/MaterialSection.java#L240-L271 | train |
neokree/MaterialNavigationDrawer | MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/elements/MaterialSection.java | MaterialSection.setBackgroundColor | public void setBackgroundColor(int color) {
colorUnpressed = color;
if(!isSelected()) {
if (rippleAnimationSupport()) {
ripple.setRippleBackground(colorUnpressed);
}
else {
view.setBackgroundColor(colorUnpressed);
}
}
} | java | public void setBackgroundColor(int color) {
colorUnpressed = color;
if(!isSelected()) {
if (rippleAnimationSupport()) {
ripple.setRippleBackground(colorUnpressed);
}
else {
view.setBackgroundColor(colorUnpressed);
}
}
} | [
"public",
"void",
"setBackgroundColor",
"(",
"int",
"color",
")",
"{",
"colorUnpressed",
"=",
"color",
";",
"if",
"(",
"!",
"isSelected",
"(",
")",
")",
"{",
"if",
"(",
"rippleAnimationSupport",
"(",
")",
")",
"{",
"ripple",
".",
"setRippleBackground",
"("... | alias of setColorUnpressed | [
"alias",
"of",
"setColorUnpressed"
] | 86e355f6190dcb7255c6b9c28c1e54cf96f46358 | https://github.com/neokree/MaterialNavigationDrawer/blob/86e355f6190dcb7255c6b9c28c1e54cf96f46358/MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/elements/MaterialSection.java#L379-L390 | train |
rabbitmq/hop | src/main/java/com/rabbitmq/http/client/Client.java | Client.getNodes | public List<NodeInfo> getNodes() {
final URI uri = uriWithPath("./nodes/");
return Arrays.asList(this.rt.getForObject(uri, NodeInfo[].class));
} | java | public List<NodeInfo> getNodes() {
final URI uri = uriWithPath("./nodes/");
return Arrays.asList(this.rt.getForObject(uri, NodeInfo[].class));
} | [
"public",
"List",
"<",
"NodeInfo",
">",
"getNodes",
"(",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./nodes/\"",
")",
";",
"return",
"Arrays",
".",
"asList",
"(",
"this",
".",
"rt",
".",
"getForObject",
"(",
"uri",
",",
"NodeInfo",
"[... | Retrieves state and metrics information for all nodes in the cluster.
@return list of nodes in the cluster | [
"Retrieves",
"state",
"and",
"metrics",
"information",
"for",
"all",
"nodes",
"in",
"the",
"cluster",
"."
] | 94e70f1f7e39f523a11ab3162b4efc976311ee03 | https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L267-L270 | train |
rabbitmq/hop | src/main/java/com/rabbitmq/http/client/Client.java | Client.getNode | public NodeInfo getNode(String name) {
final URI uri = uriWithPath("./nodes/" + encodePathSegment(name));
return this.rt.getForObject(uri, NodeInfo.class);
} | java | public NodeInfo getNode(String name) {
final URI uri = uriWithPath("./nodes/" + encodePathSegment(name));
return this.rt.getForObject(uri, NodeInfo.class);
} | [
"public",
"NodeInfo",
"getNode",
"(",
"String",
"name",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./nodes/\"",
"+",
"encodePathSegment",
"(",
"name",
")",
")",
";",
"return",
"this",
".",
"rt",
".",
"getForObject",
"(",
"uri",
",",
"No... | Retrieves state and metrics information for individual node.
@param name node name
@return node information | [
"Retrieves",
"state",
"and",
"metrics",
"information",
"for",
"individual",
"node",
"."
] | 94e70f1f7e39f523a11ab3162b4efc976311ee03 | https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L278-L281 | train |
rabbitmq/hop | src/main/java/com/rabbitmq/http/client/Client.java | Client.getConnections | public List<ConnectionInfo> getConnections() {
final URI uri = uriWithPath("./connections/");
return Arrays.asList(this.rt.getForObject(uri, ConnectionInfo[].class));
} | java | public List<ConnectionInfo> getConnections() {
final URI uri = uriWithPath("./connections/");
return Arrays.asList(this.rt.getForObject(uri, ConnectionInfo[].class));
} | [
"public",
"List",
"<",
"ConnectionInfo",
">",
"getConnections",
"(",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./connections/\"",
")",
";",
"return",
"Arrays",
".",
"asList",
"(",
"this",
".",
"rt",
".",
"getForObject",
"(",
"uri",
",",
... | Retrieves state and metrics information for all client connections across the cluster.
@return list of connections across the cluster | [
"Retrieves",
"state",
"and",
"metrics",
"information",
"for",
"all",
"client",
"connections",
"across",
"the",
"cluster",
"."
] | 94e70f1f7e39f523a11ab3162b4efc976311ee03 | https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L288-L291 | train |
rabbitmq/hop | src/main/java/com/rabbitmq/http/client/Client.java | Client.getConnection | public ConnectionInfo getConnection(String name) {
final URI uri = uriWithPath("./connections/" + encodePathSegment(name));
return this.rt.getForObject(uri, ConnectionInfo.class);
} | java | public ConnectionInfo getConnection(String name) {
final URI uri = uriWithPath("./connections/" + encodePathSegment(name));
return this.rt.getForObject(uri, ConnectionInfo.class);
} | [
"public",
"ConnectionInfo",
"getConnection",
"(",
"String",
"name",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./connections/\"",
"+",
"encodePathSegment",
"(",
"name",
")",
")",
";",
"return",
"this",
".",
"rt",
".",
"getForObject",
"(",
"... | Retrieves state and metrics information for individual client connection.
@param name connection name
@return connection information | [
"Retrieves",
"state",
"and",
"metrics",
"information",
"for",
"individual",
"client",
"connection",
"."
] | 94e70f1f7e39f523a11ab3162b4efc976311ee03 | https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L299-L302 | train |
rabbitmq/hop | src/main/java/com/rabbitmq/http/client/Client.java | Client.getChannels | public List<ChannelInfo> getChannels() {
final URI uri = uriWithPath("./channels/");
return Arrays.asList(this.rt.getForObject(uri, ChannelInfo[].class));
} | java | public List<ChannelInfo> getChannels() {
final URI uri = uriWithPath("./channels/");
return Arrays.asList(this.rt.getForObject(uri, ChannelInfo[].class));
} | [
"public",
"List",
"<",
"ChannelInfo",
">",
"getChannels",
"(",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./channels/\"",
")",
";",
"return",
"Arrays",
".",
"asList",
"(",
"this",
".",
"rt",
".",
"getForObject",
"(",
"uri",
",",
"Channe... | Retrieves state and metrics information for all channels across the cluster.
@return list of channels across the cluster | [
"Retrieves",
"state",
"and",
"metrics",
"information",
"for",
"all",
"channels",
"across",
"the",
"cluster",
"."
] | 94e70f1f7e39f523a11ab3162b4efc976311ee03 | https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L336-L339 | train |
rabbitmq/hop | src/main/java/com/rabbitmq/http/client/Client.java | Client.getChannels | public List<ChannelInfo> getChannels(String connectionName) {
final URI uri = uriWithPath("./connections/" + encodePathSegment(connectionName) + "/channels/");
return Arrays.asList(this.rt.getForObject(uri, ChannelInfo[].class));
} | java | public List<ChannelInfo> getChannels(String connectionName) {
final URI uri = uriWithPath("./connections/" + encodePathSegment(connectionName) + "/channels/");
return Arrays.asList(this.rt.getForObject(uri, ChannelInfo[].class));
} | [
"public",
"List",
"<",
"ChannelInfo",
">",
"getChannels",
"(",
"String",
"connectionName",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./connections/\"",
"+",
"encodePathSegment",
"(",
"connectionName",
")",
"+",
"\"/channels/\"",
")",
";",
"ret... | Retrieves state and metrics information for all channels on individual connection.
@param connectionName the connection name to retrieve channels
@return list of channels on the connection | [
"Retrieves",
"state",
"and",
"metrics",
"information",
"for",
"all",
"channels",
"on",
"individual",
"connection",
"."
] | 94e70f1f7e39f523a11ab3162b4efc976311ee03 | https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L346-L349 | train |
rabbitmq/hop | src/main/java/com/rabbitmq/http/client/Client.java | Client.getChannel | public ChannelInfo getChannel(String name) {
final URI uri = uriWithPath("./channels/" + encodePathSegment(name));
return this.rt.getForObject(uri, ChannelInfo.class);
} | java | public ChannelInfo getChannel(String name) {
final URI uri = uriWithPath("./channels/" + encodePathSegment(name));
return this.rt.getForObject(uri, ChannelInfo.class);
} | [
"public",
"ChannelInfo",
"getChannel",
"(",
"String",
"name",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./channels/\"",
"+",
"encodePathSegment",
"(",
"name",
")",
")",
";",
"return",
"this",
".",
"rt",
".",
"getForObject",
"(",
"uri",
"... | Retrieves state and metrics information for individual channel.
@param name channel name
@return channel information | [
"Retrieves",
"state",
"and",
"metrics",
"information",
"for",
"individual",
"channel",
"."
] | 94e70f1f7e39f523a11ab3162b4efc976311ee03 | https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L357-L360 | train |
rabbitmq/hop | src/main/java/com/rabbitmq/http/client/Client.java | Client.getQueueBindings | public List<BindingInfo> getQueueBindings(String vhost, String queue) {
final URI uri = uriWithPath("./queues/" + encodePathSegment(vhost) +
"/" + encodePathSegment(queue) + "/bindings");
final BindingInfo[] result = this.rt.getForObject(uri, BindingInfo[].class);
return asListOrNull(result);
} | java | public List<BindingInfo> getQueueBindings(String vhost, String queue) {
final URI uri = uriWithPath("./queues/" + encodePathSegment(vhost) +
"/" + encodePathSegment(queue) + "/bindings");
final BindingInfo[] result = this.rt.getForObject(uri, BindingInfo[].class);
return asListOrNull(result);
} | [
"public",
"List",
"<",
"BindingInfo",
">",
"getQueueBindings",
"(",
"String",
"vhost",
",",
"String",
"queue",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./queues/\"",
"+",
"encodePathSegment",
"(",
"vhost",
")",
"+",
"\"/\"",
"+",
"encodeP... | Returns a list of bindings where provided queue is the destination.
@param vhost vhost of the exchange
@param queue destination queue name
@return list of bindings | [
"Returns",
"a",
"list",
"of",
"bindings",
"where",
"provided",
"queue",
"is",
"the",
"destination",
"."
] | 94e70f1f7e39f523a11ab3162b4efc976311ee03 | https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L632-L637 | train |
rabbitmq/hop | src/main/java/com/rabbitmq/http/client/Client.java | Client.declareShovel | public void declareShovel(String vhost, ShovelInfo info) {
Map<String, Object> props = info.getDetails().getPublishProperties();
if(props != null && props.isEmpty()) {
throw new IllegalArgumentException("Shovel publish properties must be a non-empty map or null");
}
final URI uri = uriWithPath("./parameters/shovel/" + encodePathSegment(vhost) + "/" + encodePathSegment(info.getName()));
this.rt.put(uri, info);
} | java | public void declareShovel(String vhost, ShovelInfo info) {
Map<String, Object> props = info.getDetails().getPublishProperties();
if(props != null && props.isEmpty()) {
throw new IllegalArgumentException("Shovel publish properties must be a non-empty map or null");
}
final URI uri = uriWithPath("./parameters/shovel/" + encodePathSegment(vhost) + "/" + encodePathSegment(info.getName()));
this.rt.put(uri, info);
} | [
"public",
"void",
"declareShovel",
"(",
"String",
"vhost",
",",
"ShovelInfo",
"info",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
"=",
"info",
".",
"getDetails",
"(",
")",
".",
"getPublishProperties",
"(",
")",
";",
"if",
"(",
"props",
... | Declares a shovel.
@param vhost virtual host where to declare the shovel
@param info Shovel info. | [
"Declares",
"a",
"shovel",
"."
] | 94e70f1f7e39f523a11ab3162b4efc976311ee03 | https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L768-L775 | train |
rabbitmq/hop | src/main/java/com/rabbitmq/http/client/Client.java | Client.deleteShovel | public void deleteShovel(String vhost, String shovelname) {
this.deleteIgnoring404(uriWithPath("./parameters/shovel/" + encodePathSegment(vhost) + "/" + encodePathSegment(shovelname)));
} | java | public void deleteShovel(String vhost, String shovelname) {
this.deleteIgnoring404(uriWithPath("./parameters/shovel/" + encodePathSegment(vhost) + "/" + encodePathSegment(shovelname)));
} | [
"public",
"void",
"deleteShovel",
"(",
"String",
"vhost",
",",
"String",
"shovelname",
")",
"{",
"this",
".",
"deleteIgnoring404",
"(",
"uriWithPath",
"(",
"\"./parameters/shovel/\"",
"+",
"encodePathSegment",
"(",
"vhost",
")",
"+",
"\"/\"",
"+",
"encodePathSegme... | Deletes the specified shovel from specified virtual host.
@param vhost virtual host from where to delete the shovel
@param shovelname Shovel to be deleted. | [
"Deletes",
"the",
"specified",
"shovel",
"from",
"specified",
"virtual",
"host",
"."
] | 94e70f1f7e39f523a11ab3162b4efc976311ee03 | https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L827-L829 | train |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/AT_CellContext.java | AT_CellContext.setCharTranslator | public void setCharTranslator(CharacterTranslator charTranslator) {
if(charTranslator!=null){
this.charTranslator = charTranslator;
this.htmlElementTranslator = null;
this.targetTranslator = null;
}
} | java | public void setCharTranslator(CharacterTranslator charTranslator) {
if(charTranslator!=null){
this.charTranslator = charTranslator;
this.htmlElementTranslator = null;
this.targetTranslator = null;
}
} | [
"public",
"void",
"setCharTranslator",
"(",
"CharacterTranslator",
"charTranslator",
")",
"{",
"if",
"(",
"charTranslator",
"!=",
"null",
")",
"{",
"this",
".",
"charTranslator",
"=",
"charTranslator",
";",
"this",
".",
"htmlElementTranslator",
"=",
"null",
";",
... | Sets the character translator.
It will also remove any other translator set.
Nothing will happen if the argument is null.
@param charTranslator translator | [
"Sets",
"the",
"character",
"translator",
".",
"It",
"will",
"also",
"remove",
"any",
"other",
"translator",
"set",
".",
"Nothing",
"will",
"happen",
"if",
"the",
"argument",
"is",
"null",
"."
] | b6a73710271c89f9c749603be856ba84a969ed5f | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_CellContext.java#L173-L179 | train |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/AT_CellContext.java | AT_CellContext.setHtmlElementTranslator | public void setHtmlElementTranslator(HtmlElementTranslator htmlElementTranslator) {
if(htmlElementTranslator!=null){
this.htmlElementTranslator = htmlElementTranslator;
this.charTranslator = null;
this.targetTranslator = null;
}
} | java | public void setHtmlElementTranslator(HtmlElementTranslator htmlElementTranslator) {
if(htmlElementTranslator!=null){
this.htmlElementTranslator = htmlElementTranslator;
this.charTranslator = null;
this.targetTranslator = null;
}
} | [
"public",
"void",
"setHtmlElementTranslator",
"(",
"HtmlElementTranslator",
"htmlElementTranslator",
")",
"{",
"if",
"(",
"htmlElementTranslator",
"!=",
"null",
")",
"{",
"this",
".",
"htmlElementTranslator",
"=",
"htmlElementTranslator",
";",
"this",
".",
"charTranslat... | Sets the HTML entity translator.
It will also remove any other translator set.
Nothing will happen if the argument is null.
@param htmlElementTranslator translator | [
"Sets",
"the",
"HTML",
"entity",
"translator",
".",
"It",
"will",
"also",
"remove",
"any",
"other",
"translator",
"set",
".",
"Nothing",
"will",
"happen",
"if",
"the",
"argument",
"is",
"null",
"."
] | b6a73710271c89f9c749603be856ba84a969ed5f | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_CellContext.java#L187-L193 | train |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/AT_CellContext.java | AT_CellContext.setPadding | public AT_CellContext setPadding(int padding){
if(padding>-1){
this.paddingTop = padding;
this.paddingBottom = padding;
this.paddingLeft = padding;
this.paddingRight = padding;
}
return this;
} | java | public AT_CellContext setPadding(int padding){
if(padding>-1){
this.paddingTop = padding;
this.paddingBottom = padding;
this.paddingLeft = padding;
this.paddingRight = padding;
}
return this;
} | [
"public",
"AT_CellContext",
"setPadding",
"(",
"int",
"padding",
")",
"{",
"if",
"(",
"padding",
">",
"-",
"1",
")",
"{",
"this",
".",
"paddingTop",
"=",
"padding",
";",
"this",
".",
"paddingBottom",
"=",
"padding",
";",
"this",
".",
"paddingLeft",
"=",
... | Sets all padding to the same value.
@param padding new padding for top, bottom, left, and right, ignored if smaller than 0
@return this to allow chaining | [
"Sets",
"all",
"padding",
"to",
"the",
"same",
"value",
"."
] | b6a73710271c89f9c749603be856ba84a969ed5f | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_CellContext.java#L200-L208 | train |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/AT_CellContext.java | AT_CellContext.setTargetTranslator | public void setTargetTranslator(TargetTranslator targetTranslator) {
if(targetTranslator!=null){
this.targetTranslator = targetTranslator;
this.charTranslator = null;
this.htmlElementTranslator = null;
}
} | java | public void setTargetTranslator(TargetTranslator targetTranslator) {
if(targetTranslator!=null){
this.targetTranslator = targetTranslator;
this.charTranslator = null;
this.htmlElementTranslator = null;
}
} | [
"public",
"void",
"setTargetTranslator",
"(",
"TargetTranslator",
"targetTranslator",
")",
"{",
"if",
"(",
"targetTranslator",
"!=",
"null",
")",
"{",
"this",
".",
"targetTranslator",
"=",
"targetTranslator",
";",
"this",
".",
"charTranslator",
"=",
"null",
";",
... | Sets the target translator.
It will also remove any other translator set.
Nothing will happen if the argument is null.
@param targetTranslator translator | [
"Sets",
"the",
"target",
"translator",
".",
"It",
"will",
"also",
"remove",
"any",
"other",
"translator",
"set",
".",
"Nothing",
"will",
"happen",
"if",
"the",
"argument",
"is",
"null",
"."
] | b6a73710271c89f9c749603be856ba84a969ed5f | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_CellContext.java#L366-L372 | train |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/CWC_LongestWord.java | CWC_LongestWord.longestWord | public static int[] longestWord(LinkedList<AT_Row> rows, int colNumbers){
if(rows==null){
return null;
}
if(rows.size()==0){
return new int[0];
}
int[] ret = new int[colNumbers];
for(AT_Row row : rows){
if(row.getType()==TableRowType.CONTENT) {
LinkedList<AT_Cell> cells = row.getCells();
for(int i=0; i<cells.size(); i++) {
if(cells.get(i).getContent()!=null){
String[] ar = StringUtils.split(Object_To_StrBuilder.convert(cells.get(i).getContent()).toString());
for(int k=0; k<ar.length; k++){
int count = ar[k].length() + cells.get(i).getContext().getPaddingLeft() + cells.get(i).getContext().getPaddingRight();
if(count>ret[i]){
ret[i] = count;
}
}
}
}
}
}
return ret;
} | java | public static int[] longestWord(LinkedList<AT_Row> rows, int colNumbers){
if(rows==null){
return null;
}
if(rows.size()==0){
return new int[0];
}
int[] ret = new int[colNumbers];
for(AT_Row row : rows){
if(row.getType()==TableRowType.CONTENT) {
LinkedList<AT_Cell> cells = row.getCells();
for(int i=0; i<cells.size(); i++) {
if(cells.get(i).getContent()!=null){
String[] ar = StringUtils.split(Object_To_StrBuilder.convert(cells.get(i).getContent()).toString());
for(int k=0; k<ar.length; k++){
int count = ar[k].length() + cells.get(i).getContext().getPaddingLeft() + cells.get(i).getContext().getPaddingRight();
if(count>ret[i]){
ret[i] = count;
}
}
}
}
}
}
return ret;
} | [
"public",
"static",
"int",
"[",
"]",
"longestWord",
"(",
"LinkedList",
"<",
"AT_Row",
">",
"rows",
",",
"int",
"colNumbers",
")",
"{",
"if",
"(",
"rows",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"rows",
".",
"size",
"(",
")",
... | Returns an array with the width of the longest word per column calculated from the given table.
Default padding will be added per column.
Padding for individual columns will be added if defined.
@param rows the table rows for calculations
@param colNumbers number of columns in the table
@return array with width of longest word for each column, null if input table was null | [
"Returns",
"an",
"array",
"with",
"the",
"width",
"of",
"the",
"longest",
"word",
"per",
"column",
"calculated",
"from",
"the",
"given",
"table",
".",
"Default",
"padding",
"will",
"be",
"added",
"per",
"column",
".",
"Padding",
"for",
"individual",
"columns... | b6a73710271c89f9c749603be856ba84a969ed5f | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/CWC_LongestWord.java#L49-L79 | train |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/AT_Row.java | AT_Row.createRule | public static AT_Row createRule(TableRowType type, TableRowStyle style){
Validate.notNull(type);
Validate.validState(type!=TableRowType.UNKNOWN);
Validate.validState(type!=TableRowType.CONTENT);
Validate.notNull(style);
Validate.validState(style!=TableRowStyle.UNKNOWN);
return new AT_Row(){
@Override
public TableRowType getType(){
return type;
}
@Override
public TableRowStyle getStyle(){
return style;
}
};
} | java | public static AT_Row createRule(TableRowType type, TableRowStyle style){
Validate.notNull(type);
Validate.validState(type!=TableRowType.UNKNOWN);
Validate.validState(type!=TableRowType.CONTENT);
Validate.notNull(style);
Validate.validState(style!=TableRowStyle.UNKNOWN);
return new AT_Row(){
@Override
public TableRowType getType(){
return type;
}
@Override
public TableRowStyle getStyle(){
return style;
}
};
} | [
"public",
"static",
"AT_Row",
"createRule",
"(",
"TableRowType",
"type",
",",
"TableRowStyle",
"style",
")",
"{",
"Validate",
".",
"notNull",
"(",
"type",
")",
";",
"Validate",
".",
"validState",
"(",
"type",
"!=",
"TableRowType",
".",
"UNKNOWN",
")",
";",
... | Creates a new row representing a rule.
@param type the type for the rule row, must not be null nor {@link TableRowType#CONTENT} nor {@link TableRowType#UNKNOWN}
@param style the style for the rule row, must not be null nor {@link TableRowStyle#UNKNOWN}
@return a new row representing a rule
@throws {@link NullPointerException} if type or style where null
@throws {@link IllegalStateException} if type or style where unknown or if type was {@link TableRowType#CONTENT} | [
"Creates",
"a",
"new",
"row",
"representing",
"a",
"rule",
"."
] | b6a73710271c89f9c749603be856ba84a969ed5f | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L60-L78 | train |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/AT_Row.java | AT_Row.createContentRow | public static AT_Row createContentRow(Object[] content, TableRowStyle style){
Validate.notNull(content);
Validate.notNull(style);
Validate.validState(style!=TableRowStyle.UNKNOWN);
LinkedList<AT_Cell> cells = new LinkedList<AT_Cell>();
for(Object o : content){
cells.add(new AT_Cell(o));
}
return new AT_Row(){
@Override
public TableRowType getType(){
return TableRowType.CONTENT;
}
@Override
public TableRowStyle getStyle(){
return style;
}
@Override
public LinkedList<AT_Cell> getCells(){
return cells;
}
};
} | java | public static AT_Row createContentRow(Object[] content, TableRowStyle style){
Validate.notNull(content);
Validate.notNull(style);
Validate.validState(style!=TableRowStyle.UNKNOWN);
LinkedList<AT_Cell> cells = new LinkedList<AT_Cell>();
for(Object o : content){
cells.add(new AT_Cell(o));
}
return new AT_Row(){
@Override
public TableRowType getType(){
return TableRowType.CONTENT;
}
@Override
public TableRowStyle getStyle(){
return style;
}
@Override
public LinkedList<AT_Cell> getCells(){
return cells;
}
};
} | [
"public",
"static",
"AT_Row",
"createContentRow",
"(",
"Object",
"[",
"]",
"content",
",",
"TableRowStyle",
"style",
")",
"{",
"Validate",
".",
"notNull",
"(",
"content",
")",
";",
"Validate",
".",
"notNull",
"(",
"style",
")",
";",
"Validate",
".",
"valid... | Creates a new row with content with given cell context and a normal row style.
@param content the content for the row, each member of the array represents the content for a cell in the row, must not be null but can contain null members
@return a new row with content
@throws {@link NullPointerException} if content was null | [
"Creates",
"a",
"new",
"row",
"with",
"content",
"with",
"given",
"cell",
"context",
"and",
"a",
"normal",
"row",
"style",
"."
] | b6a73710271c89f9c749603be856ba84a969ed5f | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L96-L122 | train |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/AT_Row.java | AT_Row.setPadding | public AT_Row setPadding(int padding){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPadding(padding);
}
}
return this;
} | java | public AT_Row setPadding(int padding){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPadding(padding);
}
}
return this;
} | [
"public",
"AT_Row",
"setPadding",
"(",
"int",
"padding",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
... | Sets all padding for all cells in the row to the same value.
@param padding new padding for top, bottom, left, and right, ignored if smaller than 0
@return this to allow chaining | [
"Sets",
"all",
"padding",
"for",
"all",
"cells",
"in",
"the",
"row",
"to",
"the",
"same",
"value",
"."
] | b6a73710271c89f9c749603be856ba84a969ed5f | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L129-L136 | train |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/AT_Row.java | AT_Row.setPaddingBottom | public AT_Row setPaddingBottom(int paddingBottom) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingBottom(paddingBottom);
}
}
return this;
} | java | public AT_Row setPaddingBottom(int paddingBottom) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingBottom(paddingBottom);
}
}
return this;
} | [
"public",
"AT_Row",
"setPaddingBottom",
"(",
"int",
"paddingBottom",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")... | Sets the bottom padding for all cells in the row.
@param paddingBottom new padding, ignored if smaller than 0
@return this to allow chaining | [
"Sets",
"the",
"bottom",
"padding",
"for",
"all",
"cells",
"in",
"the",
"row",
"."
] | b6a73710271c89f9c749603be856ba84a969ed5f | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L143-L150 | train |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/AT_Row.java | AT_Row.setPaddingBottomChar | public AT_Row setPaddingBottomChar(Character paddingBottomChar) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingBottomChar(paddingBottomChar);
}
}
return this;
} | java | public AT_Row setPaddingBottomChar(Character paddingBottomChar) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingBottomChar(paddingBottomChar);
}
}
return this;
} | [
"public",
"AT_Row",
"setPaddingBottomChar",
"(",
"Character",
"paddingBottomChar",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext... | Sets the bottom padding character for all cells in the row.
@param paddingBottomChar new padding character, ignored if null
@return this to allow chaining | [
"Sets",
"the",
"bottom",
"padding",
"character",
"for",
"all",
"cells",
"in",
"the",
"row",
"."
] | b6a73710271c89f9c749603be856ba84a969ed5f | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L157-L164 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.