id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
16,800 | undertow-io/undertow | core/src/main/java/io/undertow/server/HttpServerExchange.java | HttpServerExchange.terminateRequest | void terminateRequest() {
int oldVal = state;
if (allAreSet(oldVal, FLAG_REQUEST_TERMINATED)) {
// idempotent
return;
}
if (requestChannel != null) {
requestChannel.requestDone();
}
this.state = oldVal | FLAG_REQUEST_TERMINATED;
... | java | void terminateRequest() {
int oldVal = state;
if (allAreSet(oldVal, FLAG_REQUEST_TERMINATED)) {
// idempotent
return;
}
if (requestChannel != null) {
requestChannel.requestDone();
}
this.state = oldVal | FLAG_REQUEST_TERMINATED;
... | [
"void",
"terminateRequest",
"(",
")",
"{",
"int",
"oldVal",
"=",
"state",
";",
"if",
"(",
"allAreSet",
"(",
"oldVal",
",",
"FLAG_REQUEST_TERMINATED",
")",
")",
"{",
"// idempotent",
"return",
";",
"}",
"if",
"(",
"requestChannel",
"!=",
"null",
")",
"{",
... | Force the codec to treat the request as fully read. Should only be invoked by handlers which downgrade
the socket or implement a transfer coding. | [
"Force",
"the",
"codec",
"to",
"treat",
"the",
"request",
"as",
"fully",
"read",
".",
"Should",
"only",
"be",
"invoked",
"by",
"handlers",
"which",
"downgrade",
"the",
"socket",
"or",
"implement",
"a",
"transfer",
"coding",
"."
] | 87de0b856a7a4ba8faf5b659537b9af07b763263 | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/HttpServerExchange.java#L1256-L1269 |
16,801 | undertow-io/undertow | core/src/main/java/io/undertow/server/HttpServerExchange.java | HttpServerExchange.terminateResponse | HttpServerExchange terminateResponse() {
int oldVal = state;
if (allAreSet(oldVal, FLAG_RESPONSE_TERMINATED)) {
// idempotent
return this;
}
if(responseChannel != null) {
responseChannel.responseDone();
}
this.state = oldVal | FLAG_RESP... | java | HttpServerExchange terminateResponse() {
int oldVal = state;
if (allAreSet(oldVal, FLAG_RESPONSE_TERMINATED)) {
// idempotent
return this;
}
if(responseChannel != null) {
responseChannel.responseDone();
}
this.state = oldVal | FLAG_RESP... | [
"HttpServerExchange",
"terminateResponse",
"(",
")",
"{",
"int",
"oldVal",
"=",
"state",
";",
"if",
"(",
"allAreSet",
"(",
"oldVal",
",",
"FLAG_RESPONSE_TERMINATED",
")",
")",
"{",
"// idempotent",
"return",
"this",
";",
"}",
"if",
"(",
"responseChannel",
"!="... | Force the codec to treat the response as fully written. Should only be invoked by handlers which downgrade
the socket or implement a transfer coding. | [
"Force",
"the",
"codec",
"to",
"treat",
"the",
"response",
"as",
"fully",
"written",
".",
"Should",
"only",
"be",
"invoked",
"by",
"handlers",
"which",
"downgrade",
"the",
"socket",
"or",
"implement",
"a",
"transfer",
"coding",
"."
] | 87de0b856a7a4ba8faf5b659537b9af07b763263 | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/HttpServerExchange.java#L1552-L1566 |
16,802 | undertow-io/undertow | core/src/main/java/io/undertow/server/HttpServerExchange.java | HttpServerExchange.setMaxEntitySize | public HttpServerExchange setMaxEntitySize(final long maxEntitySize) {
if (!isRequestChannelAvailable()) {
throw UndertowMessages.MESSAGES.requestChannelAlreadyProvided();
}
this.maxEntitySize = maxEntitySize;
connection.maxEntitySizeUpdated(this);
return this;
} | java | public HttpServerExchange setMaxEntitySize(final long maxEntitySize) {
if (!isRequestChannelAvailable()) {
throw UndertowMessages.MESSAGES.requestChannelAlreadyProvided();
}
this.maxEntitySize = maxEntitySize;
connection.maxEntitySizeUpdated(this);
return this;
} | [
"public",
"HttpServerExchange",
"setMaxEntitySize",
"(",
"final",
"long",
"maxEntitySize",
")",
"{",
"if",
"(",
"!",
"isRequestChannelAvailable",
"(",
")",
")",
"{",
"throw",
"UndertowMessages",
".",
"MESSAGES",
".",
"requestChannelAlreadyProvided",
"(",
")",
";",
... | Sets the max entity size for this exchange. This cannot be modified after the request channel has been obtained.
@param maxEntitySize The max entity size | [
"Sets",
"the",
"max",
"entity",
"size",
"for",
"this",
"exchange",
".",
"This",
"cannot",
"be",
"modified",
"after",
"the",
"request",
"channel",
"has",
"been",
"obtained",
"."
] | 87de0b856a7a4ba8faf5b659537b9af07b763263 | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/HttpServerExchange.java#L1810-L1817 |
16,803 | undertow-io/undertow | core/src/main/java/io/undertow/server/HttpServerExchange.java | HttpServerExchange.addResponseCommitListener | public void addResponseCommitListener(final ResponseCommitListener listener) {
//technically it is possible to modify the exchange after the response conduit has been created
//as the response channel should not be retrieved until it is about to be written to
//if we get complaints about this w... | java | public void addResponseCommitListener(final ResponseCommitListener listener) {
//technically it is possible to modify the exchange after the response conduit has been created
//as the response channel should not be retrieved until it is about to be written to
//if we get complaints about this w... | [
"public",
"void",
"addResponseCommitListener",
"(",
"final",
"ResponseCommitListener",
"listener",
")",
"{",
"//technically it is possible to modify the exchange after the response conduit has been created",
"//as the response channel should not be retrieved until it is about to be written to",
... | Adds a listener that will be invoked on response commit
@param listener The response listener | [
"Adds",
"a",
"listener",
"that",
"will",
"be",
"invoked",
"on",
"response",
"commit"
] | 87de0b856a7a4ba8faf5b659537b9af07b763263 | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/HttpServerExchange.java#L1836-L1848 |
16,804 | undertow-io/undertow | core/src/main/java/io/undertow/server/HttpServerExchange.java | HttpServerExchange.runResumeReadWrite | boolean runResumeReadWrite() {
boolean ret = false;
if(anyAreSet(state, FLAG_SHOULD_RESUME_WRITES)) {
responseChannel.runResume();
ret = true;
}
if(anyAreSet(state, FLAG_SHOULD_RESUME_READS)) {
requestChannel.runResume();
ret = true;
... | java | boolean runResumeReadWrite() {
boolean ret = false;
if(anyAreSet(state, FLAG_SHOULD_RESUME_WRITES)) {
responseChannel.runResume();
ret = true;
}
if(anyAreSet(state, FLAG_SHOULD_RESUME_READS)) {
requestChannel.runResume();
ret = true;
... | [
"boolean",
"runResumeReadWrite",
"(",
")",
"{",
"boolean",
"ret",
"=",
"false",
";",
"if",
"(",
"anyAreSet",
"(",
"state",
",",
"FLAG_SHOULD_RESUME_WRITES",
")",
")",
"{",
"responseChannel",
".",
"runResume",
"(",
")",
";",
"ret",
"=",
"true",
";",
"}",
... | Actually resumes reads or writes, if the relevant method has been called.
@return <code>true</code> if reads or writes were resumed | [
"Actually",
"resumes",
"reads",
"or",
"writes",
"if",
"the",
"relevant",
"method",
"has",
"been",
"called",
"."
] | 87de0b856a7a4ba8faf5b659537b9af07b763263 | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/HttpServerExchange.java#L1855-L1866 |
16,805 | undertow-io/undertow | servlet/src/main/java/io/undertow/servlet/compat/rewrite/RewriteCond.java | RewriteCond.evaluate | public boolean evaluate(Matcher rule, Matcher cond, Resolver resolver) {
String value = test.evaluate(rule, cond, resolver);
if (nocase) {
value = value.toLowerCase(Locale.ENGLISH);
}
Condition condition = this.condition.get();
if (condition == null) {
if ... | java | public boolean evaluate(Matcher rule, Matcher cond, Resolver resolver) {
String value = test.evaluate(rule, cond, resolver);
if (nocase) {
value = value.toLowerCase(Locale.ENGLISH);
}
Condition condition = this.condition.get();
if (condition == null) {
if ... | [
"public",
"boolean",
"evaluate",
"(",
"Matcher",
"rule",
",",
"Matcher",
"cond",
",",
"Resolver",
"resolver",
")",
"{",
"String",
"value",
"=",
"test",
".",
"evaluate",
"(",
"rule",
",",
"cond",
",",
"resolver",
")",
";",
"if",
"(",
"nocase",
")",
"{",... | Evaluate the condition based on the context
@param rule corresponding matched rule
@param cond last matched condition
@return | [
"Evaluate",
"the",
"condition",
"based",
"on",
"the",
"context"
] | 87de0b856a7a4ba8faf5b659537b9af07b763263 | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/servlet/src/main/java/io/undertow/servlet/compat/rewrite/RewriteCond.java#L201-L251 |
16,806 | yanzhenjie/AndPermission | support/src/main/java/com/yanzhenjie/permission/runtime/LRequest.java | LRequest.callbackSucceed | private void callbackSucceed() {
if (mGranted != null) {
List<String> permissionList = asList(mPermissions);
try {
mGranted.onAction(permissionList);
} catch (Exception e) {
Log.e("AndPermission", "Please check the onGranted() method body for b... | java | private void callbackSucceed() {
if (mGranted != null) {
List<String> permissionList = asList(mPermissions);
try {
mGranted.onAction(permissionList);
} catch (Exception e) {
Log.e("AndPermission", "Please check the onGranted() method body for b... | [
"private",
"void",
"callbackSucceed",
"(",
")",
"{",
"if",
"(",
"mGranted",
"!=",
"null",
")",
"{",
"List",
"<",
"String",
">",
"permissionList",
"=",
"asList",
"(",
"mPermissions",
")",
";",
"try",
"{",
"mGranted",
".",
"onAction",
"(",
"permissionList",
... | Callback acceptance status. | [
"Callback",
"acceptance",
"status",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/runtime/LRequest.java#L94-L106 |
16,807 | yanzhenjie/AndPermission | support/src/main/java/com/yanzhenjie/permission/runtime/LRequest.java | LRequest.getDeniedPermissions | private static List<String> getDeniedPermissions(PermissionChecker checker, Source source, String... permissions) {
List<String> deniedList = new ArrayList<>(1);
for (String permission : permissions) {
if (!checker.hasPermission(source.getContext(), permission)) {
deniedList.... | java | private static List<String> getDeniedPermissions(PermissionChecker checker, Source source, String... permissions) {
List<String> deniedList = new ArrayList<>(1);
for (String permission : permissions) {
if (!checker.hasPermission(source.getContext(), permission)) {
deniedList.... | [
"private",
"static",
"List",
"<",
"String",
">",
"getDeniedPermissions",
"(",
"PermissionChecker",
"checker",
",",
"Source",
"source",
",",
"String",
"...",
"permissions",
")",
"{",
"List",
"<",
"String",
">",
"deniedList",
"=",
"new",
"ArrayList",
"<>",
"(",
... | Get denied permissions. | [
"Get",
"denied",
"permissions",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/runtime/LRequest.java#L120-L128 |
16,808 | yanzhenjie/AndPermission | support/src/main/java/com/yanzhenjie/permission/bridge/BridgeActivity.java | BridgeActivity.requestInstall | static void requestInstall(Source source) {
Intent intent = new Intent(source.getContext(), BridgeActivity.class);
intent.putExtra(KEY_TYPE, BridgeRequest.TYPE_INSTALL);
source.startActivity(intent);
} | java | static void requestInstall(Source source) {
Intent intent = new Intent(source.getContext(), BridgeActivity.class);
intent.putExtra(KEY_TYPE, BridgeRequest.TYPE_INSTALL);
source.startActivity(intent);
} | [
"static",
"void",
"requestInstall",
"(",
"Source",
"source",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"source",
".",
"getContext",
"(",
")",
",",
"BridgeActivity",
".",
"class",
")",
";",
"intent",
".",
"putExtra",
"(",
"KEY_TYPE",
",",
"... | Request for package install. | [
"Request",
"for",
"package",
"install",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/bridge/BridgeActivity.java#L64-L68 |
16,809 | yanzhenjie/AndPermission | support/src/main/java/com/yanzhenjie/permission/bridge/BridgeActivity.java | BridgeActivity.requestOverlay | static void requestOverlay(Source source) {
Intent intent = new Intent(source.getContext(), BridgeActivity.class);
intent.putExtra(KEY_TYPE, BridgeRequest.TYPE_OVERLAY);
source.startActivity(intent);
} | java | static void requestOverlay(Source source) {
Intent intent = new Intent(source.getContext(), BridgeActivity.class);
intent.putExtra(KEY_TYPE, BridgeRequest.TYPE_OVERLAY);
source.startActivity(intent);
} | [
"static",
"void",
"requestOverlay",
"(",
"Source",
"source",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"source",
".",
"getContext",
"(",
")",
",",
"BridgeActivity",
".",
"class",
")",
";",
"intent",
".",
"putExtra",
"(",
"KEY_TYPE",
",",
"... | Request for overlay. | [
"Request",
"for",
"overlay",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/bridge/BridgeActivity.java#L73-L77 |
16,810 | yanzhenjie/AndPermission | support/src/main/java/com/yanzhenjie/permission/bridge/BridgeActivity.java | BridgeActivity.requestAlertWindow | static void requestAlertWindow(Source source) {
Intent intent = new Intent(source.getContext(), BridgeActivity.class);
intent.putExtra(KEY_TYPE, BridgeRequest.TYPE_ALERT_WINDOW);
source.startActivity(intent);
} | java | static void requestAlertWindow(Source source) {
Intent intent = new Intent(source.getContext(), BridgeActivity.class);
intent.putExtra(KEY_TYPE, BridgeRequest.TYPE_ALERT_WINDOW);
source.startActivity(intent);
} | [
"static",
"void",
"requestAlertWindow",
"(",
"Source",
"source",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"source",
".",
"getContext",
"(",
")",
",",
"BridgeActivity",
".",
"class",
")",
";",
"intent",
".",
"putExtra",
"(",
"KEY_TYPE",
",",... | Request for alert window. | [
"Request",
"for",
"alert",
"window",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/bridge/BridgeActivity.java#L82-L86 |
16,811 | yanzhenjie/AndPermission | support/src/main/java/com/yanzhenjie/permission/bridge/BridgeActivity.java | BridgeActivity.requestNotify | static void requestNotify(Source source) {
Intent intent = new Intent(source.getContext(), BridgeActivity.class);
intent.putExtra(KEY_TYPE, BridgeRequest.TYPE_NOTIFY);
source.startActivity(intent);
} | java | static void requestNotify(Source source) {
Intent intent = new Intent(source.getContext(), BridgeActivity.class);
intent.putExtra(KEY_TYPE, BridgeRequest.TYPE_NOTIFY);
source.startActivity(intent);
} | [
"static",
"void",
"requestNotify",
"(",
"Source",
"source",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"source",
".",
"getContext",
"(",
")",
",",
"BridgeActivity",
".",
"class",
")",
";",
"intent",
".",
"putExtra",
"(",
"KEY_TYPE",
",",
"B... | Request for notify. | [
"Request",
"for",
"notify",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/bridge/BridgeActivity.java#L91-L95 |
16,812 | yanzhenjie/AndPermission | support/src/main/java/com/yanzhenjie/permission/bridge/BridgeActivity.java | BridgeActivity.requestNotificationListener | static void requestNotificationListener(Source source) {
Intent intent = new Intent(source.getContext(), BridgeActivity.class);
intent.putExtra(KEY_TYPE, BridgeRequest.TYPE_NOTIFY_LISTENER);
source.startActivity(intent);
} | java | static void requestNotificationListener(Source source) {
Intent intent = new Intent(source.getContext(), BridgeActivity.class);
intent.putExtra(KEY_TYPE, BridgeRequest.TYPE_NOTIFY_LISTENER);
source.startActivity(intent);
} | [
"static",
"void",
"requestNotificationListener",
"(",
"Source",
"source",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"source",
".",
"getContext",
"(",
")",
",",
"BridgeActivity",
".",
"class",
")",
";",
"intent",
".",
"putExtra",
"(",
"KEY_TYPE... | Request for notification listener. | [
"Request",
"for",
"notification",
"listener",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/bridge/BridgeActivity.java#L100-L104 |
16,813 | yanzhenjie/AndPermission | support/src/main/java/com/yanzhenjie/permission/bridge/BridgeActivity.java | BridgeActivity.requestWriteSetting | static void requestWriteSetting(Source source) {
Intent intent = new Intent(source.getContext(), BridgeActivity.class);
intent.putExtra(KEY_TYPE, BridgeRequest.TYPE_WRITE_SETTING);
source.startActivity(intent);
} | java | static void requestWriteSetting(Source source) {
Intent intent = new Intent(source.getContext(), BridgeActivity.class);
intent.putExtra(KEY_TYPE, BridgeRequest.TYPE_WRITE_SETTING);
source.startActivity(intent);
} | [
"static",
"void",
"requestWriteSetting",
"(",
"Source",
"source",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"source",
".",
"getContext",
"(",
")",
",",
"BridgeActivity",
".",
"class",
")",
";",
"intent",
".",
"putExtra",
"(",
"KEY_TYPE",
","... | Request for write system setting. | [
"Request",
"for",
"write",
"system",
"setting",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/bridge/BridgeActivity.java#L109-L113 |
16,814 | yanzhenjie/AndPermission | support/src/main/java/com/yanzhenjie/permission/AndPermission.java | AndPermission.hasAlwaysDeniedPermission | private static boolean hasAlwaysDeniedPermission(Source source, String... deniedPermissions) {
for (String permission : deniedPermissions) {
if (!source.isShowRationalePermission(permission)) {
return true;
}
}
return false;
} | java | private static boolean hasAlwaysDeniedPermission(Source source, String... deniedPermissions) {
for (String permission : deniedPermissions) {
if (!source.isShowRationalePermission(permission)) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"hasAlwaysDeniedPermission",
"(",
"Source",
"source",
",",
"String",
"...",
"deniedPermissions",
")",
"{",
"for",
"(",
"String",
"permission",
":",
"deniedPermissions",
")",
"{",
"if",
"(",
"!",
"source",
".",
"isShowRationalePermis... | Has always been denied permission. | [
"Has",
"always",
"been",
"denied",
"permission",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/AndPermission.java#L197-L204 |
16,815 | yanzhenjie/AndPermission | x/src/main/java/com/yanzhenjie/permission/install/BaseRequest.java | BaseRequest.install | final void install() {
Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri uri = AndPermission.getFileUri(mSource.getContext(), mFile);
intent.setDataAndType(uri, "a... | java | final void install() {
Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri uri = AndPermission.getFileUri(mSource.getContext(), mFile);
intent.setDataAndType(uri, "a... | [
"final",
"void",
"install",
"(",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"Intent",
".",
"ACTION_INSTALL_PACKAGE",
")",
";",
"intent",
".",
"setFlags",
"(",
"Intent",
".",
"FLAG_ACTIVITY_NEW_TASK",
")",
";",
"intent",
".",
"addFlags",
"(",
... | Start the installation. | [
"Start",
"the",
"installation",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/x/src/main/java/com/yanzhenjie/permission/install/BaseRequest.java#L85-L92 |
16,816 | yanzhenjie/AndPermission | supportSample/src/main/java/com/yanzhenjie/permission/sample/widget/AlertWindow.java | AlertWindow.show | public void show() {
if (isShowing) {
Log.w("AlertWindow", "AlertWindow is already displayed.");
} else {
isShowing = true;
mWindowManager.addView(mContentView, mParams);
}
} | java | public void show() {
if (isShowing) {
Log.w("AlertWindow", "AlertWindow is already displayed.");
} else {
isShowing = true;
mWindowManager.addView(mContentView, mParams);
}
} | [
"public",
"void",
"show",
"(",
")",
"{",
"if",
"(",
"isShowing",
")",
"{",
"Log",
".",
"w",
"(",
"\"AlertWindow\"",
",",
"\"AlertWindow is already displayed.\"",
")",
";",
"}",
"else",
"{",
"isShowing",
"=",
"true",
";",
"mWindowManager",
".",
"addView",
"... | Display the alert window. | [
"Display",
"the",
"alert",
"window",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/supportSample/src/main/java/com/yanzhenjie/permission/sample/widget/AlertWindow.java#L102-L109 |
16,817 | yanzhenjie/AndPermission | x/src/main/java/com/yanzhenjie/permission/runtime/MRequest.java | MRequest.getRationalePermissions | private static List<String> getRationalePermissions(Source source, String... permissions) {
List<String> rationaleList = new ArrayList<>(1);
for (String permission : permissions) {
if (source.isShowRationalePermission(permission)) {
rationaleList.add(permission);
... | java | private static List<String> getRationalePermissions(Source source, String... permissions) {
List<String> rationaleList = new ArrayList<>(1);
for (String permission : permissions) {
if (source.isShowRationalePermission(permission)) {
rationaleList.add(permission);
... | [
"private",
"static",
"List",
"<",
"String",
">",
"getRationalePermissions",
"(",
"Source",
"source",
",",
"String",
"...",
"permissions",
")",
"{",
"List",
"<",
"String",
">",
"rationaleList",
"=",
"new",
"ArrayList",
"<>",
"(",
"1",
")",
";",
"for",
"(",
... | Get permissions to show rationale. | [
"Get",
"permissions",
"to",
"show",
"rationale",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/x/src/main/java/com/yanzhenjie/permission/runtime/MRequest.java#L178-L186 |
16,818 | yanzhenjie/AndPermission | support/src/main/java/com/yanzhenjie/permission/runtime/Runtime.java | Runtime.checkPermissions | private void checkPermissions(String... permissions) {
if (sAppPermissions == null) sAppPermissions = getManifestPermissions(mSource.getContext());
if (permissions.length == 0) {
throw new IllegalArgumentException("Please enter at least one permission.");
}
for (String p : ... | java | private void checkPermissions(String... permissions) {
if (sAppPermissions == null) sAppPermissions = getManifestPermissions(mSource.getContext());
if (permissions.length == 0) {
throw new IllegalArgumentException("Please enter at least one permission.");
}
for (String p : ... | [
"private",
"void",
"checkPermissions",
"(",
"String",
"...",
"permissions",
")",
"{",
"if",
"(",
"sAppPermissions",
"==",
"null",
")",
"sAppPermissions",
"=",
"getManifestPermissions",
"(",
"mSource",
".",
"getContext",
"(",
")",
")",
";",
"if",
"(",
"permissi... | Check if the permissions are valid and each permission has been registered in manifest.xml. This method will
throw a exception if permissions are invalid or there is any permission which is not registered in manifest.xml.
@param permissions permissions which will be checked. | [
"Check",
"if",
"the",
"permissions",
"are",
"valid",
"and",
"each",
"permission",
"has",
"been",
"registered",
"in",
"manifest",
".",
"xml",
".",
"This",
"method",
"will",
"throw",
"a",
"exception",
"if",
"permissions",
"are",
"invalid",
"or",
"there",
"is",... | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/runtime/Runtime.java#L92-L108 |
16,819 | yanzhenjie/AndPermission | support/src/main/java/com/yanzhenjie/permission/runtime/Runtime.java | Runtime.getManifestPermissions | private static List<String> getManifestPermissions(Context context) {
try {
PackageInfo packageInfo = context.getPackageManager()
.getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS);
String[] permissions = packageInfo.requestedPermissions;
... | java | private static List<String> getManifestPermissions(Context context) {
try {
PackageInfo packageInfo = context.getPackageManager()
.getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS);
String[] permissions = packageInfo.requestedPermissions;
... | [
"private",
"static",
"List",
"<",
"String",
">",
"getManifestPermissions",
"(",
"Context",
"context",
")",
"{",
"try",
"{",
"PackageInfo",
"packageInfo",
"=",
"context",
".",
"getPackageManager",
"(",
")",
".",
"getPackageInfo",
"(",
"context",
".",
"getPackageN... | Get a list of permissions in the manifest. | [
"Get",
"a",
"list",
"of",
"permissions",
"in",
"the",
"manifest",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/runtime/Runtime.java#L113-L125 |
16,820 | yanzhenjie/AndPermission | supportSample/src/main/java/com/yanzhenjie/permission/sample/app/MainActivity.java | MainActivity.showSettingDialog | public void showSettingDialog(Context context, final List<String> permissions) {
List<String> permissionNames = Permission.transformText(context, permissions);
String message = context.getString(R.string.message_permission_always_failed,
TextUtils.join("\n", permissionNames));
new A... | java | public void showSettingDialog(Context context, final List<String> permissions) {
List<String> permissionNames = Permission.transformText(context, permissions);
String message = context.getString(R.string.message_permission_always_failed,
TextUtils.join("\n", permissionNames));
new A... | [
"public",
"void",
"showSettingDialog",
"(",
"Context",
"context",
",",
"final",
"List",
"<",
"String",
">",
"permissions",
")",
"{",
"List",
"<",
"String",
">",
"permissionNames",
"=",
"Permission",
".",
"transformText",
"(",
"context",
",",
"permissions",
")"... | Display setting dialog. | [
"Display",
"setting",
"dialog",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/supportSample/src/main/java/com/yanzhenjie/permission/sample/app/MainActivity.java#L347-L367 |
16,821 | yanzhenjie/AndPermission | supportSample/src/main/java/com/yanzhenjie/permission/sample/app/MainActivity.java | MainActivity.requestNotification | private void requestNotification() {
AndPermission.with(this)
.notification()
.permission()
.rationale(new NotifyRationale())
.onGranted(new Action<Void>() {
@Override
public void onAction(Void data) {
toast(R.st... | java | private void requestNotification() {
AndPermission.with(this)
.notification()
.permission()
.rationale(new NotifyRationale())
.onGranted(new Action<Void>() {
@Override
public void onAction(Void data) {
toast(R.st... | [
"private",
"void",
"requestNotification",
"(",
")",
"{",
"AndPermission",
".",
"with",
"(",
"this",
")",
".",
"notification",
"(",
")",
".",
"permission",
"(",
")",
".",
"rationale",
"(",
"new",
"NotifyRationale",
"(",
")",
")",
".",
"onGranted",
"(",
"n... | Request notification permission. | [
"Request",
"notification",
"permission",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/supportSample/src/main/java/com/yanzhenjie/permission/sample/app/MainActivity.java#L389-L407 |
16,822 | yanzhenjie/AndPermission | supportSample/src/main/java/com/yanzhenjie/permission/sample/app/MainActivity.java | MainActivity.requestNotificationListener | private void requestNotificationListener() {
AndPermission.with(this)
.notification()
.listener()
.rationale(new NotifyListenerRationale())
.onGranted(new Action<Void>() {
@Override
public void onAction(Void data) {
... | java | private void requestNotificationListener() {
AndPermission.with(this)
.notification()
.listener()
.rationale(new NotifyListenerRationale())
.onGranted(new Action<Void>() {
@Override
public void onAction(Void data) {
... | [
"private",
"void",
"requestNotificationListener",
"(",
")",
"{",
"AndPermission",
".",
"with",
"(",
"this",
")",
".",
"notification",
"(",
")",
".",
"listener",
"(",
")",
".",
"rationale",
"(",
"new",
"NotifyListenerRationale",
"(",
")",
")",
".",
"onGranted... | Request notification listener. | [
"Request",
"notification",
"listener",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/supportSample/src/main/java/com/yanzhenjie/permission/sample/app/MainActivity.java#L412-L430 |
16,823 | yanzhenjie/AndPermission | supportSample/src/main/java/com/yanzhenjie/permission/sample/app/MainActivity.java | MainActivity.requestPermissionForInstallPackage | private void requestPermissionForInstallPackage() {
AndPermission.with(this)
.runtime()
.permission(Permission.Group.STORAGE)
.rationale(new RuntimeRationale())
.onGranted(new Action<List<String>>() {
@Override
public void onAction(... | java | private void requestPermissionForInstallPackage() {
AndPermission.with(this)
.runtime()
.permission(Permission.Group.STORAGE)
.rationale(new RuntimeRationale())
.onGranted(new Action<List<String>>() {
@Override
public void onAction(... | [
"private",
"void",
"requestPermissionForInstallPackage",
"(",
")",
"{",
"AndPermission",
".",
"with",
"(",
"this",
")",
".",
"runtime",
"(",
")",
".",
"permission",
"(",
"Permission",
".",
"Group",
".",
"STORAGE",
")",
".",
"rationale",
"(",
"new",
"RuntimeR... | Request to read and write external storage permissions. | [
"Request",
"to",
"read",
"and",
"write",
"external",
"storage",
"permissions",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/supportSample/src/main/java/com/yanzhenjie/permission/sample/app/MainActivity.java#L435-L458 |
16,824 | yanzhenjie/AndPermission | supportSample/src/main/java/com/yanzhenjie/permission/sample/app/MainActivity.java | MainActivity.createMenu | private PopupMenu createMenu(View v, String[] menuArray) {
PopupMenu popupMenu = new PopupMenu(this, v);
Menu menu = popupMenu.getMenu();
for (int i = 0; i < menuArray.length; i++) {
String menuText = menuArray[i];
menu.add(0, i, i, menuText);
}
return pop... | java | private PopupMenu createMenu(View v, String[] menuArray) {
PopupMenu popupMenu = new PopupMenu(this, v);
Menu menu = popupMenu.getMenu();
for (int i = 0; i < menuArray.length; i++) {
String menuText = menuArray[i];
menu.add(0, i, i, menuText);
}
return pop... | [
"private",
"PopupMenu",
"createMenu",
"(",
"View",
"v",
",",
"String",
"[",
"]",
"menuArray",
")",
"{",
"PopupMenu",
"popupMenu",
"=",
"new",
"PopupMenu",
"(",
"this",
",",
"v",
")",
";",
"Menu",
"menu",
"=",
"popupMenu",
".",
"getMenu",
"(",
")",
";",... | Create menu. | [
"Create",
"menu",
"."
] | bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c | https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/supportSample/src/main/java/com/yanzhenjie/permission/sample/app/MainActivity.java#L526-L534 |
16,825 | web3j/web3j | crypto/src/main/java/org/web3j/crypto/ContractUtils.java | ContractUtils.generateContractAddress | public static byte[] generateContractAddress(byte[] address, BigInteger nonce) {
List<RlpType> values = new ArrayList<>();
values.add(RlpString.create(address));
values.add(RlpString.create(nonce));
RlpList rlpList = new RlpList(values);
byte[] encoded = RlpEncoder.encode(rlpLi... | java | public static byte[] generateContractAddress(byte[] address, BigInteger nonce) {
List<RlpType> values = new ArrayList<>();
values.add(RlpString.create(address));
values.add(RlpString.create(nonce));
RlpList rlpList = new RlpList(values);
byte[] encoded = RlpEncoder.encode(rlpLi... | [
"public",
"static",
"byte",
"[",
"]",
"generateContractAddress",
"(",
"byte",
"[",
"]",
"address",
",",
"BigInteger",
"nonce",
")",
"{",
"List",
"<",
"RlpType",
">",
"values",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"values",
".",
"add",
"(",
"Rl... | Generate a smart contract address. This enables you to identify what address a
smart contract will be deployed to on the network.
@param address of sender
@param nonce of transaction
@return the generated smart contract address | [
"Generate",
"a",
"smart",
"contract",
"address",
".",
"This",
"enables",
"you",
"to",
"identify",
"what",
"address",
"a",
"smart",
"contract",
"will",
"be",
"deployed",
"to",
"on",
"the",
"network",
"."
] | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/crypto/src/main/java/org/web3j/crypto/ContractUtils.java#L27-L37 |
16,826 | web3j/web3j | crypto/src/main/java/org/web3j/crypto/MnemonicUtils.java | MnemonicUtils.generateMnemonic | public static String generateMnemonic(byte[] initialEntropy) {
validateEntropy(initialEntropy);
final List<String> words = getWords();
int ent = initialEntropy.length * 8;
int checksumLength = ent / 32;
byte checksum = calculateChecksum(initialEntropy);
boolean[] bits =... | java | public static String generateMnemonic(byte[] initialEntropy) {
validateEntropy(initialEntropy);
final List<String> words = getWords();
int ent = initialEntropy.length * 8;
int checksumLength = ent / 32;
byte checksum = calculateChecksum(initialEntropy);
boolean[] bits =... | [
"public",
"static",
"String",
"generateMnemonic",
"(",
"byte",
"[",
"]",
"initialEntropy",
")",
"{",
"validateEntropy",
"(",
"initialEntropy",
")",
";",
"final",
"List",
"<",
"String",
">",
"words",
"=",
"getWords",
"(",
")",
";",
"int",
"ent",
"=",
"initi... | The mnemonic must encode entropy in a multiple of 32 bits. With more entropy security is
improved but the sentence length increases. We refer to the initial entropy length as ENT.
The allowed size of ENT is 128-256 bits.
<h3>Mnemonic generation algorithm</h3>
Given a randomly generated initial entropy of size ENT, fir... | [
"The",
"mnemonic",
"must",
"encode",
"entropy",
"in",
"a",
"multiple",
"of",
"32",
"bits",
".",
"With",
"more",
"entropy",
"security",
"is",
"improved",
"but",
"the",
"sentence",
"length",
"increases",
".",
"We",
"refer",
"to",
"the",
"initial",
"entropy",
... | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/crypto/src/main/java/org/web3j/crypto/MnemonicUtils.java#L51-L74 |
16,827 | web3j/web3j | crypto/src/main/java/org/web3j/crypto/MnemonicUtils.java | MnemonicUtils.generateEntropy | public static byte[] generateEntropy(String mnemonic) {
final BitSet bits = new BitSet();
final int size = mnemonicToBits(mnemonic, bits);
if (size == 0) {
throw new IllegalArgumentException("Empty mnemonic");
}
final int ent = 32 * size / 33;
if (ent % 8 != ... | java | public static byte[] generateEntropy(String mnemonic) {
final BitSet bits = new BitSet();
final int size = mnemonicToBits(mnemonic, bits);
if (size == 0) {
throw new IllegalArgumentException("Empty mnemonic");
}
final int ent = 32 * size / 33;
if (ent % 8 != ... | [
"public",
"static",
"byte",
"[",
"]",
"generateEntropy",
"(",
"String",
"mnemonic",
")",
"{",
"final",
"BitSet",
"bits",
"=",
"new",
"BitSet",
"(",
")",
";",
"final",
"int",
"size",
"=",
"mnemonicToBits",
"(",
"mnemonic",
",",
"bits",
")",
";",
"if",
"... | Create entropy from the mnemonic.
@param mnemonic The input mnemonic which should be 128-160 bits in length containing
only valid words
@return Byte array representation of the entropy | [
"Create",
"entropy",
"from",
"the",
"mnemonic",
"."
] | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/crypto/src/main/java/org/web3j/crypto/MnemonicUtils.java#L82-L106 |
16,828 | web3j/web3j | core/src/main/java/org/web3j/utils/Async.java | Async.defaultExecutorService | public static ScheduledExecutorService defaultExecutorService() {
ScheduledExecutorService scheduledExecutorService =
Executors.newScheduledThreadPool(getCpuCount());
Runtime.getRuntime().addShutdownHook(new Thread(() -> shutdown(scheduledExecutorService)));
return scheduledExe... | java | public static ScheduledExecutorService defaultExecutorService() {
ScheduledExecutorService scheduledExecutorService =
Executors.newScheduledThreadPool(getCpuCount());
Runtime.getRuntime().addShutdownHook(new Thread(() -> shutdown(scheduledExecutorService)));
return scheduledExe... | [
"public",
"static",
"ScheduledExecutorService",
"defaultExecutorService",
"(",
")",
"{",
"ScheduledExecutorService",
"scheduledExecutorService",
"=",
"Executors",
".",
"newScheduledThreadPool",
"(",
"getCpuCount",
"(",
")",
")",
";",
"Runtime",
".",
"getRuntime",
"(",
"... | Provide a new ScheduledExecutorService instance.
<p>A shutdown hook is created to terminate the thread pool on application termination.
@return new ScheduledExecutorService | [
"Provide",
"a",
"new",
"ScheduledExecutorService",
"instance",
"."
] | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/core/src/main/java/org/web3j/utils/Async.java#L46-L53 |
16,829 | web3j/web3j | abi/src/main/java/org/web3j/abi/TypeDecoder.java | TypeDecoder.decodeStaticArray | @SuppressWarnings("unchecked")
static <T extends Type> T decodeStaticArray(
String input, int offset, TypeReference<T> typeReference, int length) {
BiFunction<List<T>, String, T> function = (elements, typeName) -> {
if (elements.isEmpty()) {
throw new UnsupportedOper... | java | @SuppressWarnings("unchecked")
static <T extends Type> T decodeStaticArray(
String input, int offset, TypeReference<T> typeReference, int length) {
BiFunction<List<T>, String, T> function = (elements, typeName) -> {
if (elements.isEmpty()) {
throw new UnsupportedOper... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"<",
"T",
"extends",
"Type",
">",
"T",
"decodeStaticArray",
"(",
"String",
"input",
",",
"int",
"offset",
",",
"TypeReference",
"<",
"T",
">",
"typeReference",
",",
"int",
"length",
")",
"{",
"B... | Static array length cannot be passed as a type. | [
"Static",
"array",
"length",
"cannot",
"be",
"passed",
"as",
"a",
"type",
"."
] | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/abi/src/main/java/org/web3j/abi/TypeDecoder.java#L202-L215 |
16,830 | web3j/web3j | core/src/main/java/org/web3j/tx/Contract.java | Contract.isValid | public boolean isValid() throws IOException {
if (contractBinary.equals(BIN_NOT_PROVIDED)) {
throw new UnsupportedOperationException(
"Contract binary not present in contract wrapper, "
+ "please generate your wrapper using -abiFile=<file>");
}... | java | public boolean isValid() throws IOException {
if (contractBinary.equals(BIN_NOT_PROVIDED)) {
throw new UnsupportedOperationException(
"Contract binary not present in contract wrapper, "
+ "please generate your wrapper using -abiFile=<file>");
}... | [
"public",
"boolean",
"isValid",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"contractBinary",
".",
"equals",
"(",
"BIN_NOT_PROVIDED",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Contract binary not present in contract wrapper, \"",
"+"... | Check that the contract deployed at the address associated with this smart contract wrapper
is in fact the contract you believe it is.
<p>This method uses the
<a href="https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcode">eth_getCode</a> method
to get the contract byte code and validates it against the byte code... | [
"Check",
"that",
"the",
"contract",
"deployed",
"at",
"the",
"address",
"associated",
"with",
"this",
"smart",
"contract",
"wrapper",
"is",
"in",
"fact",
"the",
"contract",
"you",
"believe",
"it",
"is",
"."
] | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/core/src/main/java/org/web3j/tx/Contract.java#L164-L192 |
16,831 | web3j/web3j | core/src/main/java/org/web3j/tx/Contract.java | Contract.executeCall | private List<Type> executeCall(
Function function) throws IOException {
String encodedFunction = FunctionEncoder.encode(function);
org.web3j.protocol.core.methods.response.EthCall ethCall = web3j.ethCall(
Transaction.createEthCallTransaction(
transacti... | java | private List<Type> executeCall(
Function function) throws IOException {
String encodedFunction = FunctionEncoder.encode(function);
org.web3j.protocol.core.methods.response.EthCall ethCall = web3j.ethCall(
Transaction.createEthCallTransaction(
transacti... | [
"private",
"List",
"<",
"Type",
">",
"executeCall",
"(",
"Function",
"function",
")",
"throws",
"IOException",
"{",
"String",
"encodedFunction",
"=",
"FunctionEncoder",
".",
"encode",
"(",
"function",
")",
";",
"org",
".",
"web3j",
".",
"protocol",
".",
"cor... | Execute constant function call - i.e. a call that does not change state of the contract
@param function to call
@return {@link List} of values returned by function call | [
"Execute",
"constant",
"function",
"call",
"-",
"i",
".",
"e",
".",
"a",
"call",
"that",
"does",
"not",
"change",
"state",
"of",
"the",
"contract"
] | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/core/src/main/java/org/web3j/tx/Contract.java#L221-L232 |
16,832 | web3j/web3j | core/src/main/java/org/web3j/tx/Contract.java | Contract.executeTransaction | TransactionReceipt executeTransaction(
String data, BigInteger weiValue, String funcName)
throws TransactionException, IOException {
TransactionReceipt receipt = send(contractAddress, data, weiValue,
gasProvider.getGasPrice(funcName),
gasProvider.getGasLi... | java | TransactionReceipt executeTransaction(
String data, BigInteger weiValue, String funcName)
throws TransactionException, IOException {
TransactionReceipt receipt = send(contractAddress, data, weiValue,
gasProvider.getGasPrice(funcName),
gasProvider.getGasLi... | [
"TransactionReceipt",
"executeTransaction",
"(",
"String",
"data",
",",
"BigInteger",
"weiValue",
",",
"String",
"funcName",
")",
"throws",
"TransactionException",
",",
"IOException",
"{",
"TransactionReceipt",
"receipt",
"=",
"send",
"(",
"contractAddress",
",",
"dat... | Given the duration required to execute a transaction.
@param data to send in transaction
@param weiValue in Wei to send in transaction
@return {@link Optional} containing our transaction receipt
@throws IOException if the call to the node fails
@throws TransactionException if the transaction was not m... | [
"Given",
"the",
"duration",
"required",
"to",
"execute",
"a",
"transaction",
"."
] | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/core/src/main/java/org/web3j/tx/Contract.java#L291-L309 |
16,833 | web3j/web3j | abi/src/main/java/org/web3j/abi/FunctionReturnDecoder.java | FunctionReturnDecoder.decode | public static List<Type> decode(
String rawInput, List<TypeReference<Type>> outputParameters) {
String input = Numeric.cleanHexPrefix(rawInput);
if (Strings.isEmpty(input)) {
return Collections.emptyList();
} else {
return build(input, outputParameters);
... | java | public static List<Type> decode(
String rawInput, List<TypeReference<Type>> outputParameters) {
String input = Numeric.cleanHexPrefix(rawInput);
if (Strings.isEmpty(input)) {
return Collections.emptyList();
} else {
return build(input, outputParameters);
... | [
"public",
"static",
"List",
"<",
"Type",
">",
"decode",
"(",
"String",
"rawInput",
",",
"List",
"<",
"TypeReference",
"<",
"Type",
">",
">",
"outputParameters",
")",
"{",
"String",
"input",
"=",
"Numeric",
".",
"cleanHexPrefix",
"(",
"rawInput",
")",
";",
... | Decode ABI encoded return values from smart contract function call.
@param rawInput ABI encoded input
@param outputParameters list of return types as {@link TypeReference}
@return {@link List} of values returned by function, {@link Collections#emptyList()} if
invalid response | [
"Decode",
"ABI",
"encoded",
"return",
"values",
"from",
"smart",
"contract",
"function",
"call",
"."
] | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/abi/src/main/java/org/web3j/abi/FunctionReturnDecoder.java#L36-L45 |
16,834 | web3j/web3j | core/src/main/java/org/web3j/ens/EnsResolver.java | EnsResolver.obtainPublicResolver | public PublicResolver obtainPublicResolver(String ensName) {
if (isValidEnsName(ensName)) {
try {
if (!isSynced()) {
throw new EnsResolutionException("Node is not currently synced");
} else {
return lookupResolver(ensName);
... | java | public PublicResolver obtainPublicResolver(String ensName) {
if (isValidEnsName(ensName)) {
try {
if (!isSynced()) {
throw new EnsResolutionException("Node is not currently synced");
} else {
return lookupResolver(ensName);
... | [
"public",
"PublicResolver",
"obtainPublicResolver",
"(",
"String",
"ensName",
")",
"{",
"if",
"(",
"isValidEnsName",
"(",
"ensName",
")",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"isSynced",
"(",
")",
")",
"{",
"throw",
"new",
"EnsResolutionException",
"(",
"... | Provides an access to a valid public resolver in order to access other API methods.
@param ensName our user input ENS name
@return PublicResolver | [
"Provides",
"an",
"access",
"to",
"a",
"valid",
"public",
"resolver",
"in",
"order",
"to",
"access",
"other",
"API",
"methods",
"."
] | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/core/src/main/java/org/web3j/ens/EnsResolver.java#L52-L67 |
16,835 | web3j/web3j | core/src/main/java/org/web3j/tx/Transfer.java | Transfer.sendFunds | public RemoteCall<TransactionReceipt> sendFunds(
String toAddress, BigDecimal value, Convert.Unit unit) {
return new RemoteCall<>(() -> send(toAddress, value, unit));
} | java | public RemoteCall<TransactionReceipt> sendFunds(
String toAddress, BigDecimal value, Convert.Unit unit) {
return new RemoteCall<>(() -> send(toAddress, value, unit));
} | [
"public",
"RemoteCall",
"<",
"TransactionReceipt",
">",
"sendFunds",
"(",
"String",
"toAddress",
",",
"BigDecimal",
"value",
",",
"Convert",
".",
"Unit",
"unit",
")",
"{",
"return",
"new",
"RemoteCall",
"<>",
"(",
"(",
")",
"->",
"send",
"(",
"toAddress",
... | Execute the provided function as a transaction asynchronously. This is intended for one-off
fund transfers. For multiple, create an instance.
@param toAddress destination address
@param value amount to send
@param unit of specified send
@return {@link RemoteCall} containing executing transaction | [
"Execute",
"the",
"provided",
"function",
"as",
"a",
"transaction",
"asynchronously",
".",
"This",
"is",
"intended",
"for",
"one",
"-",
"off",
"fund",
"transfers",
".",
"For",
"multiple",
"create",
"an",
"instance",
"."
] | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/core/src/main/java/org/web3j/tx/Transfer.java#L89-L92 |
16,836 | web3j/web3j | crypto/src/main/java/org/web3j/crypto/Sign.java | Sign.signedMessageToKey | public static BigInteger signedMessageToKey(
byte[] message, SignatureData signatureData) throws SignatureException {
return signedMessageHashToKey(Hash.sha3(message), signatureData);
} | java | public static BigInteger signedMessageToKey(
byte[] message, SignatureData signatureData) throws SignatureException {
return signedMessageHashToKey(Hash.sha3(message), signatureData);
} | [
"public",
"static",
"BigInteger",
"signedMessageToKey",
"(",
"byte",
"[",
"]",
"message",
",",
"SignatureData",
"signatureData",
")",
"throws",
"SignatureException",
"{",
"return",
"signedMessageHashToKey",
"(",
"Hash",
".",
"sha3",
"(",
"message",
")",
",",
"sign... | Given an arbitrary piece of text and an Ethereum message signature encoded in bytes,
returns the public key that was used to sign it. This can then be compared to the expected
public key to determine if the signature was correct.
@param message RLP encoded message.
@param signatureData The message signature components... | [
"Given",
"an",
"arbitrary",
"piece",
"of",
"text",
"and",
"an",
"Ethereum",
"message",
"signature",
"encoded",
"in",
"bytes",
"returns",
"the",
"public",
"key",
"that",
"was",
"used",
"to",
"sign",
"it",
".",
"This",
"can",
"then",
"be",
"compared",
"to",
... | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/crypto/src/main/java/org/web3j/crypto/Sign.java#L191-L194 |
16,837 | web3j/web3j | crypto/src/main/java/org/web3j/crypto/Sign.java | Sign.signedPrefixedMessageToKey | public static BigInteger signedPrefixedMessageToKey(
byte[] message, SignatureData signatureData) throws SignatureException {
return signedMessageHashToKey(getEthereumMessageHash(message), signatureData);
} | java | public static BigInteger signedPrefixedMessageToKey(
byte[] message, SignatureData signatureData) throws SignatureException {
return signedMessageHashToKey(getEthereumMessageHash(message), signatureData);
} | [
"public",
"static",
"BigInteger",
"signedPrefixedMessageToKey",
"(",
"byte",
"[",
"]",
"message",
",",
"SignatureData",
"signatureData",
")",
"throws",
"SignatureException",
"{",
"return",
"signedMessageHashToKey",
"(",
"getEthereumMessageHash",
"(",
"message",
")",
","... | Given an arbitrary message and an Ethereum message signature encoded in bytes,
returns the public key that was used to sign it. This can then be compared to the
expected public key to determine if the signature was correct.
@param message The message.
@param signatureData The message signature components
@return the p... | [
"Given",
"an",
"arbitrary",
"message",
"and",
"an",
"Ethereum",
"message",
"signature",
"encoded",
"in",
"bytes",
"returns",
"the",
"public",
"key",
"that",
"was",
"used",
"to",
"sign",
"it",
".",
"This",
"can",
"then",
"be",
"compared",
"to",
"the",
"expe... | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/crypto/src/main/java/org/web3j/crypto/Sign.java#L207-L210 |
16,838 | web3j/web3j | crypto/src/main/java/org/web3j/crypto/Sign.java | Sign.publicKeyFromPrivate | public static BigInteger publicKeyFromPrivate(BigInteger privKey) {
ECPoint point = publicPointFromPrivate(privKey);
byte[] encoded = point.getEncoded(false);
return new BigInteger(1, Arrays.copyOfRange(encoded, 1, encoded.length)); // remove prefix
} | java | public static BigInteger publicKeyFromPrivate(BigInteger privKey) {
ECPoint point = publicPointFromPrivate(privKey);
byte[] encoded = point.getEncoded(false);
return new BigInteger(1, Arrays.copyOfRange(encoded, 1, encoded.length)); // remove prefix
} | [
"public",
"static",
"BigInteger",
"publicKeyFromPrivate",
"(",
"BigInteger",
"privKey",
")",
"{",
"ECPoint",
"point",
"=",
"publicPointFromPrivate",
"(",
"privKey",
")",
";",
"byte",
"[",
"]",
"encoded",
"=",
"point",
".",
"getEncoded",
"(",
"false",
")",
";",... | Returns public key from the given private key.
@param privKey the private key to derive the public key from
@return BigInteger encoded public key | [
"Returns",
"public",
"key",
"from",
"the",
"given",
"private",
"key",
"."
] | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/crypto/src/main/java/org/web3j/crypto/Sign.java#L245-L250 |
16,839 | web3j/web3j | core/src/main/java/org/web3j/protocol/websocket/WebSocketService.java | WebSocketService.connect | public void connect() throws ConnectException {
try {
connectToWebSocket();
setWebSocketListener();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
log.warn("Interrupted while connecting via WebSocket protocol");
}
} | java | public void connect() throws ConnectException {
try {
connectToWebSocket();
setWebSocketListener();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
log.warn("Interrupted while connecting via WebSocket protocol");
}
} | [
"public",
"void",
"connect",
"(",
")",
"throws",
"ConnectException",
"{",
"try",
"{",
"connectToWebSocket",
"(",
")",
";",
"setWebSocketListener",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"Thread",
".",
"currentThread",
"(",
"... | Connect to a WebSocket server.
@throws ConnectException thrown if failed to connect to the server via WebSocket protocol | [
"Connect",
"to",
"a",
"WebSocket",
"server",
"."
] | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/core/src/main/java/org/web3j/protocol/websocket/WebSocketService.java#L92-L100 |
16,840 | web3j/web3j | utils/src/main/java/org/web3j/crypto/Hash.java | Hash.sha3String | public static String sha3String(String utf8String) {
return Numeric.toHexString(sha3(utf8String.getBytes(StandardCharsets.UTF_8)));
} | java | public static String sha3String(String utf8String) {
return Numeric.toHexString(sha3(utf8String.getBytes(StandardCharsets.UTF_8)));
} | [
"public",
"static",
"String",
"sha3String",
"(",
"String",
"utf8String",
")",
"{",
"return",
"Numeric",
".",
"toHexString",
"(",
"sha3",
"(",
"utf8String",
".",
"getBytes",
"(",
"StandardCharsets",
".",
"UTF_8",
")",
")",
")",
";",
"}"
] | Keccak-256 hash function that operates on a UTF-8 encoded String.
@param utf8String UTF-8 encoded string
@return hash value as hex encoded string | [
"Keccak",
"-",
"256",
"hash",
"function",
"that",
"operates",
"on",
"a",
"UTF",
"-",
"8",
"encoded",
"String",
"."
] | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/utils/src/main/java/org/web3j/crypto/Hash.java#L63-L65 |
16,841 | web3j/web3j | crypto/src/main/java/org/web3j/crypto/ECKeyPair.java | ECKeyPair.sign | public ECDSASignature sign(byte[] transactionHash) {
ECDSASigner signer = new ECDSASigner(new HMacDSAKCalculator(new SHA256Digest()));
ECPrivateKeyParameters privKey = new ECPrivateKeyParameters(privateKey, Sign.CURVE);
signer.init(true, privKey);
BigInteger[] components = signer.genera... | java | public ECDSASignature sign(byte[] transactionHash) {
ECDSASigner signer = new ECDSASigner(new HMacDSAKCalculator(new SHA256Digest()));
ECPrivateKeyParameters privKey = new ECPrivateKeyParameters(privateKey, Sign.CURVE);
signer.init(true, privKey);
BigInteger[] components = signer.genera... | [
"public",
"ECDSASignature",
"sign",
"(",
"byte",
"[",
"]",
"transactionHash",
")",
"{",
"ECDSASigner",
"signer",
"=",
"new",
"ECDSASigner",
"(",
"new",
"HMacDSAKCalculator",
"(",
"new",
"SHA256Digest",
"(",
")",
")",
")",
";",
"ECPrivateKeyParameters",
"privKey"... | Sign a hash with the private key of this key pair.
@param transactionHash the hash to sign
@return An {@link ECDSASignature} of the hash | [
"Sign",
"a",
"hash",
"with",
"the",
"private",
"key",
"of",
"this",
"key",
"pair",
"."
] | f99ceb19cdd65895c18e0a565034767ca18ea9fc | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/crypto/src/main/java/org/web3j/crypto/ECKeyPair.java#L41-L49 |
16,842 | lingochamp/okdownload | okdownload/src/main/java/com/liulishuo/okdownload/DownloadSerialQueue.java | DownloadSerialQueue.pause | public synchronized void pause() {
if (paused) {
Util.w(TAG, "require pause this queue(remain " + taskList.size() + "), but"
+ "it has already been paused");
return;
}
paused = true;
if (runningTask != null) {
runningTask.cancel();... | java | public synchronized void pause() {
if (paused) {
Util.w(TAG, "require pause this queue(remain " + taskList.size() + "), but"
+ "it has already been paused");
return;
}
paused = true;
if (runningTask != null) {
runningTask.cancel();... | [
"public",
"synchronized",
"void",
"pause",
"(",
")",
"{",
"if",
"(",
"paused",
")",
"{",
"Util",
".",
"w",
"(",
"TAG",
",",
"\"require pause this queue(remain \"",
"+",
"taskList",
".",
"size",
"(",
")",
"+",
"\"), but\"",
"+",
"\"it has already been paused\""... | Pause the queue.
@see #resume() | [
"Pause",
"the",
"queue",
"."
] | 403e2c814556ef7f2fade1f5bee83a02a5eaecb2 | https://github.com/lingochamp/okdownload/blob/403e2c814556ef7f2fade1f5bee83a02a5eaecb2/okdownload/src/main/java/com/liulishuo/okdownload/DownloadSerialQueue.java#L97-L110 |
16,843 | lingochamp/okdownload | okdownload/src/main/java/com/liulishuo/okdownload/DownloadSerialQueue.java | DownloadSerialQueue.resume | public synchronized void resume() {
if (!paused) {
Util.w(TAG, "require resume this queue(remain " + taskList.size() + "), but it is"
+ " still running");
return;
}
paused = false;
if (!taskList.isEmpty() && !looping) {
looping = t... | java | public synchronized void resume() {
if (!paused) {
Util.w(TAG, "require resume this queue(remain " + taskList.size() + "), but it is"
+ " still running");
return;
}
paused = false;
if (!taskList.isEmpty() && !looping) {
looping = t... | [
"public",
"synchronized",
"void",
"resume",
"(",
")",
"{",
"if",
"(",
"!",
"paused",
")",
"{",
"Util",
".",
"w",
"(",
"TAG",
",",
"\"require resume this queue(remain \"",
"+",
"taskList",
".",
"size",
"(",
")",
"+",
"\"), but it is\"",
"+",
"\" still running... | Resume the queue if the queue is paused.
@see #pause() | [
"Resume",
"the",
"queue",
"if",
"the",
"queue",
"is",
"paused",
"."
] | 403e2c814556ef7f2fade1f5bee83a02a5eaecb2 | https://github.com/lingochamp/okdownload/blob/403e2c814556ef7f2fade1f5bee83a02a5eaecb2/okdownload/src/main/java/com/liulishuo/okdownload/DownloadSerialQueue.java#L117-L129 |
16,844 | lingochamp/okdownload | okdownload/src/main/java/com/liulishuo/okdownload/core/breakpoint/BreakpointInfo.java | BreakpointInfo.copyWithReplaceIdAndUrl | public BreakpointInfo copyWithReplaceIdAndUrl(int replaceId, String newUrl) {
final BreakpointInfo info = new BreakpointInfo(replaceId, newUrl, parentFile,
filenameHolder.get(), taskOnlyProvidedParentPath);
info.chunked = this.chunked;
for (BlockInfo blockInfo : blockInfoList) {
... | java | public BreakpointInfo copyWithReplaceIdAndUrl(int replaceId, String newUrl) {
final BreakpointInfo info = new BreakpointInfo(replaceId, newUrl, parentFile,
filenameHolder.get(), taskOnlyProvidedParentPath);
info.chunked = this.chunked;
for (BlockInfo blockInfo : blockInfoList) {
... | [
"public",
"BreakpointInfo",
"copyWithReplaceIdAndUrl",
"(",
"int",
"replaceId",
",",
"String",
"newUrl",
")",
"{",
"final",
"BreakpointInfo",
"info",
"=",
"new",
"BreakpointInfo",
"(",
"replaceId",
",",
"newUrl",
",",
"parentFile",
",",
"filenameHolder",
".",
"get... | You can use this method to replace url for using breakpoint info from another task. | [
"You",
"can",
"use",
"this",
"method",
"to",
"replace",
"url",
"for",
"using",
"breakpoint",
"info",
"from",
"another",
"task",
"."
] | 403e2c814556ef7f2fade1f5bee83a02a5eaecb2 | https://github.com/lingochamp/okdownload/blob/403e2c814556ef7f2fade1f5bee83a02a5eaecb2/okdownload/src/main/java/com/liulishuo/okdownload/core/breakpoint/BreakpointInfo.java#L202-L210 |
16,845 | lingochamp/okdownload | okdownload/src/main/java/com/liulishuo/okdownload/DownloadTask.java | DownloadTask.getInfo | @Nullable public BreakpointInfo getInfo() {
if (info == null) info = OkDownload.with().breakpointStore().get(id);
return info;
} | java | @Nullable public BreakpointInfo getInfo() {
if (info == null) info = OkDownload.with().breakpointStore().get(id);
return info;
} | [
"@",
"Nullable",
"public",
"BreakpointInfo",
"getInfo",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"info",
"=",
"OkDownload",
".",
"with",
"(",
")",
".",
"breakpointStore",
"(",
")",
".",
"get",
"(",
"id",
")",
";",
"return",
"info",
";",
... | Get the breakpoint info of this task.
@return {@code null} Only if there isn't any info for this task yet, otherwise you can get
the info for the task. | [
"Get",
"the",
"breakpoint",
"info",
"of",
"this",
"task",
"."
] | 403e2c814556ef7f2fade1f5bee83a02a5eaecb2 | https://github.com/lingochamp/okdownload/blob/403e2c814556ef7f2fade1f5bee83a02a5eaecb2/okdownload/src/main/java/com/liulishuo/okdownload/DownloadTask.java#L429-L432 |
16,846 | lingochamp/okdownload | okdownload/src/main/java/com/liulishuo/okdownload/core/download/ConnectTrial.java | ConnectTrial.trialHeadMethodForInstanceLength | void trialHeadMethodForInstanceLength() throws IOException {
final DownloadConnection connection = OkDownload.with().connectionFactory()
.create(task.getUrl());
final DownloadListener listener = OkDownload.with().callbackDispatcher().dispatch();
try {
connection.setRe... | java | void trialHeadMethodForInstanceLength() throws IOException {
final DownloadConnection connection = OkDownload.with().connectionFactory()
.create(task.getUrl());
final DownloadListener listener = OkDownload.with().callbackDispatcher().dispatch();
try {
connection.setRe... | [
"void",
"trialHeadMethodForInstanceLength",
"(",
")",
"throws",
"IOException",
"{",
"final",
"DownloadConnection",
"connection",
"=",
"OkDownload",
".",
"with",
"(",
")",
".",
"connectionFactory",
"(",
")",
".",
"create",
"(",
"task",
".",
"getUrl",
"(",
")",
... | right one. | [
"right",
"one",
"."
] | 403e2c814556ef7f2fade1f5bee83a02a5eaecb2 | https://github.com/lingochamp/okdownload/blob/403e2c814556ef7f2fade1f5bee83a02a5eaecb2/okdownload/src/main/java/com/liulishuo/okdownload/core/download/ConnectTrial.java#L294-L313 |
16,847 | lingochamp/okdownload | okdownload/src/main/java/com/liulishuo/okdownload/DownloadContext.java | DownloadContext.start | public void start(@Nullable final DownloadListener listener, boolean isSerial) {
final long startTime = SystemClock.uptimeMillis();
Util.d(TAG, "start " + isSerial);
started = true;
final DownloadListener targetListener;
if (contextListener != null) {
targetListener =... | java | public void start(@Nullable final DownloadListener listener, boolean isSerial) {
final long startTime = SystemClock.uptimeMillis();
Util.d(TAG, "start " + isSerial);
started = true;
final DownloadListener targetListener;
if (contextListener != null) {
targetListener =... | [
"public",
"void",
"start",
"(",
"@",
"Nullable",
"final",
"DownloadListener",
"listener",
",",
"boolean",
"isSerial",
")",
"{",
"final",
"long",
"startTime",
"=",
"SystemClock",
".",
"uptimeMillis",
"(",
")",
";",
"Util",
".",
"d",
"(",
"TAG",
",",
"\"star... | Start queue.
@param listener the listener for each task, if you have already provided
{@link #contextListener}, it's accept {@code null} for each task's listener.
@param isSerial whether download queue serial or parallel. | [
"Start",
"queue",
"."
] | 403e2c814556ef7f2fade1f5bee83a02a5eaecb2 | https://github.com/lingochamp/okdownload/blob/403e2c814556ef7f2fade1f5bee83a02a5eaecb2/okdownload/src/main/java/com/liulishuo/okdownload/DownloadContext.java#L99-L133 |
16,848 | lingochamp/okdownload | okdownload-breakpoint-sqlite/src/main/java/com/liulishuo/okdownload/core/breakpoint/RemitStoreOnSQLite.java | RemitStoreOnSQLite.syncCacheToDB | @Override public void syncCacheToDB(List<Integer> idList) throws IOException {
final SQLiteDatabase database = sqLiteHelper.getWritableDatabase();
database.beginTransaction();
try {
for (Integer id : idList) {
syncCacheToDB(id);
}
database.setT... | java | @Override public void syncCacheToDB(List<Integer> idList) throws IOException {
final SQLiteDatabase database = sqLiteHelper.getWritableDatabase();
database.beginTransaction();
try {
for (Integer id : idList) {
syncCacheToDB(id);
}
database.setT... | [
"@",
"Override",
"public",
"void",
"syncCacheToDB",
"(",
"List",
"<",
"Integer",
">",
"idList",
")",
"throws",
"IOException",
"{",
"final",
"SQLiteDatabase",
"database",
"=",
"sqLiteHelper",
".",
"getWritableDatabase",
"(",
")",
";",
"database",
".",
"beginTrans... | following accept database operation what is controlled by helper. | [
"following",
"accept",
"database",
"operation",
"what",
"is",
"controlled",
"by",
"helper",
"."
] | 403e2c814556ef7f2fade1f5bee83a02a5eaecb2 | https://github.com/lingochamp/okdownload/blob/403e2c814556ef7f2fade1f5bee83a02a5eaecb2/okdownload-breakpoint-sqlite/src/main/java/com/liulishuo/okdownload/core/breakpoint/RemitStoreOnSQLite.java#L142-L153 |
16,849 | lingochamp/okdownload | okdownload/src/main/java/com/liulishuo/okdownload/SpeedCalculator.java | SpeedCalculator.getBytesPerSecondAndFlush | public synchronized long getBytesPerSecondAndFlush() {
final long interval = nowMillis() - timestamp;
if (interval < 1000 && bytesPerSecond != 0) return bytesPerSecond;
// the first time we using 500 milliseconds to let speed valid more quick
if (bytesPerSecond == 0 && interval < 500) r... | java | public synchronized long getBytesPerSecondAndFlush() {
final long interval = nowMillis() - timestamp;
if (interval < 1000 && bytesPerSecond != 0) return bytesPerSecond;
// the first time we using 500 milliseconds to let speed valid more quick
if (bytesPerSecond == 0 && interval < 500) r... | [
"public",
"synchronized",
"long",
"getBytesPerSecondAndFlush",
"(",
")",
"{",
"final",
"long",
"interval",
"=",
"nowMillis",
"(",
")",
"-",
"timestamp",
";",
"if",
"(",
"interval",
"<",
"1000",
"&&",
"bytesPerSecond",
"!=",
"0",
")",
"return",
"bytesPerSecond"... | Get bytes per-second and only if duration is greater than or equal to 1 second will flush and
re-calculate speed. | [
"Get",
"bytes",
"per",
"-",
"second",
"and",
"only",
"if",
"duration",
"is",
"greater",
"than",
"or",
"equal",
"to",
"1",
"second",
"will",
"flush",
"and",
"re",
"-",
"calculate",
"speed",
"."
] | 403e2c814556ef7f2fade1f5bee83a02a5eaecb2 | https://github.com/lingochamp/okdownload/blob/403e2c814556ef7f2fade1f5bee83a02a5eaecb2/okdownload/src/main/java/com/liulishuo/okdownload/SpeedCalculator.java#L83-L91 |
16,850 | lingochamp/okdownload | okdownload-filedownloader/src/main/java/com/liulishuo/filedownloader/notification/FileDownloadNotificationHelper.java | FileDownloadNotificationHelper.showProgress | public void showProgress(final int id, final int sofar, final int total) {
final T notification = get(id);
if (notification == null) {
return;
}
notification.updateStatus(FileDownloadStatus.progress);
notification.update(sofar, total);
} | java | public void showProgress(final int id, final int sofar, final int total) {
final T notification = get(id);
if (notification == null) {
return;
}
notification.updateStatus(FileDownloadStatus.progress);
notification.update(sofar, total);
} | [
"public",
"void",
"showProgress",
"(",
"final",
"int",
"id",
",",
"final",
"int",
"sofar",
",",
"final",
"int",
"total",
")",
"{",
"final",
"T",
"notification",
"=",
"get",
"(",
"id",
")",
";",
"if",
"(",
"notification",
"==",
"null",
")",
"{",
"retu... | Show the notification with the exact progress.
@param id The download id.
@param sofar The downloaded bytes so far.
@param total The total bytes of this task. | [
"Show",
"the",
"notification",
"with",
"the",
"exact",
"progress",
"."
] | 403e2c814556ef7f2fade1f5bee83a02a5eaecb2 | https://github.com/lingochamp/okdownload/blob/403e2c814556ef7f2fade1f5bee83a02a5eaecb2/okdownload-filedownloader/src/main/java/com/liulishuo/filedownloader/notification/FileDownloadNotificationHelper.java#L79-L88 |
16,851 | lingochamp/okdownload | okdownload-filedownloader/src/main/java/com/liulishuo/filedownloader/notification/FileDownloadNotificationHelper.java | FileDownloadNotificationHelper.showIndeterminate | public void showIndeterminate(final int id, int status) {
final BaseNotificationItem notification = get(id);
if (notification == null) {
return;
}
notification.updateStatus(status);
notification.show(false);
} | java | public void showIndeterminate(final int id, int status) {
final BaseNotificationItem notification = get(id);
if (notification == null) {
return;
}
notification.updateStatus(status);
notification.show(false);
} | [
"public",
"void",
"showIndeterminate",
"(",
"final",
"int",
"id",
",",
"int",
"status",
")",
"{",
"final",
"BaseNotificationItem",
"notification",
"=",
"get",
"(",
"id",
")",
";",
"if",
"(",
"notification",
"==",
"null",
")",
"{",
"return",
";",
"}",
"no... | Show the notification with indeterminate progress.
@param id The download id.
@param status {@link FileDownloadStatus} | [
"Show",
"the",
"notification",
"with",
"indeterminate",
"progress",
"."
] | 403e2c814556ef7f2fade1f5bee83a02a5eaecb2 | https://github.com/lingochamp/okdownload/blob/403e2c814556ef7f2fade1f5bee83a02a5eaecb2/okdownload-filedownloader/src/main/java/com/liulishuo/filedownloader/notification/FileDownloadNotificationHelper.java#L96-L105 |
16,852 | lingochamp/okdownload | okdownload-filedownloader/src/main/java/com/liulishuo/filedownloader/notification/FileDownloadNotificationHelper.java | FileDownloadNotificationHelper.cancel | public void cancel(final int id) {
final BaseNotificationItem notification = remove(id);
if (notification == null) {
return;
}
notification.cancel();
} | java | public void cancel(final int id) {
final BaseNotificationItem notification = remove(id);
if (notification == null) {
return;
}
notification.cancel();
} | [
"public",
"void",
"cancel",
"(",
"final",
"int",
"id",
")",
"{",
"final",
"BaseNotificationItem",
"notification",
"=",
"remove",
"(",
"id",
")",
";",
"if",
"(",
"notification",
"==",
"null",
")",
"{",
"return",
";",
"}",
"notification",
".",
"cancel",
"(... | Cancel the notification by notification id.
@param id The download id. | [
"Cancel",
"the",
"notification",
"by",
"notification",
"id",
"."
] | 403e2c814556ef7f2fade1f5bee83a02a5eaecb2 | https://github.com/lingochamp/okdownload/blob/403e2c814556ef7f2fade1f5bee83a02a5eaecb2/okdownload-filedownloader/src/main/java/com/liulishuo/filedownloader/notification/FileDownloadNotificationHelper.java#L112-L120 |
16,853 | lingochamp/okdownload | okdownload-filedownloader/src/main/java/com/liulishuo/filedownloader/FileDownloadList.java | FileDownloadList.addQueueTask | void addQueueTask(final DownloadTaskAdapter task) {
if (task.isMarkedAdded2List()) {
Util.w(TAG, "queue task: " + task + " has been marked");
return;
}
synchronized (list) {
task.markAdded2List();
task.assembleDownloadTask();
list.add(... | java | void addQueueTask(final DownloadTaskAdapter task) {
if (task.isMarkedAdded2List()) {
Util.w(TAG, "queue task: " + task + " has been marked");
return;
}
synchronized (list) {
task.markAdded2List();
task.assembleDownloadTask();
list.add(... | [
"void",
"addQueueTask",
"(",
"final",
"DownloadTaskAdapter",
"task",
")",
"{",
"if",
"(",
"task",
".",
"isMarkedAdded2List",
"(",
")",
")",
"{",
"Util",
".",
"w",
"(",
"TAG",
",",
"\"queue task: \"",
"+",
"task",
"+",
"\" has been marked\"",
")",
";",
"ret... | This method generally used for enqueuing the task which will be assembled by a queue.
@see BaseDownloadTask.InQueueTask#enqueue() | [
"This",
"method",
"generally",
"used",
"for",
"enqueuing",
"the",
"task",
"which",
"will",
"be",
"assembled",
"by",
"a",
"queue",
"."
] | 403e2c814556ef7f2fade1f5bee83a02a5eaecb2 | https://github.com/lingochamp/okdownload/blob/403e2c814556ef7f2fade1f5bee83a02a5eaecb2/okdownload-filedownloader/src/main/java/com/liulishuo/filedownloader/FileDownloadList.java#L112-L124 |
16,854 | powermock/powermock | powermock-modules/powermock-module-javaagent/src/main/java/sun/tools/attach/LinuxVirtualMachine.java | LinuxVirtualMachine.findSocketFile | private String findSocketFile(int pid) {
File f = new File(tmpdir, ".java_pid" + pid);
if (!f.exists()) {
return null;
}
return f.getPath();
} | java | private String findSocketFile(int pid) {
File f = new File(tmpdir, ".java_pid" + pid);
if (!f.exists()) {
return null;
}
return f.getPath();
} | [
"private",
"String",
"findSocketFile",
"(",
"int",
"pid",
")",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"tmpdir",
",",
"\".java_pid\"",
"+",
"pid",
")",
";",
"if",
"(",
"!",
"f",
".",
"exists",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"r... | Return the socket file for the given process. | [
"Return",
"the",
"socket",
"file",
"for",
"the",
"given",
"process",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-modules/powermock-module-javaagent/src/main/java/sun/tools/attach/LinuxVirtualMachine.java#L272-L278 |
16,855 | powermock/powermock | powermock-modules/powermock-module-javaagent/src/main/java/sun/tools/attach/LinuxVirtualMachine.java | LinuxVirtualMachine.createAttachFile | private File createAttachFile(int pid) throws IOException {
String fn = ".attach_pid" + pid;
String path = "/proc/" + pid + "/cwd/" + fn;
File f = new File(path);
try {
f.createNewFile();
} catch (IOException x) {
f = new File(tmpdir, fn);
f.cr... | java | private File createAttachFile(int pid) throws IOException {
String fn = ".attach_pid" + pid;
String path = "/proc/" + pid + "/cwd/" + fn;
File f = new File(path);
try {
f.createNewFile();
} catch (IOException x) {
f = new File(tmpdir, fn);
f.cr... | [
"private",
"File",
"createAttachFile",
"(",
"int",
"pid",
")",
"throws",
"IOException",
"{",
"String",
"fn",
"=",
"\".attach_pid\"",
"+",
"pid",
";",
"String",
"path",
"=",
"\"/proc/\"",
"+",
"pid",
"+",
"\"/cwd/\"",
"+",
"fn",
";",
"File",
"f",
"=",
"ne... | checks for the file. | [
"checks",
"for",
"the",
"file",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-modules/powermock-module-javaagent/src/main/java/sun/tools/attach/LinuxVirtualMachine.java#L284-L295 |
16,856 | powermock/powermock | powermock-core/src/main/java/org/powermock/core/MockRepository.java | MockRepository.clear | public synchronized static void clear() {
newSubstitutions.clear();
classMocks.clear();
instanceMocks.clear();
objectsToAutomaticallyReplayAndVerify.clear();
additionalState.clear();
suppressConstructor.clear();
suppressMethod.clear();
substituteReturnValues.clear();
suppressField.clear();
suppressF... | java | public synchronized static void clear() {
newSubstitutions.clear();
classMocks.clear();
instanceMocks.clear();
objectsToAutomaticallyReplayAndVerify.clear();
additionalState.clear();
suppressConstructor.clear();
suppressMethod.clear();
substituteReturnValues.clear();
suppressField.clear();
suppressF... | [
"public",
"synchronized",
"static",
"void",
"clear",
"(",
")",
"{",
"newSubstitutions",
".",
"clear",
"(",
")",
";",
"classMocks",
".",
"clear",
"(",
")",
";",
"instanceMocks",
".",
"clear",
"(",
")",
";",
"objectsToAutomaticallyReplayAndVerify",
".",
"clear",... | Clear all state of the mock repository except for static initializers.
The reason for not clearing static initializers is that when running in a
suite with many tests the clear method is invoked after each test. This
means that before the test that needs to suppress the static initializer
has been reach the state of th... | [
"Clear",
"all",
"state",
"of",
"the",
"mock",
"repository",
"except",
"for",
"static",
"initializers",
".",
"The",
"reason",
"for",
"not",
"clearing",
"static",
"initializers",
"is",
"that",
"when",
"running",
"in",
"a",
"suite",
"with",
"many",
"tests",
"th... | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-core/src/main/java/org/powermock/core/MockRepository.java#L112-L128 |
16,857 | powermock/powermock | powermock-core/src/main/java/org/powermock/core/MockRepository.java | MockRepository.remove | public static void remove(Object mock) {
if (mock instanceof Class<?>) {
if (newSubstitutions.containsKey(mock)) {
newSubstitutions.remove(mock);
}
if (classMocks.containsKey(mock)) {
classMocks.remove(mock);
}
} else if (instanceMocks.containsKey(mock)) {
instanceMocks.remove(mock);
}
} | java | public static void remove(Object mock) {
if (mock instanceof Class<?>) {
if (newSubstitutions.containsKey(mock)) {
newSubstitutions.remove(mock);
}
if (classMocks.containsKey(mock)) {
classMocks.remove(mock);
}
} else if (instanceMocks.containsKey(mock)) {
instanceMocks.remove(mock);
}
} | [
"public",
"static",
"void",
"remove",
"(",
"Object",
"mock",
")",
"{",
"if",
"(",
"mock",
"instanceof",
"Class",
"<",
"?",
">",
")",
"{",
"if",
"(",
"newSubstitutions",
".",
"containsKey",
"(",
"mock",
")",
")",
"{",
"newSubstitutions",
".",
"remove",
... | Removes an object from the MockRepository if it exists. | [
"Removes",
"an",
"object",
"from",
"the",
"MockRepository",
"if",
"it",
"exists",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-core/src/main/java/org/powermock/core/MockRepository.java#L133-L144 |
16,858 | powermock/powermock | powermock-core/src/main/java/org/powermock/core/MockRepository.java | MockRepository.putAdditionalState | public static synchronized Object putAdditionalState(String key, Object value) {
return additionalState.put(key, value);
} | java | public static synchronized Object putAdditionalState(String key, Object value) {
return additionalState.put(key, value);
} | [
"public",
"static",
"synchronized",
"Object",
"putAdditionalState",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"return",
"additionalState",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | When a mock framework API needs to store additional state not applicable
for the other methods, it may use this method to do so.
@param key
The key under which the <tt>value</tt> is stored.
@param value
The value to store under the specified <tt>key</tt>.
@return The previous object under the specified <tt>key</tt> or... | [
"When",
"a",
"mock",
"framework",
"API",
"needs",
"to",
"store",
"additional",
"state",
"not",
"applicable",
"for",
"the",
"other",
"methods",
"it",
"may",
"use",
"this",
"method",
"to",
"do",
"so",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-core/src/main/java/org/powermock/core/MockRepository.java#L240-L242 |
16,859 | powermock/powermock | powermock-core/src/main/java/org/powermock/core/MockRepository.java | MockRepository.getAdditionalState | @SuppressWarnings("unchecked")
public static synchronized <T> T getAdditionalState(String key) {
return (T) additionalState.get(key);
} | java | @SuppressWarnings("unchecked")
public static synchronized <T> T getAdditionalState(String key) {
return (T) additionalState.get(key);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"getAdditionalState",
"(",
"String",
"key",
")",
"{",
"return",
"(",
"T",
")",
"additionalState",
".",
"get",
"(",
"key",
")",
";",
"}"
] | Retrieve state based on the supplied key. | [
"Retrieve",
"state",
"based",
"on",
"the",
"supplied",
"key",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-core/src/main/java/org/powermock/core/MockRepository.java#L255-L258 |
16,860 | powermock/powermock | powermock-core/src/main/java/org/powermock/core/MockRepository.java | MockRepository.putMethodProxy | public static synchronized InvocationHandler putMethodProxy(Method method, InvocationHandler invocationHandler) {
return methodProxies.put(method, invocationHandler);
} | java | public static synchronized InvocationHandler putMethodProxy(Method method, InvocationHandler invocationHandler) {
return methodProxies.put(method, invocationHandler);
} | [
"public",
"static",
"synchronized",
"InvocationHandler",
"putMethodProxy",
"(",
"Method",
"method",
",",
"InvocationHandler",
"invocationHandler",
")",
"{",
"return",
"methodProxies",
".",
"put",
"(",
"method",
",",
"invocationHandler",
")",
";",
"}"
] | Set a proxy for a method. Whenever this method is called the invocation
handler will be invoked instead.
@return The method proxy if any. | [
"Set",
"a",
"proxy",
"for",
"a",
"method",
".",
"Whenever",
"this",
"method",
"is",
"called",
"the",
"invocation",
"handler",
"will",
"be",
"invoked",
"instead",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-core/src/main/java/org/powermock/core/MockRepository.java#L381-L383 |
16,861 | powermock/powermock | powermock-core/src/main/java/org/powermock/core/transformers/javassist/support/PowerMockExpressionEditor.java | PowerMockExpressionEditor.addNewDeferConstructor | private void addNewDeferConstructor(final CtClass clazz) throws CannotCompileException {
final CtClass superClass;
try {
superClass = clazz.getSuperclass();
} catch (NotFoundException e1) {
throw new IllegalArgumentException("Internal error: Failed to get superclass for "... | java | private void addNewDeferConstructor(final CtClass clazz) throws CannotCompileException {
final CtClass superClass;
try {
superClass = clazz.getSuperclass();
} catch (NotFoundException e1) {
throw new IllegalArgumentException("Internal error: Failed to get superclass for "... | [
"private",
"void",
"addNewDeferConstructor",
"(",
"final",
"CtClass",
"clazz",
")",
"throws",
"CannotCompileException",
"{",
"final",
"CtClass",
"superClass",
";",
"try",
"{",
"superClass",
"=",
"clazz",
".",
"getSuperclass",
"(",
")",
";",
"}",
"catch",
"(",
... | Create a defer constructor in the class which will be called when the
constructor is suppressed.
@param clazz The class whose super constructor will get a new defer
constructor if it doesn't already have one.
@throws CannotCompileException If an unexpected compilation error occurs. | [
"Create",
"a",
"defer",
"constructor",
"in",
"the",
"class",
"which",
"will",
"be",
"called",
"when",
"the",
"constructor",
"is",
"suppressed",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-core/src/main/java/org/powermock/core/transformers/javassist/support/PowerMockExpressionEditor.java#L210-L246 |
16,862 | powermock/powermock | powermock-modules/powermock-module-junit4/src/main/java/org/powermock/modules/junit4/PowerMockRunner.java | PowerMockRunner.run | @Override
public void run(RunNotifier notifier) {
Description description = getDescription();
try {
super.run(notifier);
} finally {
try {
Whitebox.setInternalState(description, "fAnnotations", new Annotation[]{});
} catch (RuntimeException ... | java | @Override
public void run(RunNotifier notifier) {
Description description = getDescription();
try {
super.run(notifier);
} finally {
try {
Whitebox.setInternalState(description, "fAnnotations", new Annotation[]{});
} catch (RuntimeException ... | [
"@",
"Override",
"public",
"void",
"run",
"(",
"RunNotifier",
"notifier",
")",
"{",
"Description",
"description",
"=",
"getDescription",
"(",
")",
";",
"try",
"{",
"super",
".",
"run",
"(",
"notifier",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"Whitebox... | Clean up some state to avoid OOM issues | [
"Clean",
"up",
"some",
"state",
"to",
"avoid",
"OOM",
"issues"
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-modules/powermock-module-junit4/src/main/java/org/powermock/modules/junit4/PowerMockRunner.java#L55-L72 |
16,863 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.getField | @SuppressWarnings({"unchecked", "rawtypes"})
public static Field getField(Class<?> type, String fieldName) {
LinkedList<Class<?>> examine = new LinkedList<Class<?>>();
examine.add(type);
Set<Class<?>> done = new HashSet<Class<?>>();
while (!examine.isEmpty()) {
Class<?> t... | java | @SuppressWarnings({"unchecked", "rawtypes"})
public static Field getField(Class<?> type, String fieldName) {
LinkedList<Class<?>> examine = new LinkedList<Class<?>>();
examine.add(type);
Set<Class<?>> done = new HashSet<Class<?>>();
while (!examine.isEmpty()) {
Class<?> t... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"static",
"Field",
"getField",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"fieldName",
")",
"{",
"LinkedList",
"<",
"Class",
"<",
"?",
">",
">",
"examin... | Convenience method to get a field from a class type.
The method will first try to look for a declared field in the same class.
If the method is not declared in this class it will look for the field in
the super class. This will continue throughout the whole class hierarchy.
If the field is not found an {@link IllegalA... | [
"Convenience",
"method",
"to",
"get",
"a",
"field",
"from",
"a",
"class",
"type",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L198-L225 |
16,864 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.newInstance | @SuppressWarnings("unchecked")
public static <T> T newInstance(Class<T> classToInstantiate) {
int modifiers = classToInstantiate.getModifiers();
final Object object;
if (Modifier.isInterface(modifiers)) {
object = Proxy.newProxyInstance(WhiteboxImpl.class.getClassLoader(), new C... | java | @SuppressWarnings("unchecked")
public static <T> T newInstance(Class<T> classToInstantiate) {
int modifiers = classToInstantiate.getModifiers();
final Object object;
if (Modifier.isInterface(modifiers)) {
object = Proxy.newProxyInstance(WhiteboxImpl.class.getClassLoader(), new C... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Class",
"<",
"T",
">",
"classToInstantiate",
")",
"{",
"int",
"modifiers",
"=",
"classToInstantiate",
".",
"getModifiers",
"(",
")",
";",
"final"... | Create a new instance of a class without invoking its constructor.
No byte-code manipulation is needed to perform this operation and thus
it's not necessary use the {@code PowerMockRunner} or
{@code PrepareForTest} annotation to use this functionality.
@param <T> The type of the instance to create.
@pa... | [
"Create",
"a",
"new",
"instance",
"of",
"a",
"class",
"without",
"invoking",
"its",
"constructor",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L239-L263 |
16,865 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.setInternalState | public static void setInternalState(Object object, String fieldName, Object value, Class<?> where) {
if (object == null || fieldName == null || fieldName.equals("") || fieldName.startsWith(" ")) {
throw new IllegalArgumentException("object, field name, and \"where\" must not be empty or null.");
... | java | public static void setInternalState(Object object, String fieldName, Object value, Class<?> where) {
if (object == null || fieldName == null || fieldName.equals("") || fieldName.startsWith(" ")) {
throw new IllegalArgumentException("object, field name, and \"where\" must not be empty or null.");
... | [
"public",
"static",
"void",
"setInternalState",
"(",
"Object",
"object",
",",
"String",
"fieldName",
",",
"Object",
"value",
",",
"Class",
"<",
"?",
">",
"where",
")",
"{",
"if",
"(",
"object",
"==",
"null",
"||",
"fieldName",
"==",
"null",
"||",
"fieldN... | Set the value of a field using reflection. Use this method when you need
to specify in which class the field is declared. This is useful if you
have two fields in a class hierarchy that has the same name but you like
to modify the latter.
@param object the object to modify
@param fieldName the name of the field
@pa... | [
"Set",
"the",
"value",
"of",
"a",
"field",
"using",
"reflection",
".",
"Use",
"this",
"method",
"when",
"you",
"need",
"to",
"specify",
"in",
"which",
"class",
"the",
"field",
"is",
"declared",
".",
"This",
"is",
"useful",
"if",
"you",
"have",
"two",
"... | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L399-L410 |
16,866 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.findField | private static Field findField(Object object, FieldMatcherStrategy strategy, Class<?> where) {
return findSingleFieldUsingStrategy(strategy, object, false, where);
} | java | private static Field findField(Object object, FieldMatcherStrategy strategy, Class<?> where) {
return findSingleFieldUsingStrategy(strategy, object, false, where);
} | [
"private",
"static",
"Field",
"findField",
"(",
"Object",
"object",
",",
"FieldMatcherStrategy",
"strategy",
",",
"Class",
"<",
"?",
">",
"where",
")",
"{",
"return",
"findSingleFieldUsingStrategy",
"(",
"strategy",
",",
"object",
",",
"false",
",",
"where",
"... | Find field.
@param object the object
@param strategy the strategy
@param where the where
@return the field | [
"Find",
"field",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L465-L467 |
16,867 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.findAllFieldsUsingStrategy | private static Set<Field> findAllFieldsUsingStrategy(FieldMatcherStrategy strategy, Object object,
boolean checkHierarchy, Class<?> startClass) {
assertObjectInGetInternalStateIsNotNull(object);
final Set<Field> foundFields = new LinkedHashSet<Fie... | java | private static Set<Field> findAllFieldsUsingStrategy(FieldMatcherStrategy strategy, Object object,
boolean checkHierarchy, Class<?> startClass) {
assertObjectInGetInternalStateIsNotNull(object);
final Set<Field> foundFields = new LinkedHashSet<Fie... | [
"private",
"static",
"Set",
"<",
"Field",
">",
"findAllFieldsUsingStrategy",
"(",
"FieldMatcherStrategy",
"strategy",
",",
"Object",
"object",
",",
"boolean",
"checkHierarchy",
",",
"Class",
"<",
"?",
">",
"startClass",
")",
"{",
"assertObjectInGetInternalStateIsNotNu... | Find all fields using strategy.
@param strategy the strategy
@param object the object
@param checkHierarchy the check hierarchy
@param startClass the start class
@return the set | [
"Find",
"all",
"fields",
"using",
"strategy",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L516-L541 |
16,868 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.invokeMethod | @SuppressWarnings("unchecked")
public static synchronized <T> T invokeMethod(Object tested, Object... arguments) throws Exception {
return (T) doInvokeMethod(tested, null, null, arguments);
} | java | @SuppressWarnings("unchecked")
public static synchronized <T> T invokeMethod(Object tested, Object... arguments) throws Exception {
return (T) doInvokeMethod(tested, null, null, arguments);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"invokeMethod",
"(",
"Object",
"tested",
",",
"Object",
"...",
"arguments",
")",
"throws",
"Exception",
"{",
"return",
"(",
"T",
")",
"doInvokeMethod",
... | Invoke a private or inner class method without the need to specify the
method name. This is thus a more refactor friendly version of the
@param <T> the generic type
@param tested the tested
@param arguments the arguments
@return the t
@throws Exception the exception
{@link #invokeMethod(Object, String, Object... | [
"Invoke",
"a",
"private",
"or",
"inner",
"class",
"method",
"without",
"the",
"need",
"to",
"specify",
"the",
"method",
"name",
".",
"This",
"is",
"thus",
"a",
"more",
"refactor",
"friendly",
"version",
"of",
"the"
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L644-L647 |
16,869 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.invokeMethod | @SuppressWarnings("unchecked")
public static synchronized <T> T invokeMethod(Object tested, Class<?> declaringClass, String methodToExecute,
Object... arguments) throws Exception {
return (T) doInvokeMethod(tested, declaringClass, methodToExecute, arguments)... | java | @SuppressWarnings("unchecked")
public static synchronized <T> T invokeMethod(Object tested, Class<?> declaringClass, String methodToExecute,
Object... arguments) throws Exception {
return (T) doInvokeMethod(tested, declaringClass, methodToExecute, arguments)... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"invokeMethod",
"(",
"Object",
"tested",
",",
"Class",
"<",
"?",
">",
"declaringClass",
",",
"String",
"methodToExecute",
",",
"Object",
"...",
"argumen... | Invoke a private or inner class method in that is located in a subclass
of the tested instance. This might be useful to test private methods.
@param <T> the generic type
@param tested the tested
@param declaringClass the declaring class
@param methodToExecute the method to execute
@param argument... | [
"Invoke",
"a",
"private",
"or",
"inner",
"class",
"method",
"in",
"that",
"is",
"located",
"in",
"a",
"subclass",
"of",
"the",
"tested",
"instance",
".",
"This",
"might",
"be",
"useful",
"to",
"test",
"private",
"methods",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L747-L751 |
16,870 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.invokeMethod | @SuppressWarnings("unchecked")
public static synchronized <T> T invokeMethod(Object object, Class<?> declaringClass, String methodToExecute,
Class<?>[] parameterTypes, Object... arguments) throws Exception {
if (object == null) {
throw new Illega... | java | @SuppressWarnings("unchecked")
public static synchronized <T> T invokeMethod(Object object, Class<?> declaringClass, String methodToExecute,
Class<?>[] parameterTypes, Object... arguments) throws Exception {
if (object == null) {
throw new Illega... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"invokeMethod",
"(",
"Object",
"object",
",",
"Class",
"<",
"?",
">",
"declaringClass",
",",
"String",
"methodToExecute",
",",
"Class",
"<",
"?",
">",... | Invoke a private method in that is located in a subclass of an instance.
This might be useful to test overloaded private methods.
Use this for overloaded methods only, if possible use
@param <T> the generic type
@param object the object
@param declaringClass the declaring class
@param methodToEx... | [
"Invoke",
"a",
"private",
"method",
"in",
"that",
"is",
"located",
"in",
"a",
"subclass",
"of",
"an",
"instance",
".",
"This",
"might",
"be",
"useful",
"to",
"test",
"overloaded",
"private",
"methods",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L770-L780 |
16,871 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.doInvokeMethod | @SuppressWarnings("unchecked")
private static <T> T doInvokeMethod(Object tested, Class<?> declaringClass, String methodToExecute,
Object... arguments) throws Exception {
Method methodToInvoke = findMethodOrThrowException(tested, declaringClass, methodToExecute, argum... | java | @SuppressWarnings("unchecked")
private static <T> T doInvokeMethod(Object tested, Class<?> declaringClass, String methodToExecute,
Object... arguments) throws Exception {
Method methodToInvoke = findMethodOrThrowException(tested, declaringClass, methodToExecute, argum... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"<",
"T",
">",
"T",
"doInvokeMethod",
"(",
"Object",
"tested",
",",
"Class",
"<",
"?",
">",
"declaringClass",
",",
"String",
"methodToExecute",
",",
"Object",
"...",
"arguments",
")",
"... | Do invoke method.
@param <T> the generic type
@param tested the tested
@param declaringClass the declaring class
@param methodToExecute the method to execute
@param arguments the arguments
@return the t
@throws Exception the exception | [
"Do",
"invoke",
"method",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L810-L817 |
16,872 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.findMethodOrThrowException | public static Method findMethodOrThrowException(Object tested, Class<?> declaringClass, String methodToExecute,
Object[] arguments){
if (tested == null) {
throw new IllegalArgumentException("The object to perform the operation on cannot be null.");... | java | public static Method findMethodOrThrowException(Object tested, Class<?> declaringClass, String methodToExecute,
Object[] arguments){
if (tested == null) {
throw new IllegalArgumentException("The object to perform the operation on cannot be null.");... | [
"public",
"static",
"Method",
"findMethodOrThrowException",
"(",
"Object",
"tested",
",",
"Class",
"<",
"?",
">",
"declaringClass",
",",
"String",
"methodToExecute",
",",
"Object",
"[",
"]",
"arguments",
")",
"{",
"if",
"(",
"tested",
"==",
"null",
")",
"{",... | Finds and returns a certain method. If the method couldn't be found this
method delegates to
@param tested The instance or class containing the method.
@param declaringClass The class where the method is supposed to be declared (may be
{@code null}).
@param methodToExecute The method name. If {@code null} th... | [
"Finds",
"and",
"returns",
"a",
"certain",
"method",
".",
"If",
"the",
"method",
"couldn",
"t",
"be",
"found",
"this",
"method",
"delegates",
"to"
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L834-L922 |
16,873 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.getTypes | private static Class<?>[] getTypes(Object[] arguments) {
Class<?>[] classes = new Class<?>[arguments.length];
for (int i = 0; i < arguments.length; i++) {
classes[i] = getType(arguments[i]);
}
return classes;
} | java | private static Class<?>[] getTypes(Object[] arguments) {
Class<?>[] classes = new Class<?>[arguments.length];
for (int i = 0; i < arguments.length; i++) {
classes[i] = getType(arguments[i]);
}
return classes;
} | [
"private",
"static",
"Class",
"<",
"?",
">",
"[",
"]",
"getTypes",
"(",
"Object",
"[",
"]",
"arguments",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"classes",
"=",
"new",
"Class",
"<",
"?",
">",
"[",
"arguments",
".",
"length",
"]",
";",
"for",
... | Gets the types.
@param arguments the arguments
@return the types | [
"Gets",
"the",
"types",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L975-L981 |
16,874 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.getBestMethodCandidate | public static Method getBestMethodCandidate(Class<?> cls, String methodName, Class<?>[] signature,
boolean exactParameterTypeMatch) {
final Method foundMethod;
final Method[] methods = getMethods(cls, methodName, signature, exactParameterTypeMatch);
... | java | public static Method getBestMethodCandidate(Class<?> cls, String methodName, Class<?>[] signature,
boolean exactParameterTypeMatch) {
final Method foundMethod;
final Method[] methods = getMethods(cls, methodName, signature, exactParameterTypeMatch);
... | [
"public",
"static",
"Method",
"getBestMethodCandidate",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"signature",
",",
"boolean",
"exactParameterTypeMatch",
")",
"{",
"final",
"Method",
"foundMethod",
... | Gets the best method candidate.
@param cls the cls
@param methodName the method name
@param signature the signature
@param exactParameterTypeMatch {@code true} if the {@code expectedTypes} must match
the parameter types must match exactly, {@code false} if
the {@code expe... | [
"Gets",
"the",
"best",
"method",
"candidate",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L996-L1008 |
16,875 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.filterPowerMockConstructor | static Constructor<?>[] filterPowerMockConstructor(Constructor<?>[] declaredConstructors) {
Set<Constructor<?>> constructors = new HashSet<Constructor<?>>();
for (Constructor<?> constructor : declaredConstructors) {
final Class<?>[] parameterTypes = constructor.getParameterTypes();
... | java | static Constructor<?>[] filterPowerMockConstructor(Constructor<?>[] declaredConstructors) {
Set<Constructor<?>> constructors = new HashSet<Constructor<?>>();
for (Constructor<?> constructor : declaredConstructors) {
final Class<?>[] parameterTypes = constructor.getParameterTypes();
... | [
"static",
"Constructor",
"<",
"?",
">",
"[",
"]",
"filterPowerMockConstructor",
"(",
"Constructor",
"<",
"?",
">",
"[",
"]",
"declaredConstructors",
")",
"{",
"Set",
"<",
"Constructor",
"<",
"?",
">",
">",
"constructors",
"=",
"new",
"HashSet",
"<",
"Const... | Filter power mock constructor.
@param declaredConstructors the declared constructors
@return the constructor[] | [
"Filter",
"power",
"mock",
"constructor",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1055-L1068 |
16,876 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.findUniqueConstructorOrThrowException | public static Constructor<?> findUniqueConstructorOrThrowException(Class<?> type, Object... arguments) {
return new ConstructorFinder(type, arguments).findConstructor();
} | java | public static Constructor<?> findUniqueConstructorOrThrowException(Class<?> type, Object... arguments) {
return new ConstructorFinder(type, arguments).findConstructor();
} | [
"public",
"static",
"Constructor",
"<",
"?",
">",
"findUniqueConstructorOrThrowException",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Object",
"...",
"arguments",
")",
"{",
"return",
"new",
"ConstructorFinder",
"(",
"type",
",",
"arguments",
")",
".",
"findCon... | Finds and returns a certain constructor. If the constructor couldn't be
found this method delegates to
@param type The type where the constructor should be located.
@param arguments The arguments passed to the constructor.
@return The found constructor.
@throws ConstructorNotFoundException if no constructor was f... | [
"Finds",
"and",
"returns",
"a",
"certain",
"constructor",
".",
"If",
"the",
"constructor",
"couldn",
"t",
"be",
"found",
"this",
"method",
"delegates",
"to"
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1081-L1083 |
16,877 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.convertArgumentTypesToPrimitive | private static Class<?>[] convertArgumentTypesToPrimitive(Class<?>[] paramTypes, Object[] arguments) {
Class<?>[] types = new Class<?>[arguments.length];
for (int i = 0; i < arguments.length; i++) {
Class<?> argumentType = null;
if (arguments[i] == null) {
argumen... | java | private static Class<?>[] convertArgumentTypesToPrimitive(Class<?>[] paramTypes, Object[] arguments) {
Class<?>[] types = new Class<?>[arguments.length];
for (int i = 0; i < arguments.length; i++) {
Class<?> argumentType = null;
if (arguments[i] == null) {
argumen... | [
"private",
"static",
"Class",
"<",
"?",
">",
"[",
"]",
"convertArgumentTypesToPrimitive",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
"paramTypes",
",",
"Object",
"[",
"]",
"arguments",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"types",
"=",
"new",
"Cla... | Convert argument types to primitive.
@param paramTypes the param types
@param arguments the arguments
@return the class[] | [
"Convert",
"argument",
"types",
"to",
"primitive",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1092-L1109 |
16,878 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.throwExceptionIfMethodWasNotFound | public static void throwExceptionIfMethodWasNotFound(Class<?> type, String methodName, Method methodToMock,
Object... arguments) {
if (methodToMock == null) {
String methodNameData = "";
if (methodName != null) {
me... | java | public static void throwExceptionIfMethodWasNotFound(Class<?> type, String methodName, Method methodToMock,
Object... arguments) {
if (methodToMock == null) {
String methodNameData = "";
if (methodName != null) {
me... | [
"public",
"static",
"void",
"throwExceptionIfMethodWasNotFound",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"methodName",
",",
"Method",
"methodToMock",
",",
"Object",
"...",
"arguments",
")",
"{",
"if",
"(",
"methodToMock",
"==",
"null",
")",
"{",
... | Throw exception if method was not found.
@param type the type
@param methodName the method name
@param methodToMock the method to mock
@param arguments the arguments | [
"Throw",
"exception",
"if",
"method",
"was",
"not",
"found",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1119-L1130 |
16,879 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.throwExceptionIfConstructorWasNotFound | static void throwExceptionIfConstructorWasNotFound(Class<?> type, Constructor<?> potentialConstructor,
Object... arguments) {
if (potentialConstructor == null) {
String message = "No constructor found in class '" + getOriginalUnmockedType(type).... | java | static void throwExceptionIfConstructorWasNotFound(Class<?> type, Constructor<?> potentialConstructor,
Object... arguments) {
if (potentialConstructor == null) {
String message = "No constructor found in class '" + getOriginalUnmockedType(type).... | [
"static",
"void",
"throwExceptionIfConstructorWasNotFound",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Constructor",
"<",
"?",
">",
"potentialConstructor",
",",
"Object",
"...",
"arguments",
")",
"{",
"if",
"(",
"potentialConstructor",
"==",
"null",
")",
"{",
... | Throw exception if constructor was not found.
@param type the type
@param potentialConstructor the potential constructor
@param arguments the arguments | [
"Throw",
"exception",
"if",
"constructor",
"was",
"not",
"found",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1153-L1160 |
16,880 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.getArgumentTypesAsString | static String getArgumentTypesAsString(Object... arguments) {
StringBuilder argumentsAsString = new StringBuilder();
final String noParameters = "<none>";
if (arguments != null && arguments.length != 0) {
for (int i = 0; i < arguments.length; i++) {
String argumentNam... | java | static String getArgumentTypesAsString(Object... arguments) {
StringBuilder argumentsAsString = new StringBuilder();
final String noParameters = "<none>";
if (arguments != null && arguments.length != 0) {
for (int i = 0; i < arguments.length; i++) {
String argumentNam... | [
"static",
"String",
"getArgumentTypesAsString",
"(",
"Object",
"...",
"arguments",
")",
"{",
"StringBuilder",
"argumentsAsString",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"String",
"noParameters",
"=",
"\"<none>\"",
";",
"if",
"(",
"arguments",
"!=",
... | Gets the argument types as string.
@param arguments the arguments
@return the argument types as string | [
"Gets",
"the",
"argument",
"types",
"as",
"string",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1168-L1201 |
16,881 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.appendArgument | private static void appendArgument(StringBuilder argumentsAsString, int index, String argumentName,
Object[] arguments) {
argumentsAsString.append(argumentName);
if (index != arguments.length - 1) {
argumentsAsString.append(", ");
}
} | java | private static void appendArgument(StringBuilder argumentsAsString, int index, String argumentName,
Object[] arguments) {
argumentsAsString.append(argumentName);
if (index != arguments.length - 1) {
argumentsAsString.append(", ");
}
} | [
"private",
"static",
"void",
"appendArgument",
"(",
"StringBuilder",
"argumentsAsString",
",",
"int",
"index",
",",
"String",
"argumentName",
",",
"Object",
"[",
"]",
"arguments",
")",
"{",
"argumentsAsString",
".",
"append",
"(",
"argumentName",
")",
";",
"if",... | Append argument.
@param argumentsAsString the arguments as string
@param index the index
@param argumentName the argument name
@param arguments the arguments | [
"Append",
"argument",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1211-L1217 |
16,882 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.invokeConstructor | public static <T> T invokeConstructor(Class<T> classThatContainsTheConstructorToTest, Object... arguments)
throws Exception {
if (classThatContainsTheConstructorToTest == null) {
throw new IllegalArgumentException("The class should contain the constructor cannot be null.");
}
... | java | public static <T> T invokeConstructor(Class<T> classThatContainsTheConstructorToTest, Object... arguments)
throws Exception {
if (classThatContainsTheConstructorToTest == null) {
throw new IllegalArgumentException("The class should contain the constructor cannot be null.");
}
... | [
"public",
"static",
"<",
"T",
">",
"T",
"invokeConstructor",
"(",
"Class",
"<",
"T",
">",
"classThatContainsTheConstructorToTest",
",",
"Object",
"...",
"arguments",
")",
"throws",
"Exception",
"{",
"if",
"(",
"classThatContainsTheConstructorToTest",
"==",
"null",
... | Invoke a constructor. Useful for testing classes with a private
constructor.
@param <T> the generic type
@param classThatContainsTheConstructorToTest the class that contains the constructor to test
@param arguments the arguments
@return The object created a... | [
"Invoke",
"a",
"constructor",
".",
"Useful",
"for",
"testing",
"classes",
"with",
"a",
"private",
"constructor",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1275-L1297 |
16,883 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.getPotentialVarArgsConstructor | @SuppressWarnings("unchecked")
private static <T> Constructor<T> getPotentialVarArgsConstructor(Class<T> classThatContainsTheConstructorToTest,
Object... arguments) {
Constructor<T>[] declaredConstructors = (Constructor<T>[]) classThatCont... | java | @SuppressWarnings("unchecked")
private static <T> Constructor<T> getPotentialVarArgsConstructor(Class<T> classThatContainsTheConstructorToTest,
Object... arguments) {
Constructor<T>[] declaredConstructors = (Constructor<T>[]) classThatCont... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"<",
"T",
">",
"Constructor",
"<",
"T",
">",
"getPotentialVarArgsConstructor",
"(",
"Class",
"<",
"T",
">",
"classThatContainsTheConstructorToTest",
",",
"Object",
"...",
"arguments",
")",
"{... | Gets the potential var args constructor.
@param <T> the generic type
@param classThatContainsTheConstructorToTest the class that contains the constructor to test
@param arguments the arguments
@return the potential var args constructor | [
"Gets",
"the",
"potential",
"var",
"args",
"constructor",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1366-L1385 |
16,884 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.createInstance | private static <T> T createInstance(Constructor<T> constructor, Object... arguments) throws Exception {
if (constructor == null) {
throw new IllegalArgumentException("Constructor cannot be null");
}
constructor.setAccessible(true);
T createdObject = null;
try {
... | java | private static <T> T createInstance(Constructor<T> constructor, Object... arguments) throws Exception {
if (constructor == null) {
throw new IllegalArgumentException("Constructor cannot be null");
}
constructor.setAccessible(true);
T createdObject = null;
try {
... | [
"private",
"static",
"<",
"T",
">",
"T",
"createInstance",
"(",
"Constructor",
"<",
"T",
">",
"constructor",
",",
"Object",
"...",
"arguments",
")",
"throws",
"Exception",
"{",
"if",
"(",
"constructor",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgum... | Creates the instance.
@param <T> the generic type
@param constructor the constructor
@param arguments the arguments
@return the t
@throws Exception the exception | [
"Creates",
"the",
"instance",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1396-L1425 |
16,885 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.createAndPopulateVarArgsArray | private static Object createAndPopulateVarArgsArray(Class<?> varArgsType, int varArgsStartPosition,
Object... arguments) {
Object arrayInstance = Array.newInstance(varArgsType, arguments.length - varArgsStartPosition);
for (int i = varArgsStartPosi... | java | private static Object createAndPopulateVarArgsArray(Class<?> varArgsType, int varArgsStartPosition,
Object... arguments) {
Object arrayInstance = Array.newInstance(varArgsType, arguments.length - varArgsStartPosition);
for (int i = varArgsStartPosi... | [
"private",
"static",
"Object",
"createAndPopulateVarArgsArray",
"(",
"Class",
"<",
"?",
">",
"varArgsType",
",",
"int",
"varArgsStartPosition",
",",
"Object",
"...",
"arguments",
")",
"{",
"Object",
"arrayInstance",
"=",
"Array",
".",
"newInstance",
"(",
"varArgsT... | Creates the and populate var args array.
@param varArgsType the var args type
@param varArgsStartPosition the var args start position
@param arguments the arguments
@return the object | [
"Creates",
"the",
"and",
"populate",
"var",
"args",
"array",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1435-L1442 |
16,886 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.throwExceptionWhenMultipleMethodMatchesFound | static void throwExceptionWhenMultipleMethodMatchesFound(String helpInfo, Method[] methods) {
if (methods == null || methods.length < 2) {
throw new IllegalArgumentException(
"Internal error: throwExceptionWhenMultipleMethodMatchesFound needs at ... | java | static void throwExceptionWhenMultipleMethodMatchesFound(String helpInfo, Method[] methods) {
if (methods == null || methods.length < 2) {
throw new IllegalArgumentException(
"Internal error: throwExceptionWhenMultipleMethodMatchesFound needs at ... | [
"static",
"void",
"throwExceptionWhenMultipleMethodMatchesFound",
"(",
"String",
"helpInfo",
",",
"Method",
"[",
"]",
"methods",
")",
"{",
"if",
"(",
"methods",
"==",
"null",
"||",
"methods",
".",
"length",
"<",
"2",
")",
"{",
"throw",
"new",
"IllegalArgumentE... | Throw exception when multiple method matches found.
@param helpInfo the help info
@param methods the methods | [
"Throw",
"exception",
"when",
"multiple",
"method",
"matches",
"found",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1660-L1681 |
16,887 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.throwExceptionWhenMultipleConstructorMatchesFound | static void throwExceptionWhenMultipleConstructorMatchesFound(Constructor<?>[] constructors) {
if (constructors == null || constructors.length < 2) {
throw new IllegalArgumentException(
"Internal error: throwExceptionWhenMultipleConstructorMatche... | java | static void throwExceptionWhenMultipleConstructorMatchesFound(Constructor<?>[] constructors) {
if (constructors == null || constructors.length < 2) {
throw new IllegalArgumentException(
"Internal error: throwExceptionWhenMultipleConstructorMatche... | [
"static",
"void",
"throwExceptionWhenMultipleConstructorMatchesFound",
"(",
"Constructor",
"<",
"?",
">",
"[",
"]",
"constructors",
")",
"{",
"if",
"(",
"constructors",
"==",
"null",
"||",
"constructors",
".",
"length",
"<",
"2",
")",
"{",
"throw",
"new",
"Ill... | Throw exception when multiple constructor matches found.
@param constructors the constructors | [
"Throw",
"exception",
"when",
"multiple",
"constructor",
"matches",
"found",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1688-L1707 |
16,888 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.findMethodOrThrowException | @SuppressWarnings("all")
public static Method findMethodOrThrowException(Class<?> type, String methodName, Class<?>... parameterTypes) {
Method methodToMock = findMethod(type, methodName, parameterTypes);
throwExceptionIfMethodWasNotFound(type, methodName, methodToMock, (Object[]) parameterTypes);
... | java | @SuppressWarnings("all")
public static Method findMethodOrThrowException(Class<?> type, String methodName, Class<?>... parameterTypes) {
Method methodToMock = findMethod(type, methodName, parameterTypes);
throwExceptionIfMethodWasNotFound(type, methodName, methodToMock, (Object[]) parameterTypes);
... | [
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"public",
"static",
"Method",
"findMethodOrThrowException",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"Method",
"methodToMock"... | Find method or throw exception.
@param type the type
@param methodName the method name
@param parameterTypes the parameter types
@return the method | [
"Find",
"method",
"or",
"throw",
"exception",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1717-L1722 |
16,889 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.performMethodInvocation | @SuppressWarnings("unchecked")
public static <T> T performMethodInvocation(Object tested, Method methodToInvoke, Object... arguments)
throws Exception {
final boolean accessible = methodToInvoke.isAccessible();
if (!accessible) {
methodToInvoke.setAccessible(true);
}
... | java | @SuppressWarnings("unchecked")
public static <T> T performMethodInvocation(Object tested, Method methodToInvoke, Object... arguments)
throws Exception {
final boolean accessible = methodToInvoke.isAccessible();
if (!accessible) {
methodToInvoke.setAccessible(true);
}
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"performMethodInvocation",
"(",
"Object",
"tested",
",",
"Method",
"methodToInvoke",
",",
"Object",
"...",
"arguments",
")",
"throws",
"Exception",
"{",
"final",
"boolean... | Perform method invocation.
@param <T> the generic type
@param tested the tested
@param methodToInvoke the method to invoke
@param arguments the arguments
@return the t
@throws Exception the exception | [
"Perform",
"method",
"invocation",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1836-L1870 |
16,890 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.getAllMethodExcept | public static <T> Method[] getAllMethodExcept(Class<T> type, String... methodNames) {
List<Method> methodsToMock = new LinkedList<Method>();
Method[] methods = getAllMethods(type);
iterateMethods:
for (Method method : methods) {
for (String methodName : methodNames) {
... | java | public static <T> Method[] getAllMethodExcept(Class<T> type, String... methodNames) {
List<Method> methodsToMock = new LinkedList<Method>();
Method[] methods = getAllMethods(type);
iterateMethods:
for (Method method : methods) {
for (String methodName : methodNames) {
... | [
"public",
"static",
"<",
"T",
">",
"Method",
"[",
"]",
"getAllMethodExcept",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"...",
"methodNames",
")",
"{",
"List",
"<",
"Method",
">",
"methodsToMock",
"=",
"new",
"LinkedList",
"<",
"Method",
">",
... | Gets the all method except.
@param <T> the generic type
@param type the type
@param methodNames the method names
@return the all method except | [
"Gets",
"the",
"all",
"method",
"except",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1880-L1893 |
16,891 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.getAllMethodsExcept | public static <T> Method[] getAllMethodsExcept(Class<T> type, String methodNameToExclude, Class<?>[] argumentTypes) {
Method[] methods = getAllMethods(type);
List<Method> methodList = new ArrayList<Method>();
outer:
for (Method method : methods) {
if (method.getName().equals(... | java | public static <T> Method[] getAllMethodsExcept(Class<T> type, String methodNameToExclude, Class<?>[] argumentTypes) {
Method[] methods = getAllMethods(type);
List<Method> methodList = new ArrayList<Method>();
outer:
for (Method method : methods) {
if (method.getName().equals(... | [
"public",
"static",
"<",
"T",
">",
"Method",
"[",
"]",
"getAllMethodsExcept",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"methodNameToExclude",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"argumentTypes",
")",
"{",
"Method",
"[",
"]",
"methods",
"=... | Gets the all metods except.
@param <T> the generic type
@param type the type
@param methodNameToExclude the method name to exclude
@param argumentTypes the argument types
@return the all metods except | [
"Gets",
"the",
"all",
"metods",
"except",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1904-L1931 |
16,892 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.areAllMethodsStatic | public static boolean areAllMethodsStatic(Method... methods) {
for (Method method : methods) {
if (!Modifier.isStatic(method.getModifiers())) {
return false;
}
}
return true;
} | java | public static boolean areAllMethodsStatic(Method... methods) {
for (Method method : methods) {
if (!Modifier.isStatic(method.getModifiers())) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"areAllMethodsStatic",
"(",
"Method",
"...",
"methods",
")",
"{",
"for",
"(",
"Method",
"method",
":",
"methods",
")",
"{",
"if",
"(",
"!",
"Modifier",
".",
"isStatic",
"(",
"method",
".",
"getModifiers",
"(",
")",
")",
")"... | Are all methods static.
@param methods the methods
@return true, if successful | [
"Are",
"all",
"methods",
"static",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1939-L1946 |
16,893 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.areAllArgumentsOfSameType | static boolean areAllArgumentsOfSameType(Object[] arguments) {
if (arguments == null || arguments.length <= 1) {
return true;
}
// Handle null values
int index = 0;
Object object = null;
while (object == null && index < arguments.length) {
object ... | java | static boolean areAllArgumentsOfSameType(Object[] arguments) {
if (arguments == null || arguments.length <= 1) {
return true;
}
// Handle null values
int index = 0;
Object object = null;
while (object == null && index < arguments.length) {
object ... | [
"static",
"boolean",
"areAllArgumentsOfSameType",
"(",
"Object",
"[",
"]",
"arguments",
")",
"{",
"if",
"(",
"arguments",
"==",
"null",
"||",
"arguments",
".",
"length",
"<=",
"1",
")",
"{",
"return",
"true",
";",
"}",
"// Handle null values",
"int",
"index"... | Check if all arguments are of the same type.
@param arguments the arguments
@return true, if successful | [
"Check",
"if",
"all",
"arguments",
"are",
"of",
"the",
"same",
"type",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1954-L1980 |
16,894 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.checkArgumentTypesMatchParameterTypes | static boolean checkArgumentTypesMatchParameterTypes(boolean isVarArgs, Class<?>[] parameterTypes,
Object[] arguments) {
if (parameterTypes == null) {
throw new IllegalArgumentException("parameter types cannot be null");
} else... | java | static boolean checkArgumentTypesMatchParameterTypes(boolean isVarArgs, Class<?>[] parameterTypes,
Object[] arguments) {
if (parameterTypes == null) {
throw new IllegalArgumentException("parameter types cannot be null");
} else... | [
"static",
"boolean",
"checkArgumentTypesMatchParameterTypes",
"(",
"boolean",
"isVarArgs",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
",",
"Object",
"[",
"]",
"arguments",
")",
"{",
"if",
"(",
"parameterTypes",
"==",
"null",
")",
"{",
"throw",
... | Check argument types match parameter types.
@param isVarArgs If the last parameter is a var args.
@param parameterTypes the parameter types
@param arguments the arguments
@return if all actual parameter types are assignable from the expected
arguments, otherwise. | [
"Check",
"argument",
"types",
"match",
"parameter",
"types",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1991-L2029 |
16,895 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.getInnerClassType | @SuppressWarnings("unchecked")
public static Class<Object> getInnerClassType(Class<?> declaringClass, String name) throws ClassNotFoundException {
return (Class<Object>) Class.forName(declaringClass.getName() + "$" + name);
} | java | @SuppressWarnings("unchecked")
public static Class<Object> getInnerClassType(Class<?> declaringClass, String name) throws ClassNotFoundException {
return (Class<Object>) Class.forName(declaringClass.getName() + "$" + name);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Class",
"<",
"Object",
">",
"getInnerClassType",
"(",
"Class",
"<",
"?",
">",
"declaringClass",
",",
"String",
"name",
")",
"throws",
"ClassNotFoundException",
"{",
"return",
"(",
"Class",
... | Get an inner class type.
@param declaringClass The class in which the inner class is declared.
@param name The unqualified name (simple name) of the inner class.
@return The type.
@throws ClassNotFoundException the class not found exception | [
"Get",
"an",
"inner",
"class",
"type",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L2093-L2096 |
16,896 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.getAllInstanceFields | public static Set<Field> getAllInstanceFields(Object object) {
return findAllFieldsUsingStrategy(new AllFieldsMatcherStrategy(), object, true, getUnproxyType(object));
} | java | public static Set<Field> getAllInstanceFields(Object object) {
return findAllFieldsUsingStrategy(new AllFieldsMatcherStrategy(), object, true, getUnproxyType(object));
} | [
"public",
"static",
"Set",
"<",
"Field",
">",
"getAllInstanceFields",
"(",
"Object",
"object",
")",
"{",
"return",
"findAllFieldsUsingStrategy",
"(",
"new",
"AllFieldsMatcherStrategy",
"(",
")",
",",
"object",
",",
"true",
",",
"getUnproxyType",
"(",
"object",
"... | Get all instance fields for a particular object. It returns all fields
regardless of the field modifier and regardless of where in the class
hierarchy a field is located.
@param object The object whose instance fields to get.
@return All instance fields in the hierarchy. All fields are set to
accessible | [
"Get",
"all",
"instance",
"fields",
"for",
"a",
"particular",
"object",
".",
"It",
"returns",
"all",
"fields",
"regardless",
"of",
"the",
"field",
"modifier",
"and",
"regardless",
"of",
"where",
"in",
"the",
"class",
"hierarchy",
"a",
"field",
"is",
"located... | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L2201-L2203 |
16,897 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.getAllStaticFields | public static Set<Field> getAllStaticFields(Class<?> type) {
final Set<Field> fields = new LinkedHashSet<Field>();
final Field[] declaredFields = type.getDeclaredFields();
for (Field field : declaredFields) {
if (Modifier.isStatic(field.getModifiers())) {
field.setAcc... | java | public static Set<Field> getAllStaticFields(Class<?> type) {
final Set<Field> fields = new LinkedHashSet<Field>();
final Field[] declaredFields = type.getDeclaredFields();
for (Field field : declaredFields) {
if (Modifier.isStatic(field.getModifiers())) {
field.setAcc... | [
"public",
"static",
"Set",
"<",
"Field",
">",
"getAllStaticFields",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"final",
"Set",
"<",
"Field",
">",
"fields",
"=",
"new",
"LinkedHashSet",
"<",
"Field",
">",
"(",
")",
";",
"final",
"Field",
"[",
"]",... | Get all static fields for a particular type.
@param type The class whose static fields to get.
@return All static fields in . All fields are set to accessible. | [
"Get",
"all",
"static",
"fields",
"for",
"a",
"particular",
"type",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L2211-L2221 |
16,898 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.checkIfParameterTypesAreSame | public static boolean checkIfParameterTypesAreSame(boolean isVarArgs, Class<?>[] expectedParameterTypes,
Class<?>[] actualParameterTypes) {
return new ParameterTypesMatcher(isVarArgs, expectedParameterTypes, actualParameterTypes).match();
} | java | public static boolean checkIfParameterTypesAreSame(boolean isVarArgs, Class<?>[] expectedParameterTypes,
Class<?>[] actualParameterTypes) {
return new ParameterTypesMatcher(isVarArgs, expectedParameterTypes, actualParameterTypes).match();
} | [
"public",
"static",
"boolean",
"checkIfParameterTypesAreSame",
"(",
"boolean",
"isVarArgs",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"expectedParameterTypes",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"actualParameterTypes",
")",
"{",
"return",
"new",
"ParameterTypes... | Check if parameter types are same.
@param isVarArgs Whether or not the method or constructor contains var args.
@param expectedParameterTypes the expected parameter types
@param actualParameterTypes the actual parameter types
@return if all actual parameter types are assignable from the expected
paramet... | [
"Check",
"if",
"parameter",
"types",
"are",
"same",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L2242-L2245 |
16,899 | powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.findFieldOrThrowException | private static Field findFieldOrThrowException(Class<?> fieldType, Class<?> where) {
if (fieldType == null || where == null) {
throw new IllegalArgumentException("fieldType and where cannot be null");
}
Field field = null;
for (Field currentField : where.getDeclaredFields()) ... | java | private static Field findFieldOrThrowException(Class<?> fieldType, Class<?> where) {
if (fieldType == null || where == null) {
throw new IllegalArgumentException("fieldType and where cannot be null");
}
Field field = null;
for (Field currentField : where.getDeclaredFields()) ... | [
"private",
"static",
"Field",
"findFieldOrThrowException",
"(",
"Class",
"<",
"?",
">",
"fieldType",
",",
"Class",
"<",
"?",
">",
"where",
")",
"{",
"if",
"(",
"fieldType",
"==",
"null",
"||",
"where",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgu... | Find field or throw exception.
@param fieldType the field type
@param where the where
@return the field | [
"Find",
"field",
"or",
"throw",
"exception",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L2277-L2293 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.