id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
sequence | docstring
stringlengths 3
16k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 105
339
|
---|---|---|---|---|---|---|---|---|---|---|---|
162,700 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/TransitionFilter.java | TransitionFilter.prepareFilter | public void prepareFilter( float transition ) {
try {
method.invoke( filter, new Object[] { new Float( transition ) } );
}
catch ( Exception e ) {
throw new IllegalArgumentException("Error setting value for property: "+property);
}
} | java | public void prepareFilter( float transition ) {
try {
method.invoke( filter, new Object[] { new Float( transition ) } );
}
catch ( Exception e ) {
throw new IllegalArgumentException("Error setting value for property: "+property);
}
} | [
"public",
"void",
"prepareFilter",
"(",
"float",
"transition",
")",
"{",
"try",
"{",
"method",
".",
"invoke",
"(",
"filter",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Float",
"(",
"transition",
")",
"}",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Error setting value for property: \"",
"+",
"property",
")",
";",
"}",
"}"
] | Prepare the filter for the transiton at a given time.
The default implementation sets the given filter property, but you could override this method to make other changes.
@param transition the transition time in the range 0 - 1 | [
"Prepare",
"the",
"filter",
"for",
"the",
"transiton",
"at",
"a",
"given",
"time",
".",
"The",
"default",
"implementation",
"sets",
"the",
"given",
"filter",
"property",
"but",
"you",
"could",
"override",
"this",
"method",
"to",
"make",
"other",
"changes",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/TransitionFilter.java#L139-L146 |
162,701 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinColorModelConverter.java | MarvinColorModelConverter.rgbToBinary | public static MarvinImage rgbToBinary(MarvinImage img, int threshold) {
MarvinImage resultImage = new MarvinImage(img.getWidth(), img.getHeight(), MarvinImage.COLOR_MODEL_BINARY);
for (int y = 0; y < img.getHeight(); y++) {
for (int x = 0; x < img.getWidth(); x++) {
int gray = (int) ((img.getIntComponent0(x, y) * 0.3) + (img.getIntComponent1(x, y) * 0.59) + (img.getIntComponent2(x, y) * 0.11));
if (gray <= threshold) {
resultImage.setBinaryColor(x, y, true);
} else {
resultImage.setBinaryColor(x, y, false);
}
}
}
return resultImage;
} | java | public static MarvinImage rgbToBinary(MarvinImage img, int threshold) {
MarvinImage resultImage = new MarvinImage(img.getWidth(), img.getHeight(), MarvinImage.COLOR_MODEL_BINARY);
for (int y = 0; y < img.getHeight(); y++) {
for (int x = 0; x < img.getWidth(); x++) {
int gray = (int) ((img.getIntComponent0(x, y) * 0.3) + (img.getIntComponent1(x, y) * 0.59) + (img.getIntComponent2(x, y) * 0.11));
if (gray <= threshold) {
resultImage.setBinaryColor(x, y, true);
} else {
resultImage.setBinaryColor(x, y, false);
}
}
}
return resultImage;
} | [
"public",
"static",
"MarvinImage",
"rgbToBinary",
"(",
"MarvinImage",
"img",
",",
"int",
"threshold",
")",
"{",
"MarvinImage",
"resultImage",
"=",
"new",
"MarvinImage",
"(",
"img",
".",
"getWidth",
"(",
")",
",",
"img",
".",
"getHeight",
"(",
")",
",",
"MarvinImage",
".",
"COLOR_MODEL_BINARY",
")",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"img",
".",
"getHeight",
"(",
")",
";",
"y",
"++",
")",
"{",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"img",
".",
"getWidth",
"(",
")",
";",
"x",
"++",
")",
"{",
"int",
"gray",
"=",
"(",
"int",
")",
"(",
"(",
"img",
".",
"getIntComponent0",
"(",
"x",
",",
"y",
")",
"*",
"0.3",
")",
"+",
"(",
"img",
".",
"getIntComponent1",
"(",
"x",
",",
"y",
")",
"*",
"0.59",
")",
"+",
"(",
"img",
".",
"getIntComponent2",
"(",
"x",
",",
"y",
")",
"*",
"0.11",
")",
")",
";",
"if",
"(",
"gray",
"<=",
"threshold",
")",
"{",
"resultImage",
".",
"setBinaryColor",
"(",
"x",
",",
"y",
",",
"true",
")",
";",
"}",
"else",
"{",
"resultImage",
".",
"setBinaryColor",
"(",
"x",
",",
"y",
",",
"false",
")",
";",
"}",
"}",
"}",
"return",
"resultImage",
";",
"}"
] | Converts an image in RGB mode to BINARY mode
@param img image
@param threshold grays cale threshold
@return new MarvinImage instance in BINARY mode | [
"Converts",
"an",
"image",
"in",
"RGB",
"mode",
"to",
"BINARY",
"mode"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinColorModelConverter.java#L19-L34 |
162,702 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinColorModelConverter.java | MarvinColorModelConverter.binaryToRgb | public static MarvinImage binaryToRgb(MarvinImage img) {
MarvinImage resultImage = new MarvinImage(img.getWidth(), img.getHeight(), MarvinImage.COLOR_MODEL_RGB);
for (int y = 0; y < img.getHeight(); y++) {
for (int x = 0; x < img.getWidth(); x++) {
if (img.getBinaryColor(x, y)) {
resultImage.setIntColor(x, y, 0, 0, 0);
} else {
resultImage.setIntColor(x, y, 255, 255, 255);
}
}
}
return resultImage;
} | java | public static MarvinImage binaryToRgb(MarvinImage img) {
MarvinImage resultImage = new MarvinImage(img.getWidth(), img.getHeight(), MarvinImage.COLOR_MODEL_RGB);
for (int y = 0; y < img.getHeight(); y++) {
for (int x = 0; x < img.getWidth(); x++) {
if (img.getBinaryColor(x, y)) {
resultImage.setIntColor(x, y, 0, 0, 0);
} else {
resultImage.setIntColor(x, y, 255, 255, 255);
}
}
}
return resultImage;
} | [
"public",
"static",
"MarvinImage",
"binaryToRgb",
"(",
"MarvinImage",
"img",
")",
"{",
"MarvinImage",
"resultImage",
"=",
"new",
"MarvinImage",
"(",
"img",
".",
"getWidth",
"(",
")",
",",
"img",
".",
"getHeight",
"(",
")",
",",
"MarvinImage",
".",
"COLOR_MODEL_RGB",
")",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"img",
".",
"getHeight",
"(",
")",
";",
"y",
"++",
")",
"{",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"img",
".",
"getWidth",
"(",
")",
";",
"x",
"++",
")",
"{",
"if",
"(",
"img",
".",
"getBinaryColor",
"(",
"x",
",",
"y",
")",
")",
"{",
"resultImage",
".",
"setIntColor",
"(",
"x",
",",
"y",
",",
"0",
",",
"0",
",",
"0",
")",
";",
"}",
"else",
"{",
"resultImage",
".",
"setIntColor",
"(",
"x",
",",
"y",
",",
"255",
",",
"255",
",",
"255",
")",
";",
"}",
"}",
"}",
"return",
"resultImage",
";",
"}"
] | Converts an image in BINARY mode to RGB mode
@param img image
@return new MarvinImage instance in RGB mode | [
"Converts",
"an",
"image",
"in",
"BINARY",
"mode",
"to",
"RGB",
"mode"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinColorModelConverter.java#L42-L55 |
162,703 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinColorModelConverter.java | MarvinColorModelConverter.binaryToRgb | public static int[] binaryToRgb(boolean[] binaryArray) {
int[] rgbArray = new int[binaryArray.length];
for (int i = 0; i < binaryArray.length; i++) {
if (binaryArray[i]) {
rgbArray[i] = 0x00000000;
} else {
rgbArray[i] = 0x00FFFFFF;
}
}
return rgbArray;
} | java | public static int[] binaryToRgb(boolean[] binaryArray) {
int[] rgbArray = new int[binaryArray.length];
for (int i = 0; i < binaryArray.length; i++) {
if (binaryArray[i]) {
rgbArray[i] = 0x00000000;
} else {
rgbArray[i] = 0x00FFFFFF;
}
}
return rgbArray;
} | [
"public",
"static",
"int",
"[",
"]",
"binaryToRgb",
"(",
"boolean",
"[",
"]",
"binaryArray",
")",
"{",
"int",
"[",
"]",
"rgbArray",
"=",
"new",
"int",
"[",
"binaryArray",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"binaryArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"binaryArray",
"[",
"i",
"]",
")",
"{",
"rgbArray",
"[",
"i",
"]",
"=",
"0x00000000",
";",
"}",
"else",
"{",
"rgbArray",
"[",
"i",
"]",
"=",
"0x00FFFFFF",
";",
"}",
"}",
"return",
"rgbArray",
";",
"}"
] | Converts a boolean array containing the pixel data in BINARY mode to an
integer array with the pixel data in RGB mode.
@param binaryArray pixel binary data
@return pixel integer data in RGB mode. | [
"Converts",
"a",
"boolean",
"array",
"containing",
"the",
"pixel",
"data",
"in",
"BINARY",
"mode",
"to",
"an",
"integer",
"array",
"with",
"the",
"pixel",
"data",
"in",
"RGB",
"mode",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinColorModelConverter.java#L64-L75 |
162,704 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/SwimFilter.java | SwimFilter.setAngle | public void setAngle(float angle) {
this.angle = angle;
float cos = (float) Math.cos(angle);
float sin = (float) Math.sin(angle);
m00 = cos;
m01 = sin;
m10 = -sin;
m11 = cos;
} | java | public void setAngle(float angle) {
this.angle = angle;
float cos = (float) Math.cos(angle);
float sin = (float) Math.sin(angle);
m00 = cos;
m01 = sin;
m10 = -sin;
m11 = cos;
} | [
"public",
"void",
"setAngle",
"(",
"float",
"angle",
")",
"{",
"this",
".",
"angle",
"=",
"angle",
";",
"float",
"cos",
"=",
"(",
"float",
")",
"Math",
".",
"cos",
"(",
"angle",
")",
";",
"float",
"sin",
"=",
"(",
"float",
")",
"Math",
".",
"sin",
"(",
"angle",
")",
";",
"m00",
"=",
"cos",
";",
"m01",
"=",
"sin",
";",
"m10",
"=",
"-",
"sin",
";",
"m11",
"=",
"cos",
";",
"}"
] | Specifies the angle of the effect.
@param angle the angle of the effect.
@angle | [
"Specifies",
"the",
"angle",
"of",
"the",
"effect",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/SwimFilter.java#L76-L84 |
162,705 | sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/AutocropOps.java | AutocropOps.scanright | public static int scanright(Color color, int height, int width, int col, PixelsExtractor f, int tolerance) {
if (col == width || !PixelTools.colorMatches(color, tolerance, f.apply(new Area(col, 0, 1, height))))
return col;
else
return scanright(color, height, width, col + 1, f, tolerance);
} | java | public static int scanright(Color color, int height, int width, int col, PixelsExtractor f, int tolerance) {
if (col == width || !PixelTools.colorMatches(color, tolerance, f.apply(new Area(col, 0, 1, height))))
return col;
else
return scanright(color, height, width, col + 1, f, tolerance);
} | [
"public",
"static",
"int",
"scanright",
"(",
"Color",
"color",
",",
"int",
"height",
",",
"int",
"width",
",",
"int",
"col",
",",
"PixelsExtractor",
"f",
",",
"int",
"tolerance",
")",
"{",
"if",
"(",
"col",
"==",
"width",
"||",
"!",
"PixelTools",
".",
"colorMatches",
"(",
"color",
",",
"tolerance",
",",
"f",
".",
"apply",
"(",
"new",
"Area",
"(",
"col",
",",
"0",
",",
"1",
",",
"height",
")",
")",
")",
")",
"return",
"col",
";",
"else",
"return",
"scanright",
"(",
"color",
",",
"height",
",",
"width",
",",
"col",
"+",
"1",
",",
"f",
",",
"tolerance",
")",
";",
"}"
] | Starting with the given column index, will return the first column index
which contains a colour that does not match the given color. | [
"Starting",
"with",
"the",
"given",
"column",
"index",
"will",
"return",
"the",
"first",
"column",
"index",
"which",
"contains",
"a",
"colour",
"that",
"does",
"not",
"match",
"the",
"given",
"color",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AutocropOps.java#L9-L14 |
162,706 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImageMask.java | MarvinImageMask.clear | public void clear() {
if (arrMask != null) {
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
arrMask[x][y] = false;
}
}
}
} | java | public void clear() {
if (arrMask != null) {
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
arrMask[x][y] = false;
}
}
}
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"if",
"(",
"arrMask",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"height",
";",
"y",
"++",
")",
"{",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"width",
";",
"x",
"++",
")",
"{",
"arrMask",
"[",
"x",
"]",
"[",
"y",
"]",
"=",
"false",
";",
"}",
"}",
"}",
"}"
] | Clear the mask for a new selection | [
"Clear",
"the",
"mask",
"for",
"a",
"new",
"selection"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImageMask.java#L82-L90 |
162,707 | sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java | AwtImage.pixels | public Pixel[] pixels() {
Pixel[] pixels = new Pixel[count()];
Point[] points = points();
for (int k = 0; k < points.length; k++) {
pixels[k] = pixel(points[k]);
}
return pixels;
} | java | public Pixel[] pixels() {
Pixel[] pixels = new Pixel[count()];
Point[] points = points();
for (int k = 0; k < points.length; k++) {
pixels[k] = pixel(points[k]);
}
return pixels;
} | [
"public",
"Pixel",
"[",
"]",
"pixels",
"(",
")",
"{",
"Pixel",
"[",
"]",
"pixels",
"=",
"new",
"Pixel",
"[",
"count",
"(",
")",
"]",
";",
"Point",
"[",
"]",
"points",
"=",
"points",
"(",
")",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"points",
".",
"length",
";",
"k",
"++",
")",
"{",
"pixels",
"[",
"k",
"]",
"=",
"pixel",
"(",
"points",
"[",
"k",
"]",
")",
";",
"}",
"return",
"pixels",
";",
"}"
] | Returns all the pixels for the image
@return an array of pixels for this image | [
"Returns",
"all",
"the",
"pixels",
"for",
"the",
"image"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L78-L85 |
162,708 | sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java | AwtImage.forall | public boolean forall(PixelPredicate predicate) {
return Arrays.stream(points()).allMatch(p -> predicate.test(p.x, p.y, pixel(p)));
} | java | public boolean forall(PixelPredicate predicate) {
return Arrays.stream(points()).allMatch(p -> predicate.test(p.x, p.y, pixel(p)));
} | [
"public",
"boolean",
"forall",
"(",
"PixelPredicate",
"predicate",
")",
"{",
"return",
"Arrays",
".",
"stream",
"(",
"points",
"(",
")",
")",
".",
"allMatch",
"(",
"p",
"->",
"predicate",
".",
"test",
"(",
"p",
".",
"x",
",",
"p",
".",
"y",
",",
"pixel",
"(",
"p",
")",
")",
")",
";",
"}"
] | Returns true if the predicate is true for all pixels in the image.
@param predicate a predicate function that accepts 3 parameters - the x,y coordinate and the pixel at that coordinate
@return true if f holds for at least one pixel | [
"Returns",
"true",
"if",
"the",
"predicate",
"is",
"true",
"for",
"all",
"pixels",
"in",
"the",
"image",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L172-L174 |
162,709 | sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java | AwtImage.foreach | public void foreach(PixelFunction fn) {
Arrays.stream(points()).forEach(p -> fn.apply(p.x, p.y, pixel(p)));
} | java | public void foreach(PixelFunction fn) {
Arrays.stream(points()).forEach(p -> fn.apply(p.x, p.y, pixel(p)));
} | [
"public",
"void",
"foreach",
"(",
"PixelFunction",
"fn",
")",
"{",
"Arrays",
".",
"stream",
"(",
"points",
"(",
")",
")",
".",
"forEach",
"(",
"p",
"->",
"fn",
".",
"apply",
"(",
"p",
".",
"x",
",",
"p",
".",
"y",
",",
"pixel",
"(",
"p",
")",
")",
")",
";",
"}"
] | Executes the given side effecting function on each pixel.
@param fn a function that accepts 3 parameters - the x,y coordinate and the pixel at that coordinate | [
"Executes",
"the",
"given",
"side",
"effecting",
"function",
"on",
"each",
"pixel",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L181-L183 |
162,710 | sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java | AwtImage.contains | public boolean contains(Color color) {
return exists(p -> p.toInt() == color.toPixel().toInt());
} | java | public boolean contains(Color color) {
return exists(p -> p.toInt() == color.toPixel().toInt());
} | [
"public",
"boolean",
"contains",
"(",
"Color",
"color",
")",
"{",
"return",
"exists",
"(",
"p",
"->",
"p",
".",
"toInt",
"(",
")",
"==",
"color",
".",
"toPixel",
"(",
")",
".",
"toInt",
"(",
")",
")",
";",
"}"
] | Returns true if a pixel with the given color exists
@param color the pixel colour to look for.
@return true if there exists at least one pixel that has the given pixels color | [
"Returns",
"true",
"if",
"a",
"pixel",
"with",
"the",
"given",
"color",
"exists"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L205-L207 |
162,711 | sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java | AwtImage.argb | public int[] argb(int x, int y) {
Pixel p = pixel(x, y);
return new int[]{p.alpha(), p.red(), p.green(), p.blue()};
} | java | public int[] argb(int x, int y) {
Pixel p = pixel(x, y);
return new int[]{p.alpha(), p.red(), p.green(), p.blue()};
} | [
"public",
"int",
"[",
"]",
"argb",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"Pixel",
"p",
"=",
"pixel",
"(",
"x",
",",
"y",
")",
";",
"return",
"new",
"int",
"[",
"]",
"{",
"p",
".",
"alpha",
"(",
")",
",",
"p",
".",
"red",
"(",
")",
",",
"p",
".",
"green",
"(",
")",
",",
"p",
".",
"blue",
"(",
")",
"}",
";",
"}"
] | Returns the ARGB components for the pixel at the given coordinates
@param x the x coordinate of the pixel component to grab
@param y the y coordinate of the pixel component to grab
@return an array containing ARGB components in that order. | [
"Returns",
"the",
"ARGB",
"components",
"for",
"the",
"pixel",
"at",
"the",
"given",
"coordinates"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L235-L238 |
162,712 | sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java | AwtImage.argb | public int[][] argb() {
return Arrays.stream(points()).map(p -> argb(p.x, p.y)).toArray(int[][]::new);
} | java | public int[][] argb() {
return Arrays.stream(points()).map(p -> argb(p.x, p.y)).toArray(int[][]::new);
} | [
"public",
"int",
"[",
"]",
"[",
"]",
"argb",
"(",
")",
"{",
"return",
"Arrays",
".",
"stream",
"(",
"points",
"(",
")",
")",
".",
"map",
"(",
"p",
"->",
"argb",
"(",
"p",
".",
"x",
",",
"p",
".",
"y",
")",
")",
".",
"toArray",
"(",
"int",
"[",
"]",
"[",
"]",
"::",
"new",
")",
";",
"}"
] | Returns the ARGB components for all pixels in this image
@return an array containing an array for each ARGB components in that order. | [
"Returns",
"the",
"ARGB",
"components",
"for",
"all",
"pixels",
"in",
"this",
"image"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L245-L247 |
162,713 | sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java | AwtImage.colours | public Set<RGBColor> colours() {
return stream().map(Pixel::toColor).collect(Collectors.toSet());
} | java | public Set<RGBColor> colours() {
return stream().map(Pixel::toColor).collect(Collectors.toSet());
} | [
"public",
"Set",
"<",
"RGBColor",
">",
"colours",
"(",
")",
"{",
"return",
"stream",
"(",
")",
".",
"map",
"(",
"Pixel",
"::",
"toColor",
")",
".",
"collect",
"(",
"Collectors",
".",
"toSet",
"(",
")",
")",
";",
"}"
] | Returns a set of the distinct colours used in this image.
@return the set of distinct Colors | [
"Returns",
"a",
"set",
"of",
"the",
"distinct",
"colours",
"used",
"in",
"this",
"image",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L332-L334 |
162,714 | sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java | AwtImage.toNewBufferedImage | public BufferedImage toNewBufferedImage(int type) {
BufferedImage target = new BufferedImage(width, height, type);
Graphics2D g2 = (Graphics2D) target.getGraphics();
g2.drawImage(awt, 0, 0, null);
g2.dispose();
return target;
} | java | public BufferedImage toNewBufferedImage(int type) {
BufferedImage target = new BufferedImage(width, height, type);
Graphics2D g2 = (Graphics2D) target.getGraphics();
g2.drawImage(awt, 0, 0, null);
g2.dispose();
return target;
} | [
"public",
"BufferedImage",
"toNewBufferedImage",
"(",
"int",
"type",
")",
"{",
"BufferedImage",
"target",
"=",
"new",
"BufferedImage",
"(",
"width",
",",
"height",
",",
"type",
")",
";",
"Graphics2D",
"g2",
"=",
"(",
"Graphics2D",
")",
"target",
".",
"getGraphics",
"(",
")",
";",
"g2",
".",
"drawImage",
"(",
"awt",
",",
"0",
",",
"0",
",",
"null",
")",
";",
"g2",
".",
"dispose",
"(",
")",
";",
"return",
"target",
";",
"}"
] | Returns a new AWT BufferedImage from this image.
@param type the type of buffered image to create, if not specified then defaults to the current image type
@return a new, non-shared, BufferedImage with the same data as this Image. | [
"Returns",
"a",
"new",
"AWT",
"BufferedImage",
"from",
"this",
"image",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L366-L372 |
162,715 | sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/DimensionTools.java | DimensionTools.dimensionsToFit | public static Dimension dimensionsToFit(Dimension target, Dimension source) {
// if target width/height is zero then we have no preference for that, so set it to the original value,
// since it cannot be any larger
int maxWidth;
if (target.getX() == 0) {
maxWidth = source.getX();
} else {
maxWidth = target.getX();
}
int maxHeight;
if (target.getY() == 0) {
maxHeight = source.getY();
} else {
maxHeight = target.getY();
}
double wscale = maxWidth / (double) source.getX();
double hscale = maxHeight / (double) source.getY();
if (wscale < hscale)
return new Dimension((int) (source.getX() * wscale), (int) (source.getY() * wscale));
else
return new Dimension((int) (source.getX() * hscale), (int) (source.getY() * hscale));
} | java | public static Dimension dimensionsToFit(Dimension target, Dimension source) {
// if target width/height is zero then we have no preference for that, so set it to the original value,
// since it cannot be any larger
int maxWidth;
if (target.getX() == 0) {
maxWidth = source.getX();
} else {
maxWidth = target.getX();
}
int maxHeight;
if (target.getY() == 0) {
maxHeight = source.getY();
} else {
maxHeight = target.getY();
}
double wscale = maxWidth / (double) source.getX();
double hscale = maxHeight / (double) source.getY();
if (wscale < hscale)
return new Dimension((int) (source.getX() * wscale), (int) (source.getY() * wscale));
else
return new Dimension((int) (source.getX() * hscale), (int) (source.getY() * hscale));
} | [
"public",
"static",
"Dimension",
"dimensionsToFit",
"(",
"Dimension",
"target",
",",
"Dimension",
"source",
")",
"{",
"// if target width/height is zero then we have no preference for that, so set it to the original value,",
"// since it cannot be any larger",
"int",
"maxWidth",
";",
"if",
"(",
"target",
".",
"getX",
"(",
")",
"==",
"0",
")",
"{",
"maxWidth",
"=",
"source",
".",
"getX",
"(",
")",
";",
"}",
"else",
"{",
"maxWidth",
"=",
"target",
".",
"getX",
"(",
")",
";",
"}",
"int",
"maxHeight",
";",
"if",
"(",
"target",
".",
"getY",
"(",
")",
"==",
"0",
")",
"{",
"maxHeight",
"=",
"source",
".",
"getY",
"(",
")",
";",
"}",
"else",
"{",
"maxHeight",
"=",
"target",
".",
"getY",
"(",
")",
";",
"}",
"double",
"wscale",
"=",
"maxWidth",
"/",
"(",
"double",
")",
"source",
".",
"getX",
"(",
")",
";",
"double",
"hscale",
"=",
"maxHeight",
"/",
"(",
"double",
")",
"source",
".",
"getY",
"(",
")",
";",
"if",
"(",
"wscale",
"<",
"hscale",
")",
"return",
"new",
"Dimension",
"(",
"(",
"int",
")",
"(",
"source",
".",
"getX",
"(",
")",
"*",
"wscale",
")",
",",
"(",
"int",
")",
"(",
"source",
".",
"getY",
"(",
")",
"*",
"wscale",
")",
")",
";",
"else",
"return",
"new",
"Dimension",
"(",
"(",
"int",
")",
"(",
"source",
".",
"getX",
"(",
")",
"*",
"hscale",
")",
",",
"(",
"int",
")",
"(",
"source",
".",
"getY",
"(",
")",
"*",
"hscale",
")",
")",
";",
"}"
] | Returns width and height that allow the given source width, height to fit inside the target width, height
without losing aspect ratio | [
"Returns",
"width",
"and",
"height",
"that",
"allow",
"the",
"given",
"source",
"width",
"height",
"to",
"fit",
"inside",
"the",
"target",
"width",
"height",
"without",
"losing",
"aspect",
"ratio"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/DimensionTools.java#L42-L67 |
162,716 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/GammaFilter.java | GammaFilter.setGamma | public void setGamma(float rGamma, float gGamma, float bGamma) {
this.rGamma = rGamma;
this.gGamma = gGamma;
this.bGamma = bGamma;
initialized = false;
} | java | public void setGamma(float rGamma, float gGamma, float bGamma) {
this.rGamma = rGamma;
this.gGamma = gGamma;
this.bGamma = bGamma;
initialized = false;
} | [
"public",
"void",
"setGamma",
"(",
"float",
"rGamma",
",",
"float",
"gGamma",
",",
"float",
"bGamma",
")",
"{",
"this",
".",
"rGamma",
"=",
"rGamma",
";",
"this",
".",
"gGamma",
"=",
"gGamma",
";",
"this",
".",
"bGamma",
"=",
"bGamma",
";",
"initialized",
"=",
"false",
";",
"}"
] | Set the gamma levels.
@param rGamma the gamma level for the red channel
@param gGamma the gamma level for the blue channel
@param bGamma the gamma level for the green channel
@see #getGamma | [
"Set",
"the",
"gamma",
"levels",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/GammaFilter.java#L58-L63 |
162,717 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java | ArrayColormap.setColorInterpolated | public void setColorInterpolated(int index, int firstIndex, int lastIndex, int color) {
int firstColor = map[firstIndex];
int lastColor = map[lastIndex];
for (int i = firstIndex; i <= index; i++)
map[i] = ImageMath.mixColors((float)(i-firstIndex)/(index-firstIndex), firstColor, color);
for (int i = index; i < lastIndex; i++)
map[i] = ImageMath.mixColors((float)(i-index)/(lastIndex-index), color, lastColor);
} | java | public void setColorInterpolated(int index, int firstIndex, int lastIndex, int color) {
int firstColor = map[firstIndex];
int lastColor = map[lastIndex];
for (int i = firstIndex; i <= index; i++)
map[i] = ImageMath.mixColors((float)(i-firstIndex)/(index-firstIndex), firstColor, color);
for (int i = index; i < lastIndex; i++)
map[i] = ImageMath.mixColors((float)(i-index)/(lastIndex-index), color, lastColor);
} | [
"public",
"void",
"setColorInterpolated",
"(",
"int",
"index",
",",
"int",
"firstIndex",
",",
"int",
"lastIndex",
",",
"int",
"color",
")",
"{",
"int",
"firstColor",
"=",
"map",
"[",
"firstIndex",
"]",
";",
"int",
"lastColor",
"=",
"map",
"[",
"lastIndex",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"firstIndex",
";",
"i",
"<=",
"index",
";",
"i",
"++",
")",
"map",
"[",
"i",
"]",
"=",
"ImageMath",
".",
"mixColors",
"(",
"(",
"float",
")",
"(",
"i",
"-",
"firstIndex",
")",
"/",
"(",
"index",
"-",
"firstIndex",
")",
"",
",",
"firstColor",
",",
"color",
")",
";",
"for",
"(",
"int",
"i",
"=",
"index",
";",
"i",
"<",
"lastIndex",
";",
"i",
"++",
")",
"map",
"[",
"i",
"]",
"=",
"ImageMath",
".",
"mixColors",
"(",
"(",
"float",
")",
"(",
"i",
"-",
"index",
")",
"/",
"(",
"lastIndex",
"-",
"index",
")",
"",
",",
"color",
",",
"lastColor",
")",
";",
"}"
] | Set the color at "index" to "color". Entries are interpolated linearly from
the existing entries at "firstIndex" and "lastIndex" to the new entry.
firstIndex < index < lastIndex must hold.
@param index the position to set
@param firstIndex the position of the first color from which to interpolate
@param lastIndex the position of the second color from which to interpolate
@param color the color to set | [
"Set",
"the",
"color",
"at",
"index",
"to",
"color",
".",
"Entries",
"are",
"interpolated",
"linearly",
"from",
"the",
"existing",
"entries",
"at",
"firstIndex",
"and",
"lastIndex",
"to",
"the",
"new",
"entry",
".",
"firstIndex",
"<",
"index",
"<",
"lastIndex",
"must",
"hold",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java#L107-L114 |
162,718 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java | ArrayColormap.setColorRange | public void setColorRange(int firstIndex, int lastIndex, int color1, int color2) {
for (int i = firstIndex; i <= lastIndex; i++)
map[i] = ImageMath.mixColors((float)(i-firstIndex)/(lastIndex-firstIndex), color1, color2);
} | java | public void setColorRange(int firstIndex, int lastIndex, int color1, int color2) {
for (int i = firstIndex; i <= lastIndex; i++)
map[i] = ImageMath.mixColors((float)(i-firstIndex)/(lastIndex-firstIndex), color1, color2);
} | [
"public",
"void",
"setColorRange",
"(",
"int",
"firstIndex",
",",
"int",
"lastIndex",
",",
"int",
"color1",
",",
"int",
"color2",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"firstIndex",
";",
"i",
"<=",
"lastIndex",
";",
"i",
"++",
")",
"map",
"[",
"i",
"]",
"=",
"ImageMath",
".",
"mixColors",
"(",
"(",
"float",
")",
"(",
"i",
"-",
"firstIndex",
")",
"/",
"(",
"lastIndex",
"-",
"firstIndex",
")",
"",
",",
"color1",
",",
"color2",
")",
";",
"}"
] | Set a range of the colormap, interpolating between two colors.
@param firstIndex the position of the first color
@param lastIndex the position of the second color
@param color1 the first color
@param color2 the second color | [
"Set",
"a",
"range",
"of",
"the",
"colormap",
"interpolating",
"between",
"two",
"colors",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java#L123-L126 |
162,719 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java | ArrayColormap.setColorRange | public void setColorRange(int firstIndex, int lastIndex, int color) {
for (int i = firstIndex; i <= lastIndex; i++)
map[i] = color;
} | java | public void setColorRange(int firstIndex, int lastIndex, int color) {
for (int i = firstIndex; i <= lastIndex; i++)
map[i] = color;
} | [
"public",
"void",
"setColorRange",
"(",
"int",
"firstIndex",
",",
"int",
"lastIndex",
",",
"int",
"color",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"firstIndex",
";",
"i",
"<=",
"lastIndex",
";",
"i",
"++",
")",
"map",
"[",
"i",
"]",
"=",
"color",
";",
"}"
] | Set a range of the colormap to a single color.
@param firstIndex the position of the first color
@param lastIndex the position of the second color
@param color the color | [
"Set",
"a",
"range",
"of",
"the",
"colormap",
"to",
"a",
"single",
"color",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java#L134-L137 |
162,720 | johnkil/Android-AppMsg | sample/src/com/devspark/appmsg/sample/MainActivity.java | MainActivity.buttonClick | public void buttonClick(View v) {
switch (v.getId()) {
case R.id.show:
showAppMsg();
break;
case R.id.cancel_all:
AppMsg.cancelAll(this);
break;
default:
return;
}
} | java | public void buttonClick(View v) {
switch (v.getId()) {
case R.id.show:
showAppMsg();
break;
case R.id.cancel_all:
AppMsg.cancelAll(this);
break;
default:
return;
}
} | [
"public",
"void",
"buttonClick",
"(",
"View",
"v",
")",
"{",
"switch",
"(",
"v",
".",
"getId",
"(",
")",
")",
"{",
"case",
"R",
".",
"id",
".",
"show",
":",
"showAppMsg",
"(",
")",
";",
"break",
";",
"case",
"R",
".",
"id",
".",
"cancel_all",
":",
"AppMsg",
".",
"cancelAll",
"(",
"this",
")",
";",
"break",
";",
"default",
":",
"return",
";",
"}",
"}"
] | Button onClick listener.
@param v | [
"Button",
"onClick",
"listener",
"."
] | e7fdd7870530a24e6d825278ee0863be0521e8b8 | https://github.com/johnkil/Android-AppMsg/blob/e7fdd7870530a24e6d825278ee0863be0521e8b8/sample/src/com/devspark/appmsg/sample/MainActivity.java#L97-L108 |
162,721 | johnkil/Android-AppMsg | library/src/com/devspark/appmsg/AppMsg.java | AppMsg.getLayoutParams | public LayoutParams getLayoutParams() {
if (mLayoutParams == null) {
mLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
}
return mLayoutParams;
} | java | public LayoutParams getLayoutParams() {
if (mLayoutParams == null) {
mLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
}
return mLayoutParams;
} | [
"public",
"LayoutParams",
"getLayoutParams",
"(",
")",
"{",
"if",
"(",
"mLayoutParams",
"==",
"null",
")",
"{",
"mLayoutParams",
"=",
"new",
"LayoutParams",
"(",
"LayoutParams",
".",
"MATCH_PARENT",
",",
"LayoutParams",
".",
"WRAP_CONTENT",
")",
";",
"}",
"return",
"mLayoutParams",
";",
"}"
] | Gets the crouton's layout parameters, constructing a default if necessary.
@return the layout parameters | [
"Gets",
"the",
"crouton",
"s",
"layout",
"parameters",
"constructing",
"a",
"default",
"if",
"necessary",
"."
] | e7fdd7870530a24e6d825278ee0863be0521e8b8 | https://github.com/johnkil/Android-AppMsg/blob/e7fdd7870530a24e6d825278ee0863be0521e8b8/library/src/com/devspark/appmsg/AppMsg.java#L549-L554 |
162,722 | johnkil/Android-AppMsg | library/src/com/devspark/appmsg/AppMsg.java | AppMsg.setLayoutGravity | public AppMsg setLayoutGravity(int gravity) {
mLayoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, gravity);
return this;
} | java | public AppMsg setLayoutGravity(int gravity) {
mLayoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, gravity);
return this;
} | [
"public",
"AppMsg",
"setLayoutGravity",
"(",
"int",
"gravity",
")",
"{",
"mLayoutParams",
"=",
"new",
"FrameLayout",
".",
"LayoutParams",
"(",
"LayoutParams",
".",
"MATCH_PARENT",
",",
"LayoutParams",
".",
"WRAP_CONTENT",
",",
"gravity",
")",
";",
"return",
"this",
";",
"}"
] | Constructs and sets the layout parameters to have some gravity.
@param gravity the gravity of the Crouton
@return <code>this</code>, for chaining.
@see android.view.Gravity | [
"Constructs",
"and",
"sets",
"the",
"layout",
"parameters",
"to",
"have",
"some",
"gravity",
"."
] | e7fdd7870530a24e6d825278ee0863be0521e8b8 | https://github.com/johnkil/Android-AppMsg/blob/e7fdd7870530a24e6d825278ee0863be0521e8b8/library/src/com/devspark/appmsg/AppMsg.java#L574-L577 |
162,723 | Unleash/unleash-client-java | src/main/java/no/finn/unleash/strategy/StrategyUtils.java | StrategyUtils.getPercentage | public static int getPercentage(String percentage) {
if (isNotEmpty(percentage) && isNumeric(percentage)) {
int p = Integer.parseInt(percentage);
return p;
} else {
return 0;
}
} | java | public static int getPercentage(String percentage) {
if (isNotEmpty(percentage) && isNumeric(percentage)) {
int p = Integer.parseInt(percentage);
return p;
} else {
return 0;
}
} | [
"public",
"static",
"int",
"getPercentage",
"(",
"String",
"percentage",
")",
"{",
"if",
"(",
"isNotEmpty",
"(",
"percentage",
")",
"&&",
"isNumeric",
"(",
"percentage",
")",
")",
"{",
"int",
"p",
"=",
"Integer",
".",
"parseInt",
"(",
"percentage",
")",
";",
"return",
"p",
";",
"}",
"else",
"{",
"return",
"0",
";",
"}",
"}"
] | Takes a numeric string value and converts it to a integer between 0 and 100.
returns 0 if the string is not numeric.
@param percentage - A numeric string value
@return a integer between 0 and 100 | [
"Takes",
"a",
"numeric",
"string",
"value",
"and",
"converts",
"it",
"to",
"a",
"integer",
"between",
"0",
"and",
"100",
"."
] | 4d135ceb9ad8a0e74d6f4d1b333a80a4b59afd2d | https://github.com/Unleash/unleash-client-java/blob/4d135ceb9ad8a0e74d6f4d1b333a80a4b59afd2d/src/main/java/no/finn/unleash/strategy/StrategyUtils.java#L54-L61 |
162,724 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/App.java | App.named | public App named(String name) {
App newApp = copy();
newApp.name = name;
return newApp;
} | java | public App named(String name) {
App newApp = copy();
newApp.name = name;
return newApp;
} | [
"public",
"App",
"named",
"(",
"String",
"name",
")",
"{",
"App",
"newApp",
"=",
"copy",
"(",
")",
";",
"newApp",
".",
"name",
"=",
"name",
";",
"return",
"newApp",
";",
"}"
] | Builder method for specifying the name of an app.
@param name The name to give an app.
@return A copy of the {@link App} | [
"Builder",
"method",
"for",
"specifying",
"the",
"name",
"of",
"an",
"app",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/App.java#L35-L39 |
162,725 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/App.java | App.on | public App on(Heroku.Stack stack) {
App newApp = copy();
newApp.stack = new App.Stack(stack);
return newApp;
} | java | public App on(Heroku.Stack stack) {
App newApp = copy();
newApp.stack = new App.Stack(stack);
return newApp;
} | [
"public",
"App",
"on",
"(",
"Heroku",
".",
"Stack",
"stack",
")",
"{",
"App",
"newApp",
"=",
"copy",
"(",
")",
";",
"newApp",
".",
"stack",
"=",
"new",
"App",
".",
"Stack",
"(",
"stack",
")",
";",
"return",
"newApp",
";",
"}"
] | Builder method for specifying the stack an app should be created on.
@param stack Stack to create the app on.
@return A copy of the {@link App} | [
"Builder",
"method",
"for",
"specifying",
"the",
"stack",
"an",
"app",
"should",
"be",
"created",
"on",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/App.java#L46-L50 |
162,726 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.listApps | public Range<App> listApps(String range) {
return connection.execute(new AppList(range), apiKey);
} | java | public Range<App> listApps(String range) {
return connection.execute(new AppList(range), apiKey);
} | [
"public",
"Range",
"<",
"App",
">",
"listApps",
"(",
"String",
"range",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"AppList",
"(",
"range",
")",
",",
"apiKey",
")",
";",
"}"
] | List all apps for the current user's account.
@param range The range of apps provided by {@link Range#getNextRange()}
@return a list of apps | [
"List",
"all",
"apps",
"for",
"the",
"current",
"user",
"s",
"account",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L134-L136 |
162,727 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.renameApp | public String renameApp(String appName, String newName) {
return connection.execute(new AppRename(appName, newName), apiKey).getName();
} | java | public String renameApp(String appName, String newName) {
return connection.execute(new AppRename(appName, newName), apiKey).getName();
} | [
"public",
"String",
"renameApp",
"(",
"String",
"appName",
",",
"String",
"newName",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"AppRename",
"(",
"appName",
",",
"newName",
")",
",",
"apiKey",
")",
".",
"getName",
"(",
")",
";",
"}"
] | Rename an existing app.
@param appName Existing app name. See {@link #listApps()} for names that can be used.
@param newName New name to give the existing app.
@return the new name of the object | [
"Rename",
"an",
"existing",
"app",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L196-L198 |
162,728 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.addAddon | public AddonChange addAddon(String appName, String addonName) {
return connection.execute(new AddonInstall(appName, addonName), apiKey);
} | java | public AddonChange addAddon(String appName, String addonName) {
return connection.execute(new AddonInstall(appName, addonName), apiKey);
} | [
"public",
"AddonChange",
"addAddon",
"(",
"String",
"appName",
",",
"String",
"addonName",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"AddonInstall",
"(",
"appName",
",",
"addonName",
")",
",",
"apiKey",
")",
";",
"}"
] | Add an addon to the app.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@param addonName Addon name. See {@link #listAllAddons} to get a list of addons that can be used.
@return The request object | [
"Add",
"an",
"addon",
"to",
"the",
"app",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L214-L216 |
162,729 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.listAppAddons | public List<Addon> listAppAddons(String appName) {
return connection.execute(new AppAddonsList(appName), apiKey);
} | java | public List<Addon> listAppAddons(String appName) {
return connection.execute(new AppAddonsList(appName), apiKey);
} | [
"public",
"List",
"<",
"Addon",
">",
"listAppAddons",
"(",
"String",
"appName",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"AppAddonsList",
"(",
"appName",
")",
",",
"apiKey",
")",
";",
"}"
] | List the addons already added to an app.
@param appName new of the app
@return a list of add-ons | [
"List",
"the",
"addons",
"already",
"added",
"to",
"an",
"app",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L242-L244 |
162,730 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.removeAddon | public AddonChange removeAddon(String appName, String addonName) {
return connection.execute(new AddonRemove(appName, addonName), apiKey);
} | java | public AddonChange removeAddon(String appName, String addonName) {
return connection.execute(new AddonRemove(appName, addonName), apiKey);
} | [
"public",
"AddonChange",
"removeAddon",
"(",
"String",
"appName",
",",
"String",
"addonName",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"AddonRemove",
"(",
"appName",
",",
"addonName",
")",
",",
"apiKey",
")",
";",
"}"
] | Remove an addon from an app.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@param addonName Addon name. See {@link #listAppAddons} for a list of addons that can be used.
@return the request object | [
"Remove",
"an",
"addon",
"from",
"an",
"app",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L252-L254 |
162,731 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.listReleases | public List<Release> listReleases(String appName) {
return connection.execute(new ReleaseList(appName), apiKey);
} | java | public List<Release> listReleases(String appName) {
return connection.execute(new ReleaseList(appName), apiKey);
} | [
"public",
"List",
"<",
"Release",
">",
"listReleases",
"(",
"String",
"appName",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"ReleaseList",
"(",
"appName",
")",
",",
"apiKey",
")",
";",
"}"
] | List of releases for an app.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@return a list of releases | [
"List",
"of",
"releases",
"for",
"an",
"app",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L263-L265 |
162,732 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.rollback | public Release rollback(String appName, String releaseUuid) {
return connection.execute(new Rollback(appName, releaseUuid), apiKey);
} | java | public Release rollback(String appName, String releaseUuid) {
return connection.execute(new Rollback(appName, releaseUuid), apiKey);
} | [
"public",
"Release",
"rollback",
"(",
"String",
"appName",
",",
"String",
"releaseUuid",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"Rollback",
"(",
"appName",
",",
"releaseUuid",
")",
",",
"apiKey",
")",
";",
"}"
] | Rollback an app to a specific release.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@param releaseUuid Release UUID. See {@link #listReleases} for a list of the app's releases.
@return the release object | [
"Rollback",
"an",
"app",
"to",
"a",
"specific",
"release",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L283-L285 |
162,733 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.getReleaseInfo | public Release getReleaseInfo(String appName, String releaseName) {
return connection.execute(new ReleaseInfo(appName, releaseName), apiKey);
} | java | public Release getReleaseInfo(String appName, String releaseName) {
return connection.execute(new ReleaseInfo(appName, releaseName), apiKey);
} | [
"public",
"Release",
"getReleaseInfo",
"(",
"String",
"appName",
",",
"String",
"releaseName",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"ReleaseInfo",
"(",
"appName",
",",
"releaseName",
")",
",",
"apiKey",
")",
";",
"}"
] | Information about a specific release.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@param releaseName Release name. See {@link #listReleases} for a list of the app's releases.
@return the release object | [
"Information",
"about",
"a",
"specific",
"release",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L293-L295 |
162,734 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.listCollaborators | public List<Collaborator> listCollaborators(String appName) {
return connection.execute(new CollabList(appName), apiKey);
} | java | public List<Collaborator> listCollaborators(String appName) {
return connection.execute(new CollabList(appName), apiKey);
} | [
"public",
"List",
"<",
"Collaborator",
">",
"listCollaborators",
"(",
"String",
"appName",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"CollabList",
"(",
"appName",
")",
",",
"apiKey",
")",
";",
"}"
] | Get a list of collaborators that are allowed access to an app.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@return list of collaborators | [
"Get",
"a",
"list",
"of",
"collaborators",
"that",
"are",
"allowed",
"access",
"to",
"an",
"app",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L302-L304 |
162,735 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.addCollaborator | public void addCollaborator(String appName, String collaborator) {
connection.execute(new SharingAdd(appName, collaborator), apiKey);
} | java | public void addCollaborator(String appName, String collaborator) {
connection.execute(new SharingAdd(appName, collaborator), apiKey);
} | [
"public",
"void",
"addCollaborator",
"(",
"String",
"appName",
",",
"String",
"collaborator",
")",
"{",
"connection",
".",
"execute",
"(",
"new",
"SharingAdd",
"(",
"appName",
",",
"collaborator",
")",
",",
"apiKey",
")",
";",
"}"
] | Add a collaborator to an app.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@param collaborator Username of the collaborator to add. This is usually in the form of "[email protected]". | [
"Add",
"a",
"collaborator",
"to",
"an",
"app",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L311-L313 |
162,736 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.removeCollaborator | public void removeCollaborator(String appName, String collaborator) {
connection.execute(new SharingRemove(appName, collaborator), apiKey);
} | java | public void removeCollaborator(String appName, String collaborator) {
connection.execute(new SharingRemove(appName, collaborator), apiKey);
} | [
"public",
"void",
"removeCollaborator",
"(",
"String",
"appName",
",",
"String",
"collaborator",
")",
"{",
"connection",
".",
"execute",
"(",
"new",
"SharingRemove",
"(",
"appName",
",",
"collaborator",
")",
",",
"apiKey",
")",
";",
"}"
] | Remove a collaborator from an app.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@param collaborator See {@link #listCollaborators} for collaborators that can be removed from the app. | [
"Remove",
"a",
"collaborator",
"from",
"an",
"app",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L320-L322 |
162,737 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.updateConfig | public void updateConfig(String appName, Map<String, String> config) {
connection.execute(new ConfigUpdate(appName, config), apiKey);
} | java | public void updateConfig(String appName, Map<String, String> config) {
connection.execute(new ConfigUpdate(appName, config), apiKey);
} | [
"public",
"void",
"updateConfig",
"(",
"String",
"appName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"config",
")",
"{",
"connection",
".",
"execute",
"(",
"new",
"ConfigUpdate",
"(",
"appName",
",",
"config",
")",
",",
"apiKey",
")",
";",
"}"
] | Update environment variables to an app.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@param config Key/Value pairs of environment variables. | [
"Update",
"environment",
"variables",
"to",
"an",
"app",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L329-L331 |
162,738 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.listConfig | public Map<String, String> listConfig(String appName) {
return connection.execute(new ConfigList(appName), apiKey);
} | java | public Map<String, String> listConfig(String appName) {
return connection.execute(new ConfigList(appName), apiKey);
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"listConfig",
"(",
"String",
"appName",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"ConfigList",
"(",
"appName",
")",
",",
"apiKey",
")",
";",
"}"
] | List all the environment variables for an app.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@return map of config vars | [
"List",
"all",
"the",
"environment",
"variables",
"for",
"an",
"app",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L338-L340 |
162,739 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.transferApp | public void transferApp(String appName, String to) {
connection.execute(new SharingTransfer(appName, to), apiKey);
} | java | public void transferApp(String appName, String to) {
connection.execute(new SharingTransfer(appName, to), apiKey);
} | [
"public",
"void",
"transferApp",
"(",
"String",
"appName",
",",
"String",
"to",
")",
"{",
"connection",
".",
"execute",
"(",
"new",
"SharingTransfer",
"(",
"appName",
",",
"to",
")",
",",
"apiKey",
")",
";",
"}"
] | Transfer the ownership of an application to another user.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@param to Username of the person to transfer the app to. This is usually in the form of "[email protected]". | [
"Transfer",
"the",
"ownership",
"of",
"an",
"application",
"to",
"another",
"user",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L347-L349 |
162,740 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.getLogs | public LogStreamResponse getLogs(String appName, Boolean tail) {
return connection.execute(new Log(appName, tail), apiKey);
} | java | public LogStreamResponse getLogs(String appName, Boolean tail) {
return connection.execute(new Log(appName, tail), apiKey);
} | [
"public",
"LogStreamResponse",
"getLogs",
"(",
"String",
"appName",
",",
"Boolean",
"tail",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"Log",
"(",
"appName",
",",
"tail",
")",
",",
"apiKey",
")",
";",
"}"
] | Get logs for an app.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@return log stream response | [
"Get",
"logs",
"for",
"an",
"app",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L365-L367 |
162,741 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.getLogs | public LogStreamResponse getLogs(Log.LogRequestBuilder logRequest) {
return connection.execute(new Log(logRequest), apiKey);
} | java | public LogStreamResponse getLogs(Log.LogRequestBuilder logRequest) {
return connection.execute(new Log(logRequest), apiKey);
} | [
"public",
"LogStreamResponse",
"getLogs",
"(",
"Log",
".",
"LogRequestBuilder",
"logRequest",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"Log",
"(",
"logRequest",
")",
",",
"apiKey",
")",
";",
"}"
] | Get logs for an app by specifying additional parameters.
@param logRequest See {LogRequestBuilder}
@return log stream response | [
"Get",
"logs",
"for",
"an",
"app",
"by",
"specifying",
"additional",
"parameters",
"."
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L374-L376 |
162,742 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.isMaintenanceModeEnabled | public boolean isMaintenanceModeEnabled(String appName) {
App app = connection.execute(new AppInfo(appName), apiKey);
return app.isMaintenance();
} | java | public boolean isMaintenanceModeEnabled(String appName) {
App app = connection.execute(new AppInfo(appName), apiKey);
return app.isMaintenance();
} | [
"public",
"boolean",
"isMaintenanceModeEnabled",
"(",
"String",
"appName",
")",
"{",
"App",
"app",
"=",
"connection",
".",
"execute",
"(",
"new",
"AppInfo",
"(",
"appName",
")",
",",
"apiKey",
")",
";",
"return",
"app",
".",
"isMaintenance",
"(",
")",
";",
"}"
] | Checks if maintenance mode is enabled for the given app
@param appName See {@link #listApps} for a list of apps that can be used.
@return true if maintenance mode is enabled | [
"Checks",
"if",
"maintenance",
"mode",
"is",
"enabled",
"for",
"the",
"given",
"app"
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L392-L395 |
162,743 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.setMaintenanceMode | public void setMaintenanceMode(String appName, boolean enable) {
connection.execute(new AppUpdate(appName, enable), apiKey);
} | java | public void setMaintenanceMode(String appName, boolean enable) {
connection.execute(new AppUpdate(appName, enable), apiKey);
} | [
"public",
"void",
"setMaintenanceMode",
"(",
"String",
"appName",
",",
"boolean",
"enable",
")",
"{",
"connection",
".",
"execute",
"(",
"new",
"AppUpdate",
"(",
"appName",
",",
"enable",
")",
",",
"apiKey",
")",
";",
"}"
] | Sets maintenance mode for the given app
@param appName See {@link #listApps} for a list of apps that can be used.
@param enable true to enable; false to disable | [
"Sets",
"maintenance",
"mode",
"for",
"the",
"given",
"app"
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L403-L405 |
162,744 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.createBuild | public Build createBuild(String appName, Build build) {
return connection.execute(new BuildCreate(appName, build), apiKey);
} | java | public Build createBuild(String appName, Build build) {
return connection.execute(new BuildCreate(appName, build), apiKey);
} | [
"public",
"Build",
"createBuild",
"(",
"String",
"appName",
",",
"Build",
"build",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"BuildCreate",
"(",
"appName",
",",
"build",
")",
",",
"apiKey",
")",
";",
"}"
] | Creates a build
@param appName See {@link #listApps} for a list of apps that can be used.
@param build the build information | [
"Creates",
"a",
"build"
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L441-L443 |
162,745 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.getBuildInfo | public Build getBuildInfo(String appName, String buildId) {
return connection.execute(new BuildInfo(appName, buildId), apiKey);
} | java | public Build getBuildInfo(String appName, String buildId) {
return connection.execute(new BuildInfo(appName, buildId), apiKey);
} | [
"public",
"Build",
"getBuildInfo",
"(",
"String",
"appName",
",",
"String",
"buildId",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"BuildInfo",
"(",
"appName",
",",
"buildId",
")",
",",
"apiKey",
")",
";",
"}"
] | Gets the info for a running build
@param appName See {@link #listApps} for a list of apps that can be used.
@param buildId the unique identifier of the build | [
"Gets",
"the",
"info",
"for",
"a",
"running",
"build"
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L451-L453 |
162,746 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.listDynos | public Range<Dyno> listDynos(String appName) {
return connection.execute(new DynoList(appName), apiKey);
} | java | public Range<Dyno> listDynos(String appName) {
return connection.execute(new DynoList(appName), apiKey);
} | [
"public",
"Range",
"<",
"Dyno",
">",
"listDynos",
"(",
"String",
"appName",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"DynoList",
"(",
"appName",
")",
",",
"apiKey",
")",
";",
"}"
] | List app dynos for an app
@param appName See {@link #listApps} for a list of apps that can be used. | [
"List",
"app",
"dynos",
"for",
"an",
"app"
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L460-L462 |
162,747 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.restartDyno | public void restartDyno(String appName, String dynoId) {
connection.execute(new DynoRestart(appName, dynoId), apiKey);
} | java | public void restartDyno(String appName, String dynoId) {
connection.execute(new DynoRestart(appName, dynoId), apiKey);
} | [
"public",
"void",
"restartDyno",
"(",
"String",
"appName",
",",
"String",
"dynoId",
")",
"{",
"connection",
".",
"execute",
"(",
"new",
"DynoRestart",
"(",
"appName",
",",
"dynoId",
")",
",",
"apiKey",
")",
";",
"}"
] | Restarts a single dyno
@param appName See {@link #listApps} for a list of apps that can be used.
@param dynoId the unique identifier of the dyno to restart | [
"Restarts",
"a",
"single",
"dyno"
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L470-L472 |
162,748 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.scale | public Formation scale(String appName, String processType, int quantity) {
return connection.execute(new FormationUpdate(appName, processType, quantity), apiKey);
} | java | public Formation scale(String appName, String processType, int quantity) {
return connection.execute(new FormationUpdate(appName, processType, quantity), apiKey);
} | [
"public",
"Formation",
"scale",
"(",
"String",
"appName",
",",
"String",
"processType",
",",
"int",
"quantity",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"FormationUpdate",
"(",
"appName",
",",
"processType",
",",
"quantity",
")",
",",
"apiKey",
")",
";",
"}"
] | Scales a process type
@param appName See {@link #listApps} for a list of apps that can be used.
@param processType type of process to maintain
@param quantity number of processes to maintain | [
"Scales",
"a",
"process",
"type"
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L490-L492 |
162,749 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.listFormation | public List<Formation> listFormation(String appName) {
return connection.execute(new FormationList(appName), apiKey);
} | java | public List<Formation> listFormation(String appName) {
return connection.execute(new FormationList(appName), apiKey);
} | [
"public",
"List",
"<",
"Formation",
">",
"listFormation",
"(",
"String",
"appName",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"FormationList",
"(",
"appName",
")",
",",
"apiKey",
")",
";",
"}"
] | Lists the formation info for an app
@param appName See {@link #listApps} for a list of apps that can be used. | [
"Lists",
"the",
"formation",
"info",
"for",
"an",
"app"
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L499-L501 |
162,750 | heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.listBuildpackInstallations | public List<BuildpackInstallation> listBuildpackInstallations(String appName) {
return connection.execute(new BuildpackInstallationList(appName), apiKey);
} | java | public List<BuildpackInstallation> listBuildpackInstallations(String appName) {
return connection.execute(new BuildpackInstallationList(appName), apiKey);
} | [
"public",
"List",
"<",
"BuildpackInstallation",
">",
"listBuildpackInstallations",
"(",
"String",
"appName",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"BuildpackInstallationList",
"(",
"appName",
")",
",",
"apiKey",
")",
";",
"}"
] | Lists the buildpacks installed on an app
@param appName See {@link #listApps} for a list of apps that can be used. | [
"Lists",
"the",
"buildpacks",
"installed",
"on",
"an",
"app"
] | d9e52991293159498c10c498c6f91fcdd637378e | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L508-L510 |
162,751 | 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 |
162,752 | 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",
"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",
";",
"}",
"}"
] | 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",
"a",
"release",
"not",
"newer",
"than",
"the",
"project",
"version",
"is",
"found",
"that",
"optionally",
"corresponds",
"to",
"the",
"provided",
"version",
"regex",
"if",
"provided",
"."
] | e070b136d977441ab96fdce067a13e7e0423295b | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi-maven-plugin/src/main/java/org/revapi/maven/Analyzer.java#L226-L254 |
162,753 | 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 |
162,754 | 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 |
162,755 | 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",
">",
")",
"(",
"!",
"activations",
".",
"isEmpty",
"(",
")",
"&&",
"activations",
".",
"peek",
"(",
")",
".",
"depth",
"==",
"depth",
"?",
"activations",
".",
"pop",
"(",
")",
":",
"null",
")",
";",
"}"
] | 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 |
162,756 | 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",
"(",
")",
".",
"getApiAnalyzerTypes",
"(",
")",
",",
"knownExtensionIds",
")",
";",
"addExtensionIds",
"(",
"revapi",
".",
"getPipelineConfiguration",
"(",
")",
".",
"getTransformTypes",
"(",
")",
",",
"knownExtensionIds",
")",
";",
"addExtensionIds",
"(",
"revapi",
".",
"getPipelineConfiguration",
"(",
")",
".",
"getFilterTypes",
"(",
")",
",",
"knownExtensionIds",
")",
";",
"addExtensionIds",
"(",
"revapi",
".",
"getPipelineConfiguration",
"(",
")",
".",
"getReporterTypes",
"(",
")",
",",
"knownExtensionIds",
")",
";",
"return",
"new",
"Builder",
"(",
"knownExtensionIds",
")",
";",
"}"
] | 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 |
162,757 | 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",
".",
"data",
")",
";",
"}"
] | 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 |
162,758 | 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",
"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",
")",
")",
";",
"}"
] | 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",
"configuration",
"JSON",
"schema",
"."
] | e070b136d977441ab96fdce067a13e7e0423295b | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi/src/main/java/org/revapi/PipelineConfiguration.java#L107-L127 |
162,759 | 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",
"-",
"nestingLevel",
";",
"for",
"(",
";",
"i",
"<",
"unassigned",
";",
"++",
"i",
")",
"{",
"dotPositions",
"[",
"i",
"]",
"=",
"-",
"1",
";",
"}",
"for",
"(",
";",
"i",
"<",
"dotPositions",
".",
"length",
";",
"++",
"i",
")",
"{",
"dotPositions",
"[",
"i",
"]",
"=",
"dollarPositions",
"[",
"i",
"]",
";",
"}",
"}"
] | 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 |
162,760 | 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",
".",
"emptyMap",
"(",
")",
",",
"Collections",
".",
"emptyMap",
"(",
")",
")",
")",
";",
"}"
] | 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",
"configurations",
"of",
"extensions",
"."
] | e070b136d977441ab96fdce067a13e7e0423295b | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi/src/main/java/org/revapi/AnalysisResult.java#L58-L61 |
162,761 | 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",
".",
"currentSchema",
"=",
"jsonSchema",
";",
"ctx",
".",
"rootSchema",
"=",
"jsonSchema",
";",
"ctx",
".",
"pushTag",
"(",
"extensionId",
")",
";",
"ctx",
".",
"id",
"=",
"id",
";",
"return",
"convert",
"(",
"configuration",
",",
"ctx",
")",
";",
"}"
] | 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 |
162,762 | 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",
")",
"{",
"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",
";",
"}"
] | 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 |
162,763 | 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",
",",
"HierarchicalUriComponents",
".",
"Type",
".",
"SCHEME",
")",
";",
"}"
] | 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 |
162,764 | 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",
",",
"HierarchicalUriComponents",
".",
"Type",
".",
"AUTHORITY",
")",
";",
"}"
] | 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 |
162,765 | 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",
",",
"HierarchicalUriComponents",
".",
"Type",
".",
"USER_INFO",
")",
";",
"}"
] | 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 |
162,766 | 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",
",",
"HierarchicalUriComponents",
".",
"Type",
".",
"HOST_IPV4",
")",
";",
"}"
] | 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 |
162,767 | 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",
",",
"HierarchicalUriComponents",
".",
"Type",
".",
"PORT",
")",
";",
"}"
] | 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 |
162,768 | 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",
",",
"HierarchicalUriComponents",
".",
"Type",
".",
"PATH",
")",
";",
"}"
] | 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 |
162,769 | 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",
",",
"HierarchicalUriComponents",
".",
"Type",
".",
"PATH_SEGMENT",
")",
";",
"}"
] | 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 |
162,770 | 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",
",",
"HierarchicalUriComponents",
".",
"Type",
".",
"QUERY",
")",
";",
"}"
] | 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 |
162,771 | 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",
",",
"HierarchicalUriComponents",
".",
"Type",
".",
"QUERY_PARAM",
")",
";",
"}"
] | 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 |
162,772 | 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",
",",
"HierarchicalUriComponents",
".",
"Type",
".",
"FRAGMENT",
")",
";",
"}"
] | 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 |
162,773 | 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 |
162,774 | 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 |
162,775 | 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",
")",
".",
"build",
"(",
")",
";",
"}"
] | 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 |
162,776 | 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 |
162,777 | 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 specified\"",
")",
";",
"try",
"{",
"out",
".",
"write",
"(",
"in",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"out",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"}",
"}",
"}"
] | 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 |
162,778 | 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",
".",
"matches",
"(",
")",
";",
"}"
] | 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 |
162,779 | 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 existence: can we open the stream?",
"try",
"{",
"InputStream",
"is",
"=",
"getInputStream",
"(",
")",
";",
"is",
".",
"close",
"(",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"Throwable",
"isEx",
")",
"{",
"return",
"false",
";",
"}",
"}",
"}"
] | 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 |
162,780 | 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",
"(",
"'",
"'",
")",
"==",
"-",
"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 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 |
162,781 | 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-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",
";",
"}"
] | 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 |
162,782 | 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",
".",
"hasLength",
"(",
"encoding",
",",
"\"Encoding must not be empty\"",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"encodeBytes",
"(",
"source",
".",
"getBytes",
"(",
"encoding",
")",
",",
"type",
")",
";",
"return",
"new",
"String",
"(",
"bytes",
",",
"\"US-ASCII\"",
")",
";",
"}"
] | 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 |
162,783 | 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",
"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",
")",
";",
"}",
"}"
] | 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 |
162,784 | 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",
"(",
"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\"",
")",
";",
"}",
"}",
"}",
"}"
] | 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 |
162,785 | 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",
",",
"\"'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",
")",
";",
"}"
] | 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 |
162,786 | 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",
"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",
"(",
")",
";",
"}"
] | 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 |
162,787 | 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",
",",
"\"No OutputStream specified\"",
")",
";",
"out",
".",
"write",
"(",
"in",
")",
";",
"}"
] | 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 |
162,788 | 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",
"(",
")",
")",
")",
"{",
"return",
"HttpStatus",
".",
"UNAUTHORIZED",
".",
"value",
"(",
")",
";",
"}",
"else",
"if",
"(",
"PROXY_AUTH_ERROR",
".",
"equals",
"(",
"ex",
".",
"getMessage",
"(",
")",
")",
")",
"{",
"return",
"HttpStatus",
".",
"PROXY_AUTHENTICATION_REQUIRED",
".",
"value",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"ex",
";",
"}",
"}"
] | 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",
"authentication",
"errors",
".",
"Checking",
"for",
"this",
"response",
"and",
"returning",
"the",
"proper",
"status",
"."
] | 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 |
162,789 | 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",
",",
"AndroidKeyGenerators",
".",
"shared",
"(",
"16",
")",
")",
")",
";",
"}"
] | 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",
"data",
"results",
"in",
"the",
"same",
"encryption",
"result",
".",
"This",
"is",
"done",
"to",
"allow",
"encrypted",
"data",
"to",
"be",
"queried",
"against",
".",
"Encrypted",
"text",
"is",
"hex",
"-",
"encoded",
"."
] | 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 |
162,790 | 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 |
162,791 | 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",
"(",
")",
")",
"{",
"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",
";",
"}"
] | 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 |
162,792 | 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",
".",
"addPathSegments",
"(",
"pathSegments",
")",
";",
"resetSchemeSpecificPart",
"(",
")",
";",
"return",
"this",
";",
"}"
] | 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 |
162,793 | 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",
"(",
"params",
")",
";",
"return",
"this",
";",
"}"
] | 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 |
162,794 | 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",
")",
";",
"if",
"(",
"!",
"ObjectUtils",
".",
"isEmpty",
"(",
"values",
")",
")",
"{",
"queryParam",
"(",
"name",
",",
"values",
")",
";",
"}",
"resetSchemeSpecificPart",
"(",
")",
";",
"return",
"this",
";",
"}"
] | 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 |
162,795 | 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",
"(",
")",
",",
"clazz",
")",
";",
"}",
"}"
] | 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 |
162,796 | 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",
".",
"getContextClassLoader",
"(",
")",
";",
"if",
"(",
"classLoaderToUse",
"!=",
"null",
"&&",
"!",
"classLoaderToUse",
".",
"equals",
"(",
"threadContextClassLoader",
")",
")",
"{",
"currentThread",
".",
"setContextClassLoader",
"(",
"classLoaderToUse",
")",
";",
"return",
"threadContextClassLoader",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | 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",
"ClassLoader",
"already",
"."
] | 941296e152d49a40e0745a3e81628a974f72b7e4 | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L183-L193 |
162,797 | 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",
"=",
"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",
";",
"}",
"}"
] | 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 |
162,798 | 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",
")",
";",
"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",
";",
"}"
] | 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 |
162,799 | 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\"",
")",
";",
"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",
";",
"}",
"}"
] | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.