repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
alexvasilkov/Events | library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java | Dispatcher.handleUnRegistration | @MainThread
private void handleUnRegistration(Object targetObj) {
if (targetObj == null) {
throw new NullPointerException("Target cannot be null");
}
EventTarget target = null;
for (Iterator<EventTarget> iterator = targets.iterator(); iterator.hasNext(); ) {
EventTarget listTarget = iterator.next();
if (listTarget.targetObj == targetObj) {
iterator.remove();
target = listTarget;
target.targetObj = null;
break;
}
}
if (target == null) {
Utils.logE(targetObj, "Was not registered");
}
Utils.log(targetObj, "Unregistered");
} | java | @MainThread
private void handleUnRegistration(Object targetObj) {
if (targetObj == null) {
throw new NullPointerException("Target cannot be null");
}
EventTarget target = null;
for (Iterator<EventTarget> iterator = targets.iterator(); iterator.hasNext(); ) {
EventTarget listTarget = iterator.next();
if (listTarget.targetObj == targetObj) {
iterator.remove();
target = listTarget;
target.targetObj = null;
break;
}
}
if (target == null) {
Utils.logE(targetObj, "Was not registered");
}
Utils.log(targetObj, "Unregistered");
} | [
"@",
"MainThread",
"private",
"void",
"handleUnRegistration",
"(",
"Object",
"targetObj",
")",
"{",
"if",
"(",
"targetObj",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Target cannot be null\"",
")",
";",
"}",
"EventTarget",
"target",
... | Handles target un-registration | [
"Handles",
"target",
"un",
"-",
"registration"
] | 4208e11fab35d99229fe6c3b3d434ca1948f3fc5 | https://github.com/alexvasilkov/Events/blob/4208e11fab35d99229fe6c3b3d434ca1948f3fc5/library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java#L191-L214 | train |
alexvasilkov/Events | library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java | Dispatcher.handleEventPost | @MainThread
private void handleEventPost(Event event) {
Utils.log(event.getKey(), "Handling posted event");
int sizeBefore = executionQueue.size();
scheduleStatusUpdates(event, EventStatus.STARTED);
scheduleSubscribersInvocation(event);
if (((EventBase) event).handlersCount == 0) {
Utils.log(event.getKey(), "No subscribers found");
// Removing all scheduled STARTED status callbacks
while (executionQueue.size() > sizeBefore) {
executionQueue.removeLast();
}
} else {
activeEvents.add(event);
executeTasks(false);
}
} | java | @MainThread
private void handleEventPost(Event event) {
Utils.log(event.getKey(), "Handling posted event");
int sizeBefore = executionQueue.size();
scheduleStatusUpdates(event, EventStatus.STARTED);
scheduleSubscribersInvocation(event);
if (((EventBase) event).handlersCount == 0) {
Utils.log(event.getKey(), "No subscribers found");
// Removing all scheduled STARTED status callbacks
while (executionQueue.size() > sizeBefore) {
executionQueue.removeLast();
}
} else {
activeEvents.add(event);
executeTasks(false);
}
} | [
"@",
"MainThread",
"private",
"void",
"handleEventPost",
"(",
"Event",
"event",
")",
"{",
"Utils",
".",
"log",
"(",
"event",
".",
"getKey",
"(",
")",
",",
"\"Handling posted event\"",
")",
";",
"int",
"sizeBefore",
"=",
"executionQueue",
".",
"size",
"(",
... | Handles event posting | [
"Handles",
"event",
"posting"
] | 4208e11fab35d99229fe6c3b3d434ca1948f3fc5 | https://github.com/alexvasilkov/Events/blob/4208e11fab35d99229fe6c3b3d434ca1948f3fc5/library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java#L217-L236 | train |
alexvasilkov/Events | library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java | Dispatcher.handleEventResult | @MainThread
private void handleEventResult(Event event, EventResult result) {
if (!activeEvents.contains(event)) {
Utils.logE(event.getKey(), "Cannot send result of finished event");
return;
}
scheduleResultCallbacks(event, result);
executeTasks(false);
} | java | @MainThread
private void handleEventResult(Event event, EventResult result) {
if (!activeEvents.contains(event)) {
Utils.logE(event.getKey(), "Cannot send result of finished event");
return;
}
scheduleResultCallbacks(event, result);
executeTasks(false);
} | [
"@",
"MainThread",
"private",
"void",
"handleEventResult",
"(",
"Event",
"event",
",",
"EventResult",
"result",
")",
"{",
"if",
"(",
"!",
"activeEvents",
".",
"contains",
"(",
"event",
")",
")",
"{",
"Utils",
".",
"logE",
"(",
"event",
".",
"getKey",
"("... | Handles event result | [
"Handles",
"event",
"result"
] | 4208e11fab35d99229fe6c3b3d434ca1948f3fc5 | https://github.com/alexvasilkov/Events/blob/4208e11fab35d99229fe6c3b3d434ca1948f3fc5/library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java#L239-L248 | train |
alexvasilkov/Events | library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java | Dispatcher.handleEventFailure | @MainThread
private void handleEventFailure(Event event, EventFailure failure) {
if (!activeEvents.contains(event)) {
Utils.logE(event.getKey(), "Cannot send failure callback of finished event");
return;
}
scheduleFailureCallbacks(event, failure);
executeTasks(false);
} | java | @MainThread
private void handleEventFailure(Event event, EventFailure failure) {
if (!activeEvents.contains(event)) {
Utils.logE(event.getKey(), "Cannot send failure callback of finished event");
return;
}
scheduleFailureCallbacks(event, failure);
executeTasks(false);
} | [
"@",
"MainThread",
"private",
"void",
"handleEventFailure",
"(",
"Event",
"event",
",",
"EventFailure",
"failure",
")",
"{",
"if",
"(",
"!",
"activeEvents",
".",
"contains",
"(",
"event",
")",
")",
"{",
"Utils",
".",
"logE",
"(",
"event",
".",
"getKey",
... | Handles event failure | [
"Handles",
"event",
"failure"
] | 4208e11fab35d99229fe6c3b3d434ca1948f3fc5 | https://github.com/alexvasilkov/Events/blob/4208e11fab35d99229fe6c3b3d434ca1948f3fc5/library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java#L251-L260 | train |
alexvasilkov/Events | library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java | Dispatcher.handleTaskFinished | @MainThread
private void handleTaskFinished(Task task) {
if (task.method.type != EventMethod.Type.SUBSCRIBE) {
// We are not interested in finished callbacks, only finished subscriber calls
return;
}
if (task.method.isSingleThread) {
Utils.log(task, "Single-thread method is no longer in use");
task.method.isInUse = false;
}
Event event = task.event;
if (!activeEvents.contains(event)) {
Utils.logE(event.getKey(), "Cannot finish already finished event");
return;
}
((EventBase) event).handlersCount--;
if (((EventBase) event).handlersCount == 0) {
// No more running handlers
activeEvents.remove(event);
scheduleStatusUpdates(event, EventStatus.FINISHED);
executeTasks(false);
}
} | java | @MainThread
private void handleTaskFinished(Task task) {
if (task.method.type != EventMethod.Type.SUBSCRIBE) {
// We are not interested in finished callbacks, only finished subscriber calls
return;
}
if (task.method.isSingleThread) {
Utils.log(task, "Single-thread method is no longer in use");
task.method.isInUse = false;
}
Event event = task.event;
if (!activeEvents.contains(event)) {
Utils.logE(event.getKey(), "Cannot finish already finished event");
return;
}
((EventBase) event).handlersCount--;
if (((EventBase) event).handlersCount == 0) {
// No more running handlers
activeEvents.remove(event);
scheduleStatusUpdates(event, EventStatus.FINISHED);
executeTasks(false);
}
} | [
"@",
"MainThread",
"private",
"void",
"handleTaskFinished",
"(",
"Task",
"task",
")",
"{",
"if",
"(",
"task",
".",
"method",
".",
"type",
"!=",
"EventMethod",
".",
"Type",
".",
"SUBSCRIBE",
")",
"{",
"// We are not interested in finished callbacks, only finished sub... | Handles finished event | [
"Handles",
"finished",
"event"
] | 4208e11fab35d99229fe6c3b3d434ca1948f3fc5 | https://github.com/alexvasilkov/Events/blob/4208e11fab35d99229fe6c3b3d434ca1948f3fc5/library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java#L263-L290 | train |
alexvasilkov/Events | library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java | Dispatcher.handleTasksExecution | @MainThread
private void handleTasksExecution() {
if (isExecuting || executionQueue.isEmpty()) {
return; // Nothing to dispatch
}
try {
isExecuting = true;
handleTasksExecutionWrapped();
} finally {
isExecuting = false;
}
} | java | @MainThread
private void handleTasksExecution() {
if (isExecuting || executionQueue.isEmpty()) {
return; // Nothing to dispatch
}
try {
isExecuting = true;
handleTasksExecutionWrapped();
} finally {
isExecuting = false;
}
} | [
"@",
"MainThread",
"private",
"void",
"handleTasksExecution",
"(",
")",
"{",
"if",
"(",
"isExecuting",
"||",
"executionQueue",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"// Nothing to dispatch",
"}",
"try",
"{",
"isExecuting",
"=",
"true",
";",
"han... | Handles scheduled execution tasks | [
"Handles",
"scheduled",
"execution",
"tasks"
] | 4208e11fab35d99229fe6c3b3d434ca1948f3fc5 | https://github.com/alexvasilkov/Events/blob/4208e11fab35d99229fe6c3b3d434ca1948f3fc5/library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java#L293-L305 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/ValueLabel.java | ValueLabel.create | public static <T> ValueLabel<T> create (Value<T> value, String... styles)
{
return new ValueLabel<T>(value, styles);
} | java | public static <T> ValueLabel<T> create (Value<T> value, String... styles)
{
return new ValueLabel<T>(value, styles);
} | [
"public",
"static",
"<",
"T",
">",
"ValueLabel",
"<",
"T",
">",
"create",
"(",
"Value",
"<",
"T",
">",
"value",
",",
"String",
"...",
"styles",
")",
"{",
"return",
"new",
"ValueLabel",
"<",
"T",
">",
"(",
"value",
",",
"styles",
")",
";",
"}"
] | Creates a value label for the supplied value with the specified CSS styles. | [
"Creates",
"a",
"value",
"label",
"for",
"the",
"supplied",
"value",
"with",
"the",
"specified",
"CSS",
"styles",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/ValueLabel.java#L39-L42 | train |
icode/ameba | src/main/java/ameba/db/ebean/migration/PlatformDdlWriter.java | PlatformDdlWriter.isApply | private boolean isApply(ChangeSet changeSet) {
// 必须包含 PENDING_DROPS 不然无法在只删除列时产生变更脚本
return (changeSet.getType() == ChangeSetType.APPLY || changeSet.getType() == ChangeSetType.PENDING_DROPS)
&& !changeSet.getChangeSetChildren().isEmpty();
} | java | private boolean isApply(ChangeSet changeSet) {
// 必须包含 PENDING_DROPS 不然无法在只删除列时产生变更脚本
return (changeSet.getType() == ChangeSetType.APPLY || changeSet.getType() == ChangeSetType.PENDING_DROPS)
&& !changeSet.getChangeSetChildren().isEmpty();
} | [
"private",
"boolean",
"isApply",
"(",
"ChangeSet",
"changeSet",
")",
"{",
"// 必须包含 PENDING_DROPS 不然无法在只删除列时产生变更脚本",
"return",
"(",
"changeSet",
".",
"getType",
"(",
")",
"==",
"ChangeSetType",
".",
"APPLY",
"||",
"changeSet",
".",
"getType",
"(",
")",
"==",
"Cha... | Return true if the changeSet is APPLY and not empty. | [
"Return",
"true",
"if",
"the",
"changeSet",
"is",
"APPLY",
"and",
"not",
"empty",
"."
] | 9d4956e935898e41331b2745e400ef869cd265e0 | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/migration/PlatformDdlWriter.java#L63-L67 | train |
icode/ameba | src/main/java/ameba/db/ebean/migration/PlatformDdlWriter.java | PlatformDdlWriter.writeApplyDdl | protected void writeApplyDdl(DdlWrite write) {
scriptInfo.setApplyDdl(
"-- drop dependencies\n"
+ write.applyDropDependencies().getBuffer() + "\n"
+ "-- apply changes\n"
+ write.apply().getBuffer()
+ write.applyForeignKeys().getBuffer()
+ write.applyHistoryView().getBuffer()
+ write.applyHistoryTrigger().getBuffer()
);
} | java | protected void writeApplyDdl(DdlWrite write) {
scriptInfo.setApplyDdl(
"-- drop dependencies\n"
+ write.applyDropDependencies().getBuffer() + "\n"
+ "-- apply changes\n"
+ write.apply().getBuffer()
+ write.applyForeignKeys().getBuffer()
+ write.applyHistoryView().getBuffer()
+ write.applyHistoryTrigger().getBuffer()
);
} | [
"protected",
"void",
"writeApplyDdl",
"(",
"DdlWrite",
"write",
")",
"{",
"scriptInfo",
".",
"setApplyDdl",
"(",
"\"-- drop dependencies\\n\"",
"+",
"write",
".",
"applyDropDependencies",
"(",
")",
".",
"getBuffer",
"(",
")",
"+",
"\"\\n\"",
"+",
"\"-- apply chang... | Write the 'Apply' DDL buffers to the writer.
@param write a {@link io.ebeaninternal.dbmigration.ddlgeneration.DdlWrite} object.
@throws java.io.IOException if any. | [
"Write",
"the",
"Apply",
"DDL",
"buffers",
"to",
"the",
"writer",
"."
] | 9d4956e935898e41331b2745e400ef869cd265e0 | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/migration/PlatformDdlWriter.java#L86-L96 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/PopupStack.java | PopupStack.show | public void show (PopupPanel popup, Widget onCenter)
{
// determine the ypos of our onCenter target in case it's in the currently popped up popup,
// because after we hide that popup we won't be able to compute it
int ypos = (onCenter == null) ? 0 :
(onCenter.getAbsoluteTop() + onCenter.getOffsetHeight()/2);
PopupPanel showing = _showingPopup.get();
if (showing != null) {
// null _showingPopup before hiding to avoid triggering the close handler logic
_popups.add(showing);
_showingPopup.update(null);
showing.hide(true);
}
if (onCenter == null) {
popup.center(); // this will show the popup
} else {
Popups.centerOn(popup, ypos).show();
}
// now that we've centered and shown our popup (which may have involved showing, hiding and
// showing it again), we can add a close handler and listen for it to actually close
popup.addCloseHandler(new CloseHandler<PopupPanel>() {
public void onClose (CloseEvent<PopupPanel> event) {
if (_showingPopup.get() == event.getTarget()) {
if (_popups.size() > 0) {
_showingPopup.update(_popups.remove(_popups.size()-1));
_showingPopup.get().show();
} else {
_showingPopup.update(null);
}
}
}
});
_showingPopup.update(popup);
} | java | public void show (PopupPanel popup, Widget onCenter)
{
// determine the ypos of our onCenter target in case it's in the currently popped up popup,
// because after we hide that popup we won't be able to compute it
int ypos = (onCenter == null) ? 0 :
(onCenter.getAbsoluteTop() + onCenter.getOffsetHeight()/2);
PopupPanel showing = _showingPopup.get();
if (showing != null) {
// null _showingPopup before hiding to avoid triggering the close handler logic
_popups.add(showing);
_showingPopup.update(null);
showing.hide(true);
}
if (onCenter == null) {
popup.center(); // this will show the popup
} else {
Popups.centerOn(popup, ypos).show();
}
// now that we've centered and shown our popup (which may have involved showing, hiding and
// showing it again), we can add a close handler and listen for it to actually close
popup.addCloseHandler(new CloseHandler<PopupPanel>() {
public void onClose (CloseEvent<PopupPanel> event) {
if (_showingPopup.get() == event.getTarget()) {
if (_popups.size() > 0) {
_showingPopup.update(_popups.remove(_popups.size()-1));
_showingPopup.get().show();
} else {
_showingPopup.update(null);
}
}
}
});
_showingPopup.update(popup);
} | [
"public",
"void",
"show",
"(",
"PopupPanel",
"popup",
",",
"Widget",
"onCenter",
")",
"{",
"// determine the ypos of our onCenter target in case it's in the currently popped up popup,",
"// because after we hide that popup we won't be able to compute it",
"int",
"ypos",
"=",
"(",
"... | Pushes any currently showing popup onto the stack and displays the supplied popup. The popup
will centered horizontally in the page and centered vertically around the supplied widget. | [
"Pushes",
"any",
"currently",
"showing",
"popup",
"onto",
"the",
"stack",
"and",
"displays",
"the",
"supplied",
"popup",
".",
"The",
"popup",
"will",
"centered",
"horizontally",
"in",
"the",
"page",
"and",
"centered",
"vertically",
"around",
"the",
"supplied",
... | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/PopupStack.java#L67-L103 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/PopupStack.java | PopupStack.clear | public void clear ()
{
_popups.clear();
if (_showingPopup.get() != null) {
_showingPopup.get().hide(true);
_showingPopup.update(null);
}
} | java | public void clear ()
{
_popups.clear();
if (_showingPopup.get() != null) {
_showingPopup.get().hide(true);
_showingPopup.update(null);
}
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"_popups",
".",
"clear",
"(",
")",
";",
"if",
"(",
"_showingPopup",
".",
"get",
"(",
")",
"!=",
"null",
")",
"{",
"_showingPopup",
".",
"get",
"(",
")",
".",
"hide",
"(",
"true",
")",
";",
"_showingPopup",
... | Clears out the stack completely, removing all pending popups and clearing any currently
showing popup. | [
"Clears",
"out",
"the",
"stack",
"completely",
"removing",
"all",
"pending",
"popups",
"and",
"clearing",
"any",
"currently",
"showing",
"popup",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/PopupStack.java#L109-L116 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/StringUtil.java | StringUtil.escapeAttribute | public static String escapeAttribute (String value)
{
for (int ii = 0; ii < ATTR_ESCAPES.length; ++ii) {
value = value.replace(ATTR_ESCAPES[ii][0], ATTR_ESCAPES[ii][1]);
}
return value;
} | java | public static String escapeAttribute (String value)
{
for (int ii = 0; ii < ATTR_ESCAPES.length; ++ii) {
value = value.replace(ATTR_ESCAPES[ii][0], ATTR_ESCAPES[ii][1]);
}
return value;
} | [
"public",
"static",
"String",
"escapeAttribute",
"(",
"String",
"value",
")",
"{",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"ATTR_ESCAPES",
".",
"length",
";",
"++",
"ii",
")",
"{",
"value",
"=",
"value",
".",
"replace",
"(",
"ATTR_ESCAPES",
... | Escapes user or deployment values that we need to put into an html attribute. | [
"Escapes",
"user",
"or",
"deployment",
"values",
"that",
"we",
"need",
"to",
"put",
"into",
"an",
"html",
"attribute",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/StringUtil.java#L111-L117 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/StringUtil.java | StringUtil.sanitizeAttribute | public static String sanitizeAttribute (String value)
{
for (int ii = 0; ii < ATTR_ESCAPES.length; ++ii) {
value = value.replace(ATTR_ESCAPES[ii][0], "");
}
return value;
} | java | public static String sanitizeAttribute (String value)
{
for (int ii = 0; ii < ATTR_ESCAPES.length; ++ii) {
value = value.replace(ATTR_ESCAPES[ii][0], "");
}
return value;
} | [
"public",
"static",
"String",
"sanitizeAttribute",
"(",
"String",
"value",
")",
"{",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"ATTR_ESCAPES",
".",
"length",
";",
"++",
"ii",
")",
"{",
"value",
"=",
"value",
".",
"replace",
"(",
"ATTR_ESCAPES"... | Nukes special attribute characters. Ideally this would not be needed, but some integrations
do not accept special characters in attributes. | [
"Nukes",
"special",
"attribute",
"characters",
".",
"Ideally",
"this",
"would",
"not",
"be",
"needed",
"but",
"some",
"integrations",
"do",
"not",
"accept",
"special",
"characters",
"in",
"attributes",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/StringUtil.java#L123-L129 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/StringUtil.java | StringUtil.truncate | public static String truncate (String str, int limit, String appendage)
{
if (str == null || str.length() <= limit) {
return str;
}
return str.substring(0, limit - appendage.length()) + appendage;
} | java | public static String truncate (String str, int limit, String appendage)
{
if (str == null || str.length() <= limit) {
return str;
}
return str.substring(0, limit - appendage.length()) + appendage;
} | [
"public",
"static",
"String",
"truncate",
"(",
"String",
"str",
",",
"int",
"limit",
",",
"String",
"appendage",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"str",
".",
"length",
"(",
")",
"<=",
"limit",
")",
"{",
"return",
"str",
";",
"}",
"re... | Truncates the string so it has length less than or equal to the given limit. If truncation
occurs, the result will end with the given appendage. Returns null if the input is null. | [
"Truncates",
"the",
"string",
"so",
"it",
"has",
"length",
"less",
"than",
"or",
"equal",
"to",
"the",
"given",
"limit",
".",
"If",
"truncation",
"occurs",
"the",
"result",
"will",
"end",
"with",
"the",
"given",
"appendage",
".",
"Returns",
"null",
"if",
... | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/StringUtil.java#L144-L150 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/StringUtil.java | StringUtil.join | public static String join (Iterable<?> items, String sep)
{
Iterator<?> i = items.iterator();
if (!i.hasNext()) {
return "";
}
StringBuilder buf = new StringBuilder(String.valueOf(i.next()));
while (i.hasNext()) {
buf.append(sep).append(i.next());
}
return buf.toString();
} | java | public static String join (Iterable<?> items, String sep)
{
Iterator<?> i = items.iterator();
if (!i.hasNext()) {
return "";
}
StringBuilder buf = new StringBuilder(String.valueOf(i.next()));
while (i.hasNext()) {
buf.append(sep).append(i.next());
}
return buf.toString();
} | [
"public",
"static",
"String",
"join",
"(",
"Iterable",
"<",
"?",
">",
"items",
",",
"String",
"sep",
")",
"{",
"Iterator",
"<",
"?",
">",
"i",
"=",
"items",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"!",
"i",
".",
"hasNext",
"(",
")",
")",
"{"... | Joins the given sequence of strings, which the given separator string between each
consecutive pair. | [
"Joins",
"the",
"given",
"sequence",
"of",
"strings",
"which",
"the",
"given",
"separator",
"string",
"between",
"each",
"consecutive",
"pair",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/StringUtil.java#L180-L191 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/WidgetUtilImpl.java | WidgetUtilImpl.createDefinition | public String createDefinition (WidgetUtil.FlashObject obj)
{
String transparent = obj.transparent ? "transparent" : "opaque";
String params = "<param name=\"movie\" value=\"" + obj.movie + "\">" +
"<param name=\"allowFullScreen\" value=\"true\">" +
"<param name=\"wmode\" value=\"" + transparent + "\">" +
"<param name=\"bgcolor\" value=\"" + obj.bgcolor + "\">";
if (obj.flashVars != null) {
params += "<param name=\"FlashVars\" value=\"" + obj.flashVars + "\">";
}
String tag = "<object id=\"" + obj.ident + "\" type=\"application/x-shockwave-flash\"";
if (obj.width.length() > 0) {
tag += " width=\"" + obj.width + "\"";
}
if (obj.height.length() > 0) {
tag += " height=\"" + obj.height + "\"";
}
tag += " allowFullScreen=\"true\" allowScriptAccess=\"sameDomain\">" + params + "</object>";
return tag;
} | java | public String createDefinition (WidgetUtil.FlashObject obj)
{
String transparent = obj.transparent ? "transparent" : "opaque";
String params = "<param name=\"movie\" value=\"" + obj.movie + "\">" +
"<param name=\"allowFullScreen\" value=\"true\">" +
"<param name=\"wmode\" value=\"" + transparent + "\">" +
"<param name=\"bgcolor\" value=\"" + obj.bgcolor + "\">";
if (obj.flashVars != null) {
params += "<param name=\"FlashVars\" value=\"" + obj.flashVars + "\">";
}
String tag = "<object id=\"" + obj.ident + "\" type=\"application/x-shockwave-flash\"";
if (obj.width.length() > 0) {
tag += " width=\"" + obj.width + "\"";
}
if (obj.height.length() > 0) {
tag += " height=\"" + obj.height + "\"";
}
tag += " allowFullScreen=\"true\" allowScriptAccess=\"sameDomain\">" + params + "</object>";
return tag;
} | [
"public",
"String",
"createDefinition",
"(",
"WidgetUtil",
".",
"FlashObject",
"obj",
")",
"{",
"String",
"transparent",
"=",
"obj",
".",
"transparent",
"?",
"\"transparent\"",
":",
"\"opaque\"",
";",
"String",
"params",
"=",
"\"<param name=\\\"movie\\\" value=\\\"\""... | Creates the HTML string definition of an embedded Flash object. | [
"Creates",
"the",
"HTML",
"string",
"definition",
"of",
"an",
"embedded",
"Flash",
"object",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/WidgetUtilImpl.java#L42-L62 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/WidgetUtilImpl.java | WidgetUtilImpl.createApplet | public HTML createApplet (String ident, String archive, String clazz,
String width, String height, boolean mayScript, String ptags)
{
String html = "<object classid=\"java:" + clazz + ".class\" " +
"type=\"application/x-java-applet\" archive=\"" + archive + "\" " +
"width=\"" + width + "\" height=\"" + height + "\">";
if (mayScript) {
html += "<param name=\"mayscript\" value=\"true\"/>";
}
html += ptags;
html += "</object>";
return new HTML(html);
} | java | public HTML createApplet (String ident, String archive, String clazz,
String width, String height, boolean mayScript, String ptags)
{
String html = "<object classid=\"java:" + clazz + ".class\" " +
"type=\"application/x-java-applet\" archive=\"" + archive + "\" " +
"width=\"" + width + "\" height=\"" + height + "\">";
if (mayScript) {
html += "<param name=\"mayscript\" value=\"true\"/>";
}
html += ptags;
html += "</object>";
return new HTML(html);
} | [
"public",
"HTML",
"createApplet",
"(",
"String",
"ident",
",",
"String",
"archive",
",",
"String",
"clazz",
",",
"String",
"width",
",",
"String",
"height",
",",
"boolean",
"mayScript",
",",
"String",
"ptags",
")",
"{",
"String",
"html",
"=",
"\"<object clas... | Creates the HTML needed to display a Java applet. | [
"Creates",
"the",
"HTML",
"needed",
"to",
"display",
"a",
"Java",
"applet",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/WidgetUtilImpl.java#L67-L79 | train |
udoprog/tiny-async-java | tiny-async-core/src/main/java/eu/toolchain/concurrent/DelayedCollectCoordinator.java | DelayedCollectCoordinator.run | @Override
public void run() {
synchronized (lock) {
if (!callables.hasNext()) {
checkEnd();
return;
}
for (int i = 0; i < parallelism && callables.hasNext(); i++) {
setupNext(callables.next());
}
}
future.whenCancelled(() -> {
cancel = true;
checkNext();
});
} | java | @Override
public void run() {
synchronized (lock) {
if (!callables.hasNext()) {
checkEnd();
return;
}
for (int i = 0; i < parallelism && callables.hasNext(); i++) {
setupNext(callables.next());
}
}
future.whenCancelled(() -> {
cancel = true;
checkNext();
});
} | [
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"!",
"callables",
".",
"hasNext",
"(",
")",
")",
"{",
"checkEnd",
"(",
")",
";",
"return",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";... | coordinate thread. | [
"coordinate",
"thread",
"."
] | 987706d4b7f2d13b45eefdc6c54ea63ce64b3310 | https://github.com/udoprog/tiny-async-java/blob/987706d4b7f2d13b45eefdc6c54ea63ce64b3310/tiny-async-core/src/main/java/eu/toolchain/concurrent/DelayedCollectCoordinator.java#L70-L87 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/EnterClickAdapter.java | EnterClickAdapter.bind | public static HandlerRegistration bind (HasKeyDownHandlers target, ClickHandler onEnter)
{
return target.addKeyDownHandler(new EnterClickAdapter(onEnter));
} | java | public static HandlerRegistration bind (HasKeyDownHandlers target, ClickHandler onEnter)
{
return target.addKeyDownHandler(new EnterClickAdapter(onEnter));
} | [
"public",
"static",
"HandlerRegistration",
"bind",
"(",
"HasKeyDownHandlers",
"target",
",",
"ClickHandler",
"onEnter",
")",
"{",
"return",
"target",
".",
"addKeyDownHandler",
"(",
"new",
"EnterClickAdapter",
"(",
"onEnter",
")",
")",
";",
"}"
] | Binds a listener to the supplied target text box that triggers the supplied click handler
when enter is pressed on the text box. | [
"Binds",
"a",
"listener",
"to",
"the",
"supplied",
"target",
"text",
"box",
"that",
"triggers",
"the",
"supplied",
"click",
"handler",
"when",
"enter",
"is",
"pressed",
"on",
"the",
"text",
"box",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/EnterClickAdapter.java#L41-L44 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/EnterClickAdapter.java | EnterClickAdapter.onKeyDown | public void onKeyDown (KeyDownEvent event)
{
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
_onEnter.onClick(null);
}
} | java | public void onKeyDown (KeyDownEvent event)
{
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
_onEnter.onClick(null);
}
} | [
"public",
"void",
"onKeyDown",
"(",
"KeyDownEvent",
"event",
")",
"{",
"if",
"(",
"event",
".",
"getNativeKeyCode",
"(",
")",
"==",
"KeyCodes",
".",
"KEY_ENTER",
")",
"{",
"_onEnter",
".",
"onClick",
"(",
"null",
")",
";",
"}",
"}"
] | from interface KeyDownHandler | [
"from",
"interface",
"KeyDownHandler"
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/EnterClickAdapter.java#L52-L57 | train |
ebean-orm/ebean-mocker | src/main/java/io/ebean/WhenBeanReturn.java | WhenBeanReturn.isMatch | boolean isMatch(Class<?> beanType, Object id) {
return beanType.equals(this.beanType) && idMatch(id);
} | java | boolean isMatch(Class<?> beanType, Object id) {
return beanType.equals(this.beanType) && idMatch(id);
} | [
"boolean",
"isMatch",
"(",
"Class",
"<",
"?",
">",
"beanType",
",",
"Object",
"id",
")",
"{",
"return",
"beanType",
".",
"equals",
"(",
"this",
".",
"beanType",
")",
"&&",
"idMatch",
"(",
"id",
")",
";",
"}"
] | Return true if matched by beanType and id value. | [
"Return",
"true",
"if",
"matched",
"by",
"beanType",
"and",
"id",
"value",
"."
] | 98c14a58253e8cd40b2a0c9b49526a307079389a | https://github.com/ebean-orm/ebean-mocker/blob/98c14a58253e8cd40b2a0c9b49526a307079389a/src/main/java/io/ebean/WhenBeanReturn.java#L41-L44 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/CookieUtil.java | CookieUtil.set | public static void set (String path, int expires, String name, String value, String domain)
{
String extra = "";
if (path.length() > 0) {
extra += "; path=" + path;
}
if (domain != null) {
extra += "; domain=" + domain;
}
doSet(name, value, expires, extra);
} | java | public static void set (String path, int expires, String name, String value, String domain)
{
String extra = "";
if (path.length() > 0) {
extra += "; path=" + path;
}
if (domain != null) {
extra += "; domain=" + domain;
}
doSet(name, value, expires, extra);
} | [
"public",
"static",
"void",
"set",
"(",
"String",
"path",
",",
"int",
"expires",
",",
"String",
"name",
",",
"String",
"value",
",",
"String",
"domain",
")",
"{",
"String",
"extra",
"=",
"\"\"",
";",
"if",
"(",
"path",
".",
"length",
"(",
")",
">",
... | Sets the specified cookie to the supplied value.
@param expires The number of days in which the cookie should expire.
@param domain The domain to set this cookie on. | [
"Sets",
"the",
"specified",
"cookie",
"to",
"the",
"supplied",
"value",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/CookieUtil.java#L52-L62 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/InfoPopup.java | InfoPopup.show | public void show (Popups.Position pos, Widget target)
{
Popups.show(this, pos, target);
} | java | public void show (Popups.Position pos, Widget target)
{
Popups.show(this, pos, target);
} | [
"public",
"void",
"show",
"(",
"Popups",
".",
"Position",
"pos",
",",
"Widget",
"target",
")",
"{",
"Popups",
".",
"show",
"(",
"this",
",",
"pos",
",",
"target",
")",
";",
"}"
] | Displays this info popup directly below the specified widget. | [
"Displays",
"this",
"info",
"popup",
"directly",
"below",
"the",
"specified",
"widget",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/InfoPopup.java#L81-L84 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/MessagesLookup.java | MessagesLookup.get | public String get (String key, Object... args)
{
// First make the key for GWT-friendly
return fetch(key.replace('.', '_'), args);
} | java | public String get (String key, Object... args)
{
// First make the key for GWT-friendly
return fetch(key.replace('.', '_'), args);
} | [
"public",
"String",
"get",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"// First make the key for GWT-friendly",
"return",
"fetch",
"(",
"key",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"args",
")",
";",
"}"
] | Translate a key with any number of arguments, backed by the Lookup. | [
"Translate",
"a",
"key",
"with",
"any",
"number",
"of",
"arguments",
"backed",
"by",
"the",
"Lookup",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/MessagesLookup.java#L63-L67 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/DefaultTextListener.java | DefaultTextListener.configure | @Deprecated
public static void configure (TextBoxBase target, String defaultText)
{
DefaultTextListener listener = new DefaultTextListener(target, defaultText);
target.addFocusHandler(listener);
target.addBlurHandler(listener);
} | java | @Deprecated
public static void configure (TextBoxBase target, String defaultText)
{
DefaultTextListener listener = new DefaultTextListener(target, defaultText);
target.addFocusHandler(listener);
target.addBlurHandler(listener);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"configure",
"(",
"TextBoxBase",
"target",
",",
"String",
"defaultText",
")",
"{",
"DefaultTextListener",
"listener",
"=",
"new",
"DefaultTextListener",
"(",
"target",
",",
"defaultText",
")",
";",
"target",
".",
"a... | Configures the target text box to display the supplied default text when it does not have
focus and to clear it out when the user selects it to enter text.
@deprecated use Widgets.setPlaceholderText(TextBoxBase, String) | [
"Configures",
"the",
"target",
"text",
"box",
"to",
"display",
"the",
"supplied",
"default",
"text",
"when",
"it",
"does",
"not",
"have",
"focus",
"and",
"to",
"clear",
"it",
"out",
"when",
"the",
"user",
"selects",
"it",
"to",
"enter",
"text",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/DefaultTextListener.java#L42-L48 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/DefaultTextListener.java | DefaultTextListener.getText | @Deprecated
public static String getText (TextBoxBase target, String defaultText)
{
String text = target.getText().trim();
return text.equals(defaultText.trim()) ? "" : text;
} | java | @Deprecated
public static String getText (TextBoxBase target, String defaultText)
{
String text = target.getText().trim();
return text.equals(defaultText.trim()) ? "" : text;
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"getText",
"(",
"TextBoxBase",
"target",
",",
"String",
"defaultText",
")",
"{",
"String",
"text",
"=",
"target",
".",
"getText",
"(",
")",
".",
"trim",
"(",
")",
";",
"return",
"text",
".",
"equals",
"(",... | Returns the contents of the supplied text box, accounting for the supplied default text.
@deprecated use Widgets.getText(TextBoxBase, String) | [
"Returns",
"the",
"contents",
"of",
"the",
"supplied",
"text",
"box",
"accounting",
"for",
"the",
"supplied",
"default",
"text",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/DefaultTextListener.java#L54-L59 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/DefaultTextListener.java | DefaultTextListener.onBlur | public void onBlur (BlurEvent event)
{
if (_target.getText().trim().equals("")) {
_target.setText(_defaultText);
}
} | java | public void onBlur (BlurEvent event)
{
if (_target.getText().trim().equals("")) {
_target.setText(_defaultText);
}
} | [
"public",
"void",
"onBlur",
"(",
"BlurEvent",
"event",
")",
"{",
"if",
"(",
"_target",
".",
"getText",
"(",
")",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"_target",
".",
"setText",
"(",
"_defaultText",
")",
";",
"}",
"}"
] | from interface BlurHandler | [
"from",
"interface",
"BlurHandler"
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/DefaultTextListener.java#L70-L75 | train |
tminglei/form-binder-java | src/main/java/com/github/tminglei/bind/FrameworkUtils.java | FrameworkUtils.workObject | static Object workObject(Map<String, Object> workList, String name, boolean isArray) {
logger.trace("get working object for {}", name);
if (workList.get(name) != null) return workList.get(name);
else {
String[] parts = splitName(name); // parts: (parent, name, isArray)
Map<String, Object> parentObj = (Map<String, Object>) workObject(workList, parts[0], false);
Object theObj = isArray ? new ArrayList<String>() : new HashMap<String, Object>();
parentObj.put(parts[1], theObj);
workList.put(name, theObj);
return theObj;
}
} | java | static Object workObject(Map<String, Object> workList, String name, boolean isArray) {
logger.trace("get working object for {}", name);
if (workList.get(name) != null) return workList.get(name);
else {
String[] parts = splitName(name); // parts: (parent, name, isArray)
Map<String, Object> parentObj = (Map<String, Object>) workObject(workList, parts[0], false);
Object theObj = isArray ? new ArrayList<String>() : new HashMap<String, Object>();
parentObj.put(parts[1], theObj);
workList.put(name, theObj);
return theObj;
}
} | [
"static",
"Object",
"workObject",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"workList",
",",
"String",
"name",
",",
"boolean",
"isArray",
")",
"{",
"logger",
".",
"trace",
"(",
"\"get working object for {}\"",
",",
"name",
")",
";",
"if",
"(",
"workLi... | find work object specified by name, create and attach it if not exists | [
"find",
"work",
"object",
"specified",
"by",
"name",
"create",
"and",
"attach",
"it",
"if",
"not",
"exists"
] | 4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab | https://github.com/tminglei/form-binder-java/blob/4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab/src/main/java/com/github/tminglei/bind/FrameworkUtils.java#L97-L111 | train |
tminglei/form-binder-java | src/main/java/com/github/tminglei/bind/FrameworkUtils.java | FrameworkUtils.checking | public static <T> Constraint
checking(Function<String, T> check, String messageOrKey, boolean isKey, String... extraMessageArgs) {
return mkSimpleConstraint(((label, vString, messages) -> {
logger.debug("checking for {}", vString);
if (isEmptyStr(vString)) return null;
else {
try {
check.apply(vString);
return null;
} catch (Exception ex) {
String msgTemplate = isKey ? messages.get(messageOrKey) : messageOrKey;
List<String> messageArgs = appendList(Arrays.asList(vString), extraMessageArgs);
return String.format(msgTemplate, messageArgs.toArray());
}
}
}), null);
} | java | public static <T> Constraint
checking(Function<String, T> check, String messageOrKey, boolean isKey, String... extraMessageArgs) {
return mkSimpleConstraint(((label, vString, messages) -> {
logger.debug("checking for {}", vString);
if (isEmptyStr(vString)) return null;
else {
try {
check.apply(vString);
return null;
} catch (Exception ex) {
String msgTemplate = isKey ? messages.get(messageOrKey) : messageOrKey;
List<String> messageArgs = appendList(Arrays.asList(vString), extraMessageArgs);
return String.format(msgTemplate, messageArgs.toArray());
}
}
}), null);
} | [
"public",
"static",
"<",
"T",
">",
"Constraint",
"checking",
"(",
"Function",
"<",
"String",
",",
"T",
">",
"check",
",",
"String",
"messageOrKey",
",",
"boolean",
"isKey",
",",
"String",
"...",
"extraMessageArgs",
")",
"{",
"return",
"mkSimpleConstraint",
"... | make a Constraint which will try to check and collect errors | [
"make",
"a",
"Constraint",
"which",
"will",
"try",
"to",
"check",
"and",
"collect",
"errors"
] | 4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab | https://github.com/tminglei/form-binder-java/blob/4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab/src/main/java/com/github/tminglei/bind/FrameworkUtils.java#L282-L299 | train |
tminglei/form-binder-java | src/main/java/com/github/tminglei/bind/FrameworkUtils.java | FrameworkUtils.anyPassed | public static Constraint anyPassed(Constraint... constraints) {
return ((name, data, messages, options) -> {
logger.debug("checking any passed for {}", name);
List<Map.Entry<String, String>> errErrors = new ArrayList<>();
for(Constraint constraint : constraints) {
List<Map.Entry<String, String>> errors = constraint.apply(name, data, messages, options);
if (errors.isEmpty()) return Collections.emptyList();
else {
errErrors.addAll(errors);
}
}
String label = getLabel(name, messages, options);
String errStr = errErrors.stream().map(e -> e.getValue())
.collect(Collectors.joining(", ", "[", "]"));
return Arrays.asList(entry(name,
String.format(messages.get("error.anypassed"), label, errStr)));
});
} | java | public static Constraint anyPassed(Constraint... constraints) {
return ((name, data, messages, options) -> {
logger.debug("checking any passed for {}", name);
List<Map.Entry<String, String>> errErrors = new ArrayList<>();
for(Constraint constraint : constraints) {
List<Map.Entry<String, String>> errors = constraint.apply(name, data, messages, options);
if (errors.isEmpty()) return Collections.emptyList();
else {
errErrors.addAll(errors);
}
}
String label = getLabel(name, messages, options);
String errStr = errErrors.stream().map(e -> e.getValue())
.collect(Collectors.joining(", ", "[", "]"));
return Arrays.asList(entry(name,
String.format(messages.get("error.anypassed"), label, errStr)));
});
} | [
"public",
"static",
"Constraint",
"anyPassed",
"(",
"Constraint",
"...",
"constraints",
")",
"{",
"return",
"(",
"(",
"name",
",",
"data",
",",
"messages",
",",
"options",
")",
"->",
"{",
"logger",
".",
"debug",
"(",
"\"checking any passed for {}\"",
",",
"n... | make a compound Constraint, which checks whether any inputting constraints passed | [
"make",
"a",
"compound",
"Constraint",
"which",
"checks",
"whether",
"any",
"inputting",
"constraints",
"passed"
] | 4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab | https://github.com/tminglei/form-binder-java/blob/4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab/src/main/java/com/github/tminglei/bind/FrameworkUtils.java#L302-L321 | train |
tminglei/form-binder-java | src/main/java/com/github/tminglei/bind/FrameworkUtils.java | FrameworkUtils.indexes | public static List<Integer> indexes(String name, Map<String, String> data) {
logger.debug("get indexes for {}", name);
// matches: 'prefix[index]...'
Pattern keyPattern = Pattern.compile("^" + Pattern.quote(name) + "\\[(\\d+)\\].*$");
return data.keySet().stream()
.map(key -> {
Matcher m = keyPattern.matcher(key);
return m.matches() ? Integer.parseInt(m.group(1))
: -1;
}).filter(i -> i >= 0)
.distinct()
.sorted()
.collect(Collectors.toList());
} | java | public static List<Integer> indexes(String name, Map<String, String> data) {
logger.debug("get indexes for {}", name);
// matches: 'prefix[index]...'
Pattern keyPattern = Pattern.compile("^" + Pattern.quote(name) + "\\[(\\d+)\\].*$");
return data.keySet().stream()
.map(key -> {
Matcher m = keyPattern.matcher(key);
return m.matches() ? Integer.parseInt(m.group(1))
: -1;
}).filter(i -> i >= 0)
.distinct()
.sorted()
.collect(Collectors.toList());
} | [
"public",
"static",
"List",
"<",
"Integer",
">",
"indexes",
"(",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"String",
">",
"data",
")",
"{",
"logger",
".",
"debug",
"(",
"\"get indexes for {}\"",
",",
"name",
")",
";",
"// matches: 'prefix[index]...'"... | Computes the available indexes for the given key in this set of data. | [
"Computes",
"the",
"available",
"indexes",
"for",
"the",
"given",
"key",
"in",
"this",
"set",
"of",
"data",
"."
] | 4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab | https://github.com/tminglei/form-binder-java/blob/4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab/src/main/java/com/github/tminglei/bind/FrameworkUtils.java#L324-L337 | train |
tminglei/form-binder-java | src/main/java/com/github/tminglei/bind/FrameworkUtils.java | FrameworkUtils.keys | public static List<String> keys(String prefix, Map<String, String> data) {
logger.debug("get keys for {}", prefix);
// matches: 'prefix.xxx...' | 'prefix."xxx.t"...'
Pattern keyPattern = Pattern.compile("^" + Pattern.quote(prefix) + "\\.(\"[^\"]+\"|[^\\.]+).*$");
return data.keySet().stream()
.map(key -> {
Matcher m = keyPattern.matcher(key);
return m.matches() ? m.group(1)
: null;
}).filter(k -> k != null)
.distinct()
.collect(Collectors.toList());
} | java | public static List<String> keys(String prefix, Map<String, String> data) {
logger.debug("get keys for {}", prefix);
// matches: 'prefix.xxx...' | 'prefix."xxx.t"...'
Pattern keyPattern = Pattern.compile("^" + Pattern.quote(prefix) + "\\.(\"[^\"]+\"|[^\\.]+).*$");
return data.keySet().stream()
.map(key -> {
Matcher m = keyPattern.matcher(key);
return m.matches() ? m.group(1)
: null;
}).filter(k -> k != null)
.distinct()
.collect(Collectors.toList());
} | [
"public",
"static",
"List",
"<",
"String",
">",
"keys",
"(",
"String",
"prefix",
",",
"Map",
"<",
"String",
",",
"String",
">",
"data",
")",
"{",
"logger",
".",
"debug",
"(",
"\"get keys for {}\"",
",",
"prefix",
")",
";",
"// matches: 'prefix.xxx...' | 'pre... | Computes the available keys for the given prefix in this set of data. | [
"Computes",
"the",
"available",
"keys",
"for",
"the",
"given",
"prefix",
"in",
"this",
"set",
"of",
"data",
"."
] | 4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab | https://github.com/tminglei/form-binder-java/blob/4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab/src/main/java/com/github/tminglei/bind/FrameworkUtils.java#L340-L352 | train |
tminglei/form-binder-java | src/main/java/com/github/tminglei/bind/FrameworkUtils.java | FrameworkUtils.json2map | public static Map<String, String> json2map(String prefix, JsonNode json) {
logger.trace("json to map - prefix: {}", prefix);
if (json.isArray()) {
Map<String, String> result = new HashMap<>();
for(int i=0; i <json.size(); i++) {
result.putAll(json2map(prefix +"["+i+"]", json.get(i)));
}
return result;
} else if (json.isObject()) {
Map<String, String> result = new HashMap<>();
json.fields().forEachRemaining(e -> {
String newPrefix = isEmptyStr(prefix) ? e.getKey() : prefix + "." + e.getKey();
result.putAll(json2map(newPrefix, e.getValue()));
});
return result;
} else {
return newmap(entry(prefix, json.asText()));
}
} | java | public static Map<String, String> json2map(String prefix, JsonNode json) {
logger.trace("json to map - prefix: {}", prefix);
if (json.isArray()) {
Map<String, String> result = new HashMap<>();
for(int i=0; i <json.size(); i++) {
result.putAll(json2map(prefix +"["+i+"]", json.get(i)));
}
return result;
} else if (json.isObject()) {
Map<String, String> result = new HashMap<>();
json.fields().forEachRemaining(e -> {
String newPrefix = isEmptyStr(prefix) ? e.getKey() : prefix + "." + e.getKey();
result.putAll(json2map(newPrefix, e.getValue()));
});
return result;
} else {
return newmap(entry(prefix, json.asText()));
}
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"json2map",
"(",
"String",
"prefix",
",",
"JsonNode",
"json",
")",
"{",
"logger",
".",
"trace",
"(",
"\"json to map - prefix: {}\"",
",",
"prefix",
")",
";",
"if",
"(",
"json",
".",
"isArray",
... | Construct data map from inputting jackson json object | [
"Construct",
"data",
"map",
"from",
"inputting",
"jackson",
"json",
"object"
] | 4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab | https://github.com/tminglei/form-binder-java/blob/4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab/src/main/java/com/github/tminglei/bind/FrameworkUtils.java#L355-L374 | train |
icode/ameba | src/main/java/ameba/db/ebean/migration/ModelMigration.java | ModelMigration.getVersion | private String getVersion(MigrationModel migrationModel) {
String version = migrationConfig.getVersion();
if (version == null) {
version = migrationModel.getNextVersion(initialVersion);
}
return version;
} | java | private String getVersion(MigrationModel migrationModel) {
String version = migrationConfig.getVersion();
if (version == null) {
version = migrationModel.getNextVersion(initialVersion);
}
return version;
} | [
"private",
"String",
"getVersion",
"(",
"MigrationModel",
"migrationModel",
")",
"{",
"String",
"version",
"=",
"migrationConfig",
".",
"getVersion",
"(",
")",
";",
"if",
"(",
"version",
"==",
"null",
")",
"{",
"version",
"=",
"migrationModel",
".",
"getNextVe... | Return the full version for the migration being generated. | [
"Return",
"the",
"full",
"version",
"for",
"the",
"migration",
"being",
"generated",
"."
] | 9d4956e935898e41331b2745e400ef869cd265e0 | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/migration/ModelMigration.java#L172-L180 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/Predicates.java | Predicates.in | public <T> Predicate<T> in (final Collection<? extends T> target)
{
return new Predicate<T>() {
public boolean apply (T arg) {
try {
return target.contains(arg);
} catch (NullPointerException e) {
return false;
} catch (ClassCastException e) {
return false;
}
}
};
} | java | public <T> Predicate<T> in (final Collection<? extends T> target)
{
return new Predicate<T>() {
public boolean apply (T arg) {
try {
return target.contains(arg);
} catch (NullPointerException e) {
return false;
} catch (ClassCastException e) {
return false;
}
}
};
} | [
"public",
"<",
"T",
">",
"Predicate",
"<",
"T",
">",
"in",
"(",
"final",
"Collection",
"<",
"?",
"extends",
"T",
">",
"target",
")",
"{",
"return",
"new",
"Predicate",
"<",
"T",
">",
"(",
")",
"{",
"public",
"boolean",
"apply",
"(",
"T",
"arg",
"... | Returns a predicate that evaluates to true if the object reference being tested is a member
of the given collection. | [
"Returns",
"a",
"predicate",
"that",
"evaluates",
"to",
"true",
"if",
"the",
"object",
"reference",
"being",
"tested",
"is",
"a",
"member",
"of",
"the",
"given",
"collection",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/Predicates.java#L38-L51 | train |
xebialabs/overcast | src/main/java/com/xebialabs/overcast/support/vagrant/VagrantDriver.java | VagrantDriver.doVagrant | public CommandResponse doVagrant(String vagrantVm, final String... vagrantCommand) {
CommandResponse response = commandProcessor.run(
aCommand("vagrant").withArguments(vagrantCommand).withOptions(vagrantVm)
);
if(!response.isSuccessful()) {
throw new RuntimeException("Errors during vagrant execution: \n" + response.getErrors());
}
// Check for puppet errors. Not vagrant still returns 0 when puppet fails
// May not be needed after this PR released: https://github.com/mitchellh/vagrant/pull/1175
for (String line : response.getOutput().split("\n\u001B")) {
if (line.startsWith("[1;35merr:")) {
throw new RuntimeException("Error in puppet output: " + line);
}
}
return response;
} | java | public CommandResponse doVagrant(String vagrantVm, final String... vagrantCommand) {
CommandResponse response = commandProcessor.run(
aCommand("vagrant").withArguments(vagrantCommand).withOptions(vagrantVm)
);
if(!response.isSuccessful()) {
throw new RuntimeException("Errors during vagrant execution: \n" + response.getErrors());
}
// Check for puppet errors. Not vagrant still returns 0 when puppet fails
// May not be needed after this PR released: https://github.com/mitchellh/vagrant/pull/1175
for (String line : response.getOutput().split("\n\u001B")) {
if (line.startsWith("[1;35merr:")) {
throw new RuntimeException("Error in puppet output: " + line);
}
}
return response;
} | [
"public",
"CommandResponse",
"doVagrant",
"(",
"String",
"vagrantVm",
",",
"final",
"String",
"...",
"vagrantCommand",
")",
"{",
"CommandResponse",
"response",
"=",
"commandProcessor",
".",
"run",
"(",
"aCommand",
"(",
"\"vagrant\"",
")",
".",
"withArguments",
"("... | Executes vagrant command which means that arguments passed here will be prepended with "vagrant"
@param vagrantCommand arguments for <i>vagrant</i> command
@return vagrant response object | [
"Executes",
"vagrant",
"command",
"which",
"means",
"that",
"arguments",
"passed",
"here",
"will",
"be",
"prepended",
"with",
"vagrant"
] | 716e57b66870c9afe51edc3b6045863a34fb0061 | https://github.com/xebialabs/overcast/blob/716e57b66870c9afe51edc3b6045863a34fb0061/src/main/java/com/xebialabs/overcast/support/vagrant/VagrantDriver.java#L38-L56 | train |
omalley/hadoop-gpl-compression | src/java/com/hadoop/mapreduce/LzoTextInputFormat.java | LzoTextInputFormat.readIndex | private LzoIndex readIndex(Path file, FileSystem fs) throws IOException {
FSDataInputStream indexIn = null;
try {
Path indexFile = new Path(file.toString() + LZO_INDEX_SUFFIX);
if (!fs.exists(indexFile)) {
// return empty index, fall back to the unsplittable mode
return new LzoIndex();
}
long indexLen = fs.getFileStatus(indexFile).getLen();
int blocks = (int) (indexLen / 8);
LzoIndex index = new LzoIndex(blocks);
indexIn = fs.open(indexFile);
for (int i = 0; i < blocks; i++) {
index.set(i, indexIn.readLong());
}
return index;
} finally {
if (indexIn != null) {
indexIn.close();
}
}
} | java | private LzoIndex readIndex(Path file, FileSystem fs) throws IOException {
FSDataInputStream indexIn = null;
try {
Path indexFile = new Path(file.toString() + LZO_INDEX_SUFFIX);
if (!fs.exists(indexFile)) {
// return empty index, fall back to the unsplittable mode
return new LzoIndex();
}
long indexLen = fs.getFileStatus(indexFile).getLen();
int blocks = (int) (indexLen / 8);
LzoIndex index = new LzoIndex(blocks);
indexIn = fs.open(indexFile);
for (int i = 0; i < blocks; i++) {
index.set(i, indexIn.readLong());
}
return index;
} finally {
if (indexIn != null) {
indexIn.close();
}
}
} | [
"private",
"LzoIndex",
"readIndex",
"(",
"Path",
"file",
",",
"FileSystem",
"fs",
")",
"throws",
"IOException",
"{",
"FSDataInputStream",
"indexIn",
"=",
"null",
";",
"try",
"{",
"Path",
"indexFile",
"=",
"new",
"Path",
"(",
"file",
".",
"toString",
"(",
"... | Read the index of the lzo file.
@param split
Read the index of this file.
@param fs
The index file is on this file system.
@throws IOException | [
"Read",
"the",
"index",
"of",
"the",
"lzo",
"file",
"."
] | 64ab3eb60fffac2a4d77680d506b34b02fcc3d7e | https://github.com/omalley/hadoop-gpl-compression/blob/64ab3eb60fffac2a4d77680d506b34b02fcc3d7e/src/java/com/hadoop/mapreduce/LzoTextInputFormat.java#L156-L178 | train |
omalley/hadoop-gpl-compression | src/java/com/hadoop/mapreduce/LzoTextInputFormat.java | LzoTextInputFormat.createIndex | public static void createIndex(FileSystem fs, Path lzoFile)
throws IOException {
Configuration conf = fs.getConf();
CompressionCodecFactory factory = new CompressionCodecFactory(fs.getConf());
CompressionCodec codec = factory.getCodec(lzoFile);
((Configurable) codec).setConf(conf);
InputStream lzoIs = null;
FSDataOutputStream os = null;
Path outputFile = new Path(lzoFile.toString()
+ LzoTextInputFormat.LZO_INDEX_SUFFIX);
Path tmpOutputFile = outputFile.suffix(".tmp");
try {
FSDataInputStream is = fs.open(lzoFile);
os = fs.create(tmpOutputFile);
LzopDecompressor decompressor = (LzopDecompressor) codec
.createDecompressor();
// for reading the header
lzoIs = codec.createInputStream(is, decompressor);
int numChecksums = decompressor.getChecksumsCount();
while (true) {
// read and ignore, we just want to get to the next int
int uncompressedBlockSize = is.readInt();
if (uncompressedBlockSize == 0) {
break;
} else if (uncompressedBlockSize < 0) {
throw new EOFException();
}
int compressedBlockSize = is.readInt();
if (compressedBlockSize <= 0) {
throw new IOException("Could not read compressed block size");
}
long pos = is.getPos();
// write the pos of the block start
os.writeLong(pos - 8);
// seek to the start of the next block, skip any checksums
is.seek(pos + compressedBlockSize + (4 * numChecksums));
}
} finally {
if (lzoIs != null) {
lzoIs.close();
}
if (os != null) {
os.close();
}
}
fs.rename(tmpOutputFile, outputFile);
} | java | public static void createIndex(FileSystem fs, Path lzoFile)
throws IOException {
Configuration conf = fs.getConf();
CompressionCodecFactory factory = new CompressionCodecFactory(fs.getConf());
CompressionCodec codec = factory.getCodec(lzoFile);
((Configurable) codec).setConf(conf);
InputStream lzoIs = null;
FSDataOutputStream os = null;
Path outputFile = new Path(lzoFile.toString()
+ LzoTextInputFormat.LZO_INDEX_SUFFIX);
Path tmpOutputFile = outputFile.suffix(".tmp");
try {
FSDataInputStream is = fs.open(lzoFile);
os = fs.create(tmpOutputFile);
LzopDecompressor decompressor = (LzopDecompressor) codec
.createDecompressor();
// for reading the header
lzoIs = codec.createInputStream(is, decompressor);
int numChecksums = decompressor.getChecksumsCount();
while (true) {
// read and ignore, we just want to get to the next int
int uncompressedBlockSize = is.readInt();
if (uncompressedBlockSize == 0) {
break;
} else if (uncompressedBlockSize < 0) {
throw new EOFException();
}
int compressedBlockSize = is.readInt();
if (compressedBlockSize <= 0) {
throw new IOException("Could not read compressed block size");
}
long pos = is.getPos();
// write the pos of the block start
os.writeLong(pos - 8);
// seek to the start of the next block, skip any checksums
is.seek(pos + compressedBlockSize + (4 * numChecksums));
}
} finally {
if (lzoIs != null) {
lzoIs.close();
}
if (os != null) {
os.close();
}
}
fs.rename(tmpOutputFile, outputFile);
} | [
"public",
"static",
"void",
"createIndex",
"(",
"FileSystem",
"fs",
",",
"Path",
"lzoFile",
")",
"throws",
"IOException",
"{",
"Configuration",
"conf",
"=",
"fs",
".",
"getConf",
"(",
")",
";",
"CompressionCodecFactory",
"factory",
"=",
"new",
"CompressionCodecF... | Index an lzo file to allow the input format to split them into separate map
jobs.
@param fs
File system that contains the file.
@param lzoFile
the lzo file to index.
@throws IOException | [
"Index",
"an",
"lzo",
"file",
"to",
"allow",
"the",
"input",
"format",
"to",
"split",
"them",
"into",
"separate",
"map",
"jobs",
"."
] | 64ab3eb60fffac2a4d77680d506b34b02fcc3d7e | https://github.com/omalley/hadoop-gpl-compression/blob/64ab3eb60fffac2a4d77680d506b34b02fcc3d7e/src/java/com/hadoop/mapreduce/LzoTextInputFormat.java#L190-L245 | train |
xebialabs/overcast | src/main/java/com/xebialabs/overcast/support/libvirt/LibvirtUtil.java | LibvirtUtil.getDefinedDomains | public static List<Domain> getDefinedDomains(Connect libvirt) {
try {
List<Domain> domains = new ArrayList<>();
String[] domainNames = libvirt.listDefinedDomains();
for (String name : domainNames) {
domains.add(libvirt.domainLookupByName(name));
}
return domains;
} catch (LibvirtException e) {
throw new LibvirtRuntimeException("Unable to list defined domains", e);
}
} | java | public static List<Domain> getDefinedDomains(Connect libvirt) {
try {
List<Domain> domains = new ArrayList<>();
String[] domainNames = libvirt.listDefinedDomains();
for (String name : domainNames) {
domains.add(libvirt.domainLookupByName(name));
}
return domains;
} catch (LibvirtException e) {
throw new LibvirtRuntimeException("Unable to list defined domains", e);
}
} | [
"public",
"static",
"List",
"<",
"Domain",
">",
"getDefinedDomains",
"(",
"Connect",
"libvirt",
")",
"{",
"try",
"{",
"List",
"<",
"Domain",
">",
"domains",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"String",
"[",
"]",
"domainNames",
"=",
"libvirt",
... | Get list of the inactive domains. | [
"Get",
"list",
"of",
"the",
"inactive",
"domains",
"."
] | 716e57b66870c9afe51edc3b6045863a34fb0061 | https://github.com/xebialabs/overcast/blob/716e57b66870c9afe51edc3b6045863a34fb0061/src/main/java/com/xebialabs/overcast/support/libvirt/LibvirtUtil.java#L88-L99 | train |
xebialabs/overcast | src/main/java/com/xebialabs/overcast/support/libvirt/LibvirtUtil.java | LibvirtUtil.getRunningDomains | public static List<Domain> getRunningDomains(Connect libvirt) {
try {
List<Domain> domains = new ArrayList<>();
int[] ids = libvirt.listDomains();
for (int id : ids) {
domains.add(libvirt.domainLookupByID(id));
}
return domains;
} catch (LibvirtException e) {
throw new LibvirtRuntimeException("Unable to list defined domains", e);
}
} | java | public static List<Domain> getRunningDomains(Connect libvirt) {
try {
List<Domain> domains = new ArrayList<>();
int[] ids = libvirt.listDomains();
for (int id : ids) {
domains.add(libvirt.domainLookupByID(id));
}
return domains;
} catch (LibvirtException e) {
throw new LibvirtRuntimeException("Unable to list defined domains", e);
}
} | [
"public",
"static",
"List",
"<",
"Domain",
">",
"getRunningDomains",
"(",
"Connect",
"libvirt",
")",
"{",
"try",
"{",
"List",
"<",
"Domain",
">",
"domains",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int",
"[",
"]",
"ids",
"=",
"libvirt",
".",
"l... | Get list of the active domains. | [
"Get",
"list",
"of",
"the",
"active",
"domains",
"."
] | 716e57b66870c9afe51edc3b6045863a34fb0061 | https://github.com/xebialabs/overcast/blob/716e57b66870c9afe51edc3b6045863a34fb0061/src/main/java/com/xebialabs/overcast/support/libvirt/LibvirtUtil.java#L102-L113 | train |
xebialabs/overcast | src/main/java/com/xebialabs/overcast/support/libvirt/LibvirtUtil.java | LibvirtUtil.getConnection | public static Connect getConnection(String libvirtURL, boolean readOnly) {
connectLock.lock();
try {
return new Connect(libvirtURL, readOnly);
} catch (LibvirtException e) {
throw new LibvirtRuntimeException("Unable to connect to " + libvirtURL, e);
} finally {
connectLock.unlock();
}
} | java | public static Connect getConnection(String libvirtURL, boolean readOnly) {
connectLock.lock();
try {
return new Connect(libvirtURL, readOnly);
} catch (LibvirtException e) {
throw new LibvirtRuntimeException("Unable to connect to " + libvirtURL, e);
} finally {
connectLock.unlock();
}
} | [
"public",
"static",
"Connect",
"getConnection",
"(",
"String",
"libvirtURL",
",",
"boolean",
"readOnly",
")",
"{",
"connectLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"new",
"Connect",
"(",
"libvirtURL",
",",
"readOnly",
")",
";",
"}",
"catch"... | Create a connection to libvirt in a thread safe manner. | [
"Create",
"a",
"connection",
"to",
"libvirt",
"in",
"a",
"thread",
"safe",
"manner",
"."
] | 716e57b66870c9afe51edc3b6045863a34fb0061 | https://github.com/xebialabs/overcast/blob/716e57b66870c9afe51edc3b6045863a34fb0061/src/main/java/com/xebialabs/overcast/support/libvirt/LibvirtUtil.java#L116-L125 | train |
embulk/guice-bootstrap | src/main/java/org/embulk/guice/LifeCycleManager.java | LifeCycleManager.addInstance | public void addInstance(Object instance)
throws Exception
{
if (isDestroyed()) {
throw new IllegalStateException("System already stopped");
}
else {
startInstance(instance);
if (methodsMap.get(instance.getClass()).hasFor(PreDestroy.class)) {
managedInstances.add(instance);
}
}
} | java | public void addInstance(Object instance)
throws Exception
{
if (isDestroyed()) {
throw new IllegalStateException("System already stopped");
}
else {
startInstance(instance);
if (methodsMap.get(instance.getClass()).hasFor(PreDestroy.class)) {
managedInstances.add(instance);
}
}
} | [
"public",
"void",
"addInstance",
"(",
"Object",
"instance",
")",
"throws",
"Exception",
"{",
"if",
"(",
"isDestroyed",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"System already stopped\"",
")",
";",
"}",
"else",
"{",
"startInstance",
... | Add an additional managed instance
@param instance instance to add
@throws Exception errors | [
"Add",
"an",
"additional",
"managed",
"instance"
] | 3d0306b7129c769e27687351ed3a334ce443e27c | https://github.com/embulk/guice-bootstrap/blob/3d0306b7129c769e27687351ed3a334ce443e27c/src/main/java/org/embulk/guice/LifeCycleManager.java#L178-L190 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/ServiceUtil.java | ServiceUtil.bind | public static <T> T bind (T service, String entryPoint)
{
((ServiceDefTarget)service).setServiceEntryPoint(entryPoint);
return service;
} | java | public static <T> T bind (T service, String entryPoint)
{
((ServiceDefTarget)service).setServiceEntryPoint(entryPoint);
return service;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"bind",
"(",
"T",
"service",
",",
"String",
"entryPoint",
")",
"{",
"(",
"(",
"ServiceDefTarget",
")",
"service",
")",
".",
"setServiceEntryPoint",
"(",
"entryPoint",
")",
";",
"return",
"service",
";",
"}"
] | Binds the supplied service to the specified entry point. | [
"Binds",
"the",
"supplied",
"service",
"to",
"the",
"specified",
"entry",
"point",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/ServiceUtil.java#L35-L39 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/DateUtil.java | DateUtil.toUtc | @SuppressWarnings("deprecation")
public static Date toUtc (Date date)
{
if (date == null) {
return null;
}
return new Date(Date.UTC(date.getYear(), date.getMonth(), date.getDate(), date.getHours(),
date.getMinutes(), date.getSeconds()));
} | java | @SuppressWarnings("deprecation")
public static Date toUtc (Date date)
{
if (date == null) {
return null;
}
return new Date(Date.UTC(date.getYear(), date.getMonth(), date.getDate(), date.getHours(),
date.getMinutes(), date.getSeconds()));
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"static",
"Date",
"toUtc",
"(",
"Date",
"date",
")",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"Date",
"(",
"Date",
".",
"UTC",
"(",
"d... | Returns the equivalent of this date when it was in Greenwich. For example, a date at 4pm
pacific would result in a new date at 4pm gmt, or 8am pacific. This has the effect of
normalizing the date. It may be used to allow clients to send data requests to the server
in absolute time, which can then be treated appropriately on the server. | [
"Returns",
"the",
"equivalent",
"of",
"this",
"date",
"when",
"it",
"was",
"in",
"Greenwich",
".",
"For",
"example",
"a",
"date",
"at",
"4pm",
"pacific",
"would",
"result",
"in",
"a",
"new",
"date",
"at",
"4pm",
"gmt",
"or",
"8am",
"pacific",
".",
"Thi... | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/DateUtil.java#L174-L182 | train |
stackify/stackify-metrics | src/main/java/com/stackify/metric/impl/MetricAggregator.java | MetricAggregator.add | public void add(final Metric metric) {
Preconditions.checkNotNull(metric);
// get the aggregate for this minute
MetricAggregate aggregate = getAggregate(metric.getIdentity());
// add the current metric into the aggregate
switch (metric.getIdentity().getType()) {
case COUNTER:
case TIMER:
case AVERAGE:
aggregate.setCount(aggregate.getCount() + 1);
aggregate.setValue(aggregate.getValue() + metric.getValue());
break;
case GAUGE:
aggregate.setCount(1);
if (metric.isIncrement()) {
aggregate.setValue(aggregate.getValue() + metric.getValue());
} else {
aggregate.setValue(metric.getValue());
}
break;
default:
LOGGER.info("Unable to aggregate {} metric type", metric.getIdentity().getType());
break;
}
} | java | public void add(final Metric metric) {
Preconditions.checkNotNull(metric);
// get the aggregate for this minute
MetricAggregate aggregate = getAggregate(metric.getIdentity());
// add the current metric into the aggregate
switch (metric.getIdentity().getType()) {
case COUNTER:
case TIMER:
case AVERAGE:
aggregate.setCount(aggregate.getCount() + 1);
aggregate.setValue(aggregate.getValue() + metric.getValue());
break;
case GAUGE:
aggregate.setCount(1);
if (metric.isIncrement()) {
aggregate.setValue(aggregate.getValue() + metric.getValue());
} else {
aggregate.setValue(metric.getValue());
}
break;
default:
LOGGER.info("Unable to aggregate {} metric type", metric.getIdentity().getType());
break;
}
} | [
"public",
"void",
"add",
"(",
"final",
"Metric",
"metric",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"metric",
")",
";",
"// get the aggregate for this minute",
"MetricAggregate",
"aggregate",
"=",
"getAggregate",
"(",
"metric",
".",
"getIdentity",
"(",
... | Aggregates a single metric into the collection of aggregates
@param metric The metric | [
"Aggregates",
"a",
"single",
"metric",
"into",
"the",
"collection",
"of",
"aggregates"
] | 6827d516085e4b29a3e54da963eebb2955822a5c | https://github.com/stackify/stackify-metrics/blob/6827d516085e4b29a3e54da963eebb2955822a5c/src/main/java/com/stackify/metric/impl/MetricAggregator.java#L87-L115 | train |
stackify/stackify-metrics | src/main/java/com/stackify/metric/impl/MetricAggregator.java | MetricAggregator.aggregateExistsForCurrentMinute | private boolean aggregateExistsForCurrentMinute(final MetricIdentity identity) {
Preconditions.checkNotNull(identity);
if (aggregates.containsKey(identity)) {
if (aggregates.get(identity).containsKey(currentMinute)) {
return true;
}
}
return false;
} | java | private boolean aggregateExistsForCurrentMinute(final MetricIdentity identity) {
Preconditions.checkNotNull(identity);
if (aggregates.containsKey(identity)) {
if (aggregates.get(identity).containsKey(currentMinute)) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"aggregateExistsForCurrentMinute",
"(",
"final",
"MetricIdentity",
"identity",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"identity",
")",
";",
"if",
"(",
"aggregates",
".",
"containsKey",
"(",
"identity",
")",
")",
"{",
"if",
"("... | Determines if the specified aggregate metric exists for the current minute
@param identity The metric identity
@return True if the metric exists, false otherwise | [
"Determines",
"if",
"the",
"specified",
"aggregate",
"metric",
"exists",
"for",
"the",
"current",
"minute"
] | 6827d516085e4b29a3e54da963eebb2955822a5c | https://github.com/stackify/stackify-metrics/blob/6827d516085e4b29a3e54da963eebb2955822a5c/src/main/java/com/stackify/metric/impl/MetricAggregator.java#L161-L171 | train |
stackify/stackify-metrics | src/main/java/com/stackify/metric/impl/MetricAggregator.java | MetricAggregator.getAggregate | private MetricAggregate getAggregate(final MetricIdentity identity) {
// get the map from utc minute to aggregate for this metric
if (!aggregates.containsKey(identity)) {
aggregates.put(identity, new HashMap<Long, MetricAggregate>());
}
Map<Long, MetricAggregate> metricAggregates = aggregates.get(identity);
// get the aggregate for this minute
if (!metricAggregates.containsKey(currentMinute)) {
MetricAggregate initialAggregate = MetricAggregate.fromMetricIdentity(identity, currentMinute);
if (identity.getType().equals(MetricMonitorType.GAUGE)) {
if (lastValues.containsKey(identity)) {
initialAggregate.setValue(lastValues.get(identity));
}
}
metricAggregates.put(currentMinute, initialAggregate);
}
MetricAggregate aggregate = metricAggregates.get(currentMinute);
return aggregate;
} | java | private MetricAggregate getAggregate(final MetricIdentity identity) {
// get the map from utc minute to aggregate for this metric
if (!aggregates.containsKey(identity)) {
aggregates.put(identity, new HashMap<Long, MetricAggregate>());
}
Map<Long, MetricAggregate> metricAggregates = aggregates.get(identity);
// get the aggregate for this minute
if (!metricAggregates.containsKey(currentMinute)) {
MetricAggregate initialAggregate = MetricAggregate.fromMetricIdentity(identity, currentMinute);
if (identity.getType().equals(MetricMonitorType.GAUGE)) {
if (lastValues.containsKey(identity)) {
initialAggregate.setValue(lastValues.get(identity));
}
}
metricAggregates.put(currentMinute, initialAggregate);
}
MetricAggregate aggregate = metricAggregates.get(currentMinute);
return aggregate;
} | [
"private",
"MetricAggregate",
"getAggregate",
"(",
"final",
"MetricIdentity",
"identity",
")",
"{",
"// get the map from utc minute to aggregate for this metric",
"if",
"(",
"!",
"aggregates",
".",
"containsKey",
"(",
"identity",
")",
")",
"{",
"aggregates",
".",
"put",... | Retrieves the specified metric for the current minute
@param metric The metric identity
@return The metric aggregate for the metric at the current minute | [
"Retrieves",
"the",
"specified",
"metric",
"for",
"the",
"current",
"minute"
] | 6827d516085e4b29a3e54da963eebb2955822a5c | https://github.com/stackify/stackify-metrics/blob/6827d516085e4b29a3e54da963eebb2955822a5c/src/main/java/com/stackify/metric/impl/MetricAggregator.java#L178-L206 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/ListenerList.java | ListenerList.addListener | public static <L> ListenerList<L> addListener (ListenerList<L> list, L listener)
{
if (list == null) {
list = new ListenerList<L>();
}
list.add(listener);
return list;
} | java | public static <L> ListenerList<L> addListener (ListenerList<L> list, L listener)
{
if (list == null) {
list = new ListenerList<L>();
}
list.add(listener);
return list;
} | [
"public",
"static",
"<",
"L",
">",
"ListenerList",
"<",
"L",
">",
"addListener",
"(",
"ListenerList",
"<",
"L",
">",
"list",
",",
"L",
"listener",
")",
"{",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"list",
"=",
"new",
"ListenerList",
"<",
"L",
">... | Adds the supplied listener to the supplied list. If the list is null, a new listener list
will be created. The supplied or newly created list as appropriate will be returned. | [
"Adds",
"the",
"supplied",
"listener",
"to",
"the",
"supplied",
"list",
".",
"If",
"the",
"list",
"is",
"null",
"a",
"new",
"listener",
"list",
"will",
"be",
"created",
".",
"The",
"supplied",
"or",
"newly",
"created",
"list",
"as",
"appropriate",
"will",
... | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/ListenerList.java#L43-L50 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/ListenerList.java | ListenerList.addListener | public static <L, K> void addListener (Map<K, ListenerList<L>> map, K key, L listener)
{
ListenerList<L> list = map.get(key);
if (list == null) {
map.put(key, list = new ListenerList<L>());
}
list.add(listener);
} | java | public static <L, K> void addListener (Map<K, ListenerList<L>> map, K key, L listener)
{
ListenerList<L> list = map.get(key);
if (list == null) {
map.put(key, list = new ListenerList<L>());
}
list.add(listener);
} | [
"public",
"static",
"<",
"L",
",",
"K",
">",
"void",
"addListener",
"(",
"Map",
"<",
"K",
",",
"ListenerList",
"<",
"L",
">",
">",
"map",
",",
"K",
"key",
",",
"L",
"listener",
")",
"{",
"ListenerList",
"<",
"L",
">",
"list",
"=",
"map",
".",
"... | Adds a listener to the listener list in the supplied map. If no list exists, one will be
created and mapped to the supplied key. | [
"Adds",
"a",
"listener",
"to",
"the",
"listener",
"list",
"in",
"the",
"supplied",
"map",
".",
"If",
"no",
"list",
"exists",
"one",
"will",
"be",
"created",
"and",
"mapped",
"to",
"the",
"supplied",
"key",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/ListenerList.java#L56-L63 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/ListenerList.java | ListenerList.removeListener | public static <L, K> void removeListener (Map<K, ListenerList<L>> map, K key, L listener)
{
ListenerList<L> list = map.get(key);
if (list != null) {
list.remove(listener);
}
} | java | public static <L, K> void removeListener (Map<K, ListenerList<L>> map, K key, L listener)
{
ListenerList<L> list = map.get(key);
if (list != null) {
list.remove(listener);
}
} | [
"public",
"static",
"<",
"L",
",",
"K",
">",
"void",
"removeListener",
"(",
"Map",
"<",
"K",
",",
"ListenerList",
"<",
"L",
">",
">",
"map",
",",
"K",
"key",
",",
"L",
"listener",
")",
"{",
"ListenerList",
"<",
"L",
">",
"list",
"=",
"map",
".",
... | Removes a listener from the supplied list in the supplied map. | [
"Removes",
"a",
"listener",
"from",
"the",
"supplied",
"list",
"in",
"the",
"supplied",
"map",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/ListenerList.java#L68-L74 | train |
icode/ameba | src/main/java/ameba/db/ebean/migration/MigrationResource.java | MigrationResource.read | public Migration read() {
try (StringReader reader = new StringReader(info.getModelDiff())) {
JAXBContext jaxbContext = JAXBContext.newInstance(Migration.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
return (Migration) unmarshaller.unmarshal(reader);
} catch (JAXBException e) {
throw new RuntimeException(e);
}
} | java | public Migration read() {
try (StringReader reader = new StringReader(info.getModelDiff())) {
JAXBContext jaxbContext = JAXBContext.newInstance(Migration.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
return (Migration) unmarshaller.unmarshal(reader);
} catch (JAXBException e) {
throw new RuntimeException(e);
}
} | [
"public",
"Migration",
"read",
"(",
")",
"{",
"try",
"(",
"StringReader",
"reader",
"=",
"new",
"StringReader",
"(",
"info",
".",
"getModelDiff",
"(",
")",
")",
")",
"{",
"JAXBContext",
"jaxbContext",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"Migration",... | Read and return the migration from the resource.
@return a {@link io.ebeaninternal.dbmigration.migration.Migration} object. | [
"Read",
"and",
"return",
"the",
"migration",
"from",
"the",
"resource",
"."
] | 9d4956e935898e41331b2745e400ef869cd265e0 | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/migration/MigrationResource.java#L56-L64 | train |
udoprog/tiny-async-java | tiny-async-core/src/main/java/eu/toolchain/concurrent/CollectHelper.java | CollectHelper.add | void add(final byte type, final Object value) {
final int w = write.getAndIncrement();
if (w < size) {
writeAt(w, type, value);
}
// countdown could wrap around, however we check the state of finished in here.
// MUST be called after write to make sure that results and states are synchronized.
final int c = countdown.decrementAndGet();
if (c < 0) {
throw new IllegalStateException("already finished (countdown)");
}
// if this thread is not the last thread to check-in, do nothing..
if (c != 0) {
return;
}
// make sure this can only happen once.
// This protects against countdown, and write wrapping around which should very rarely
// happen.
if (!done.compareAndSet(false, true)) {
throw new IllegalStateException("already finished");
}
done(collect());
} | java | void add(final byte type, final Object value) {
final int w = write.getAndIncrement();
if (w < size) {
writeAt(w, type, value);
}
// countdown could wrap around, however we check the state of finished in here.
// MUST be called after write to make sure that results and states are synchronized.
final int c = countdown.decrementAndGet();
if (c < 0) {
throw new IllegalStateException("already finished (countdown)");
}
// if this thread is not the last thread to check-in, do nothing..
if (c != 0) {
return;
}
// make sure this can only happen once.
// This protects against countdown, and write wrapping around which should very rarely
// happen.
if (!done.compareAndSet(false, true)) {
throw new IllegalStateException("already finished");
}
done(collect());
} | [
"void",
"add",
"(",
"final",
"byte",
"type",
",",
"final",
"Object",
"value",
")",
"{",
"final",
"int",
"w",
"=",
"write",
".",
"getAndIncrement",
"(",
")",
";",
"if",
"(",
"w",
"<",
"size",
")",
"{",
"writeAt",
"(",
"w",
",",
"type",
",",
"value... | Checks in a doCall back. It also wraps up the group if all the callbacks have checked in. | [
"Checks",
"in",
"a",
"doCall",
"back",
".",
"It",
"also",
"wraps",
"up",
"the",
"group",
"if",
"all",
"the",
"callbacks",
"have",
"checked",
"in",
"."
] | 987706d4b7f2d13b45eefdc6c54ea63ce64b3310 | https://github.com/udoprog/tiny-async-java/blob/987706d4b7f2d13b45eefdc6c54ea63ce64b3310/tiny-async-core/src/main/java/eu/toolchain/concurrent/CollectHelper.java#L123-L151 | train |
stackify/stackify-metrics | src/main/java/com/stackify/metric/MetricManager.java | MetricManager.configure | public static synchronized void configure(final ApiConfiguration config) {
ApiConfiguration.Builder builder = ApiConfiguration.newBuilder();
builder.apiUrl(config.getApiUrl());
builder.apiKey(config.getApiKey());
builder.application(config.getApplication());
builder.environment(config.getEnvironment());
if (config.getEnvDetail() == null)
{
builder.envDetail(EnvironmentDetails.getEnvironmentDetail(config.getApplication(), config.getEnvironment()));
}
else
{
builder.envDetail(config.getEnvDetail());
}
CONFIG = builder.build();
} | java | public static synchronized void configure(final ApiConfiguration config) {
ApiConfiguration.Builder builder = ApiConfiguration.newBuilder();
builder.apiUrl(config.getApiUrl());
builder.apiKey(config.getApiKey());
builder.application(config.getApplication());
builder.environment(config.getEnvironment());
if (config.getEnvDetail() == null)
{
builder.envDetail(EnvironmentDetails.getEnvironmentDetail(config.getApplication(), config.getEnvironment()));
}
else
{
builder.envDetail(config.getEnvDetail());
}
CONFIG = builder.build();
} | [
"public",
"static",
"synchronized",
"void",
"configure",
"(",
"final",
"ApiConfiguration",
"config",
")",
"{",
"ApiConfiguration",
".",
"Builder",
"builder",
"=",
"ApiConfiguration",
".",
"newBuilder",
"(",
")",
";",
"builder",
".",
"apiUrl",
"(",
"config",
".",... | Manually configure the metrics api
@param config API configuration | [
"Manually",
"configure",
"the",
"metrics",
"api"
] | 6827d516085e4b29a3e54da963eebb2955822a5c | https://github.com/stackify/stackify-metrics/blob/6827d516085e4b29a3e54da963eebb2955822a5c/src/main/java/com/stackify/metric/MetricManager.java#L79-L98 | train |
stackify/stackify-metrics | src/main/java/com/stackify/metric/MetricManager.java | MetricManager.startup | private static synchronized void startup() {
try {
if (CONFIG == null) {
CONFIG = ApiConfigurations.fromProperties();
}
ObjectMapper objectMapper = new ObjectMapper();
AppIdentityService appIdentityService = new AppIdentityService(CONFIG, objectMapper, true);
MetricMonitorService monitorService = new MetricMonitorService(CONFIG, objectMapper, appIdentityService);
MetricSender sender = new MetricSender(CONFIG, objectMapper, monitorService);
BACKGROUND_SERVICE = new MetricBackgroundService(COLLECTOR, sender);
BACKGROUND_SERVICE.start();
} catch (Throwable t) {
LOGGER.error("Exception starting Stackify Metrics API service", t);
}
} | java | private static synchronized void startup() {
try {
if (CONFIG == null) {
CONFIG = ApiConfigurations.fromProperties();
}
ObjectMapper objectMapper = new ObjectMapper();
AppIdentityService appIdentityService = new AppIdentityService(CONFIG, objectMapper, true);
MetricMonitorService monitorService = new MetricMonitorService(CONFIG, objectMapper, appIdentityService);
MetricSender sender = new MetricSender(CONFIG, objectMapper, monitorService);
BACKGROUND_SERVICE = new MetricBackgroundService(COLLECTOR, sender);
BACKGROUND_SERVICE.start();
} catch (Throwable t) {
LOGGER.error("Exception starting Stackify Metrics API service", t);
}
} | [
"private",
"static",
"synchronized",
"void",
"startup",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"CONFIG",
"==",
"null",
")",
"{",
"CONFIG",
"=",
"ApiConfigurations",
".",
"fromProperties",
"(",
")",
";",
"}",
"ObjectMapper",
"objectMapper",
"=",
"new",
"Obje... | Start up the background thread that is processing metrics | [
"Start",
"up",
"the",
"background",
"thread",
"that",
"is",
"processing",
"metrics"
] | 6827d516085e4b29a3e54da963eebb2955822a5c | https://github.com/stackify/stackify-metrics/blob/6827d516085e4b29a3e54da963eebb2955822a5c/src/main/java/com/stackify/metric/MetricManager.java#L103-L124 | train |
stackify/stackify-metrics | src/main/java/com/stackify/metric/MetricManager.java | MetricManager.shutdown | public static synchronized void shutdown() {
if (BACKGROUND_SERVICE != null) {
try {
BACKGROUND_SERVICE.stop();
} catch (Throwable t) {
LOGGER.error("Exception stopping Stackify Metrics API service", t);
}
INITIALIZED.compareAndSet(true, false);
}
} | java | public static synchronized void shutdown() {
if (BACKGROUND_SERVICE != null) {
try {
BACKGROUND_SERVICE.stop();
} catch (Throwable t) {
LOGGER.error("Exception stopping Stackify Metrics API service", t);
}
INITIALIZED.compareAndSet(true, false);
}
} | [
"public",
"static",
"synchronized",
"void",
"shutdown",
"(",
")",
"{",
"if",
"(",
"BACKGROUND_SERVICE",
"!=",
"null",
")",
"{",
"try",
"{",
"BACKGROUND_SERVICE",
".",
"stop",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"LOGGER",
".",
... | Shut down the background thread that is processing metrics | [
"Shut",
"down",
"the",
"background",
"thread",
"that",
"is",
"processing",
"metrics"
] | 6827d516085e4b29a3e54da963eebb2955822a5c | https://github.com/stackify/stackify-metrics/blob/6827d516085e4b29a3e54da963eebb2955822a5c/src/main/java/com/stackify/metric/MetricManager.java#L129-L139 | train |
ebean-orm/ebean-mocker | src/main/java/io/ebean/WithStaticFinders.java | WithStaticFinders.withFinder | public <T> WithStaticFinder<T> withFinder(Class<T> beanType) {
WithStaticFinder<T> withFinder = new WithStaticFinder<>(beanType);
staticFinderReplacement.add(withFinder);
return withFinder;
} | java | public <T> WithStaticFinder<T> withFinder(Class<T> beanType) {
WithStaticFinder<T> withFinder = new WithStaticFinder<>(beanType);
staticFinderReplacement.add(withFinder);
return withFinder;
} | [
"public",
"<",
"T",
">",
"WithStaticFinder",
"<",
"T",
">",
"withFinder",
"(",
"Class",
"<",
"T",
">",
"beanType",
")",
"{",
"WithStaticFinder",
"<",
"T",
">",
"withFinder",
"=",
"new",
"WithStaticFinder",
"<>",
"(",
"beanType",
")",
";",
"staticFinderRepl... | Create and return a WithStaticFinder. Expects a static 'finder' field on the beanType class. | [
"Create",
"and",
"return",
"a",
"WithStaticFinder",
".",
"Expects",
"a",
"static",
"finder",
"field",
"on",
"the",
"beanType",
"class",
"."
] | 98c14a58253e8cd40b2a0c9b49526a307079389a | https://github.com/ebean-orm/ebean-mocker/blob/98c14a58253e8cd40b2a0c9b49526a307079389a/src/main/java/io/ebean/WithStaticFinders.java#L17-L21 | train |
udoprog/tiny-async-java | tiny-async-core/src/main/java/eu/toolchain/concurrent/ConcurrentCompletable.java | ConcurrentCompletable.takeAndClear | RunnablePair takeAndClear() {
RunnablePair entries;
while ((entries = callbacks.get()) != END) {
if (callbacks.compareAndSet(entries, END)) {
return entries;
}
}
return null;
} | java | RunnablePair takeAndClear() {
RunnablePair entries;
while ((entries = callbacks.get()) != END) {
if (callbacks.compareAndSet(entries, END)) {
return entries;
}
}
return null;
} | [
"RunnablePair",
"takeAndClear",
"(",
")",
"{",
"RunnablePair",
"entries",
";",
"while",
"(",
"(",
"entries",
"=",
"callbacks",
".",
"get",
"(",
")",
")",
"!=",
"END",
")",
"{",
"if",
"(",
"callbacks",
".",
"compareAndSet",
"(",
"entries",
",",
"END",
"... | Take and reset all callbacks in an atomic fashion. | [
"Take",
"and",
"reset",
"all",
"callbacks",
"in",
"an",
"atomic",
"fashion",
"."
] | 987706d4b7f2d13b45eefdc6c54ea63ce64b3310 | https://github.com/udoprog/tiny-async-java/blob/987706d4b7f2d13b45eefdc6c54ea63ce64b3310/tiny-async-core/src/main/java/eu/toolchain/concurrent/ConcurrentCompletable.java#L435-L445 | train |
udoprog/tiny-async-java | tiny-async-core/src/main/java/eu/toolchain/concurrent/ConcurrentCompletable.java | ConcurrentCompletable.add | boolean add(Runnable runnable) {
int spins = 0;
RunnablePair entries;
while ((entries = callbacks.get()) != END) {
if (callbacks.compareAndSet(entries, new RunnablePair(runnable, entries))) {
return true;
}
if (spins++ > MAX_SPINS) {
Thread.yield();
spins = 0;
}
}
return false;
} | java | boolean add(Runnable runnable) {
int spins = 0;
RunnablePair entries;
while ((entries = callbacks.get()) != END) {
if (callbacks.compareAndSet(entries, new RunnablePair(runnable, entries))) {
return true;
}
if (spins++ > MAX_SPINS) {
Thread.yield();
spins = 0;
}
}
return false;
} | [
"boolean",
"add",
"(",
"Runnable",
"runnable",
")",
"{",
"int",
"spins",
"=",
"0",
";",
"RunnablePair",
"entries",
";",
"while",
"(",
"(",
"entries",
"=",
"callbacks",
".",
"get",
"(",
")",
")",
"!=",
"END",
")",
"{",
"if",
"(",
"callbacks",
".",
"... | Attempt to add an event listener to the list of listeners.
This implementation uses a spin-lock, where the loop copies the entire list of listeners.
@return {@code true} if a task has been queued up, {@code false} otherwise. | [
"Attempt",
"to",
"add",
"an",
"event",
"listener",
"to",
"the",
"list",
"of",
"listeners",
"."
] | 987706d4b7f2d13b45eefdc6c54ea63ce64b3310 | https://github.com/udoprog/tiny-async-java/blob/987706d4b7f2d13b45eefdc6c54ea63ce64b3310/tiny-async-core/src/main/java/eu/toolchain/concurrent/ConcurrentCompletable.java#L454-L471 | train |
udoprog/tiny-async-java | tiny-async-core/src/main/java/eu/toolchain/concurrent/ConcurrentCompletable.java | ConcurrentCompletable.result | @SuppressWarnings("unchecked")
T result(final Object r) {
return (T) (r == NULL ? null : r);
} | java | @SuppressWarnings("unchecked")
T result(final Object r) {
return (T) (r == NULL ? null : r);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"T",
"result",
"(",
"final",
"Object",
"r",
")",
"{",
"return",
"(",
"T",
")",
"(",
"r",
"==",
"NULL",
"?",
"null",
":",
"r",
")",
";",
"}"
] | Convert the result object to a result.
<p>Takes {@link #NULL} into account.
@param r the result object
@return result | [
"Convert",
"the",
"result",
"object",
"to",
"a",
"result",
"."
] | 987706d4b7f2d13b45eefdc6c54ea63ce64b3310 | https://github.com/udoprog/tiny-async-java/blob/987706d4b7f2d13b45eefdc6c54ea63ce64b3310/tiny-async-core/src/main/java/eu/toolchain/concurrent/ConcurrentCompletable.java#L518-L521 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/WidgetUtil.java | WidgetUtil.createTransparentFlashContainer | public static HTML createTransparentFlashContainer (
String ident, String movie, int width, int height, String flashVars)
{
FlashObject obj = new FlashObject(ident, movie, width, height, flashVars);
obj.transparent = true;
return createContainer(obj);
} | java | public static HTML createTransparentFlashContainer (
String ident, String movie, int width, int height, String flashVars)
{
FlashObject obj = new FlashObject(ident, movie, width, height, flashVars);
obj.transparent = true;
return createContainer(obj);
} | [
"public",
"static",
"HTML",
"createTransparentFlashContainer",
"(",
"String",
"ident",
",",
"String",
"movie",
",",
"int",
"width",
",",
"int",
"height",
",",
"String",
"flashVars",
")",
"{",
"FlashObject",
"obj",
"=",
"new",
"FlashObject",
"(",
"ident",
",",
... | Creates the HTML to display a transparent Flash movie for the browser on which we're running.
@param flashVars a pre-URLEncoded string containing flash variables, or null.
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16417 | [
"Creates",
"the",
"HTML",
"to",
"display",
"a",
"transparent",
"Flash",
"movie",
"for",
"the",
"browser",
"on",
"which",
"we",
"re",
"running",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/WidgetUtil.java#L113-L119 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/WidgetUtil.java | WidgetUtil.createFlashContainer | public static HTML createFlashContainer (
String ident, String movie, int width, int height, String flashVars)
{
return createContainer(new FlashObject(ident, movie, width, height, flashVars));
} | java | public static HTML createFlashContainer (
String ident, String movie, int width, int height, String flashVars)
{
return createContainer(new FlashObject(ident, movie, width, height, flashVars));
} | [
"public",
"static",
"HTML",
"createFlashContainer",
"(",
"String",
"ident",
",",
"String",
"movie",
",",
"int",
"width",
",",
"int",
"height",
",",
"String",
"flashVars",
")",
"{",
"return",
"createContainer",
"(",
"new",
"FlashObject",
"(",
"ident",
",",
"m... | Creates the HTML to display a Flash movie for the browser on which we're running.
@param flashVars a pre-URLEncoded string containing flash variables, or null.
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16417 | [
"Creates",
"the",
"HTML",
"to",
"display",
"a",
"Flash",
"movie",
"for",
"the",
"browser",
"on",
"which",
"we",
"re",
"running",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/WidgetUtil.java#L141-L145 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/WidgetUtil.java | WidgetUtil.ensurePixels | public static String ensurePixels (String value)
{
int index = 0;
for (int nn = value.length(); index < nn; index++) {
char c = value.charAt(index);
if (c < '0' || c > '9') {
break;
}
}
return value.substring(0, index);
} | java | public static String ensurePixels (String value)
{
int index = 0;
for (int nn = value.length(); index < nn; index++) {
char c = value.charAt(index);
if (c < '0' || c > '9') {
break;
}
}
return value.substring(0, index);
} | [
"public",
"static",
"String",
"ensurePixels",
"(",
"String",
"value",
")",
"{",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"nn",
"=",
"value",
".",
"length",
"(",
")",
";",
"index",
"<",
"nn",
";",
"index",
"++",
")",
"{",
"char",
"c",
"="... | Chops off any non-numeric suffix. | [
"Chops",
"off",
"any",
"non",
"-",
"numeric",
"suffix",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/WidgetUtil.java#L265-L275 | train |
omalley/hadoop-gpl-compression | src/java/com/hadoop/compression/lzo/LzoCodec.java | LzoCodec.isNativeLzoLoaded | public static synchronized boolean isNativeLzoLoaded(Configuration conf) {
if (!nativeLzoChecked) {
if (GPLNativeCodeLoader.isNativeCodeLoaded()) {
nativeLzoLoaded = LzoCompressor.isNativeLzoLoaded()
&& LzoDecompressor.isNativeLzoLoaded();
if (nativeLzoLoaded) {
LOG.info("Successfully loaded & initialized native-lzo library");
} else {
LOG.error("Failed to load/initialize native-lzo library");
}
} else {
LOG.error("Cannot load native-lzo without native-hadoop");
}
nativeLzoChecked = true;
}
return nativeLzoLoaded && conf.getBoolean("hadoop.native.lib", true);
} | java | public static synchronized boolean isNativeLzoLoaded(Configuration conf) {
if (!nativeLzoChecked) {
if (GPLNativeCodeLoader.isNativeCodeLoaded()) {
nativeLzoLoaded = LzoCompressor.isNativeLzoLoaded()
&& LzoDecompressor.isNativeLzoLoaded();
if (nativeLzoLoaded) {
LOG.info("Successfully loaded & initialized native-lzo library");
} else {
LOG.error("Failed to load/initialize native-lzo library");
}
} else {
LOG.error("Cannot load native-lzo without native-hadoop");
}
nativeLzoChecked = true;
}
return nativeLzoLoaded && conf.getBoolean("hadoop.native.lib", true);
} | [
"public",
"static",
"synchronized",
"boolean",
"isNativeLzoLoaded",
"(",
"Configuration",
"conf",
")",
"{",
"if",
"(",
"!",
"nativeLzoChecked",
")",
"{",
"if",
"(",
"GPLNativeCodeLoader",
".",
"isNativeCodeLoaded",
"(",
")",
")",
"{",
"nativeLzoLoaded",
"=",
"Lz... | Check if native-lzo library is loaded & initialized.
@param conf configuration
@return <code>true</code> if native-lzo library is loaded & initialized;
else <code>false</code> | [
"Check",
"if",
"native",
"-",
"lzo",
"library",
"is",
"loaded",
"&",
"initialized",
"."
] | 64ab3eb60fffac2a4d77680d506b34b02fcc3d7e | https://github.com/omalley/hadoop-gpl-compression/blob/64ab3eb60fffac2a4d77680d506b34b02fcc3d7e/src/java/com/hadoop/compression/lzo/LzoCodec.java#L67-L85 | train |
MaxxtonGroup/microdocs | example/product-service/src/main/java/com/example/service/product/controller/ProductController.java | ProductController.getProducts | @RequestMapping(path = "", method = RequestMethod.GET)
public List<Product> getProducts(){
return productService.getProducts();
} | java | @RequestMapping(path = "", method = RequestMethod.GET)
public List<Product> getProducts(){
return productService.getProducts();
} | [
"@",
"RequestMapping",
"(",
"path",
"=",
"\"\"",
",",
"method",
"=",
"RequestMethod",
".",
"GET",
")",
"public",
"List",
"<",
"Product",
">",
"getProducts",
"(",
")",
"{",
"return",
"productService",
".",
"getProducts",
"(",
")",
";",
"}"
] | Request a page of products
@response 200
@return Page of products | [
"Request",
"a",
"page",
"of",
"products"
] | fdc80f203d68145af3e8d28d13de63ddfa3e6953 | https://github.com/MaxxtonGroup/microdocs/blob/fdc80f203d68145af3e8d28d13de63ddfa3e6953/example/product-service/src/main/java/com/example/service/product/controller/ProductController.java#L28-L31 | train |
MaxxtonGroup/microdocs | example/product-service/src/main/java/com/example/service/product/controller/ProductController.java | ProductController.getCustomer | @RequestMapping(path = "/{productId}", method=RequestMethod.GET)
public ResponseEntity<Product> getCustomer(@PathVariable("productId") Long productId){
Product product = productService.getProduct(productId);
if(product != null){
return new ResponseEntity<Product>(product, HttpStatus.OK);
}
return new ResponseEntity<Product>(HttpStatus.NOT_FOUND);
} | java | @RequestMapping(path = "/{productId}", method=RequestMethod.GET)
public ResponseEntity<Product> getCustomer(@PathVariable("productId") Long productId){
Product product = productService.getProduct(productId);
if(product != null){
return new ResponseEntity<Product>(product, HttpStatus.OK);
}
return new ResponseEntity<Product>(HttpStatus.NOT_FOUND);
} | [
"@",
"RequestMapping",
"(",
"path",
"=",
"\"/{productId}\"",
",",
"method",
"=",
"RequestMethod",
".",
"GET",
")",
"public",
"ResponseEntity",
"<",
"Product",
">",
"getCustomer",
"(",
"@",
"PathVariable",
"(",
"\"productId\"",
")",
"Long",
"productId",
")",
"{... | Get a specific product by id
@param productId id of the product
@response 200
@response 404 if product doesn't exists
@return the product or null | [
"Get",
"a",
"specific",
"product",
"by",
"id"
] | fdc80f203d68145af3e8d28d13de63ddfa3e6953 | https://github.com/MaxxtonGroup/microdocs/blob/fdc80f203d68145af3e8d28d13de63ddfa3e6953/example/product-service/src/main/java/com/example/service/product/controller/ProductController.java#L40-L47 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/NumberTextBox.java | NumberTextBox.getNumber | public Number getNumber ()
{
String valstr = getText().length() == 0 ? "0" : getText();
return _allowFloatingPoint ? (Number)(new Double(valstr)) : (Number)(new Long(valstr));
} | java | public Number getNumber ()
{
String valstr = getText().length() == 0 ? "0" : getText();
return _allowFloatingPoint ? (Number)(new Double(valstr)) : (Number)(new Long(valstr));
} | [
"public",
"Number",
"getNumber",
"(",
")",
"{",
"String",
"valstr",
"=",
"getText",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
"?",
"\"0\"",
":",
"getText",
"(",
")",
";",
"return",
"_allowFloatingPoint",
"?",
"(",
"Number",
")",
"(",
"new",
"Doub... | Get the numberic value of this box. Returns 0 if the box is empty. | [
"Get",
"the",
"numberic",
"value",
"of",
"this",
"box",
".",
"Returns",
"0",
"if",
"the",
"box",
"is",
"empty",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/NumberTextBox.java#L134-L138 | train |
stackify/stackify-metrics | src/main/java/com/stackify/metric/impl/MetricSender.java | MetricSender.send | public void send(final List<MetricAggregate> aggregates) throws IOException, HttpException {
HttpClient httpClient = new HttpClient(apiConfig);
// retransmit any metrics on the resend queue
resendQueue.drain(httpClient, "/Metrics/SubmitMetricsByID");
// build the json objects
List<JsonMetric> metrics = new ArrayList<JsonMetric>(aggregates.size());
for (MetricAggregate aggregate : aggregates) {
Integer monitorId = monitorService.getMonitorId(aggregate.getIdentity());
if (monitorId != null) {
JsonMetric.Builder builder = JsonMetric.newBuilder();
builder.monitorId(monitorId);
builder.value(Double.valueOf(aggregate.getValue()));
builder.count(Integer.valueOf(aggregate.getCount()));
builder.occurredUtc(new Date(aggregate.getOccurredMillis()));
builder.monitorTypeId(Integer.valueOf(aggregate.getIdentity().getType().getId()));
builder.clientDeviceId(monitorService.getDeviceId());
metrics.add(builder.build());
} else {
LOGGER.info("Unable to determine monitor id for aggregate metric {}", aggregate);
}
}
if (metrics.isEmpty()) {
return;
}
// post metrics to stackify
byte[] jsonBytes = objectMapper.writer().writeValueAsBytes(metrics);
try {
httpClient.post("/Metrics/SubmitMetricsByID", jsonBytes);
} catch (IOException t) {
LOGGER.info("Queueing metrics for retransmission due to IOException");
resendQueue.offer(jsonBytes, t);
throw t;
} catch (HttpException t) {
LOGGER.info("Queueing metrics for retransmission due to HttpException");
resendQueue.offer(jsonBytes, t);
throw t;
}
} | java | public void send(final List<MetricAggregate> aggregates) throws IOException, HttpException {
HttpClient httpClient = new HttpClient(apiConfig);
// retransmit any metrics on the resend queue
resendQueue.drain(httpClient, "/Metrics/SubmitMetricsByID");
// build the json objects
List<JsonMetric> metrics = new ArrayList<JsonMetric>(aggregates.size());
for (MetricAggregate aggregate : aggregates) {
Integer monitorId = monitorService.getMonitorId(aggregate.getIdentity());
if (monitorId != null) {
JsonMetric.Builder builder = JsonMetric.newBuilder();
builder.monitorId(monitorId);
builder.value(Double.valueOf(aggregate.getValue()));
builder.count(Integer.valueOf(aggregate.getCount()));
builder.occurredUtc(new Date(aggregate.getOccurredMillis()));
builder.monitorTypeId(Integer.valueOf(aggregate.getIdentity().getType().getId()));
builder.clientDeviceId(monitorService.getDeviceId());
metrics.add(builder.build());
} else {
LOGGER.info("Unable to determine monitor id for aggregate metric {}", aggregate);
}
}
if (metrics.isEmpty()) {
return;
}
// post metrics to stackify
byte[] jsonBytes = objectMapper.writer().writeValueAsBytes(metrics);
try {
httpClient.post("/Metrics/SubmitMetricsByID", jsonBytes);
} catch (IOException t) {
LOGGER.info("Queueing metrics for retransmission due to IOException");
resendQueue.offer(jsonBytes, t);
throw t;
} catch (HttpException t) {
LOGGER.info("Queueing metrics for retransmission due to HttpException");
resendQueue.offer(jsonBytes, t);
throw t;
}
} | [
"public",
"void",
"send",
"(",
"final",
"List",
"<",
"MetricAggregate",
">",
"aggregates",
")",
"throws",
"IOException",
",",
"HttpException",
"{",
"HttpClient",
"httpClient",
"=",
"new",
"HttpClient",
"(",
"apiConfig",
")",
";",
"// retransmit any metrics on the re... | Sends aggregate metrics to Stackify
@param aggregates The aggregate metrics
@throws IOException
@throws HttpException | [
"Sends",
"aggregate",
"metrics",
"to",
"Stackify"
] | 6827d516085e4b29a3e54da963eebb2955822a5c | https://github.com/stackify/stackify-metrics/blob/6827d516085e4b29a3e54da963eebb2955822a5c/src/main/java/com/stackify/metric/impl/MetricSender.java#L85-L135 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/Values.java | Values.not | public static Value<Boolean> not (Value<Boolean> value)
{
return value.map(Functions.NOT);
} | java | public static Value<Boolean> not (Value<Boolean> value)
{
return value.map(Functions.NOT);
} | [
"public",
"static",
"Value",
"<",
"Boolean",
">",
"not",
"(",
"Value",
"<",
"Boolean",
">",
"value",
")",
"{",
"return",
"value",
".",
"map",
"(",
"Functions",
".",
"NOT",
")",
";",
"}"
] | Returns a value which is the logical NOT of the supplied value. | [
"Returns",
"a",
"value",
"which",
"is",
"the",
"logical",
"NOT",
"of",
"the",
"supplied",
"value",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/Values.java#L36-L39 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/Values.java | Values.computeAnd | protected static boolean computeAnd (Iterable<Value<Boolean>> values)
{
for (Value<Boolean> value : values) {
if (!value.get()) {
return false;
}
}
return true;
} | java | protected static boolean computeAnd (Iterable<Value<Boolean>> values)
{
for (Value<Boolean> value : values) {
if (!value.get()) {
return false;
}
}
return true;
} | [
"protected",
"static",
"boolean",
"computeAnd",
"(",
"Iterable",
"<",
"Value",
"<",
"Boolean",
">",
">",
"values",
")",
"{",
"for",
"(",
"Value",
"<",
"Boolean",
">",
"value",
":",
"values",
")",
"{",
"if",
"(",
"!",
"value",
".",
"get",
"(",
")",
... | my kingdom for a higher order | [
"my",
"kingdom",
"for",
"a",
"higher",
"order"
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/Values.java#L92-L100 | train |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/Handlers.java | Handlers.chain | public static ClickHandler chain (final ClickHandler... handlers)
{
return new ClickHandler() {
public void onClick (ClickEvent event) {
for (ClickHandler handler : handlers) {
try {
handler.onClick(event);
} catch (Exception e) {
Console.log("Chained click handler failed", "handler", handler, e);
}
}
}
};
} | java | public static ClickHandler chain (final ClickHandler... handlers)
{
return new ClickHandler() {
public void onClick (ClickEvent event) {
for (ClickHandler handler : handlers) {
try {
handler.onClick(event);
} catch (Exception e) {
Console.log("Chained click handler failed", "handler", handler, e);
}
}
}
};
} | [
"public",
"static",
"ClickHandler",
"chain",
"(",
"final",
"ClickHandler",
"...",
"handlers",
")",
"{",
"return",
"new",
"ClickHandler",
"(",
")",
"{",
"public",
"void",
"onClick",
"(",
"ClickEvent",
"event",
")",
"{",
"for",
"(",
"ClickHandler",
"handler",
... | Creates a click handler that dispatches a single click event to a series of handlers in
sequence. If any handler fails, the error will be caught, logged and the other handlers will
still have a chance to process the event. | [
"Creates",
"a",
"click",
"handler",
"that",
"dispatches",
"a",
"single",
"click",
"event",
"to",
"a",
"series",
"of",
"handlers",
"in",
"sequence",
".",
"If",
"any",
"handler",
"fails",
"the",
"error",
"will",
"be",
"caught",
"logged",
"and",
"the",
"other... | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/Handlers.java#L37-L50 | train |
MaxxtonGroup/microdocs | example/customer-service/src/main/java/com/example/service/customer/controller/CustomerController.java | CustomerController.getCustomers | @RequestMapping(path = "", method = RequestMethod.GET)
public Page<Customer> getCustomers(Pageable pageable){
return customerService.getCustomers(pageable);
} | java | @RequestMapping(path = "", method = RequestMethod.GET)
public Page<Customer> getCustomers(Pageable pageable){
return customerService.getCustomers(pageable);
} | [
"@",
"RequestMapping",
"(",
"path",
"=",
"\"\"",
",",
"method",
"=",
"RequestMethod",
".",
"GET",
")",
"public",
"Page",
"<",
"Customer",
">",
"getCustomers",
"(",
"Pageable",
"pageable",
")",
"{",
"return",
"customerService",
".",
"getCustomers",
"(",
"page... | Request a page of customers
@param pageable select which page to request
@response 200
@return Page of customers | [
"Request",
"a",
"page",
"of",
"customers"
] | fdc80f203d68145af3e8d28d13de63ddfa3e6953 | https://github.com/MaxxtonGroup/microdocs/blob/fdc80f203d68145af3e8d28d13de63ddfa3e6953/example/customer-service/src/main/java/com/example/service/customer/controller/CustomerController.java#L29-L32 | train |
MaxxtonGroup/microdocs | example/customer-service/src/main/java/com/example/service/customer/controller/CustomerController.java | CustomerController.getCustomer | @RequestMapping(path = "/{customerId}", method=RequestMethod.GET)
public ResponseEntity<Customer> getCustomer(@PathVariable("customerId") Long customerId, @RequestParam(required=true) String name){
Customer customer = customerService.getCustomer(customerId);
if(customer != null){
return new ResponseEntity<Customer>(customer, HttpStatus.OK);
}
return new ResponseEntity<Customer>(HttpStatus.NOT_FOUND);
} | java | @RequestMapping(path = "/{customerId}", method=RequestMethod.GET)
public ResponseEntity<Customer> getCustomer(@PathVariable("customerId") Long customerId, @RequestParam(required=true) String name){
Customer customer = customerService.getCustomer(customerId);
if(customer != null){
return new ResponseEntity<Customer>(customer, HttpStatus.OK);
}
return new ResponseEntity<Customer>(HttpStatus.NOT_FOUND);
} | [
"@",
"RequestMapping",
"(",
"path",
"=",
"\"/{customerId}\"",
",",
"method",
"=",
"RequestMethod",
".",
"GET",
")",
"public",
"ResponseEntity",
"<",
"Customer",
">",
"getCustomer",
"(",
"@",
"PathVariable",
"(",
"\"customerId\"",
")",
"Long",
"customerId",
",",
... | Get a specific customer by id
@param customerId id of the customer
@response 200
@response 404 if customer doesn't exists
@return the customer or null | [
"Get",
"a",
"specific",
"customer",
"by",
"id"
] | fdc80f203d68145af3e8d28d13de63ddfa3e6953 | https://github.com/MaxxtonGroup/microdocs/blob/fdc80f203d68145af3e8d28d13de63ddfa3e6953/example/customer-service/src/main/java/com/example/service/customer/controller/CustomerController.java#L41-L48 | train |
MaxxtonGroup/microdocs | example/customer-service/src/main/java/com/example/service/customer/controller/CustomerController.java | CustomerController.removeCustomer | @RequestMapping(path = "/{customerId}", method = RequestMethod.DELETE)
public ResponseEntity removeCustomer(@PathVariable("customerId") Long customerId){
boolean succeed = customerService.removeCustomer(customerId);
if(succeed){
return new ResponseEntity(HttpStatus.OK);
}else{
return new ResponseEntity(HttpStatus.NOT_FOUND);
}
} | java | @RequestMapping(path = "/{customerId}", method = RequestMethod.DELETE)
public ResponseEntity removeCustomer(@PathVariable("customerId") Long customerId){
boolean succeed = customerService.removeCustomer(customerId);
if(succeed){
return new ResponseEntity(HttpStatus.OK);
}else{
return new ResponseEntity(HttpStatus.NOT_FOUND);
}
} | [
"@",
"RequestMapping",
"(",
"path",
"=",
"\"/{customerId}\"",
",",
"method",
"=",
"RequestMethod",
".",
"DELETE",
")",
"public",
"ResponseEntity",
"removeCustomer",
"(",
"@",
"PathVariable",
"(",
"\"customerId\"",
")",
"Long",
"customerId",
")",
"{",
"boolean",
... | Delete customer by id
@param customerId id of the customer
@response 200 the customer is removed
@response 404 the customer did not exists
@return OK if the customer is removed, NOT_FOUND if the customer did not exists | [
"Delete",
"customer",
"by",
"id"
] | fdc80f203d68145af3e8d28d13de63ddfa3e6953 | https://github.com/MaxxtonGroup/microdocs/blob/fdc80f203d68145af3e8d28d13de63ddfa3e6953/example/customer-service/src/main/java/com/example/service/customer/controller/CustomerController.java#L74-L82 | train |
alexvasilkov/Events | library/src/main/java/com/alexvasilkov/events/internal/EventMethodsHelper.java | EventMethodsHelper.checkNoAnnotations | @SafeVarargs
private static void checkNoAnnotations(Method method, Class<? extends Annotation> foundAn,
Class<? extends Annotation>... disallowedAn) {
for (Class<? extends Annotation> an : disallowedAn) {
if (method.isAnnotationPresent(an)) {
throw new EventsException("Method " + Utils.methodToString(method)
+ " marked with @" + foundAn.getSimpleName()
+ " cannot be marked with @" + an.getSimpleName());
}
}
} | java | @SafeVarargs
private static void checkNoAnnotations(Method method, Class<? extends Annotation> foundAn,
Class<? extends Annotation>... disallowedAn) {
for (Class<? extends Annotation> an : disallowedAn) {
if (method.isAnnotationPresent(an)) {
throw new EventsException("Method " + Utils.methodToString(method)
+ " marked with @" + foundAn.getSimpleName()
+ " cannot be marked with @" + an.getSimpleName());
}
}
} | [
"@",
"SafeVarargs",
"private",
"static",
"void",
"checkNoAnnotations",
"(",
"Method",
"method",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"foundAn",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"...",
"disallowedAn",
")",
"{",
"for",
"("... | Checks that no given annotations are present on given method | [
"Checks",
"that",
"no",
"given",
"annotations",
"are",
"present",
"on",
"given",
"method"
] | 4208e11fab35d99229fe6c3b3d434ca1948f3fc5 | https://github.com/alexvasilkov/Events/blob/4208e11fab35d99229fe6c3b3d434ca1948f3fc5/library/src/main/java/com/alexvasilkov/events/internal/EventMethodsHelper.java#L177-L188 | train |
alexvasilkov/Events | library/src/main/java/com/alexvasilkov/events/internal/EventMethodsHelper.java | EventMethodsHelper.getCacheProvider | private static CacheProvider getCacheProvider(Method javaMethod) {
if (!javaMethod.isAnnotationPresent(Cache.class)) {
return null;
}
Cache an = javaMethod.getAnnotation(Cache.class);
Class<? extends CacheProvider> cacheClazz = an.value();
try {
Constructor<? extends CacheProvider> constructor = cacheClazz.getDeclaredConstructor();
constructor.setAccessible(true);
return constructor.newInstance();
} catch (Exception e) {
throw new EventsException("Cannot instantiate cache provider "
+ cacheClazz.getSimpleName() + " for method "
+ Utils.methodToString(javaMethod), e);
}
} | java | private static CacheProvider getCacheProvider(Method javaMethod) {
if (!javaMethod.isAnnotationPresent(Cache.class)) {
return null;
}
Cache an = javaMethod.getAnnotation(Cache.class);
Class<? extends CacheProvider> cacheClazz = an.value();
try {
Constructor<? extends CacheProvider> constructor = cacheClazz.getDeclaredConstructor();
constructor.setAccessible(true);
return constructor.newInstance();
} catch (Exception e) {
throw new EventsException("Cannot instantiate cache provider "
+ cacheClazz.getSimpleName() + " for method "
+ Utils.methodToString(javaMethod), e);
}
} | [
"private",
"static",
"CacheProvider",
"getCacheProvider",
"(",
"Method",
"javaMethod",
")",
"{",
"if",
"(",
"!",
"javaMethod",
".",
"isAnnotationPresent",
"(",
"Cache",
".",
"class",
")",
")",
"{",
"return",
"null",
";",
"}",
"Cache",
"an",
"=",
"javaMethod"... | Retrieves cache provider instance for method | [
"Retrieves",
"cache",
"provider",
"instance",
"for",
"method"
] | 4208e11fab35d99229fe6c3b3d434ca1948f3fc5 | https://github.com/alexvasilkov/Events/blob/4208e11fab35d99229fe6c3b3d434ca1948f3fc5/library/src/main/java/com/alexvasilkov/events/internal/EventMethodsHelper.java#L198-L215 | train |
stackify/stackify-metrics | src/main/java/com/stackify/metric/impl/AbstractMetric.java | AbstractMetric.submit | protected void submit(final double value, final boolean isIncrement) {
MetricCollector collector = MetricManager.getCollector();
if (collector != null) {
Metric.Builder builder = Metric.newBuilder();
builder.identity(identity);
builder.value(value);
builder.isIncrement(isIncrement);
Metric metric = builder.build();
collector.submit(metric);
}
} | java | protected void submit(final double value, final boolean isIncrement) {
MetricCollector collector = MetricManager.getCollector();
if (collector != null) {
Metric.Builder builder = Metric.newBuilder();
builder.identity(identity);
builder.value(value);
builder.isIncrement(isIncrement);
Metric metric = builder.build();
collector.submit(metric);
}
} | [
"protected",
"void",
"submit",
"(",
"final",
"double",
"value",
",",
"final",
"boolean",
"isIncrement",
")",
"{",
"MetricCollector",
"collector",
"=",
"MetricManager",
".",
"getCollector",
"(",
")",
";",
"if",
"(",
"collector",
"!=",
"null",
")",
"{",
"Metri... | Submits a metric to the collector
@param value The value
@param isIncrement True if the value in an increment | [
"Submits",
"a",
"metric",
"to",
"the",
"collector"
] | 6827d516085e4b29a3e54da963eebb2955822a5c | https://github.com/stackify/stackify-metrics/blob/6827d516085e4b29a3e54da963eebb2955822a5c/src/main/java/com/stackify/metric/impl/AbstractMetric.java#L53-L67 | train |
stackify/stackify-metrics | src/main/java/com/stackify/metric/impl/AbstractMetric.java | AbstractMetric.autoReportZero | protected void autoReportZero() {
MetricCollector collector = MetricManager.getCollector();
if (collector != null) {
collector.autoReportZero(identity);
}
} | java | protected void autoReportZero() {
MetricCollector collector = MetricManager.getCollector();
if (collector != null) {
collector.autoReportZero(identity);
}
} | [
"protected",
"void",
"autoReportZero",
"(",
")",
"{",
"MetricCollector",
"collector",
"=",
"MetricManager",
".",
"getCollector",
"(",
")",
";",
"if",
"(",
"collector",
"!=",
"null",
")",
"{",
"collector",
".",
"autoReportZero",
"(",
"identity",
")",
";",
"}"... | Auto reports zero if the metric hasn't been modified | [
"Auto",
"reports",
"zero",
"if",
"the",
"metric",
"hasn",
"t",
"been",
"modified"
] | 6827d516085e4b29a3e54da963eebb2955822a5c | https://github.com/stackify/stackify-metrics/blob/6827d516085e4b29a3e54da963eebb2955822a5c/src/main/java/com/stackify/metric/impl/AbstractMetric.java#L72-L79 | train |
stackify/stackify-metrics | src/main/java/com/stackify/metric/impl/AbstractMetric.java | AbstractMetric.autoReportLast | protected void autoReportLast() {
MetricCollector collector = MetricManager.getCollector();
if (collector != null) {
collector.autoReportLast(identity);
}
} | java | protected void autoReportLast() {
MetricCollector collector = MetricManager.getCollector();
if (collector != null) {
collector.autoReportLast(identity);
}
} | [
"protected",
"void",
"autoReportLast",
"(",
")",
"{",
"MetricCollector",
"collector",
"=",
"MetricManager",
".",
"getCollector",
"(",
")",
";",
"if",
"(",
"collector",
"!=",
"null",
")",
"{",
"collector",
".",
"autoReportLast",
"(",
"identity",
")",
";",
"}"... | Auto reports the last value if the metric hasn't been modified | [
"Auto",
"reports",
"the",
"last",
"value",
"if",
"the",
"metric",
"hasn",
"t",
"been",
"modified"
] | 6827d516085e4b29a3e54da963eebb2955822a5c | https://github.com/stackify/stackify-metrics/blob/6827d516085e4b29a3e54da963eebb2955822a5c/src/main/java/com/stackify/metric/impl/AbstractMetric.java#L84-L91 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeLocalizedContentUrl.java | AttributeLocalizedContentUrl.updateLocalizedContentsUrl | public static MozuUrl updateLocalizedContentsUrl(String attributeFQN)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent");
formatter.formatUrl("attributeFQN", attributeFQN);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl updateLocalizedContentsUrl(String attributeFQN)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent");
formatter.formatUrl("attributeFQN", attributeFQN);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"updateLocalizedContentsUrl",
"(",
"String",
"attributeFQN",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent\"",
")",
";",
"formatt... | Get Resource Url for UpdateLocalizedContents
@param attributeFQN Fully qualified name for an attribute.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"UpdateLocalizedContents"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeLocalizedContentUrl.java#L63-L68 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeLocalizedContentUrl.java | AttributeLocalizedContentUrl.updateLocalizedContentUrl | public static MozuUrl updateLocalizedContentUrl(String attributeFQN, String localeCode, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent/{localeCode}?responseFields={responseFields}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("localeCode", localeCode);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl updateLocalizedContentUrl(String attributeFQN, String localeCode, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent/{localeCode}?responseFields={responseFields}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("localeCode", localeCode);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"updateLocalizedContentUrl",
"(",
"String",
"attributeFQN",
",",
"String",
"localeCode",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/attributedefinitio... | Get Resource Url for UpdateLocalizedContent
@param attributeFQN Fully qualified name for an attribute.
@param localeCode The two character country code that sets the locale, such as US for United States. Sites, tenants, and catalogs use locale codes for localizing content, such as translated product text per supported country.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"UpdateLocalizedContent"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeLocalizedContentUrl.java#L77-L84 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeLocalizedContentUrl.java | AttributeLocalizedContentUrl.deleteLocalizedContentUrl | public static MozuUrl deleteLocalizedContentUrl(String attributeFQN, String localeCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent/{localeCode}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("localeCode", localeCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteLocalizedContentUrl(String attributeFQN, String localeCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent/{localeCode}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("localeCode", localeCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteLocalizedContentUrl",
"(",
"String",
"attributeFQN",
",",
"String",
"localeCode",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedCo... | Get Resource Url for DeleteLocalizedContent
@param attributeFQN Fully qualified name for an attribute.
@param localeCode The two character country code that sets the locale, such as US for United States. Sites, tenants, and catalogs use locale codes for localizing content, such as translated product text per supported country.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteLocalizedContent"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeLocalizedContentUrl.java#L92-L98 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/AppliedDiscountUrl.java | AppliedDiscountUrl.applyCouponUrl | public static MozuUrl applyCouponUrl(String checkoutId, String couponCode, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/coupons/{couponCode}?responseFields={responseFields}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("couponCode", couponCode);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl applyCouponUrl(String checkoutId, String couponCode, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/coupons/{couponCode}?responseFields={responseFields}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("couponCode", couponCode);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"applyCouponUrl",
"(",
"String",
"checkoutId",
",",
"String",
"couponCode",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/checkouts/{checkoutId}/coupons/{couponCode}?r... | Get Resource Url for ApplyCoupon
@param checkoutId The unique identifier of the checkout.
@param couponCode Code associated with the coupon to remove from the cart.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"ApplyCoupon"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/AppliedDiscountUrl.java#L23-L30 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/AppliedDiscountUrl.java | AppliedDiscountUrl.removeCouponUrl | public static MozuUrl removeCouponUrl(String checkoutId, String couponCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/coupons/{couponcode}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("couponCode", couponCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl removeCouponUrl(String checkoutId, String couponCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/coupons/{couponcode}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("couponCode", couponCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"removeCouponUrl",
"(",
"String",
"checkoutId",
",",
"String",
"couponCode",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/checkouts/{checkoutId}/coupons/{couponcode}\"",
")",
";",
"formatter",
".",... | Get Resource Url for RemoveCoupon
@param checkoutId The unique identifier of the checkout.
@param couponCode Code associated with the coupon to remove from the cart.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"RemoveCoupon"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/AppliedDiscountUrl.java#L50-L56 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/storefront/ProductSearchResultUrl.java | ProductSearchResultUrl.getRandomAccessCursorUrl | public static MozuUrl getRandomAccessCursorUrl(String filter, Integer pageSize, String query, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/storefront/productsearch/randomAccessCursor/?query={query}&filter={filter}&pageSize={pageSize}&responseFields={responseFields}");
formatter.formatUrl("filter", filter);
formatter.formatUrl("pageSize", pageSize);
formatter.formatUrl("query", query);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getRandomAccessCursorUrl(String filter, Integer pageSize, String query, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/storefront/productsearch/randomAccessCursor/?query={query}&filter={filter}&pageSize={pageSize}&responseFields={responseFields}");
formatter.formatUrl("filter", filter);
formatter.formatUrl("pageSize", pageSize);
formatter.formatUrl("query", query);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getRandomAccessCursorUrl",
"(",
"String",
"filter",
",",
"Integer",
"pageSize",
",",
"String",
"query",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/st... | Get Resource Url for GetRandomAccessCursor
@param filter A set of filter expressions representing the search parameters for a query. This parameter is optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for a list of supported filters.
@param pageSize When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with this parameter set to 25, to get the 51st through the 75th items, set startIndex to 50.
@param query Properties for the product location inventory provided for queries to locate products by their location.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetRandomAccessCursor"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/storefront/ProductSearchResultUrl.java#L24-L32 | train |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CustomerNoteUrl.java | CustomerNoteUrl.getAccountNotesUrl | public static MozuUrl getAccountNotesUrl(Integer accountId, String filter, Integer pageSize, String responseFields, String sortBy, Integer startIndex)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/notes?startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&filter={filter}&responseFields={responseFields}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("filter", filter);
formatter.formatUrl("pageSize", pageSize);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("sortBy", sortBy);
formatter.formatUrl("startIndex", startIndex);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getAccountNotesUrl(Integer accountId, String filter, Integer pageSize, String responseFields, String sortBy, Integer startIndex)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/notes?startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&filter={filter}&responseFields={responseFields}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("filter", filter);
formatter.formatUrl("pageSize", pageSize);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("sortBy", sortBy);
formatter.formatUrl("startIndex", startIndex);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getAccountNotesUrl",
"(",
"Integer",
"accountId",
",",
"String",
"filter",
",",
"Integer",
"pageSize",
",",
"String",
"responseFields",
",",
"String",
"sortBy",
",",
"Integer",
"startIndex",
")",
"{",
"UrlFormatter",
"formatter",
"=... | Get Resource Url for GetAccountNotes
@param accountId Unique identifier of the customer account.
@param filter A set of filter expressions representing the search parameters for a query. This parameter is optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for a list of supported filters.
@param pageSize When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with this parameter set to 25, to get the 51st through the 75th items, set startIndex to 50.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param sortBy The element to sort the results by and the channel in which the results appear. Either ascending (a-z) or descending (z-a) channel. Optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for more information.
@param startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with pageSize set to 25, to get the 51st through the 75th items, set this parameter to 50.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetAccountNotes"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CustomerNoteUrl.java#L42-L52 | train |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CustomerNoteUrl.java | CustomerNoteUrl.addAccountNoteUrl | public static MozuUrl addAccountNoteUrl(Integer accountId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/notes?responseFields={responseFields}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl addAccountNoteUrl(Integer accountId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/notes?responseFields={responseFields}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"addAccountNoteUrl",
"(",
"Integer",
"accountId",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/accounts/{accountId}/notes?responseFields={responseFields}\"",
")"... | Get Resource Url for AddAccountNote
@param accountId Unique identifier of the customer account.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"AddAccountNote"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CustomerNoteUrl.java#L60-L66 | train |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CustomerNoteUrl.java | CustomerNoteUrl.updateAccountNoteUrl | public static MozuUrl updateAccountNoteUrl(Integer accountId, Integer noteId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/notes/{noteId}?responseFields={responseFields}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("noteId", noteId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl updateAccountNoteUrl(Integer accountId, Integer noteId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/notes/{noteId}?responseFields={responseFields}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("noteId", noteId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"updateAccountNoteUrl",
"(",
"Integer",
"accountId",
",",
"Integer",
"noteId",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/accounts/{accountId}/notes/{noteI... | Get Resource Url for UpdateAccountNote
@param accountId Unique identifier of the customer account.
@param noteId Unique identifier of a particular note to retrieve.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"UpdateAccountNote"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CustomerNoteUrl.java#L75-L82 | train |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CustomerNoteUrl.java | CustomerNoteUrl.deleteAccountNoteUrl | public static MozuUrl deleteAccountNoteUrl(Integer accountId, Integer noteId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/notes/{noteId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("noteId", noteId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteAccountNoteUrl(Integer accountId, Integer noteId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/notes/{noteId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("noteId", noteId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteAccountNoteUrl",
"(",
"Integer",
"accountId",
",",
"Integer",
"noteId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/accounts/{accountId}/notes/{noteId}\"",
")",
";",
"formatter",
"... | Get Resource Url for DeleteAccountNote
@param accountId Unique identifier of the customer account.
@param noteId Unique identifier of a particular note to retrieve.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteAccountNote"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CustomerNoteUrl.java#L90-L96 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/content/documentlists/FacetUrl.java | FacetUrl.getFacetsUrl | public static MozuUrl getFacetsUrl(String documentListName, String propertyName)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/facets/{propertyName}");
formatter.formatUrl("documentListName", documentListName);
formatter.formatUrl("propertyName", propertyName);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getFacetsUrl(String documentListName, String propertyName)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/facets/{propertyName}");
formatter.formatUrl("documentListName", documentListName);
formatter.formatUrl("propertyName", propertyName);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getFacetsUrl",
"(",
"String",
"documentListName",
",",
"String",
"propertyName",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/content/documentlists/{documentListName}/facets/{propertyName}\"",
")",
";",
"for... | Get Resource Url for GetFacets
@param documentListName Name of content documentListName to delete
@param propertyName The property name associated with the facets to retrieve.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetFacets"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/content/documentlists/FacetUrl.java#L22-L28 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeVocabularyValueUrl.java | AttributeVocabularyValueUrl.getAttributeVocabularyValueLocalizedContentsUrl | public static MozuUrl getAttributeVocabularyValueLocalizedContentsUrl(String attributeFQN, String value)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues/{value}/LocalizedContent");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("value", value);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getAttributeVocabularyValueLocalizedContentsUrl(String attributeFQN, String value)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues/{value}/LocalizedContent");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("value", value);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getAttributeVocabularyValueLocalizedContentsUrl",
"(",
"String",
"attributeFQN",
",",
"String",
"value",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/attributedefinition/attributes/{attribut... | Get Resource Url for GetAttributeVocabularyValueLocalizedContents
@param attributeFQN Fully qualified name for an attribute.
@param value The value string to create.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetAttributeVocabularyValueLocalizedContents"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeVocabularyValueUrl.java#L34-L40 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeVocabularyValueUrl.java | AttributeVocabularyValueUrl.addAttributeVocabularyValueUrl | public static MozuUrl addAttributeVocabularyValueUrl(String attributeFQN, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues?responseFields={responseFields}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl addAttributeVocabularyValueUrl(String attributeFQN, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues?responseFields={responseFields}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"addAttributeVocabularyValueUrl",
"(",
"String",
"attributeFQN",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/Vo... | Get Resource Url for AddAttributeVocabularyValue
@param attributeFQN Fully qualified name for an attribute.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"AddAttributeVocabularyValue"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeVocabularyValueUrl.java#L98-L104 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeVocabularyValueUrl.java | AttributeVocabularyValueUrl.updateAttributeVocabularyValueUrl | public static MozuUrl updateAttributeVocabularyValueUrl(String attributeFQN, String responseFields, String value)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues/{value}?responseFields={responseFields}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("value", value);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl updateAttributeVocabularyValueUrl(String attributeFQN, String responseFields, String value)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues/{value}?responseFields={responseFields}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("value", value);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"updateAttributeVocabularyValueUrl",
"(",
"String",
"attributeFQN",
",",
"String",
"responseFields",
",",
"String",
"value",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/attributedefini... | Get Resource Url for UpdateAttributeVocabularyValue
@param attributeFQN Fully qualified name for an attribute.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param value The value string to create.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"UpdateAttributeVocabularyValue"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeVocabularyValueUrl.java#L157-L164 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeVocabularyValueUrl.java | AttributeVocabularyValueUrl.deleteAttributeVocabularyValueLocalizedContentUrl | public static MozuUrl deleteAttributeVocabularyValueLocalizedContentUrl(String attributeFQN, String localeCode, String value)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues/{value}/LocalizedContent/{localeCode}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("localeCode", localeCode);
formatter.formatUrl("value", value);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteAttributeVocabularyValueLocalizedContentUrl(String attributeFQN, String localeCode, String value)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues/{value}/LocalizedContent/{localeCode}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("localeCode", localeCode);
formatter.formatUrl("value", value);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteAttributeVocabularyValueLocalizedContentUrl",
"(",
"String",
"attributeFQN",
",",
"String",
"localeCode",
",",
"String",
"value",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/att... | Get Resource Url for DeleteAttributeVocabularyValueLocalizedContent
@param attributeFQN Fully qualified name for an attribute.
@param localeCode The two character country code that sets the locale, such as US for United States. Sites, tenants, and catalogs use locale codes for localizing content, such as translated product text per supported country.
@param value The value string to create.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteAttributeVocabularyValueLocalizedContent"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeVocabularyValueUrl.java#L187-L194 | train |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/checkouts/OrderAttributeUrl.java | OrderAttributeUrl.updateCheckoutAttributeUrl | public static MozuUrl updateCheckoutAttributeUrl(String checkoutId, Boolean removeMissing)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/attributes?removeMissing={removeMissing}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("removeMissing", removeMissing);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl updateCheckoutAttributeUrl(String checkoutId, Boolean removeMissing)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/attributes?removeMissing={removeMissing}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("removeMissing", removeMissing);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"updateCheckoutAttributeUrl",
"(",
"String",
"checkoutId",
",",
"Boolean",
"removeMissing",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/checkouts/{checkoutId}/attributes?removeMissing={removeMissing}\"",
... | Get Resource Url for UpdateCheckoutAttribute
@param checkoutId The unique identifier of the checkout.
@param removeMissing If true, the operation removes missing properties so that the updated checkout attributes will not show properties with a null value.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"UpdateCheckoutAttribute"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/checkouts/OrderAttributeUrl.java#L46-L52 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/platform/developer/DeveloperAdminUserAuthTicketUrl.java | DeveloperAdminUserAuthTicketUrl.createDeveloperUserAuthTicketUrl | public static MozuUrl createDeveloperUserAuthTicketUrl(Integer developerAccountId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/developer/authtickets/?developerAccountId={developerAccountId}&responseFields={responseFields}");
formatter.formatUrl("developerAccountId", developerAccountId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ;
} | java | public static MozuUrl createDeveloperUserAuthTicketUrl(Integer developerAccountId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/developer/authtickets/?developerAccountId={developerAccountId}&responseFields={responseFields}");
formatter.formatUrl("developerAccountId", developerAccountId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ;
} | [
"public",
"static",
"MozuUrl",
"createDeveloperUserAuthTicketUrl",
"(",
"Integer",
"developerAccountId",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/platform/developer/authtickets/?developerAccountId={developerA... | Get Resource Url for CreateDeveloperUserAuthTicket
@param developerAccountId Unique identifier of the developer account.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"CreateDeveloperUserAuthTicket"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/developer/DeveloperAdminUserAuthTicketUrl.java#L22-L28 | train |
Mozu/mozu-java | mozu-sample-java/src/main/java/com/mozu/api/sample/controller/MozuController.java | MozuController.getTenants | @RequestMapping(value = "/tenants", method = RequestMethod.GET)
public String getTenants(@RequestParam ("tenantId") Integer tenantId, Locale locale, ModelMap modelMap, Model model) {
AuthenticationProfile authenticationProfile = (AuthenticationProfile)modelMap.get("tenantAuthorization");
//if there is no active user, go to the auth page.
if (authenticationProfile == null) {
setupHomePage (locale, model);
return "home";
}
// if no tenant id was supplied just use the active tenantID in the user auth.
if (tenantId == null) {
tenantId = authenticationProfile.getActiveScope().getId();
}
// we need to get a new auth ticket for the tenant and update the authenticationProfile in session.
if (tenantId != null && !tenantId.equals(authenticationProfile.getActiveScope().getId())) {
authenticationProfile = UserAuthenticator.refreshUserAuthTicket(authenticationProfile.getAuthTicket(), tenantId);
model.addAttribute("tenantAuthorization", authenticationProfile);
}
// Authorize user and get tenants
List<Scope> tenants = authenticationProfile.getAuthorizedScopes();
if (tenants == null) {
tenants = new ArrayList<Scope>();
tenants.add(authenticationProfile.getActiveScope());
}
model.addAttribute("user", authenticationProfile.getUserProfile());
model.addAttribute("availableTenants", tenants);
model.addAttribute("tenantId", tenantId);
List<Site> sites = null;
if (tenants != null && tenants.size() > 0) {
sites = getAvailableTenantSites(tenantId);
} else {
sites = new ArrayList<Site>();
}
model.addAttribute("sites", sites);
return "tenants";
} | java | @RequestMapping(value = "/tenants", method = RequestMethod.GET)
public String getTenants(@RequestParam ("tenantId") Integer tenantId, Locale locale, ModelMap modelMap, Model model) {
AuthenticationProfile authenticationProfile = (AuthenticationProfile)modelMap.get("tenantAuthorization");
//if there is no active user, go to the auth page.
if (authenticationProfile == null) {
setupHomePage (locale, model);
return "home";
}
// if no tenant id was supplied just use the active tenantID in the user auth.
if (tenantId == null) {
tenantId = authenticationProfile.getActiveScope().getId();
}
// we need to get a new auth ticket for the tenant and update the authenticationProfile in session.
if (tenantId != null && !tenantId.equals(authenticationProfile.getActiveScope().getId())) {
authenticationProfile = UserAuthenticator.refreshUserAuthTicket(authenticationProfile.getAuthTicket(), tenantId);
model.addAttribute("tenantAuthorization", authenticationProfile);
}
// Authorize user and get tenants
List<Scope> tenants = authenticationProfile.getAuthorizedScopes();
if (tenants == null) {
tenants = new ArrayList<Scope>();
tenants.add(authenticationProfile.getActiveScope());
}
model.addAttribute("user", authenticationProfile.getUserProfile());
model.addAttribute("availableTenants", tenants);
model.addAttribute("tenantId", tenantId);
List<Site> sites = null;
if (tenants != null && tenants.size() > 0) {
sites = getAvailableTenantSites(tenantId);
} else {
sites = new ArrayList<Site>();
}
model.addAttribute("sites", sites);
return "tenants";
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/tenants\"",
",",
"method",
"=",
"RequestMethod",
".",
"GET",
")",
"public",
"String",
"getTenants",
"(",
"@",
"RequestParam",
"(",
"\"tenantId\"",
")",
"Integer",
"tenantId",
",",
"Locale",
"locale",
",",
"ModelMap... | This method is used when the application and user have been authorized
@param tenantId
@param locale
@param modelMap
@param model
@return | [
"This",
"method",
"is",
"used",
"when",
"the",
"application",
"and",
"user",
"have",
"been",
"authorized"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-sample-java/src/main/java/com/mozu/api/sample/controller/MozuController.java#L153-L195 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/platform/adminuser/AdminUserUrl.java | AdminUserUrl.getTenantScopesForUserUrl | public static MozuUrl getTenantScopesForUserUrl(String responseFields, String userId)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/adminuser/accounts/{userId}/tenants?responseFields={responseFields}");
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ;
} | java | public static MozuUrl getTenantScopesForUserUrl(String responseFields, String userId)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/adminuser/accounts/{userId}/tenants?responseFields={responseFields}");
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getTenantScopesForUserUrl",
"(",
"String",
"responseFields",
",",
"String",
"userId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/platform/adminuser/accounts/{userId}/tenants?responseFields={responseFields}\"",
... | Get Resource Url for GetTenantScopesForUser
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param userId Unique identifier of the user whose tenant scopes you want to retrieve.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetTenantScopesForUser"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/adminuser/AdminUserUrl.java#L22-L28 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/shipping/admin/CarrierConfigurationUrl.java | CarrierConfigurationUrl.getConfigurationUrl | public static MozuUrl getConfigurationUrl(String carrierId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/shipping/admin/carriers/{carrierId}?responseFields={responseFields}");
formatter.formatUrl("carrierId", carrierId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getConfigurationUrl(String carrierId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/shipping/admin/carriers/{carrierId}?responseFields={responseFields}");
formatter.formatUrl("carrierId", carrierId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getConfigurationUrl",
"(",
"String",
"carrierId",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/shipping/admin/carriers/{carrierId}?responseFields={responseFields}\"",
")... | Get Resource Url for GetConfiguration
@param carrierId The unique identifier of the carrier.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetConfiguration"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/shipping/admin/CarrierConfigurationUrl.java#L42-L48 | train |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/shipping/admin/CarrierConfigurationUrl.java | CarrierConfigurationUrl.deleteConfigurationUrl | public static MozuUrl deleteConfigurationUrl(String carrierId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/shipping/admin/carriers/{carrierId}");
formatter.formatUrl("carrierId", carrierId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteConfigurationUrl(String carrierId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/shipping/admin/carriers/{carrierId}");
formatter.formatUrl("carrierId", carrierId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteConfigurationUrl",
"(",
"String",
"carrierId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/shipping/admin/carriers/{carrierId}\"",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"carrierId... | Get Resource Url for DeleteConfiguration
@param carrierId The unique identifier of the carrier configuration.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteConfiguration"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/shipping/admin/CarrierConfigurationUrl.java#L83-L88 | train |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/appdev/AppPackageUrl.java | AppPackageUrl.getPackageUrl | public static MozuUrl getPackageUrl(String applicationKey, Boolean includeChildren, String responseFields, Boolean skipDevAccountCheck)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/appdev/apppackages/{applicationKey}/?includeChildren={includeChildren}&skipDevAccountCheck={skipDevAccountCheck}&responseFields={responseFields}");
formatter.formatUrl("applicationKey", applicationKey);
formatter.formatUrl("includeChildren", includeChildren);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("skipDevAccountCheck", skipDevAccountCheck);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getPackageUrl(String applicationKey, Boolean includeChildren, String responseFields, Boolean skipDevAccountCheck)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/appdev/apppackages/{applicationKey}/?includeChildren={includeChildren}&skipDevAccountCheck={skipDevAccountCheck}&responseFields={responseFields}");
formatter.formatUrl("applicationKey", applicationKey);
formatter.formatUrl("includeChildren", includeChildren);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("skipDevAccountCheck", skipDevAccountCheck);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getPackageUrl",
"(",
"String",
"applicationKey",
",",
"Boolean",
"includeChildren",
",",
"String",
"responseFields",
",",
"Boolean",
"skipDevAccountCheck",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/... | Get Resource Url for GetPackage
@param applicationKey
@param includeChildren
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param skipDevAccountCheck
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetPackage"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/appdev/AppPackageUrl.java#L44-L52 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.