id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
sequence | docstring
stringlengths 3
16k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 105
339
|
---|---|---|---|---|---|---|---|---|---|---|---|
163,000 | cdapio/netty-http | src/main/java/io/cdap/http/internal/HttpResourceModel.java | HttpResourceModel.handle | @SuppressWarnings("unchecked")
public HttpMethodInfo handle(HttpRequest request,
HttpResponder responder, Map<String, String> groupValues) throws Exception {
//TODO: Refactor group values.
try {
if (httpMethods.contains(request.method())) {
//Setup args for reflection call
Object [] args = new Object[paramsInfo.size()];
int idx = 0;
for (Map<Class<? extends Annotation>, ParameterInfo<?>> info : paramsInfo) {
if (info.containsKey(PathParam.class)) {
args[idx] = getPathParamValue(info, groupValues);
}
if (info.containsKey(QueryParam.class)) {
args[idx] = getQueryParamValue(info, request.uri());
}
if (info.containsKey(HeaderParam.class)) {
args[idx] = getHeaderParamValue(info, request);
}
idx++;
}
return new HttpMethodInfo(method, handler, responder, args, exceptionHandler);
} else {
//Found a matching resource but could not find the right HttpMethod so return 405
throw new HandlerException(HttpResponseStatus.METHOD_NOT_ALLOWED, String.format
("Problem accessing: %s. Reason: Method Not Allowed", request.uri()));
}
} catch (Throwable e) {
throw new HandlerException(HttpResponseStatus.INTERNAL_SERVER_ERROR,
String.format("Error in executing request: %s %s", request.method(),
request.uri()), e);
}
} | java | @SuppressWarnings("unchecked")
public HttpMethodInfo handle(HttpRequest request,
HttpResponder responder, Map<String, String> groupValues) throws Exception {
//TODO: Refactor group values.
try {
if (httpMethods.contains(request.method())) {
//Setup args for reflection call
Object [] args = new Object[paramsInfo.size()];
int idx = 0;
for (Map<Class<? extends Annotation>, ParameterInfo<?>> info : paramsInfo) {
if (info.containsKey(PathParam.class)) {
args[idx] = getPathParamValue(info, groupValues);
}
if (info.containsKey(QueryParam.class)) {
args[idx] = getQueryParamValue(info, request.uri());
}
if (info.containsKey(HeaderParam.class)) {
args[idx] = getHeaderParamValue(info, request);
}
idx++;
}
return new HttpMethodInfo(method, handler, responder, args, exceptionHandler);
} else {
//Found a matching resource but could not find the right HttpMethod so return 405
throw new HandlerException(HttpResponseStatus.METHOD_NOT_ALLOWED, String.format
("Problem accessing: %s. Reason: Method Not Allowed", request.uri()));
}
} catch (Throwable e) {
throw new HandlerException(HttpResponseStatus.INTERNAL_SERVER_ERROR,
String.format("Error in executing request: %s %s", request.method(),
request.uri()), e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"HttpMethodInfo",
"handle",
"(",
"HttpRequest",
"request",
",",
"HttpResponder",
"responder",
",",
"Map",
"<",
"String",
",",
"String",
">",
"groupValues",
")",
"throws",
"Exception",
"{",
"//TODO: Refactor group values.",
"try",
"{",
"if",
"(",
"httpMethods",
".",
"contains",
"(",
"request",
".",
"method",
"(",
")",
")",
")",
"{",
"//Setup args for reflection call",
"Object",
"[",
"]",
"args",
"=",
"new",
"Object",
"[",
"paramsInfo",
".",
"size",
"(",
")",
"]",
";",
"int",
"idx",
"=",
"0",
";",
"for",
"(",
"Map",
"<",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
",",
"ParameterInfo",
"<",
"?",
">",
">",
"info",
":",
"paramsInfo",
")",
"{",
"if",
"(",
"info",
".",
"containsKey",
"(",
"PathParam",
".",
"class",
")",
")",
"{",
"args",
"[",
"idx",
"]",
"=",
"getPathParamValue",
"(",
"info",
",",
"groupValues",
")",
";",
"}",
"if",
"(",
"info",
".",
"containsKey",
"(",
"QueryParam",
".",
"class",
")",
")",
"{",
"args",
"[",
"idx",
"]",
"=",
"getQueryParamValue",
"(",
"info",
",",
"request",
".",
"uri",
"(",
")",
")",
";",
"}",
"if",
"(",
"info",
".",
"containsKey",
"(",
"HeaderParam",
".",
"class",
")",
")",
"{",
"args",
"[",
"idx",
"]",
"=",
"getHeaderParamValue",
"(",
"info",
",",
"request",
")",
";",
"}",
"idx",
"++",
";",
"}",
"return",
"new",
"HttpMethodInfo",
"(",
"method",
",",
"handler",
",",
"responder",
",",
"args",
",",
"exceptionHandler",
")",
";",
"}",
"else",
"{",
"//Found a matching resource but could not find the right HttpMethod so return 405",
"throw",
"new",
"HandlerException",
"(",
"HttpResponseStatus",
".",
"METHOD_NOT_ALLOWED",
",",
"String",
".",
"format",
"(",
"\"Problem accessing: %s. Reason: Method Not Allowed\"",
",",
"request",
".",
"uri",
"(",
")",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"throw",
"new",
"HandlerException",
"(",
"HttpResponseStatus",
".",
"INTERNAL_SERVER_ERROR",
",",
"String",
".",
"format",
"(",
"\"Error in executing request: %s %s\"",
",",
"request",
".",
"method",
"(",
")",
",",
"request",
".",
"uri",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"}"
] | Handle http Request.
@param request HttpRequest to be handled.
@param responder HttpResponder to write the response.
@param groupValues Values needed for the invocation. | [
"Handle",
"http",
"Request",
"."
] | 02fdbb45bdd51d3dd58c0efbb2f27195d265cd0f | https://github.com/cdapio/netty-http/blob/02fdbb45bdd51d3dd58c0efbb2f27195d265cd0f/src/main/java/io/cdap/http/internal/HttpResourceModel.java#L113-L147 |
163,001 | cdapio/netty-http | src/main/java/io/cdap/http/internal/HttpResourceModel.java | HttpResourceModel.createParametersInfos | private List<Map<Class<? extends Annotation>, ParameterInfo<?>>> createParametersInfos(Method method) {
if (method.getParameterTypes().length <= 2) {
return Collections.emptyList();
}
List<Map<Class<? extends Annotation>, ParameterInfo<?>>> result = new ArrayList<>();
Type[] parameterTypes = method.getGenericParameterTypes();
Annotation[][] parameterAnnotations = method.getParameterAnnotations();
for (int i = 2; i < parameterAnnotations.length; i++) {
Annotation[] annotations = parameterAnnotations[i];
Map<Class<? extends Annotation>, ParameterInfo<?>> paramAnnotations = new IdentityHashMap<>();
for (Annotation annotation : annotations) {
Class<? extends Annotation> annotationType = annotation.annotationType();
ParameterInfo<?> parameterInfo;
if (PathParam.class.isAssignableFrom(annotationType)) {
parameterInfo = ParameterInfo.create(annotation,
ParamConvertUtils.createPathParamConverter(parameterTypes[i]));
} else if (QueryParam.class.isAssignableFrom(annotationType)) {
parameterInfo = ParameterInfo.create(annotation,
ParamConvertUtils.createQueryParamConverter(parameterTypes[i]));
} else if (HeaderParam.class.isAssignableFrom(annotationType)) {
parameterInfo = ParameterInfo.create(annotation,
ParamConvertUtils.createHeaderParamConverter(parameterTypes[i]));
} else {
parameterInfo = ParameterInfo.create(annotation, null);
}
paramAnnotations.put(annotationType, parameterInfo);
}
// Must have either @PathParam, @QueryParam or @HeaderParam, but not two or more.
int presence = 0;
for (Class<? extends Annotation> annotationClass : paramAnnotations.keySet()) {
if (SUPPORTED_PARAM_ANNOTATIONS.contains(annotationClass)) {
presence++;
}
}
if (presence != 1) {
throw new IllegalArgumentException(
String.format("Must have exactly one annotation from %s for parameter %d in method %s",
SUPPORTED_PARAM_ANNOTATIONS, i, method));
}
result.add(Collections.unmodifiableMap(paramAnnotations));
}
return Collections.unmodifiableList(result);
} | java | private List<Map<Class<? extends Annotation>, ParameterInfo<?>>> createParametersInfos(Method method) {
if (method.getParameterTypes().length <= 2) {
return Collections.emptyList();
}
List<Map<Class<? extends Annotation>, ParameterInfo<?>>> result = new ArrayList<>();
Type[] parameterTypes = method.getGenericParameterTypes();
Annotation[][] parameterAnnotations = method.getParameterAnnotations();
for (int i = 2; i < parameterAnnotations.length; i++) {
Annotation[] annotations = parameterAnnotations[i];
Map<Class<? extends Annotation>, ParameterInfo<?>> paramAnnotations = new IdentityHashMap<>();
for (Annotation annotation : annotations) {
Class<? extends Annotation> annotationType = annotation.annotationType();
ParameterInfo<?> parameterInfo;
if (PathParam.class.isAssignableFrom(annotationType)) {
parameterInfo = ParameterInfo.create(annotation,
ParamConvertUtils.createPathParamConverter(parameterTypes[i]));
} else if (QueryParam.class.isAssignableFrom(annotationType)) {
parameterInfo = ParameterInfo.create(annotation,
ParamConvertUtils.createQueryParamConverter(parameterTypes[i]));
} else if (HeaderParam.class.isAssignableFrom(annotationType)) {
parameterInfo = ParameterInfo.create(annotation,
ParamConvertUtils.createHeaderParamConverter(parameterTypes[i]));
} else {
parameterInfo = ParameterInfo.create(annotation, null);
}
paramAnnotations.put(annotationType, parameterInfo);
}
// Must have either @PathParam, @QueryParam or @HeaderParam, but not two or more.
int presence = 0;
for (Class<? extends Annotation> annotationClass : paramAnnotations.keySet()) {
if (SUPPORTED_PARAM_ANNOTATIONS.contains(annotationClass)) {
presence++;
}
}
if (presence != 1) {
throw new IllegalArgumentException(
String.format("Must have exactly one annotation from %s for parameter %d in method %s",
SUPPORTED_PARAM_ANNOTATIONS, i, method));
}
result.add(Collections.unmodifiableMap(paramAnnotations));
}
return Collections.unmodifiableList(result);
} | [
"private",
"List",
"<",
"Map",
"<",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
",",
"ParameterInfo",
"<",
"?",
">",
">",
">",
"createParametersInfos",
"(",
"Method",
"method",
")",
"{",
"if",
"(",
"method",
".",
"getParameterTypes",
"(",
")",
".",
"length",
"<=",
"2",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"List",
"<",
"Map",
"<",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
",",
"ParameterInfo",
"<",
"?",
">",
">",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Type",
"[",
"]",
"parameterTypes",
"=",
"method",
".",
"getGenericParameterTypes",
"(",
")",
";",
"Annotation",
"[",
"]",
"[",
"]",
"parameterAnnotations",
"=",
"method",
".",
"getParameterAnnotations",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"2",
";",
"i",
"<",
"parameterAnnotations",
".",
"length",
";",
"i",
"++",
")",
"{",
"Annotation",
"[",
"]",
"annotations",
"=",
"parameterAnnotations",
"[",
"i",
"]",
";",
"Map",
"<",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
",",
"ParameterInfo",
"<",
"?",
">",
">",
"paramAnnotations",
"=",
"new",
"IdentityHashMap",
"<>",
"(",
")",
";",
"for",
"(",
"Annotation",
"annotation",
":",
"annotations",
")",
"{",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
"=",
"annotation",
".",
"annotationType",
"(",
")",
";",
"ParameterInfo",
"<",
"?",
">",
"parameterInfo",
";",
"if",
"(",
"PathParam",
".",
"class",
".",
"isAssignableFrom",
"(",
"annotationType",
")",
")",
"{",
"parameterInfo",
"=",
"ParameterInfo",
".",
"create",
"(",
"annotation",
",",
"ParamConvertUtils",
".",
"createPathParamConverter",
"(",
"parameterTypes",
"[",
"i",
"]",
")",
")",
";",
"}",
"else",
"if",
"(",
"QueryParam",
".",
"class",
".",
"isAssignableFrom",
"(",
"annotationType",
")",
")",
"{",
"parameterInfo",
"=",
"ParameterInfo",
".",
"create",
"(",
"annotation",
",",
"ParamConvertUtils",
".",
"createQueryParamConverter",
"(",
"parameterTypes",
"[",
"i",
"]",
")",
")",
";",
"}",
"else",
"if",
"(",
"HeaderParam",
".",
"class",
".",
"isAssignableFrom",
"(",
"annotationType",
")",
")",
"{",
"parameterInfo",
"=",
"ParameterInfo",
".",
"create",
"(",
"annotation",
",",
"ParamConvertUtils",
".",
"createHeaderParamConverter",
"(",
"parameterTypes",
"[",
"i",
"]",
")",
")",
";",
"}",
"else",
"{",
"parameterInfo",
"=",
"ParameterInfo",
".",
"create",
"(",
"annotation",
",",
"null",
")",
";",
"}",
"paramAnnotations",
".",
"put",
"(",
"annotationType",
",",
"parameterInfo",
")",
";",
"}",
"// Must have either @PathParam, @QueryParam or @HeaderParam, but not two or more.",
"int",
"presence",
"=",
"0",
";",
"for",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
":",
"paramAnnotations",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"SUPPORTED_PARAM_ANNOTATIONS",
".",
"contains",
"(",
"annotationClass",
")",
")",
"{",
"presence",
"++",
";",
"}",
"}",
"if",
"(",
"presence",
"!=",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Must have exactly one annotation from %s for parameter %d in method %s\"",
",",
"SUPPORTED_PARAM_ANNOTATIONS",
",",
"i",
",",
"method",
")",
")",
";",
"}",
"result",
".",
"add",
"(",
"Collections",
".",
"unmodifiableMap",
"(",
"paramAnnotations",
")",
")",
";",
"}",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"result",
")",
";",
"}"
] | Gathers all parameters' annotations for the given method, starting from the third parameter. | [
"Gathers",
"all",
"parameters",
"annotations",
"for",
"the",
"given",
"method",
"starting",
"from",
"the",
"third",
"parameter",
"."
] | 02fdbb45bdd51d3dd58c0efbb2f27195d265cd0f | https://github.com/cdapio/netty-http/blob/02fdbb45bdd51d3dd58c0efbb2f27195d265cd0f/src/main/java/io/cdap/http/internal/HttpResourceModel.java#L209-L259 |
163,002 | Azure/autorest-clientruntime-for-java | client-runtime/src/main/java/com/microsoft/rest/ServiceFuture.java | ServiceFuture.fromResponse | public static <T> ServiceFuture<T> fromResponse(final Observable<ServiceResponse<T>> observable) {
final ServiceFuture<T> serviceFuture = new ServiceFuture<>();
serviceFuture.subscription = observable
.last()
.subscribe(new Action1<ServiceResponse<T>>() {
@Override
public void call(ServiceResponse<T> t) {
serviceFuture.set(t.body());
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
serviceFuture.setException(throwable);
}
});
return serviceFuture;
} | java | public static <T> ServiceFuture<T> fromResponse(final Observable<ServiceResponse<T>> observable) {
final ServiceFuture<T> serviceFuture = new ServiceFuture<>();
serviceFuture.subscription = observable
.last()
.subscribe(new Action1<ServiceResponse<T>>() {
@Override
public void call(ServiceResponse<T> t) {
serviceFuture.set(t.body());
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
serviceFuture.setException(throwable);
}
});
return serviceFuture;
} | [
"public",
"static",
"<",
"T",
">",
"ServiceFuture",
"<",
"T",
">",
"fromResponse",
"(",
"final",
"Observable",
"<",
"ServiceResponse",
"<",
"T",
">",
">",
"observable",
")",
"{",
"final",
"ServiceFuture",
"<",
"T",
">",
"serviceFuture",
"=",
"new",
"ServiceFuture",
"<>",
"(",
")",
";",
"serviceFuture",
".",
"subscription",
"=",
"observable",
".",
"last",
"(",
")",
".",
"subscribe",
"(",
"new",
"Action1",
"<",
"ServiceResponse",
"<",
"T",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"call",
"(",
"ServiceResponse",
"<",
"T",
">",
"t",
")",
"{",
"serviceFuture",
".",
"set",
"(",
"t",
".",
"body",
"(",
")",
")",
";",
"}",
"}",
",",
"new",
"Action1",
"<",
"Throwable",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"call",
"(",
"Throwable",
"throwable",
")",
"{",
"serviceFuture",
".",
"setException",
"(",
"throwable",
")",
";",
"}",
"}",
")",
";",
"return",
"serviceFuture",
";",
"}"
] | Creates a ServiceCall from an observable object.
@param observable the observable to create from
@param <T> the type of the response
@return the created ServiceCall | [
"Creates",
"a",
"ServiceCall",
"from",
"an",
"observable",
"object",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/ServiceFuture.java#L39-L55 |
163,003 | Azure/autorest-clientruntime-for-java | client-runtime/src/main/java/com/microsoft/rest/ServiceFuture.java | ServiceFuture.fromResponse | public static <T> ServiceFuture<T> fromResponse(final Observable<ServiceResponse<T>> observable, final ServiceCallback<T> callback) {
final ServiceFuture<T> serviceFuture = new ServiceFuture<>();
serviceFuture.subscription = observable
.last()
.subscribe(new Action1<ServiceResponse<T>>() {
@Override
public void call(ServiceResponse<T> t) {
if (callback != null) {
callback.success(t.body());
}
serviceFuture.set(t.body());
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
if (callback != null) {
callback.failure(throwable);
}
serviceFuture.setException(throwable);
}
});
return serviceFuture;
} | java | public static <T> ServiceFuture<T> fromResponse(final Observable<ServiceResponse<T>> observable, final ServiceCallback<T> callback) {
final ServiceFuture<T> serviceFuture = new ServiceFuture<>();
serviceFuture.subscription = observable
.last()
.subscribe(new Action1<ServiceResponse<T>>() {
@Override
public void call(ServiceResponse<T> t) {
if (callback != null) {
callback.success(t.body());
}
serviceFuture.set(t.body());
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
if (callback != null) {
callback.failure(throwable);
}
serviceFuture.setException(throwable);
}
});
return serviceFuture;
} | [
"public",
"static",
"<",
"T",
">",
"ServiceFuture",
"<",
"T",
">",
"fromResponse",
"(",
"final",
"Observable",
"<",
"ServiceResponse",
"<",
"T",
">",
">",
"observable",
",",
"final",
"ServiceCallback",
"<",
"T",
">",
"callback",
")",
"{",
"final",
"ServiceFuture",
"<",
"T",
">",
"serviceFuture",
"=",
"new",
"ServiceFuture",
"<>",
"(",
")",
";",
"serviceFuture",
".",
"subscription",
"=",
"observable",
".",
"last",
"(",
")",
".",
"subscribe",
"(",
"new",
"Action1",
"<",
"ServiceResponse",
"<",
"T",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"call",
"(",
"ServiceResponse",
"<",
"T",
">",
"t",
")",
"{",
"if",
"(",
"callback",
"!=",
"null",
")",
"{",
"callback",
".",
"success",
"(",
"t",
".",
"body",
"(",
")",
")",
";",
"}",
"serviceFuture",
".",
"set",
"(",
"t",
".",
"body",
"(",
")",
")",
";",
"}",
"}",
",",
"new",
"Action1",
"<",
"Throwable",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"call",
"(",
"Throwable",
"throwable",
")",
"{",
"if",
"(",
"callback",
"!=",
"null",
")",
"{",
"callback",
".",
"failure",
"(",
"throwable",
")",
";",
"}",
"serviceFuture",
".",
"setException",
"(",
"throwable",
")",
";",
"}",
"}",
")",
";",
"return",
"serviceFuture",
";",
"}"
] | Creates a ServiceCall from an observable object and a callback.
@param observable the observable to create from
@param callback the callback to call when events happen
@param <T> the type of the response
@return the created ServiceCall | [
"Creates",
"a",
"ServiceCall",
"from",
"an",
"observable",
"object",
"and",
"a",
"callback",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/ServiceFuture.java#L65-L87 |
163,004 | Azure/autorest-clientruntime-for-java | client-runtime/src/main/java/com/microsoft/rest/ServiceFuture.java | ServiceFuture.fromBody | public static ServiceFuture<Void> fromBody(final Completable completable, final ServiceCallback<Void> callback) {
final ServiceFuture<Void> serviceFuture = new ServiceFuture<>();
completable.subscribe(new Action0() {
Void value = null;
@Override
public void call() {
if (callback != null) {
callback.success(value);
}
serviceFuture.set(value);
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
if (callback != null) {
callback.failure(throwable);
}
serviceFuture.setException(throwable);
}
});
return serviceFuture;
} | java | public static ServiceFuture<Void> fromBody(final Completable completable, final ServiceCallback<Void> callback) {
final ServiceFuture<Void> serviceFuture = new ServiceFuture<>();
completable.subscribe(new Action0() {
Void value = null;
@Override
public void call() {
if (callback != null) {
callback.success(value);
}
serviceFuture.set(value);
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
if (callback != null) {
callback.failure(throwable);
}
serviceFuture.setException(throwable);
}
});
return serviceFuture;
} | [
"public",
"static",
"ServiceFuture",
"<",
"Void",
">",
"fromBody",
"(",
"final",
"Completable",
"completable",
",",
"final",
"ServiceCallback",
"<",
"Void",
">",
"callback",
")",
"{",
"final",
"ServiceFuture",
"<",
"Void",
">",
"serviceFuture",
"=",
"new",
"ServiceFuture",
"<>",
"(",
")",
";",
"completable",
".",
"subscribe",
"(",
"new",
"Action0",
"(",
")",
"{",
"Void",
"value",
"=",
"null",
";",
"@",
"Override",
"public",
"void",
"call",
"(",
")",
"{",
"if",
"(",
"callback",
"!=",
"null",
")",
"{",
"callback",
".",
"success",
"(",
"value",
")",
";",
"}",
"serviceFuture",
".",
"set",
"(",
"value",
")",
";",
"}",
"}",
",",
"new",
"Action1",
"<",
"Throwable",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"call",
"(",
"Throwable",
"throwable",
")",
"{",
"if",
"(",
"callback",
"!=",
"null",
")",
"{",
"callback",
".",
"failure",
"(",
"throwable",
")",
";",
"}",
"serviceFuture",
".",
"setException",
"(",
"throwable",
")",
";",
"}",
"}",
")",
";",
"return",
"serviceFuture",
";",
"}"
] | Creates a ServiceFuture from an Completable object and a callback.
@param completable the completable to create from
@param callback the callback to call when event happen
@return the created ServiceFuture | [
"Creates",
"a",
"ServiceFuture",
"from",
"an",
"Completable",
"object",
"and",
"a",
"callback",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/ServiceFuture.java#L128-L149 |
163,005 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ExternalChildResourcesCachedImpl.java | ExternalChildResourcesCachedImpl.cacheCollection | protected void cacheCollection() {
this.clear();
for (FluentModelTImpl childResource : this.listChildResources()) {
this.childCollection.put(childResource.childResourceKey(), childResource);
}
} | java | protected void cacheCollection() {
this.clear();
for (FluentModelTImpl childResource : this.listChildResources()) {
this.childCollection.put(childResource.childResourceKey(), childResource);
}
} | [
"protected",
"void",
"cacheCollection",
"(",
")",
"{",
"this",
".",
"clear",
"(",
")",
";",
"for",
"(",
"FluentModelTImpl",
"childResource",
":",
"this",
".",
"listChildResources",
"(",
")",
")",
"{",
"this",
".",
"childCollection",
".",
"put",
"(",
"childResource",
".",
"childResourceKey",
"(",
")",
",",
"childResource",
")",
";",
"}",
"}"
] | Initializes the external child resource collection. | [
"Initializes",
"the",
"external",
"child",
"resource",
"collection",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ExternalChildResourcesCachedImpl.java#L178-L183 |
163,006 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java | DAGraph.addDependencyGraph | public void addDependencyGraph(DAGraph<DataT, NodeT> dependencyGraph) {
this.rootNode.addDependency(dependencyGraph.rootNode.key());
Map<String, NodeT> sourceNodeTable = dependencyGraph.nodeTable;
Map<String, NodeT> targetNodeTable = this.nodeTable;
this.merge(sourceNodeTable, targetNodeTable);
dependencyGraph.parentDAGs.add(this);
if (this.hasParents()) {
this.bubbleUpNodeTable(this, new LinkedList<String>());
}
} | java | public void addDependencyGraph(DAGraph<DataT, NodeT> dependencyGraph) {
this.rootNode.addDependency(dependencyGraph.rootNode.key());
Map<String, NodeT> sourceNodeTable = dependencyGraph.nodeTable;
Map<String, NodeT> targetNodeTable = this.nodeTable;
this.merge(sourceNodeTable, targetNodeTable);
dependencyGraph.parentDAGs.add(this);
if (this.hasParents()) {
this.bubbleUpNodeTable(this, new LinkedList<String>());
}
} | [
"public",
"void",
"addDependencyGraph",
"(",
"DAGraph",
"<",
"DataT",
",",
"NodeT",
">",
"dependencyGraph",
")",
"{",
"this",
".",
"rootNode",
".",
"addDependency",
"(",
"dependencyGraph",
".",
"rootNode",
".",
"key",
"(",
")",
")",
";",
"Map",
"<",
"String",
",",
"NodeT",
">",
"sourceNodeTable",
"=",
"dependencyGraph",
".",
"nodeTable",
";",
"Map",
"<",
"String",
",",
"NodeT",
">",
"targetNodeTable",
"=",
"this",
".",
"nodeTable",
";",
"this",
".",
"merge",
"(",
"sourceNodeTable",
",",
"targetNodeTable",
")",
";",
"dependencyGraph",
".",
"parentDAGs",
".",
"add",
"(",
"this",
")",
";",
"if",
"(",
"this",
".",
"hasParents",
"(",
")",
")",
"{",
"this",
".",
"bubbleUpNodeTable",
"(",
"this",
",",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
")",
";",
"}",
"}"
] | Mark root of this DAG depends on given DAG's root.
@param dependencyGraph the dependency DAG | [
"Mark",
"root",
"of",
"this",
"DAG",
"depends",
"on",
"given",
"DAG",
"s",
"root",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java#L101-L110 |
163,007 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java | DAGraph.prepareForEnumeration | public void prepareForEnumeration() {
if (isPreparer()) {
for (NodeT node : nodeTable.values()) {
// Prepare each node for traversal
node.initialize();
if (!this.isRootNode(node)) {
// Mark other sub-DAGs as non-preparer
node.setPreparer(false);
}
}
initializeDependentKeys();
initializeQueue();
}
} | java | public void prepareForEnumeration() {
if (isPreparer()) {
for (NodeT node : nodeTable.values()) {
// Prepare each node for traversal
node.initialize();
if (!this.isRootNode(node)) {
// Mark other sub-DAGs as non-preparer
node.setPreparer(false);
}
}
initializeDependentKeys();
initializeQueue();
}
} | [
"public",
"void",
"prepareForEnumeration",
"(",
")",
"{",
"if",
"(",
"isPreparer",
"(",
")",
")",
"{",
"for",
"(",
"NodeT",
"node",
":",
"nodeTable",
".",
"values",
"(",
")",
")",
"{",
"// Prepare each node for traversal",
"node",
".",
"initialize",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"isRootNode",
"(",
"node",
")",
")",
"{",
"// Mark other sub-DAGs as non-preparer",
"node",
".",
"setPreparer",
"(",
"false",
")",
";",
"}",
"}",
"initializeDependentKeys",
"(",
")",
";",
"initializeQueue",
"(",
")",
";",
"}",
"}"
] | Prepares this DAG for node enumeration using getNext method, each call to getNext returns next node
in the DAG with no dependencies. | [
"Prepares",
"this",
"DAG",
"for",
"node",
"enumeration",
"using",
"getNext",
"method",
"each",
"call",
"to",
"getNext",
"returns",
"next",
"node",
"in",
"the",
"DAG",
"with",
"no",
"dependencies",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java#L125-L138 |
163,008 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java | DAGraph.getNext | public NodeT getNext() {
String nextItemKey = queue.poll();
if (nextItemKey == null) {
return null;
}
return nodeTable.get(nextItemKey);
} | java | public NodeT getNext() {
String nextItemKey = queue.poll();
if (nextItemKey == null) {
return null;
}
return nodeTable.get(nextItemKey);
} | [
"public",
"NodeT",
"getNext",
"(",
")",
"{",
"String",
"nextItemKey",
"=",
"queue",
".",
"poll",
"(",
")",
";",
"if",
"(",
"nextItemKey",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"nodeTable",
".",
"get",
"(",
"nextItemKey",
")",
";",
"}"
] | Gets next node in the DAG which has no dependency or all of it's dependencies are resolved and
ready to be consumed.
@return next node or null if all the nodes have been explored or no node is available at this moment. | [
"Gets",
"next",
"node",
"in",
"the",
"DAG",
"which",
"has",
"no",
"dependency",
"or",
"all",
"of",
"it",
"s",
"dependencies",
"are",
"resolved",
"and",
"ready",
"to",
"be",
"consumed",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java#L146-L152 |
163,009 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java | DAGraph.reportCompletion | public void reportCompletion(NodeT completed) {
completed.setPreparer(true);
String dependency = completed.key();
for (String dependentKey : nodeTable.get(dependency).dependentKeys()) {
DAGNode<DataT, NodeT> dependent = nodeTable.get(dependentKey);
dependent.lock().lock();
try {
dependent.onSuccessfulResolution(dependency);
if (dependent.hasAllResolved()) {
queue.add(dependent.key());
}
} finally {
dependent.lock().unlock();
}
}
} | java | public void reportCompletion(NodeT completed) {
completed.setPreparer(true);
String dependency = completed.key();
for (String dependentKey : nodeTable.get(dependency).dependentKeys()) {
DAGNode<DataT, NodeT> dependent = nodeTable.get(dependentKey);
dependent.lock().lock();
try {
dependent.onSuccessfulResolution(dependency);
if (dependent.hasAllResolved()) {
queue.add(dependent.key());
}
} finally {
dependent.lock().unlock();
}
}
} | [
"public",
"void",
"reportCompletion",
"(",
"NodeT",
"completed",
")",
"{",
"completed",
".",
"setPreparer",
"(",
"true",
")",
";",
"String",
"dependency",
"=",
"completed",
".",
"key",
"(",
")",
";",
"for",
"(",
"String",
"dependentKey",
":",
"nodeTable",
".",
"get",
"(",
"dependency",
")",
".",
"dependentKeys",
"(",
")",
")",
"{",
"DAGNode",
"<",
"DataT",
",",
"NodeT",
">",
"dependent",
"=",
"nodeTable",
".",
"get",
"(",
"dependentKey",
")",
";",
"dependent",
".",
"lock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"dependent",
".",
"onSuccessfulResolution",
"(",
"dependency",
")",
";",
"if",
"(",
"dependent",
".",
"hasAllResolved",
"(",
")",
")",
"{",
"queue",
".",
"add",
"(",
"dependent",
".",
"key",
"(",
")",
")",
";",
"}",
"}",
"finally",
"{",
"dependent",
".",
"lock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}",
"}"
] | Reports that a node is resolved hence other nodes depends on it can consume it.
@param completed the node ready to be consumed | [
"Reports",
"that",
"a",
"node",
"is",
"resolved",
"hence",
"other",
"nodes",
"depends",
"on",
"it",
"can",
"consume",
"it",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java#L159-L174 |
163,010 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java | DAGraph.reportError | public void reportError(NodeT faulted, Throwable throwable) {
faulted.setPreparer(true);
String dependency = faulted.key();
for (String dependentKey : nodeTable.get(dependency).dependentKeys()) {
DAGNode<DataT, NodeT> dependent = nodeTable.get(dependentKey);
dependent.lock().lock();
try {
dependent.onFaultedResolution(dependency, throwable);
if (dependent.hasAllResolved()) {
queue.add(dependent.key());
}
} finally {
dependent.lock().unlock();
}
}
} | java | public void reportError(NodeT faulted, Throwable throwable) {
faulted.setPreparer(true);
String dependency = faulted.key();
for (String dependentKey : nodeTable.get(dependency).dependentKeys()) {
DAGNode<DataT, NodeT> dependent = nodeTable.get(dependentKey);
dependent.lock().lock();
try {
dependent.onFaultedResolution(dependency, throwable);
if (dependent.hasAllResolved()) {
queue.add(dependent.key());
}
} finally {
dependent.lock().unlock();
}
}
} | [
"public",
"void",
"reportError",
"(",
"NodeT",
"faulted",
",",
"Throwable",
"throwable",
")",
"{",
"faulted",
".",
"setPreparer",
"(",
"true",
")",
";",
"String",
"dependency",
"=",
"faulted",
".",
"key",
"(",
")",
";",
"for",
"(",
"String",
"dependentKey",
":",
"nodeTable",
".",
"get",
"(",
"dependency",
")",
".",
"dependentKeys",
"(",
")",
")",
"{",
"DAGNode",
"<",
"DataT",
",",
"NodeT",
">",
"dependent",
"=",
"nodeTable",
".",
"get",
"(",
"dependentKey",
")",
";",
"dependent",
".",
"lock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"dependent",
".",
"onFaultedResolution",
"(",
"dependency",
",",
"throwable",
")",
";",
"if",
"(",
"dependent",
".",
"hasAllResolved",
"(",
")",
")",
"{",
"queue",
".",
"add",
"(",
"dependent",
".",
"key",
"(",
")",
")",
";",
"}",
"}",
"finally",
"{",
"dependent",
".",
"lock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}",
"}"
] | Reports that a node is faulted.
@param faulted the node faulted
@param throwable the reason for fault | [
"Reports",
"that",
"a",
"node",
"is",
"faulted",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java#L182-L197 |
163,011 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java | DAGraph.initializeQueue | private void initializeQueue() {
this.queue.clear();
for (Map.Entry<String, NodeT> entry: nodeTable.entrySet()) {
if (!entry.getValue().hasDependencies()) {
this.queue.add(entry.getKey());
}
}
if (queue.isEmpty()) {
throw new IllegalStateException("Detected circular dependency");
}
} | java | private void initializeQueue() {
this.queue.clear();
for (Map.Entry<String, NodeT> entry: nodeTable.entrySet()) {
if (!entry.getValue().hasDependencies()) {
this.queue.add(entry.getKey());
}
}
if (queue.isEmpty()) {
throw new IllegalStateException("Detected circular dependency");
}
} | [
"private",
"void",
"initializeQueue",
"(",
")",
"{",
"this",
".",
"queue",
".",
"clear",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"NodeT",
">",
"entry",
":",
"nodeTable",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"!",
"entry",
".",
"getValue",
"(",
")",
".",
"hasDependencies",
"(",
")",
")",
"{",
"this",
".",
"queue",
".",
"add",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"queue",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Detected circular dependency\"",
")",
";",
"}",
"}"
] | Initializes the queue that tracks the next set of nodes with no dependencies or
whose dependencies are resolved. | [
"Initializes",
"the",
"queue",
"that",
"tracks",
"the",
"next",
"set",
"of",
"nodes",
"with",
"no",
"dependencies",
"or",
"whose",
"dependencies",
"are",
"resolved",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java#L234-L244 |
163,012 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java | DAGraph.merge | private void merge(Map<String, NodeT> source, Map<String, NodeT> target) {
for (Map.Entry<String, NodeT> entry : source.entrySet()) {
String key = entry.getKey();
if (!target.containsKey(key)) {
target.put(key, entry.getValue());
}
}
} | java | private void merge(Map<String, NodeT> source, Map<String, NodeT> target) {
for (Map.Entry<String, NodeT> entry : source.entrySet()) {
String key = entry.getKey();
if (!target.containsKey(key)) {
target.put(key, entry.getValue());
}
}
} | [
"private",
"void",
"merge",
"(",
"Map",
"<",
"String",
",",
"NodeT",
">",
"source",
",",
"Map",
"<",
"String",
",",
"NodeT",
">",
"target",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"NodeT",
">",
"entry",
":",
"source",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"key",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"!",
"target",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"target",
".",
"put",
"(",
"key",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Copies entries in the source map to target map.
@param source source map
@param target target map | [
"Copies",
"entries",
"in",
"the",
"source",
"map",
"to",
"target",
"map",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java#L252-L259 |
163,013 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java | DAGraph.bubbleUpNodeTable | private void bubbleUpNodeTable(DAGraph<DataT, NodeT> from, LinkedList<String> path) {
if (path.contains(from.rootNode.key())) {
path.push(from.rootNode.key()); // For better error message
throw new IllegalStateException("Detected circular dependency: " + StringUtils.join(path, " -> "));
}
path.push(from.rootNode.key());
for (DAGraph<DataT, NodeT> to : from.parentDAGs) {
this.merge(from.nodeTable, to.nodeTable);
this.bubbleUpNodeTable(to, path);
}
path.pop();
} | java | private void bubbleUpNodeTable(DAGraph<DataT, NodeT> from, LinkedList<String> path) {
if (path.contains(from.rootNode.key())) {
path.push(from.rootNode.key()); // For better error message
throw new IllegalStateException("Detected circular dependency: " + StringUtils.join(path, " -> "));
}
path.push(from.rootNode.key());
for (DAGraph<DataT, NodeT> to : from.parentDAGs) {
this.merge(from.nodeTable, to.nodeTable);
this.bubbleUpNodeTable(to, path);
}
path.pop();
} | [
"private",
"void",
"bubbleUpNodeTable",
"(",
"DAGraph",
"<",
"DataT",
",",
"NodeT",
">",
"from",
",",
"LinkedList",
"<",
"String",
">",
"path",
")",
"{",
"if",
"(",
"path",
".",
"contains",
"(",
"from",
".",
"rootNode",
".",
"key",
"(",
")",
")",
")",
"{",
"path",
".",
"push",
"(",
"from",
".",
"rootNode",
".",
"key",
"(",
")",
")",
";",
"// For better error message",
"throw",
"new",
"IllegalStateException",
"(",
"\"Detected circular dependency: \"",
"+",
"StringUtils",
".",
"join",
"(",
"path",
",",
"\" -> \"",
")",
")",
";",
"}",
"path",
".",
"push",
"(",
"from",
".",
"rootNode",
".",
"key",
"(",
")",
")",
";",
"for",
"(",
"DAGraph",
"<",
"DataT",
",",
"NodeT",
">",
"to",
":",
"from",
".",
"parentDAGs",
")",
"{",
"this",
".",
"merge",
"(",
"from",
".",
"nodeTable",
",",
"to",
".",
"nodeTable",
")",
";",
"this",
".",
"bubbleUpNodeTable",
"(",
"to",
",",
"path",
")",
";",
"}",
"path",
".",
"pop",
"(",
")",
";",
"}"
] | Propagates node table of given DAG to all of it ancestors. | [
"Propagates",
"node",
"table",
"of",
"given",
"DAG",
"to",
"all",
"of",
"it",
"ancestors",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java#L264-L275 |
163,014 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/IndexableTaskItem.java | IndexableTaskItem.create | public static IndexableTaskItem create(final FunctionalTaskItem taskItem) {
return new IndexableTaskItem() {
@Override
protected Observable<Indexable> invokeTaskAsync(TaskGroup.InvocationContext context) {
FunctionalTaskItem.Context fContext = new FunctionalTaskItem.Context(this);
fContext.setInnerContext(context);
return taskItem.call(fContext);
}
};
} | java | public static IndexableTaskItem create(final FunctionalTaskItem taskItem) {
return new IndexableTaskItem() {
@Override
protected Observable<Indexable> invokeTaskAsync(TaskGroup.InvocationContext context) {
FunctionalTaskItem.Context fContext = new FunctionalTaskItem.Context(this);
fContext.setInnerContext(context);
return taskItem.call(fContext);
}
};
} | [
"public",
"static",
"IndexableTaskItem",
"create",
"(",
"final",
"FunctionalTaskItem",
"taskItem",
")",
"{",
"return",
"new",
"IndexableTaskItem",
"(",
")",
"{",
"@",
"Override",
"protected",
"Observable",
"<",
"Indexable",
">",
"invokeTaskAsync",
"(",
"TaskGroup",
".",
"InvocationContext",
"context",
")",
"{",
"FunctionalTaskItem",
".",
"Context",
"fContext",
"=",
"new",
"FunctionalTaskItem",
".",
"Context",
"(",
"this",
")",
";",
"fContext",
".",
"setInnerContext",
"(",
"context",
")",
";",
"return",
"taskItem",
".",
"call",
"(",
"fContext",
")",
";",
"}",
"}",
";",
"}"
] | Creates an IndexableTaskItem from provided FunctionalTaskItem.
@param taskItem functional TaskItem
@return IndexableTaskItem | [
"Creates",
"an",
"IndexableTaskItem",
"from",
"provided",
"FunctionalTaskItem",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/IndexableTaskItem.java#L63-L72 |
163,015 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/IndexableTaskItem.java | IndexableTaskItem.addeDependency | @SuppressWarnings("unchecked")
protected String addeDependency(Appliable<? extends Indexable> appliable) {
TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) appliable;
return this.addDependency(dependency);
} | java | @SuppressWarnings("unchecked")
protected String addeDependency(Appliable<? extends Indexable> appliable) {
TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) appliable;
return this.addDependency(dependency);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"String",
"addeDependency",
"(",
"Appliable",
"<",
"?",
"extends",
"Indexable",
">",
"appliable",
")",
"{",
"TaskGroup",
".",
"HasTaskGroup",
"dependency",
"=",
"(",
"TaskGroup",
".",
"HasTaskGroup",
")",
"appliable",
";",
"return",
"this",
".",
"addDependency",
"(",
"dependency",
")",
";",
"}"
] | Add an appliable dependency for this task item.
@param appliable the appliable dependency.
@return the key to be used as parameter to taskResult(string) method to retrieve updated dependency | [
"Add",
"an",
"appliable",
"dependency",
"for",
"this",
"task",
"item",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/IndexableTaskItem.java#L136-L140 |
163,016 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/IndexableTaskItem.java | IndexableTaskItem.addPostRunDependent | public String addPostRunDependent(FunctionalTaskItem dependent) {
Objects.requireNonNull(dependent);
return this.taskGroup().addPostRunDependent(dependent);
} | java | public String addPostRunDependent(FunctionalTaskItem dependent) {
Objects.requireNonNull(dependent);
return this.taskGroup().addPostRunDependent(dependent);
} | [
"public",
"String",
"addPostRunDependent",
"(",
"FunctionalTaskItem",
"dependent",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"dependent",
")",
";",
"return",
"this",
".",
"taskGroup",
"(",
")",
".",
"addPostRunDependent",
"(",
"dependent",
")",
";",
"}"
] | Add a "post-run" dependent task item for this task item.
@param dependent the "post-run" dependent task item.
@return key to be used as parameter to taskResult(string) method to retrieve result of root
task in the given dependent task group | [
"Add",
"a",
"post",
"-",
"run",
"dependent",
"task",
"item",
"for",
"this",
"task",
"item",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/IndexableTaskItem.java#L162-L165 |
163,017 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/IndexableTaskItem.java | IndexableTaskItem.addPostRunDependent | @SuppressWarnings("unchecked")
protected String addPostRunDependent(Creatable<? extends Indexable> creatable) {
TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) creatable;
return this.addPostRunDependent(dependency);
} | java | @SuppressWarnings("unchecked")
protected String addPostRunDependent(Creatable<? extends Indexable> creatable) {
TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) creatable;
return this.addPostRunDependent(dependency);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"String",
"addPostRunDependent",
"(",
"Creatable",
"<",
"?",
"extends",
"Indexable",
">",
"creatable",
")",
"{",
"TaskGroup",
".",
"HasTaskGroup",
"dependency",
"=",
"(",
"TaskGroup",
".",
"HasTaskGroup",
")",
"creatable",
";",
"return",
"this",
".",
"addPostRunDependent",
"(",
"dependency",
")",
";",
"}"
] | Add a creatable "post-run" dependent for this task item.
@param creatable the creatable "post-run" dependent.
@return the key to be used as parameter to taskResult(string) method to retrieve created "post-run" dependent | [
"Add",
"a",
"creatable",
"post",
"-",
"run",
"dependent",
"for",
"this",
"task",
"item",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/IndexableTaskItem.java#L186-L190 |
163,018 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/IndexableTaskItem.java | IndexableTaskItem.addPostRunDependent | @SuppressWarnings("unchecked")
protected String addPostRunDependent(Appliable<? extends Indexable> appliable) {
TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) appliable;
return this.addPostRunDependent(dependency);
} | java | @SuppressWarnings("unchecked")
protected String addPostRunDependent(Appliable<? extends Indexable> appliable) {
TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) appliable;
return this.addPostRunDependent(dependency);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"String",
"addPostRunDependent",
"(",
"Appliable",
"<",
"?",
"extends",
"Indexable",
">",
"appliable",
")",
"{",
"TaskGroup",
".",
"HasTaskGroup",
"dependency",
"=",
"(",
"TaskGroup",
".",
"HasTaskGroup",
")",
"appliable",
";",
"return",
"this",
".",
"addPostRunDependent",
"(",
"dependency",
")",
";",
"}"
] | Add an appliable "post-run" dependent for this task item.
@param appliable the appliable "post-run" dependent.
@return the key to be used as parameter to taskResult(string) method to retrieve updated "post-run" dependent | [
"Add",
"an",
"appliable",
"post",
"-",
"run",
"dependent",
"for",
"this",
"task",
"item",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/IndexableTaskItem.java#L198-L202 |
163,019 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/IndexableTaskItem.java | IndexableTaskItem.taskResult | @SuppressWarnings("unchecked")
protected <T extends Indexable> T taskResult(String key) {
Indexable result = this.taskGroup.taskResult(key);
if (result == null) {
return null;
} else {
T castedResult = (T) result;
return castedResult;
}
} | java | @SuppressWarnings("unchecked")
protected <T extends Indexable> T taskResult(String key) {
Indexable result = this.taskGroup.taskResult(key);
if (result == null) {
return null;
} else {
T castedResult = (T) result;
return castedResult;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"<",
"T",
"extends",
"Indexable",
">",
"T",
"taskResult",
"(",
"String",
"key",
")",
"{",
"Indexable",
"result",
"=",
"this",
".",
"taskGroup",
".",
"taskResult",
"(",
"key",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"T",
"castedResult",
"=",
"(",
"T",
")",
"result",
";",
"return",
"castedResult",
";",
"}",
"}"
] | Get result of one of the task that belongs to this task's task group.
@param key the task key
@param <T> the actual type of the task result
@return the task result, null will be returned if task has not produced a result yet | [
"Get",
"result",
"of",
"one",
"of",
"the",
"task",
"that",
"belongs",
"to",
"this",
"task",
"s",
"task",
"group",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/IndexableTaskItem.java#L224-L233 |
163,020 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/Region.java | Region.create | public static Region create(String name, String label) {
Region region = VALUES_BY_NAME.get(name.toLowerCase());
if (region != null) {
return region;
} else {
return new Region(name, label);
}
} | java | public static Region create(String name, String label) {
Region region = VALUES_BY_NAME.get(name.toLowerCase());
if (region != null) {
return region;
} else {
return new Region(name, label);
}
} | [
"public",
"static",
"Region",
"create",
"(",
"String",
"name",
",",
"String",
"label",
")",
"{",
"Region",
"region",
"=",
"VALUES_BY_NAME",
".",
"get",
"(",
"name",
".",
"toLowerCase",
"(",
")",
")",
";",
"if",
"(",
"region",
"!=",
"null",
")",
"{",
"return",
"region",
";",
"}",
"else",
"{",
"return",
"new",
"Region",
"(",
"name",
",",
"label",
")",
";",
"}",
"}"
] | Creates a region from a name and a label.
@param name the uniquely identifiable name of the region
@param label the label of the region
@return the newly created region | [
"Creates",
"a",
"region",
"from",
"a",
"name",
"and",
"a",
"label",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/Region.java#L129-L136 |
163,021 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/Region.java | Region.fromName | public static Region fromName(String name) {
if (name == null) {
return null;
}
Region region = VALUES_BY_NAME.get(name.toLowerCase().replace(" ", ""));
if (region != null) {
return region;
} else {
return Region.create(name.toLowerCase().replace(" ", ""), name);
}
} | java | public static Region fromName(String name) {
if (name == null) {
return null;
}
Region region = VALUES_BY_NAME.get(name.toLowerCase().replace(" ", ""));
if (region != null) {
return region;
} else {
return Region.create(name.toLowerCase().replace(" ", ""), name);
}
} | [
"public",
"static",
"Region",
"fromName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Region",
"region",
"=",
"VALUES_BY_NAME",
".",
"get",
"(",
"name",
".",
"toLowerCase",
"(",
")",
".",
"replace",
"(",
"\" \"",
",",
"\"\"",
")",
")",
";",
"if",
"(",
"region",
"!=",
"null",
")",
"{",
"return",
"region",
";",
"}",
"else",
"{",
"return",
"Region",
".",
"create",
"(",
"name",
".",
"toLowerCase",
"(",
")",
".",
"replace",
"(",
"\" \"",
",",
"\"\"",
")",
",",
"name",
")",
";",
"}",
"}"
] | Parses a name into a Region object and creates a new Region instance if not found among the existing ones.
@param name a region name
@return the parsed or created region | [
"Parses",
"a",
"name",
"into",
"a",
"Region",
"object",
"and",
"creates",
"a",
"new",
"Region",
"instance",
"if",
"not",
"found",
"among",
"the",
"existing",
"ones",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/Region.java#L179-L190 |
163,022 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ExternalChildResourceCollectionImpl.java | ExternalChildResourceCollectionImpl.prepareForFutureCommitOrPostRun | protected FluentModelTImpl prepareForFutureCommitOrPostRun(FluentModelTImpl childResource) {
if (this.isPostRunMode) {
if (!childResource.taskGroup().dependsOn(this.parentTaskGroup)) {
this.parentTaskGroup.addPostRunDependentTaskGroup(childResource.taskGroup());
}
return childResource;
} else {
return childResource;
}
} | java | protected FluentModelTImpl prepareForFutureCommitOrPostRun(FluentModelTImpl childResource) {
if (this.isPostRunMode) {
if (!childResource.taskGroup().dependsOn(this.parentTaskGroup)) {
this.parentTaskGroup.addPostRunDependentTaskGroup(childResource.taskGroup());
}
return childResource;
} else {
return childResource;
}
} | [
"protected",
"FluentModelTImpl",
"prepareForFutureCommitOrPostRun",
"(",
"FluentModelTImpl",
"childResource",
")",
"{",
"if",
"(",
"this",
".",
"isPostRunMode",
")",
"{",
"if",
"(",
"!",
"childResource",
".",
"taskGroup",
"(",
")",
".",
"dependsOn",
"(",
"this",
".",
"parentTaskGroup",
")",
")",
"{",
"this",
".",
"parentTaskGroup",
".",
"addPostRunDependentTaskGroup",
"(",
"childResource",
".",
"taskGroup",
"(",
")",
")",
";",
"}",
"return",
"childResource",
";",
"}",
"else",
"{",
"return",
"childResource",
";",
"}",
"}"
] | Mark the given child resource as the post run dependent of the parent of this collection.
@param childResource the child resource | [
"Mark",
"the",
"given",
"child",
"resource",
"as",
"the",
"post",
"run",
"dependent",
"of",
"the",
"parent",
"of",
"this",
"collection",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ExternalChildResourceCollectionImpl.java#L113-L122 |
163,023 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ExternalChildResourceCollectionImpl.java | ExternalChildResourceCollectionImpl.find | protected FluentModelTImpl find(String key) {
for (Map.Entry<String, FluentModelTImpl> entry : this.childCollection.entrySet()) {
if (entry.getKey().equalsIgnoreCase(key)) {
return entry.getValue();
}
}
return null;
} | java | protected FluentModelTImpl find(String key) {
for (Map.Entry<String, FluentModelTImpl> entry : this.childCollection.entrySet()) {
if (entry.getKey().equalsIgnoreCase(key)) {
return entry.getValue();
}
}
return null;
} | [
"protected",
"FluentModelTImpl",
"find",
"(",
"String",
"key",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"FluentModelTImpl",
">",
"entry",
":",
"this",
".",
"childCollection",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"entry",
".",
"getKey",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"key",
")",
")",
"{",
"return",
"entry",
".",
"getValue",
"(",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Finds a child resource with the given key.
@param key the child resource key
@return null if no child resource exists with the given name else the child resource | [
"Finds",
"a",
"child",
"resource",
"with",
"the",
"given",
"key",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ExternalChildResourceCollectionImpl.java#L294-L301 |
163,024 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceFuture.java | AzureServiceFuture.fromPageResponse | public static <E> ServiceFuture<List<E>> fromPageResponse(Observable<ServiceResponse<Page<E>>> first, final Func1<String, Observable<ServiceResponse<Page<E>>>> next, final ListOperationCallback<E> callback) {
final AzureServiceFuture<List<E>> serviceCall = new AzureServiceFuture<>();
final PagingSubscriber<E> subscriber = new PagingSubscriber<>(serviceCall, next, callback);
serviceCall.setSubscription(first
.single()
.subscribe(subscriber));
return serviceCall;
} | java | public static <E> ServiceFuture<List<E>> fromPageResponse(Observable<ServiceResponse<Page<E>>> first, final Func1<String, Observable<ServiceResponse<Page<E>>>> next, final ListOperationCallback<E> callback) {
final AzureServiceFuture<List<E>> serviceCall = new AzureServiceFuture<>();
final PagingSubscriber<E> subscriber = new PagingSubscriber<>(serviceCall, next, callback);
serviceCall.setSubscription(first
.single()
.subscribe(subscriber));
return serviceCall;
} | [
"public",
"static",
"<",
"E",
">",
"ServiceFuture",
"<",
"List",
"<",
"E",
">",
">",
"fromPageResponse",
"(",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"E",
">",
">",
">",
"first",
",",
"final",
"Func1",
"<",
"String",
",",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"E",
">",
">",
">",
">",
"next",
",",
"final",
"ListOperationCallback",
"<",
"E",
">",
"callback",
")",
"{",
"final",
"AzureServiceFuture",
"<",
"List",
"<",
"E",
">",
">",
"serviceCall",
"=",
"new",
"AzureServiceFuture",
"<>",
"(",
")",
";",
"final",
"PagingSubscriber",
"<",
"E",
">",
"subscriber",
"=",
"new",
"PagingSubscriber",
"<>",
"(",
"serviceCall",
",",
"next",
",",
"callback",
")",
";",
"serviceCall",
".",
"setSubscription",
"(",
"first",
".",
"single",
"(",
")",
".",
"subscribe",
"(",
"subscriber",
")",
")",
";",
"return",
"serviceCall",
";",
"}"
] | Creates a ServiceCall from a paging operation.
@param first the observable to the first page
@param next the observable to poll subsequent pages
@param callback the client-side callback
@param <E> the element type
@return the future based ServiceCall | [
"Creates",
"a",
"ServiceCall",
"from",
"a",
"paging",
"operation",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceFuture.java#L38-L45 |
163,025 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceFuture.java | AzureServiceFuture.fromHeaderPageResponse | public static <E, V> ServiceFuture<List<E>> fromHeaderPageResponse(Observable<ServiceResponseWithHeaders<Page<E>, V>> first, final Func1<String, Observable<ServiceResponseWithHeaders<Page<E>, V>>> next, final ListOperationCallback<E> callback) {
final AzureServiceFuture<List<E>> serviceCall = new AzureServiceFuture<>();
final PagingSubscriber<E> subscriber = new PagingSubscriber<>(serviceCall, new Func1<String, Observable<ServiceResponse<Page<E>>>>() {
@Override
public Observable<ServiceResponse<Page<E>>> call(String s) {
return next.call(s)
.map(new Func1<ServiceResponseWithHeaders<Page<E>, V>, ServiceResponse<Page<E>>>() {
@Override
public ServiceResponse<Page<E>> call(ServiceResponseWithHeaders<Page<E>, V> pageVServiceResponseWithHeaders) {
return pageVServiceResponseWithHeaders;
}
});
}
}, callback);
serviceCall.setSubscription(first
.single()
.subscribe(subscriber));
return serviceCall;
} | java | public static <E, V> ServiceFuture<List<E>> fromHeaderPageResponse(Observable<ServiceResponseWithHeaders<Page<E>, V>> first, final Func1<String, Observable<ServiceResponseWithHeaders<Page<E>, V>>> next, final ListOperationCallback<E> callback) {
final AzureServiceFuture<List<E>> serviceCall = new AzureServiceFuture<>();
final PagingSubscriber<E> subscriber = new PagingSubscriber<>(serviceCall, new Func1<String, Observable<ServiceResponse<Page<E>>>>() {
@Override
public Observable<ServiceResponse<Page<E>>> call(String s) {
return next.call(s)
.map(new Func1<ServiceResponseWithHeaders<Page<E>, V>, ServiceResponse<Page<E>>>() {
@Override
public ServiceResponse<Page<E>> call(ServiceResponseWithHeaders<Page<E>, V> pageVServiceResponseWithHeaders) {
return pageVServiceResponseWithHeaders;
}
});
}
}, callback);
serviceCall.setSubscription(first
.single()
.subscribe(subscriber));
return serviceCall;
} | [
"public",
"static",
"<",
"E",
",",
"V",
">",
"ServiceFuture",
"<",
"List",
"<",
"E",
">",
">",
"fromHeaderPageResponse",
"(",
"Observable",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"E",
">",
",",
"V",
">",
">",
"first",
",",
"final",
"Func1",
"<",
"String",
",",
"Observable",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"E",
">",
",",
"V",
">",
">",
">",
"next",
",",
"final",
"ListOperationCallback",
"<",
"E",
">",
"callback",
")",
"{",
"final",
"AzureServiceFuture",
"<",
"List",
"<",
"E",
">",
">",
"serviceCall",
"=",
"new",
"AzureServiceFuture",
"<>",
"(",
")",
";",
"final",
"PagingSubscriber",
"<",
"E",
">",
"subscriber",
"=",
"new",
"PagingSubscriber",
"<>",
"(",
"serviceCall",
",",
"new",
"Func1",
"<",
"String",
",",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"E",
">",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"E",
">",
">",
">",
"call",
"(",
"String",
"s",
")",
"{",
"return",
"next",
".",
"call",
"(",
"s",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"E",
">",
",",
"V",
">",
",",
"ServiceResponse",
"<",
"Page",
"<",
"E",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ServiceResponse",
"<",
"Page",
"<",
"E",
">",
">",
"call",
"(",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"E",
">",
",",
"V",
">",
"pageVServiceResponseWithHeaders",
")",
"{",
"return",
"pageVServiceResponseWithHeaders",
";",
"}",
"}",
")",
";",
"}",
"}",
",",
"callback",
")",
";",
"serviceCall",
".",
"setSubscription",
"(",
"first",
".",
"single",
"(",
")",
".",
"subscribe",
"(",
"subscriber",
")",
")",
";",
"return",
"serviceCall",
";",
"}"
] | Creates a ServiceCall from a paging operation that returns a header response.
@param first the observable to the first page
@param next the observable to poll subsequent pages
@param callback the client-side callback
@param <E> the element type
@param <V> the header object type
@return the future based ServiceCall | [
"Creates",
"a",
"ServiceCall",
"from",
"a",
"paging",
"operation",
"that",
"returns",
"a",
"header",
"response",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceFuture.java#L57-L75 |
163,026 | Azure/autorest-clientruntime-for-java | client-runtime/src/main/java/com/microsoft/rest/serializer/FlatteningDeserializer.java | FlatteningDeserializer.findNestedNode | private static JsonNode findNestedNode(JsonNode jsonNode, String composedKey) {
String[] jsonNodeKeys = splitKeyByFlatteningDots(composedKey);
for (String jsonNodeKey : jsonNodeKeys) {
jsonNode = jsonNode.get(unescapeEscapedDots(jsonNodeKey));
if (jsonNode == null) {
return null;
}
}
return jsonNode;
} | java | private static JsonNode findNestedNode(JsonNode jsonNode, String composedKey) {
String[] jsonNodeKeys = splitKeyByFlatteningDots(composedKey);
for (String jsonNodeKey : jsonNodeKeys) {
jsonNode = jsonNode.get(unescapeEscapedDots(jsonNodeKey));
if (jsonNode == null) {
return null;
}
}
return jsonNode;
} | [
"private",
"static",
"JsonNode",
"findNestedNode",
"(",
"JsonNode",
"jsonNode",
",",
"String",
"composedKey",
")",
"{",
"String",
"[",
"]",
"jsonNodeKeys",
"=",
"splitKeyByFlatteningDots",
"(",
"composedKey",
")",
";",
"for",
"(",
"String",
"jsonNodeKey",
":",
"jsonNodeKeys",
")",
"{",
"jsonNode",
"=",
"jsonNode",
".",
"get",
"(",
"unescapeEscapedDots",
"(",
"jsonNodeKey",
")",
")",
";",
"if",
"(",
"jsonNode",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"}",
"return",
"jsonNode",
";",
"}"
] | Given a json node, find a nested node using given composed key.
@param jsonNode the parent json node
@param composedKey a key combines multiple keys using flattening dots.
Flattening dots are dot character '.' those are not preceded by slash '\'
Each flattening dot represents a level with following key as field key in that level
@return nested json node located using given composed key | [
"Given",
"a",
"json",
"node",
"find",
"a",
"nested",
"node",
"using",
"given",
"composed",
"key",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/serializer/FlatteningDeserializer.java#L168-L177 |
163,027 | Azure/autorest-clientruntime-for-java | client-runtime/src/main/java/com/microsoft/rest/serializer/FlatteningDeserializer.java | FlatteningDeserializer.newJsonParserForNode | private static JsonParser newJsonParserForNode(JsonNode jsonNode) throws IOException {
JsonParser parser = new JsonFactory().createParser(jsonNode.toString());
parser.nextToken();
return parser;
} | java | private static JsonParser newJsonParserForNode(JsonNode jsonNode) throws IOException {
JsonParser parser = new JsonFactory().createParser(jsonNode.toString());
parser.nextToken();
return parser;
} | [
"private",
"static",
"JsonParser",
"newJsonParserForNode",
"(",
"JsonNode",
"jsonNode",
")",
"throws",
"IOException",
"{",
"JsonParser",
"parser",
"=",
"new",
"JsonFactory",
"(",
")",
".",
"createParser",
"(",
"jsonNode",
".",
"toString",
"(",
")",
")",
";",
"parser",
".",
"nextToken",
"(",
")",
";",
"return",
"parser",
";",
"}"
] | Create a JsonParser for a given json node.
@param jsonNode the json node
@return the json parser
@throws IOException | [
"Create",
"a",
"JsonParser",
"for",
"a",
"given",
"json",
"node",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/serializer/FlatteningDeserializer.java#L229-L233 |
163,028 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/models/implementation/ExternalChildResourceImpl.java | ExternalChildResourceImpl.addDependency | protected String addDependency(FunctionalTaskItem dependency) {
Objects.requireNonNull(dependency);
return this.taskGroup().addDependency(dependency);
} | java | protected String addDependency(FunctionalTaskItem dependency) {
Objects.requireNonNull(dependency);
return this.taskGroup().addDependency(dependency);
} | [
"protected",
"String",
"addDependency",
"(",
"FunctionalTaskItem",
"dependency",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"dependency",
")",
";",
"return",
"this",
".",
"taskGroup",
"(",
")",
".",
"addDependency",
"(",
"dependency",
")",
";",
"}"
] | Add a dependency task item for this model.
@param dependency the dependency task item.
@return key to be used as parameter to taskResult(string) method to retrieve result the task item | [
"Add",
"a",
"dependency",
"task",
"item",
"for",
"this",
"model",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/models/implementation/ExternalChildResourceImpl.java#L201-L204 |
163,029 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/models/implementation/ExternalChildResourceImpl.java | ExternalChildResourceImpl.addDependency | protected String addDependency(TaskGroup.HasTaskGroup dependency) {
Objects.requireNonNull(dependency);
this.taskGroup().addDependencyTaskGroup(dependency.taskGroup());
return dependency.taskGroup().key();
} | java | protected String addDependency(TaskGroup.HasTaskGroup dependency) {
Objects.requireNonNull(dependency);
this.taskGroup().addDependencyTaskGroup(dependency.taskGroup());
return dependency.taskGroup().key();
} | [
"protected",
"String",
"addDependency",
"(",
"TaskGroup",
".",
"HasTaskGroup",
"dependency",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"dependency",
")",
";",
"this",
".",
"taskGroup",
"(",
")",
".",
"addDependencyTaskGroup",
"(",
"dependency",
".",
"taskGroup",
"(",
")",
")",
";",
"return",
"dependency",
".",
"taskGroup",
"(",
")",
".",
"key",
"(",
")",
";",
"}"
] | Add a dependency task group for this model.
@param dependency the dependency.
@return key to be used as parameter to taskResult(string) method to retrieve result of root
task in the given dependency task group | [
"Add",
"a",
"dependency",
"task",
"group",
"for",
"this",
"model",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/models/implementation/ExternalChildResourceImpl.java#L213-L217 |
163,030 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/models/implementation/ExternalChildResourceImpl.java | ExternalChildResourceImpl.addPostRunDependent | @SuppressWarnings("unchecked")
protected void addPostRunDependent(Executable<? extends Indexable> executable) {
TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) executable;
this.addPostRunDependent(dependency);
} | java | @SuppressWarnings("unchecked")
protected void addPostRunDependent(Executable<? extends Indexable> executable) {
TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) executable;
this.addPostRunDependent(dependency);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"void",
"addPostRunDependent",
"(",
"Executable",
"<",
"?",
"extends",
"Indexable",
">",
"executable",
")",
"{",
"TaskGroup",
".",
"HasTaskGroup",
"dependency",
"=",
"(",
"TaskGroup",
".",
"HasTaskGroup",
")",
"executable",
";",
"this",
".",
"addPostRunDependent",
"(",
"dependency",
")",
";",
"}"
] | Add an executable "post-run" dependent for this model.
@param executable the executable "post-run" dependent
@return the key to be used as parameter to taskResult(string) method to retrieve result of executing
the executable "post-run" dependent | [
"Add",
"an",
"executable",
"post",
"-",
"run",
"dependent",
"for",
"this",
"model",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/models/implementation/ExternalChildResourceImpl.java#L312-L316 |
163,031 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/Graph.java | Graph.addNode | public void addNode(NodeT node) {
node.setOwner(this);
nodeTable.put(node.key(), node);
} | java | public void addNode(NodeT node) {
node.setOwner(this);
nodeTable.put(node.key(), node);
} | [
"public",
"void",
"addNode",
"(",
"NodeT",
"node",
")",
"{",
"node",
".",
"setOwner",
"(",
"this",
")",
";",
"nodeTable",
".",
"put",
"(",
"node",
".",
"key",
"(",
")",
",",
"node",
")",
";",
"}"
] | Adds a node to this graph.
@param node the node | [
"Adds",
"a",
"node",
"to",
"this",
"graph",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/Graph.java#L79-L82 |
163,032 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/Graph.java | Graph.findPath | protected String findPath(String start, String end) {
if (start.equals(end)) {
return start;
} else {
return findPath(start, parent.get(end)) + " -> " + end;
}
} | java | protected String findPath(String start, String end) {
if (start.equals(end)) {
return start;
} else {
return findPath(start, parent.get(end)) + " -> " + end;
}
} | [
"protected",
"String",
"findPath",
"(",
"String",
"start",
",",
"String",
"end",
")",
"{",
"if",
"(",
"start",
".",
"equals",
"(",
"end",
")",
")",
"{",
"return",
"start",
";",
"}",
"else",
"{",
"return",
"findPath",
"(",
"start",
",",
"parent",
".",
"get",
"(",
"end",
")",
")",
"+",
"\" -> \"",
"+",
"end",
";",
"}",
"}"
] | Find the path.
@param start key of first node in the path
@param end key of last node in the path
@return string containing the nodes keys in the path separated by arrow symbol | [
"Find",
"the",
"path",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/Graph.java#L156-L162 |
163,033 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/ListToMapConverter.java | ListToMapConverter.convertToUnmodifiableMap | public Map<String, ImplT> convertToUnmodifiableMap(List<InnerT> innerList) {
Map<String, ImplT> result = new HashMap<>();
for (InnerT inner : innerList) {
result.put(name(inner), impl(inner));
}
return Collections.unmodifiableMap(result);
} | java | public Map<String, ImplT> convertToUnmodifiableMap(List<InnerT> innerList) {
Map<String, ImplT> result = new HashMap<>();
for (InnerT inner : innerList) {
result.put(name(inner), impl(inner));
}
return Collections.unmodifiableMap(result);
} | [
"public",
"Map",
"<",
"String",
",",
"ImplT",
">",
"convertToUnmodifiableMap",
"(",
"List",
"<",
"InnerT",
">",
"innerList",
")",
"{",
"Map",
"<",
"String",
",",
"ImplT",
">",
"result",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"InnerT",
"inner",
":",
"innerList",
")",
"{",
"result",
".",
"put",
"(",
"name",
"(",
"inner",
")",
",",
"impl",
"(",
"inner",
")",
")",
";",
"}",
"return",
"Collections",
".",
"unmodifiableMap",
"(",
"result",
")",
";",
"}"
] | Converts the passed list of inners to unmodifiable map of impls.
@param innerList list of the inners.
@return map of the impls | [
"Converts",
"the",
"passed",
"list",
"of",
"inners",
"to",
"unmodifiable",
"map",
"of",
"impls",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/ListToMapConverter.java#L29-L36 |
163,034 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java | Utils.createOdataFilterForTags | public static String createOdataFilterForTags(String tagName, String tagValue) {
if (tagName == null) {
return null;
} else if (tagValue == null) {
return String.format("tagname eq '%s'", tagName);
} else {
return String.format("tagname eq '%s' and tagvalue eq '%s'", tagName, tagValue);
}
} | java | public static String createOdataFilterForTags(String tagName, String tagValue) {
if (tagName == null) {
return null;
} else if (tagValue == null) {
return String.format("tagname eq '%s'", tagName);
} else {
return String.format("tagname eq '%s' and tagvalue eq '%s'", tagName, tagValue);
}
} | [
"public",
"static",
"String",
"createOdataFilterForTags",
"(",
"String",
"tagName",
",",
"String",
"tagValue",
")",
"{",
"if",
"(",
"tagName",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"tagValue",
"==",
"null",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"tagname eq '%s'\"",
",",
"tagName",
")",
";",
"}",
"else",
"{",
"return",
"String",
".",
"format",
"(",
"\"tagname eq '%s' and tagvalue eq '%s'\"",
",",
"tagName",
",",
"tagValue",
")",
";",
"}",
"}"
] | Creates an Odata filter string that can be used for filtering list results by tags.
@param tagName the name of the tag. If not provided, all resources will be returned.
@param tagValue the value of the tag. If not provided, only tag name will be filtered.
@return the Odata filter to pass into list methods | [
"Creates",
"an",
"Odata",
"filter",
"string",
"that",
"can",
"be",
"used",
"for",
"filtering",
"list",
"results",
"by",
"tags",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java#L90-L98 |
163,035 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java | Utils.downloadFileAsync | public static Observable<byte[]> downloadFileAsync(String url, Retrofit retrofit) {
FileService service = retrofit.create(FileService.class);
Observable<ResponseBody> response = service.download(url);
return response.map(new Func1<ResponseBody, byte[]>() {
@Override
public byte[] call(ResponseBody responseBody) {
try {
return responseBody.bytes();
} catch (IOException e) {
throw Exceptions.propagate(e);
}
}
});
} | java | public static Observable<byte[]> downloadFileAsync(String url, Retrofit retrofit) {
FileService service = retrofit.create(FileService.class);
Observable<ResponseBody> response = service.download(url);
return response.map(new Func1<ResponseBody, byte[]>() {
@Override
public byte[] call(ResponseBody responseBody) {
try {
return responseBody.bytes();
} catch (IOException e) {
throw Exceptions.propagate(e);
}
}
});
} | [
"public",
"static",
"Observable",
"<",
"byte",
"[",
"]",
">",
"downloadFileAsync",
"(",
"String",
"url",
",",
"Retrofit",
"retrofit",
")",
"{",
"FileService",
"service",
"=",
"retrofit",
".",
"create",
"(",
"FileService",
".",
"class",
")",
";",
"Observable",
"<",
"ResponseBody",
">",
"response",
"=",
"service",
".",
"download",
"(",
"url",
")",
";",
"return",
"response",
".",
"map",
"(",
"new",
"Func1",
"<",
"ResponseBody",
",",
"byte",
"[",
"]",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"byte",
"[",
"]",
"call",
"(",
"ResponseBody",
"responseBody",
")",
"{",
"try",
"{",
"return",
"responseBody",
".",
"bytes",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"Exceptions",
".",
"propagate",
"(",
"e",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Download a file asynchronously.
@param url the URL pointing to the file
@param retrofit the retrofit client
@return an Observable pointing to the content of the file | [
"Download",
"a",
"file",
"asynchronously",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java#L124-L137 |
163,036 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java | Utils.toPagedList | public static <OutT, InT> PagedList<OutT> toPagedList(List<InT> list, final Func1<InT, OutT> mapper) {
PageImpl<InT> page = new PageImpl<>();
page.setItems(list);
page.setNextPageLink(null);
PagedList<InT> pagedList = new PagedList<InT>(page) {
@Override
public Page<InT> nextPage(String nextPageLink) {
return null;
}
};
PagedListConverter<InT, OutT> converter = new PagedListConverter<InT, OutT>() {
@Override
public Observable<OutT> typeConvertAsync(InT inner) {
return Observable.just(mapper.call(inner));
}
};
return converter.convert(pagedList);
} | java | public static <OutT, InT> PagedList<OutT> toPagedList(List<InT> list, final Func1<InT, OutT> mapper) {
PageImpl<InT> page = new PageImpl<>();
page.setItems(list);
page.setNextPageLink(null);
PagedList<InT> pagedList = new PagedList<InT>(page) {
@Override
public Page<InT> nextPage(String nextPageLink) {
return null;
}
};
PagedListConverter<InT, OutT> converter = new PagedListConverter<InT, OutT>() {
@Override
public Observable<OutT> typeConvertAsync(InT inner) {
return Observable.just(mapper.call(inner));
}
};
return converter.convert(pagedList);
} | [
"public",
"static",
"<",
"OutT",
",",
"InT",
">",
"PagedList",
"<",
"OutT",
">",
"toPagedList",
"(",
"List",
"<",
"InT",
">",
"list",
",",
"final",
"Func1",
"<",
"InT",
",",
"OutT",
">",
"mapper",
")",
"{",
"PageImpl",
"<",
"InT",
">",
"page",
"=",
"new",
"PageImpl",
"<>",
"(",
")",
";",
"page",
".",
"setItems",
"(",
"list",
")",
";",
"page",
".",
"setNextPageLink",
"(",
"null",
")",
";",
"PagedList",
"<",
"InT",
">",
"pagedList",
"=",
"new",
"PagedList",
"<",
"InT",
">",
"(",
"page",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"InT",
">",
"nextPage",
"(",
"String",
"nextPageLink",
")",
"{",
"return",
"null",
";",
"}",
"}",
";",
"PagedListConverter",
"<",
"InT",
",",
"OutT",
">",
"converter",
"=",
"new",
"PagedListConverter",
"<",
"InT",
",",
"OutT",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"OutT",
">",
"typeConvertAsync",
"(",
"InT",
"inner",
")",
"{",
"return",
"Observable",
".",
"just",
"(",
"mapper",
".",
"call",
"(",
"inner",
")",
")",
";",
"}",
"}",
";",
"return",
"converter",
".",
"convert",
"(",
"pagedList",
")",
";",
"}"
] | Converts the given list of a type to paged list of a different type.
@param list the list to convert to paged list
@param mapper the mapper to map type in input list to output list
@param <OutT> the type of items in output paged list
@param <InT> the type of items in input paged list
@return the paged list | [
"Converts",
"the",
"given",
"list",
"of",
"a",
"type",
"to",
"paged",
"list",
"of",
"a",
"different",
"type",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java#L148-L165 |
163,037 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java | Utils.addToListIfNotExists | public static void addToListIfNotExists(List<String> list, String value) {
boolean found = false;
for (String item : list) {
if (item.equalsIgnoreCase(value)) {
found = true;
break;
}
}
if (!found) {
list.add(value);
}
} | java | public static void addToListIfNotExists(List<String> list, String value) {
boolean found = false;
for (String item : list) {
if (item.equalsIgnoreCase(value)) {
found = true;
break;
}
}
if (!found) {
list.add(value);
}
} | [
"public",
"static",
"void",
"addToListIfNotExists",
"(",
"List",
"<",
"String",
">",
"list",
",",
"String",
"value",
")",
"{",
"boolean",
"found",
"=",
"false",
";",
"for",
"(",
"String",
"item",
":",
"list",
")",
"{",
"if",
"(",
"item",
".",
"equalsIgnoreCase",
"(",
"value",
")",
")",
"{",
"found",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"found",
")",
"{",
"list",
".",
"add",
"(",
"value",
")",
";",
"}",
"}"
] | Adds a value to the list if does not already exists.
@param list the list
@param value value to add if not exists in the list | [
"Adds",
"a",
"value",
"to",
"the",
"list",
"if",
"does",
"not",
"already",
"exists",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java#L173-L184 |
163,038 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java | Utils.removeFromList | public static void removeFromList(List<String> list, String value) {
int foundIndex = -1;
int i = 0;
for (String id : list) {
if (id.equalsIgnoreCase(value)) {
foundIndex = i;
break;
}
i++;
}
if (foundIndex != -1) {
list.remove(foundIndex);
}
} | java | public static void removeFromList(List<String> list, String value) {
int foundIndex = -1;
int i = 0;
for (String id : list) {
if (id.equalsIgnoreCase(value)) {
foundIndex = i;
break;
}
i++;
}
if (foundIndex != -1) {
list.remove(foundIndex);
}
} | [
"public",
"static",
"void",
"removeFromList",
"(",
"List",
"<",
"String",
">",
"list",
",",
"String",
"value",
")",
"{",
"int",
"foundIndex",
"=",
"-",
"1",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"String",
"id",
":",
"list",
")",
"{",
"if",
"(",
"id",
".",
"equalsIgnoreCase",
"(",
"value",
")",
")",
"{",
"foundIndex",
"=",
"i",
";",
"break",
";",
"}",
"i",
"++",
";",
"}",
"if",
"(",
"foundIndex",
"!=",
"-",
"1",
")",
"{",
"list",
".",
"remove",
"(",
"foundIndex",
")",
";",
"}",
"}"
] | Removes a value from the list.
@param list the list
@param value value to remove | [
"Removes",
"a",
"value",
"from",
"the",
"list",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java#L192-L205 |
163,039 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/PagedListConverter.java | PagedListConverter.convert | public PagedList<V> convert(final PagedList<U> uList) {
if (uList == null || uList.isEmpty()) {
return new PagedList<V>() {
@Override
public Page<V> nextPage(String s) throws RestException, IOException {
return null;
}
};
}
Page<U> uPage = uList.currentPage();
final PageImpl<V> vPage = new PageImpl<>();
vPage.setNextPageLink(uPage.nextPageLink());
vPage.setItems(new ArrayList<V>());
loadConvertedList(uPage, vPage);
return new PagedList<V>(vPage) {
@Override
public Page<V> nextPage(String nextPageLink) throws RestException, IOException {
Page<U> uPage = uList.nextPage(nextPageLink);
final PageImpl<V> vPage = new PageImpl<>();
vPage.setNextPageLink(uPage.nextPageLink());
vPage.setItems(new ArrayList<V>());
loadConvertedList(uPage, vPage);
return vPage;
}
};
} | java | public PagedList<V> convert(final PagedList<U> uList) {
if (uList == null || uList.isEmpty()) {
return new PagedList<V>() {
@Override
public Page<V> nextPage(String s) throws RestException, IOException {
return null;
}
};
}
Page<U> uPage = uList.currentPage();
final PageImpl<V> vPage = new PageImpl<>();
vPage.setNextPageLink(uPage.nextPageLink());
vPage.setItems(new ArrayList<V>());
loadConvertedList(uPage, vPage);
return new PagedList<V>(vPage) {
@Override
public Page<V> nextPage(String nextPageLink) throws RestException, IOException {
Page<U> uPage = uList.nextPage(nextPageLink);
final PageImpl<V> vPage = new PageImpl<>();
vPage.setNextPageLink(uPage.nextPageLink());
vPage.setItems(new ArrayList<V>());
loadConvertedList(uPage, vPage);
return vPage;
}
};
} | [
"public",
"PagedList",
"<",
"V",
">",
"convert",
"(",
"final",
"PagedList",
"<",
"U",
">",
"uList",
")",
"{",
"if",
"(",
"uList",
"==",
"null",
"||",
"uList",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"new",
"PagedList",
"<",
"V",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"V",
">",
"nextPage",
"(",
"String",
"s",
")",
"throws",
"RestException",
",",
"IOException",
"{",
"return",
"null",
";",
"}",
"}",
";",
"}",
"Page",
"<",
"U",
">",
"uPage",
"=",
"uList",
".",
"currentPage",
"(",
")",
";",
"final",
"PageImpl",
"<",
"V",
">",
"vPage",
"=",
"new",
"PageImpl",
"<>",
"(",
")",
";",
"vPage",
".",
"setNextPageLink",
"(",
"uPage",
".",
"nextPageLink",
"(",
")",
")",
";",
"vPage",
".",
"setItems",
"(",
"new",
"ArrayList",
"<",
"V",
">",
"(",
")",
")",
";",
"loadConvertedList",
"(",
"uPage",
",",
"vPage",
")",
";",
"return",
"new",
"PagedList",
"<",
"V",
">",
"(",
"vPage",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"V",
">",
"nextPage",
"(",
"String",
"nextPageLink",
")",
"throws",
"RestException",
",",
"IOException",
"{",
"Page",
"<",
"U",
">",
"uPage",
"=",
"uList",
".",
"nextPage",
"(",
"nextPageLink",
")",
";",
"final",
"PageImpl",
"<",
"V",
">",
"vPage",
"=",
"new",
"PageImpl",
"<>",
"(",
")",
";",
"vPage",
".",
"setNextPageLink",
"(",
"uPage",
".",
"nextPageLink",
"(",
")",
")",
";",
"vPage",
".",
"setItems",
"(",
"new",
"ArrayList",
"<",
"V",
">",
"(",
")",
")",
";",
"loadConvertedList",
"(",
"uPage",
",",
"vPage",
")",
";",
"return",
"vPage",
";",
"}",
"}",
";",
"}"
] | Converts the paged list.
@param uList the resource list to convert from
@return the converted list | [
"Converts",
"the",
"paged",
"list",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/PagedListConverter.java#L53-L78 |
163,040 | Azure/autorest-clientruntime-for-java | client-runtime/src/main/java/com/microsoft/rest/interceptors/CustomHeadersInterceptor.java | CustomHeadersInterceptor.replaceHeader | public CustomHeadersInterceptor replaceHeader(String name, String value) {
this.headers.put(name, new ArrayList<String>());
this.headers.get(name).add(value);
return this;
} | java | public CustomHeadersInterceptor replaceHeader(String name, String value) {
this.headers.put(name, new ArrayList<String>());
this.headers.get(name).add(value);
return this;
} | [
"public",
"CustomHeadersInterceptor",
"replaceHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"this",
".",
"headers",
".",
"put",
"(",
"name",
",",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
")",
";",
"this",
".",
"headers",
".",
"get",
"(",
"name",
")",
".",
"add",
"(",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Add a single header key-value pair. If one with the name already exists,
it gets replaced.
@param name the name of the header.
@param value the value of the header.
@return the interceptor instance itself. | [
"Add",
"a",
"single",
"header",
"key",
"-",
"value",
"pair",
".",
"If",
"one",
"with",
"the",
"name",
"already",
"exists",
"it",
"gets",
"replaced",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/interceptors/CustomHeadersInterceptor.java#L64-L68 |
163,041 | Azure/autorest-clientruntime-for-java | client-runtime/src/main/java/com/microsoft/rest/interceptors/CustomHeadersInterceptor.java | CustomHeadersInterceptor.addHeader | public CustomHeadersInterceptor addHeader(String name, String value) {
if (!this.headers.containsKey(name)) {
this.headers.put(name, new ArrayList<String>());
}
this.headers.get(name).add(value);
return this;
} | java | public CustomHeadersInterceptor addHeader(String name, String value) {
if (!this.headers.containsKey(name)) {
this.headers.put(name, new ArrayList<String>());
}
this.headers.get(name).add(value);
return this;
} | [
"public",
"CustomHeadersInterceptor",
"addHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"!",
"this",
".",
"headers",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"this",
".",
"headers",
".",
"put",
"(",
"name",
",",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
")",
";",
"}",
"this",
".",
"headers",
".",
"get",
"(",
"name",
")",
".",
"add",
"(",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Add a single header key-value pair. If one with the name already exists,
both stay in the header map.
@param name the name of the header.
@param value the value of the header.
@return the interceptor instance itself. | [
"Add",
"a",
"single",
"header",
"key",
"-",
"value",
"pair",
".",
"If",
"one",
"with",
"the",
"name",
"already",
"exists",
"both",
"stay",
"in",
"the",
"header",
"map",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/interceptors/CustomHeadersInterceptor.java#L78-L84 |
163,042 | Azure/autorest-clientruntime-for-java | client-runtime/src/main/java/com/microsoft/rest/interceptors/CustomHeadersInterceptor.java | CustomHeadersInterceptor.addHeaderMap | public CustomHeadersInterceptor addHeaderMap(Map<String, String> headers) {
for (Map.Entry<String, String> header : headers.entrySet()) {
this.headers.put(header.getKey(), Collections.singletonList(header.getValue()));
}
return this;
} | java | public CustomHeadersInterceptor addHeaderMap(Map<String, String> headers) {
for (Map.Entry<String, String> header : headers.entrySet()) {
this.headers.put(header.getKey(), Collections.singletonList(header.getValue()));
}
return this;
} | [
"public",
"CustomHeadersInterceptor",
"addHeaderMap",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"header",
":",
"headers",
".",
"entrySet",
"(",
")",
")",
"{",
"this",
".",
"headers",
".",
"put",
"(",
"header",
".",
"getKey",
"(",
")",
",",
"Collections",
".",
"singletonList",
"(",
"header",
".",
"getValue",
"(",
")",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Add all headers in a header map.
@param headers a map of headers.
@return the interceptor instance itself. | [
"Add",
"all",
"headers",
"in",
"a",
"header",
"map",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/interceptors/CustomHeadersInterceptor.java#L103-L108 |
163,043 | Azure/autorest-clientruntime-for-java | client-runtime/src/main/java/com/microsoft/rest/interceptors/CustomHeadersInterceptor.java | CustomHeadersInterceptor.addHeaderMultimap | public CustomHeadersInterceptor addHeaderMultimap(Map<String, List<String>> headers) {
this.headers.putAll(headers);
return this;
} | java | public CustomHeadersInterceptor addHeaderMultimap(Map<String, List<String>> headers) {
this.headers.putAll(headers);
return this;
} | [
"public",
"CustomHeadersInterceptor",
"addHeaderMultimap",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"headers",
")",
"{",
"this",
".",
"headers",
".",
"putAll",
"(",
"headers",
")",
";",
"return",
"this",
";",
"}"
] | Add all headers in a header multimap.
@param headers a multimap of headers.
@return the interceptor instance itself. | [
"Add",
"all",
"headers",
"in",
"a",
"header",
"multimap",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/interceptors/CustomHeadersInterceptor.java#L116-L119 |
163,044 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/RXMapper.java | RXMapper.map | public static <T> Observable<T> map(Observable<?> fromObservable, final T toValue) {
if (fromObservable != null) {
return fromObservable.subscribeOn(Schedulers.io())
.map(new RXMapper<T>(toValue));
} else {
return Observable.empty();
}
} | java | public static <T> Observable<T> map(Observable<?> fromObservable, final T toValue) {
if (fromObservable != null) {
return fromObservable.subscribeOn(Schedulers.io())
.map(new RXMapper<T>(toValue));
} else {
return Observable.empty();
}
} | [
"public",
"static",
"<",
"T",
">",
"Observable",
"<",
"T",
">",
"map",
"(",
"Observable",
"<",
"?",
">",
"fromObservable",
",",
"final",
"T",
"toValue",
")",
"{",
"if",
"(",
"fromObservable",
"!=",
"null",
")",
"{",
"return",
"fromObservable",
".",
"subscribeOn",
"(",
"Schedulers",
".",
"io",
"(",
")",
")",
".",
"map",
"(",
"new",
"RXMapper",
"<",
"T",
">",
"(",
"toValue",
")",
")",
";",
"}",
"else",
"{",
"return",
"Observable",
".",
"empty",
"(",
")",
";",
"}",
"}"
] | Shortcut for mapping the output of an arbitrary observable to one returning an instance of a specific type, using the IO scheduler.
@param fromObservable the source observable
@param toValue the value to emit to the observer
@param <T> the type of the value to emit
@return an observable emitting the specified value | [
"Shortcut",
"for",
"mapping",
"the",
"output",
"of",
"an",
"arbitrary",
"observable",
"to",
"one",
"returning",
"an",
"instance",
"of",
"a",
"specific",
"type",
"using",
"the",
"IO",
"scheduler",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/RXMapper.java#L28-L35 |
163,045 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/RXMapper.java | RXMapper.mapToVoid | public static Observable<Void> mapToVoid(Observable<?> fromObservable) {
if (fromObservable != null) {
return fromObservable.subscribeOn(Schedulers.io())
.map(new RXMapper<Void>());
} else {
return Observable.empty();
}
} | java | public static Observable<Void> mapToVoid(Observable<?> fromObservable) {
if (fromObservable != null) {
return fromObservable.subscribeOn(Schedulers.io())
.map(new RXMapper<Void>());
} else {
return Observable.empty();
}
} | [
"public",
"static",
"Observable",
"<",
"Void",
">",
"mapToVoid",
"(",
"Observable",
"<",
"?",
">",
"fromObservable",
")",
"{",
"if",
"(",
"fromObservable",
"!=",
"null",
")",
"{",
"return",
"fromObservable",
".",
"subscribeOn",
"(",
"Schedulers",
".",
"io",
"(",
")",
")",
".",
"map",
"(",
"new",
"RXMapper",
"<",
"Void",
">",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"Observable",
".",
"empty",
"(",
")",
";",
"}",
"}"
] | Shortcut for mapping an arbitrary observable to void, using the IO scheduler.
@param fromObservable the source observable
@return a void-emitting observable | [
"Shortcut",
"for",
"mapping",
"an",
"arbitrary",
"observable",
"to",
"void",
"using",
"the",
"IO",
"scheduler",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/RXMapper.java#L42-L49 |
163,046 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/models/implementation/ResourceImpl.java | ResourceImpl.withTag | @SuppressWarnings("unchecked")
public final FluentModelImplT withTag(String key, String value) {
if (this.inner().getTags() == null) {
this.inner().withTags(new HashMap<String, String>());
}
this.inner().getTags().put(key, value);
return (FluentModelImplT) this;
} | java | @SuppressWarnings("unchecked")
public final FluentModelImplT withTag(String key, String value) {
if (this.inner().getTags() == null) {
this.inner().withTags(new HashMap<String, String>());
}
this.inner().getTags().put(key, value);
return (FluentModelImplT) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"FluentModelImplT",
"withTag",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"this",
".",
"inner",
"(",
")",
".",
"getTags",
"(",
")",
"==",
"null",
")",
"{",
"this",
".",
"inner",
"(",
")",
".",
"withTags",
"(",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
")",
";",
"}",
"this",
".",
"inner",
"(",
")",
".",
"getTags",
"(",
")",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"(",
"FluentModelImplT",
")",
"this",
";",
"}"
] | Adds a tag to the resource.
@param key the key for the tag
@param value the value for the tag
@return the next stage of the definition/update | [
"Adds",
"a",
"tag",
"to",
"the",
"resource",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/models/implementation/ResourceImpl.java#L109-L116 |
163,047 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/models/implementation/ResourceImpl.java | ResourceImpl.withoutTag | @SuppressWarnings("unchecked")
public final FluentModelImplT withoutTag(String key) {
if (this.inner().getTags() != null) {
this.inner().getTags().remove(key);
}
return (FluentModelImplT) this;
} | java | @SuppressWarnings("unchecked")
public final FluentModelImplT withoutTag(String key) {
if (this.inner().getTags() != null) {
this.inner().getTags().remove(key);
}
return (FluentModelImplT) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"FluentModelImplT",
"withoutTag",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"this",
".",
"inner",
"(",
")",
".",
"getTags",
"(",
")",
"!=",
"null",
")",
"{",
"this",
".",
"inner",
"(",
")",
".",
"getTags",
"(",
")",
".",
"remove",
"(",
"key",
")",
";",
"}",
"return",
"(",
"FluentModelImplT",
")",
"this",
";",
"}"
] | Removes a tag from the resource.
@param key the key of the tag to remove
@return the next stage of the definition/update | [
"Removes",
"a",
"tag",
"from",
"the",
"resource",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/models/implementation/ResourceImpl.java#L123-L129 |
163,048 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/ListOperationCallback.java | ListOperationCallback.load | public void load(List<E> result) {
++pageCount;
if (this.result == null || this.result.isEmpty()) {
this.result = result;
} else {
this.result.addAll(result);
}
} | java | public void load(List<E> result) {
++pageCount;
if (this.result == null || this.result.isEmpty()) {
this.result = result;
} else {
this.result.addAll(result);
}
} | [
"public",
"void",
"load",
"(",
"List",
"<",
"E",
">",
"result",
")",
"{",
"++",
"pageCount",
";",
"if",
"(",
"this",
".",
"result",
"==",
"null",
"||",
"this",
".",
"result",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"result",
"=",
"result",
";",
"}",
"else",
"{",
"this",
".",
"result",
".",
"addAll",
"(",
"result",
")",
";",
"}",
"}"
] | This method is called by the client to load the most recent list of resources.
This method should only be called by the service client.
@param result the most recent list of resources. | [
"This",
"method",
"is",
"called",
"by",
"the",
"client",
"to",
"load",
"the",
"most",
"recent",
"list",
"of",
"resources",
".",
"This",
"method",
"should",
"only",
"be",
"called",
"by",
"the",
"service",
"client",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/ListOperationCallback.java#L62-L69 |
163,049 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/DelayProvider.java | DelayProvider.delayedEmitAsync | public <T> Observable<T> delayedEmitAsync(T event, int milliseconds) {
return Observable.just(event).delay(milliseconds, TimeUnit.MILLISECONDS, Schedulers.immediate());
} | java | public <T> Observable<T> delayedEmitAsync(T event, int milliseconds) {
return Observable.just(event).delay(milliseconds, TimeUnit.MILLISECONDS, Schedulers.immediate());
} | [
"public",
"<",
"T",
">",
"Observable",
"<",
"T",
">",
"delayedEmitAsync",
"(",
"T",
"event",
",",
"int",
"milliseconds",
")",
"{",
"return",
"Observable",
".",
"just",
"(",
"event",
")",
".",
"delay",
"(",
"milliseconds",
",",
"TimeUnit",
".",
"MILLISECONDS",
",",
"Schedulers",
".",
"immediate",
"(",
")",
")",
";",
"}"
] | Creates an observable that emits the given item after the specified time in milliseconds.
@param event the event to emit
@param milliseconds the delay in milliseconds
@param <T> the type of event
@return delayed observable | [
"Creates",
"an",
"observable",
"that",
"emits",
"the",
"given",
"item",
"after",
"the",
"specified",
"time",
"in",
"milliseconds",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/DelayProvider.java#L37-L39 |
163,050 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/SdkContext.java | SdkContext.randomResourceNames | public static String[] randomResourceNames(String prefix, int maxLen, int count) {
String[] names = new String[count];
ResourceNamer resourceNamer = SdkContext.getResourceNamerFactory().createResourceNamer("");
for (int i = 0; i < count; i++) {
names[i] = resourceNamer.randomName(prefix, maxLen);
}
return names;
} | java | public static String[] randomResourceNames(String prefix, int maxLen, int count) {
String[] names = new String[count];
ResourceNamer resourceNamer = SdkContext.getResourceNamerFactory().createResourceNamer("");
for (int i = 0; i < count; i++) {
names[i] = resourceNamer.randomName(prefix, maxLen);
}
return names;
} | [
"public",
"static",
"String",
"[",
"]",
"randomResourceNames",
"(",
"String",
"prefix",
",",
"int",
"maxLen",
",",
"int",
"count",
")",
"{",
"String",
"[",
"]",
"names",
"=",
"new",
"String",
"[",
"count",
"]",
";",
"ResourceNamer",
"resourceNamer",
"=",
"SdkContext",
".",
"getResourceNamerFactory",
"(",
")",
".",
"createResourceNamer",
"(",
"\"\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"names",
"[",
"i",
"]",
"=",
"resourceNamer",
".",
"randomName",
"(",
"prefix",
",",
"maxLen",
")",
";",
"}",
"return",
"names",
";",
"}"
] | Generates the specified number of random resource names with the same prefix.
@param prefix the prefix to be used if possible
@param maxLen the maximum length for the random generated name
@param count the number of names to generate
@return random names | [
"Generates",
"the",
"specified",
"number",
"of",
"random",
"resource",
"names",
"with",
"the",
"same",
"prefix",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/SdkContext.java#L57-L64 |
163,051 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/SdkContext.java | SdkContext.delayedEmitAsync | public static <T> Observable<T> delayedEmitAsync(T event, int milliseconds) {
return delayProvider.delayedEmitAsync(event, milliseconds);
} | java | public static <T> Observable<T> delayedEmitAsync(T event, int milliseconds) {
return delayProvider.delayedEmitAsync(event, milliseconds);
} | [
"public",
"static",
"<",
"T",
">",
"Observable",
"<",
"T",
">",
"delayedEmitAsync",
"(",
"T",
"event",
",",
"int",
"milliseconds",
")",
"{",
"return",
"delayProvider",
".",
"delayedEmitAsync",
"(",
"event",
",",
"milliseconds",
")",
";",
"}"
] | Wrapper delayed emission, based on delayProvider.
@param event the event to emit
@param milliseconds the delay in milliseconds
@param <T> the type of event
@return delayed observable | [
"Wrapper",
"delayed",
"emission",
"based",
"on",
"delayProvider",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/SdkContext.java#L101-L103 |
163,052 | Azure/autorest-clientruntime-for-java | azure-client-authentication/src/main/java/com/microsoft/azure/credentials/MSICredentials.java | MSICredentials.withObjectId | @Beta
public MSICredentials withObjectId(String objectId) {
this.objectId = objectId;
this.clientId = null;
this.identityId = null;
return this;
} | java | @Beta
public MSICredentials withObjectId(String objectId) {
this.objectId = objectId;
this.clientId = null;
this.identityId = null;
return this;
} | [
"@",
"Beta",
"public",
"MSICredentials",
"withObjectId",
"(",
"String",
"objectId",
")",
"{",
"this",
".",
"objectId",
"=",
"objectId",
";",
"this",
".",
"clientId",
"=",
"null",
";",
"this",
".",
"identityId",
"=",
"null",
";",
"return",
"this",
";",
"}"
] | Specifies the object id associated with a user assigned managed service identity
resource that should be used to retrieve the access token.
@param objectId Object ID of the identity to use when authenticating to Azure AD.
@return MSICredentials | [
"Specifies",
"the",
"object",
"id",
"associated",
"with",
"a",
"user",
"assigned",
"managed",
"service",
"identity",
"resource",
"that",
"should",
"be",
"used",
"to",
"retrieve",
"the",
"access",
"token",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-authentication/src/main/java/com/microsoft/azure/credentials/MSICredentials.java#L89-L95 |
163,053 | Azure/autorest-clientruntime-for-java | azure-client-authentication/src/main/java/com/microsoft/azure/credentials/MSICredentials.java | MSICredentials.withIdentityId | @Beta
public MSICredentials withIdentityId(String identityId) {
this.identityId = identityId;
this.clientId = null;
this.objectId = null;
return this;
} | java | @Beta
public MSICredentials withIdentityId(String identityId) {
this.identityId = identityId;
this.clientId = null;
this.objectId = null;
return this;
} | [
"@",
"Beta",
"public",
"MSICredentials",
"withIdentityId",
"(",
"String",
"identityId",
")",
"{",
"this",
".",
"identityId",
"=",
"identityId",
";",
"this",
".",
"clientId",
"=",
"null",
";",
"this",
".",
"objectId",
"=",
"null",
";",
"return",
"this",
";",
"}"
] | Specifies the ARM resource id of the user assigned managed service identity resource that
should be used to retrieve the access token.
@param identityId the ARM resource id of the user assigned identity resource
@return MSICredentials | [
"Specifies",
"the",
"ARM",
"resource",
"id",
"of",
"the",
"user",
"assigned",
"managed",
"service",
"identity",
"resource",
"that",
"should",
"be",
"used",
"to",
"retrieve",
"the",
"access",
"token",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-authentication/src/main/java/com/microsoft/azure/credentials/MSICredentials.java#L119-L125 |
163,054 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/model/implementation/CreatableUpdatableImpl.java | CreatableUpdatableImpl.addPostRunDependent | protected String addPostRunDependent(TaskGroup.HasTaskGroup dependent) {
Objects.requireNonNull(dependent);
this.taskGroup.addPostRunDependentTaskGroup(dependent.taskGroup());
return dependent.taskGroup().key();
} | java | protected String addPostRunDependent(TaskGroup.HasTaskGroup dependent) {
Objects.requireNonNull(dependent);
this.taskGroup.addPostRunDependentTaskGroup(dependent.taskGroup());
return dependent.taskGroup().key();
} | [
"protected",
"String",
"addPostRunDependent",
"(",
"TaskGroup",
".",
"HasTaskGroup",
"dependent",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"dependent",
")",
";",
"this",
".",
"taskGroup",
".",
"addPostRunDependentTaskGroup",
"(",
"dependent",
".",
"taskGroup",
"(",
")",
")",
";",
"return",
"dependent",
".",
"taskGroup",
"(",
")",
".",
"key",
"(",
")",
";",
"}"
] | Add a "post-run" dependent for this model.
@param dependent the "post-run" dependent.
@return key to be used as parameter to taskResult(string) method to retrieve result of root
task in the given dependent task group | [
"Add",
"a",
"post",
"-",
"run",
"dependent",
"for",
"this",
"model",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/model/implementation/CreatableUpdatableImpl.java#L166-L170 |
163,055 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java | PollingState.create | public static <T> PollingState<T> create(Response<ResponseBody> response, LongRunningOperationOptions lroOptions, int defaultRetryTimeout, Type resourceType, SerializerAdapter<?> serializerAdapter) throws IOException {
PollingState<T> pollingState = new PollingState<>();
pollingState.initialHttpMethod = response.raw().request().method();
pollingState.defaultRetryTimeout = defaultRetryTimeout;
pollingState.withResponse(response);
pollingState.resourceType = resourceType;
pollingState.serializerAdapter = serializerAdapter;
pollingState.loggingContext = response.raw().request().header(LOGGING_HEADER);
pollingState.finalStateVia = lroOptions.finalStateVia();
String responseContent = null;
PollingResource resource = null;
if (response.body() != null) {
responseContent = response.body().string();
response.body().close();
}
if (responseContent != null && !responseContent.isEmpty()) {
pollingState.resource = serializerAdapter.deserialize(responseContent, resourceType);
resource = serializerAdapter.deserialize(responseContent, PollingResource.class);
}
final int statusCode = pollingState.response.code();
if (resource != null && resource.properties != null
&& resource.properties.provisioningState != null) {
pollingState.withStatus(resource.properties.provisioningState, statusCode);
} else {
switch (statusCode) {
case 202:
pollingState.withStatus(AzureAsyncOperation.IN_PROGRESS_STATUS, statusCode);
break;
case 204:
case 201:
case 200:
pollingState.withStatus(AzureAsyncOperation.SUCCESS_STATUS, statusCode);
break;
default:
pollingState.withStatus(AzureAsyncOperation.FAILED_STATUS, statusCode);
}
}
return pollingState;
} | java | public static <T> PollingState<T> create(Response<ResponseBody> response, LongRunningOperationOptions lroOptions, int defaultRetryTimeout, Type resourceType, SerializerAdapter<?> serializerAdapter) throws IOException {
PollingState<T> pollingState = new PollingState<>();
pollingState.initialHttpMethod = response.raw().request().method();
pollingState.defaultRetryTimeout = defaultRetryTimeout;
pollingState.withResponse(response);
pollingState.resourceType = resourceType;
pollingState.serializerAdapter = serializerAdapter;
pollingState.loggingContext = response.raw().request().header(LOGGING_HEADER);
pollingState.finalStateVia = lroOptions.finalStateVia();
String responseContent = null;
PollingResource resource = null;
if (response.body() != null) {
responseContent = response.body().string();
response.body().close();
}
if (responseContent != null && !responseContent.isEmpty()) {
pollingState.resource = serializerAdapter.deserialize(responseContent, resourceType);
resource = serializerAdapter.deserialize(responseContent, PollingResource.class);
}
final int statusCode = pollingState.response.code();
if (resource != null && resource.properties != null
&& resource.properties.provisioningState != null) {
pollingState.withStatus(resource.properties.provisioningState, statusCode);
} else {
switch (statusCode) {
case 202:
pollingState.withStatus(AzureAsyncOperation.IN_PROGRESS_STATUS, statusCode);
break;
case 204:
case 201:
case 200:
pollingState.withStatus(AzureAsyncOperation.SUCCESS_STATUS, statusCode);
break;
default:
pollingState.withStatus(AzureAsyncOperation.FAILED_STATUS, statusCode);
}
}
return pollingState;
} | [
"public",
"static",
"<",
"T",
">",
"PollingState",
"<",
"T",
">",
"create",
"(",
"Response",
"<",
"ResponseBody",
">",
"response",
",",
"LongRunningOperationOptions",
"lroOptions",
",",
"int",
"defaultRetryTimeout",
",",
"Type",
"resourceType",
",",
"SerializerAdapter",
"<",
"?",
">",
"serializerAdapter",
")",
"throws",
"IOException",
"{",
"PollingState",
"<",
"T",
">",
"pollingState",
"=",
"new",
"PollingState",
"<>",
"(",
")",
";",
"pollingState",
".",
"initialHttpMethod",
"=",
"response",
".",
"raw",
"(",
")",
".",
"request",
"(",
")",
".",
"method",
"(",
")",
";",
"pollingState",
".",
"defaultRetryTimeout",
"=",
"defaultRetryTimeout",
";",
"pollingState",
".",
"withResponse",
"(",
"response",
")",
";",
"pollingState",
".",
"resourceType",
"=",
"resourceType",
";",
"pollingState",
".",
"serializerAdapter",
"=",
"serializerAdapter",
";",
"pollingState",
".",
"loggingContext",
"=",
"response",
".",
"raw",
"(",
")",
".",
"request",
"(",
")",
".",
"header",
"(",
"LOGGING_HEADER",
")",
";",
"pollingState",
".",
"finalStateVia",
"=",
"lroOptions",
".",
"finalStateVia",
"(",
")",
";",
"String",
"responseContent",
"=",
"null",
";",
"PollingResource",
"resource",
"=",
"null",
";",
"if",
"(",
"response",
".",
"body",
"(",
")",
"!=",
"null",
")",
"{",
"responseContent",
"=",
"response",
".",
"body",
"(",
")",
".",
"string",
"(",
")",
";",
"response",
".",
"body",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"responseContent",
"!=",
"null",
"&&",
"!",
"responseContent",
".",
"isEmpty",
"(",
")",
")",
"{",
"pollingState",
".",
"resource",
"=",
"serializerAdapter",
".",
"deserialize",
"(",
"responseContent",
",",
"resourceType",
")",
";",
"resource",
"=",
"serializerAdapter",
".",
"deserialize",
"(",
"responseContent",
",",
"PollingResource",
".",
"class",
")",
";",
"}",
"final",
"int",
"statusCode",
"=",
"pollingState",
".",
"response",
".",
"code",
"(",
")",
";",
"if",
"(",
"resource",
"!=",
"null",
"&&",
"resource",
".",
"properties",
"!=",
"null",
"&&",
"resource",
".",
"properties",
".",
"provisioningState",
"!=",
"null",
")",
"{",
"pollingState",
".",
"withStatus",
"(",
"resource",
".",
"properties",
".",
"provisioningState",
",",
"statusCode",
")",
";",
"}",
"else",
"{",
"switch",
"(",
"statusCode",
")",
"{",
"case",
"202",
":",
"pollingState",
".",
"withStatus",
"(",
"AzureAsyncOperation",
".",
"IN_PROGRESS_STATUS",
",",
"statusCode",
")",
";",
"break",
";",
"case",
"204",
":",
"case",
"201",
":",
"case",
"200",
":",
"pollingState",
".",
"withStatus",
"(",
"AzureAsyncOperation",
".",
"SUCCESS_STATUS",
",",
"statusCode",
")",
";",
"break",
";",
"default",
":",
"pollingState",
".",
"withStatus",
"(",
"AzureAsyncOperation",
".",
"FAILED_STATUS",
",",
"statusCode",
")",
";",
"}",
"}",
"return",
"pollingState",
";",
"}"
] | Creates a polling state.
@param response the response from Retrofit REST call that initiate the long running operation.
@param lroOptions long running operation options.
@param defaultRetryTimeout the long running operation retry timeout.
@param resourceType the type of the resource the long running operation returns
@param serializerAdapter the adapter for the Jackson object mapper
@param <T> the result type
@return the polling state
@throws IOException thrown by deserialization | [
"Creates",
"a",
"polling",
"state",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java#L99-L138 |
163,056 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java | PollingState.createFromJSONString | public static <ResultT> PollingState<ResultT> createFromJSONString(String serializedPollingState) {
ObjectMapper mapper = initMapper(new ObjectMapper());
PollingState<ResultT> pollingState;
try {
pollingState = mapper.readValue(serializedPollingState, PollingState.class);
} catch (IOException exception) {
throw new RuntimeException(exception);
}
return pollingState;
} | java | public static <ResultT> PollingState<ResultT> createFromJSONString(String serializedPollingState) {
ObjectMapper mapper = initMapper(new ObjectMapper());
PollingState<ResultT> pollingState;
try {
pollingState = mapper.readValue(serializedPollingState, PollingState.class);
} catch (IOException exception) {
throw new RuntimeException(exception);
}
return pollingState;
} | [
"public",
"static",
"<",
"ResultT",
">",
"PollingState",
"<",
"ResultT",
">",
"createFromJSONString",
"(",
"String",
"serializedPollingState",
")",
"{",
"ObjectMapper",
"mapper",
"=",
"initMapper",
"(",
"new",
"ObjectMapper",
"(",
")",
")",
";",
"PollingState",
"<",
"ResultT",
">",
"pollingState",
";",
"try",
"{",
"pollingState",
"=",
"mapper",
".",
"readValue",
"(",
"serializedPollingState",
",",
"PollingState",
".",
"class",
")",
";",
"}",
"catch",
"(",
"IOException",
"exception",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"exception",
")",
";",
"}",
"return",
"pollingState",
";",
"}"
] | Creates PollingState from the json string.
@param serializedPollingState polling state as json string
@param <ResultT> the result that the poll operation produces
@return the polling state | [
"Creates",
"PollingState",
"from",
"the",
"json",
"string",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java#L147-L156 |
163,057 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java | PollingState.createFromPollingState | public static <ResultT> PollingState<ResultT> createFromPollingState(PollingState<?> other, ResultT result) {
PollingState<ResultT> pollingState = new PollingState<>();
pollingState.resource = result;
pollingState.initialHttpMethod = other.initialHttpMethod();
pollingState.status = other.status();
pollingState.statusCode = other.statusCode();
pollingState.azureAsyncOperationHeaderLink = other.azureAsyncOperationHeaderLink();
pollingState.locationHeaderLink = other.locationHeaderLink();
pollingState.putOrPatchResourceUri = other.putOrPatchResourceUri();
pollingState.defaultRetryTimeout = other.defaultRetryTimeout;
pollingState.retryTimeout = other.retryTimeout;
pollingState.loggingContext = other.loggingContext;
pollingState.finalStateVia = other.finalStateVia;
return pollingState;
} | java | public static <ResultT> PollingState<ResultT> createFromPollingState(PollingState<?> other, ResultT result) {
PollingState<ResultT> pollingState = new PollingState<>();
pollingState.resource = result;
pollingState.initialHttpMethod = other.initialHttpMethod();
pollingState.status = other.status();
pollingState.statusCode = other.statusCode();
pollingState.azureAsyncOperationHeaderLink = other.azureAsyncOperationHeaderLink();
pollingState.locationHeaderLink = other.locationHeaderLink();
pollingState.putOrPatchResourceUri = other.putOrPatchResourceUri();
pollingState.defaultRetryTimeout = other.defaultRetryTimeout;
pollingState.retryTimeout = other.retryTimeout;
pollingState.loggingContext = other.loggingContext;
pollingState.finalStateVia = other.finalStateVia;
return pollingState;
} | [
"public",
"static",
"<",
"ResultT",
">",
"PollingState",
"<",
"ResultT",
">",
"createFromPollingState",
"(",
"PollingState",
"<",
"?",
">",
"other",
",",
"ResultT",
"result",
")",
"{",
"PollingState",
"<",
"ResultT",
">",
"pollingState",
"=",
"new",
"PollingState",
"<>",
"(",
")",
";",
"pollingState",
".",
"resource",
"=",
"result",
";",
"pollingState",
".",
"initialHttpMethod",
"=",
"other",
".",
"initialHttpMethod",
"(",
")",
";",
"pollingState",
".",
"status",
"=",
"other",
".",
"status",
"(",
")",
";",
"pollingState",
".",
"statusCode",
"=",
"other",
".",
"statusCode",
"(",
")",
";",
"pollingState",
".",
"azureAsyncOperationHeaderLink",
"=",
"other",
".",
"azureAsyncOperationHeaderLink",
"(",
")",
";",
"pollingState",
".",
"locationHeaderLink",
"=",
"other",
".",
"locationHeaderLink",
"(",
")",
";",
"pollingState",
".",
"putOrPatchResourceUri",
"=",
"other",
".",
"putOrPatchResourceUri",
"(",
")",
";",
"pollingState",
".",
"defaultRetryTimeout",
"=",
"other",
".",
"defaultRetryTimeout",
";",
"pollingState",
".",
"retryTimeout",
"=",
"other",
".",
"retryTimeout",
";",
"pollingState",
".",
"loggingContext",
"=",
"other",
".",
"loggingContext",
";",
"pollingState",
".",
"finalStateVia",
"=",
"other",
".",
"finalStateVia",
";",
"return",
"pollingState",
";",
"}"
] | Creates PollingState from another polling state.
@param other other polling state
@param result the final result of the LRO
@param <ResultT> the result that the poll operation produces
@return the polling state | [
"Creates",
"PollingState",
"from",
"another",
"polling",
"state",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java#L166-L180 |
163,058 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java | PollingState.updateFromResponseOnPutPatch | void updateFromResponseOnPutPatch(Response<ResponseBody> response) throws CloudException, IOException {
String responseContent = null;
if (response.body() != null) {
responseContent = response.body().string();
response.body().close();
}
if (responseContent == null || responseContent.isEmpty()) {
throw new CloudException("polling response does not contain a valid body", response);
}
PollingResource resource = serializerAdapter.deserialize(responseContent, PollingResource.class);
final int statusCode = response.code();
if (resource != null && resource.properties != null && resource.properties.provisioningState != null) {
this.withStatus(resource.properties.provisioningState, statusCode);
} else {
this.withStatus(AzureAsyncOperation.SUCCESS_STATUS, statusCode);
}
CloudError error = new CloudError();
this.withErrorBody(error);
error.withCode(this.status());
error.withMessage("Long running operation failed");
this.withResponse(response);
this.withResource(serializerAdapter.<T>deserialize(responseContent, resourceType));
} | java | void updateFromResponseOnPutPatch(Response<ResponseBody> response) throws CloudException, IOException {
String responseContent = null;
if (response.body() != null) {
responseContent = response.body().string();
response.body().close();
}
if (responseContent == null || responseContent.isEmpty()) {
throw new CloudException("polling response does not contain a valid body", response);
}
PollingResource resource = serializerAdapter.deserialize(responseContent, PollingResource.class);
final int statusCode = response.code();
if (resource != null && resource.properties != null && resource.properties.provisioningState != null) {
this.withStatus(resource.properties.provisioningState, statusCode);
} else {
this.withStatus(AzureAsyncOperation.SUCCESS_STATUS, statusCode);
}
CloudError error = new CloudError();
this.withErrorBody(error);
error.withCode(this.status());
error.withMessage("Long running operation failed");
this.withResponse(response);
this.withResource(serializerAdapter.<T>deserialize(responseContent, resourceType));
} | [
"void",
"updateFromResponseOnPutPatch",
"(",
"Response",
"<",
"ResponseBody",
">",
"response",
")",
"throws",
"CloudException",
",",
"IOException",
"{",
"String",
"responseContent",
"=",
"null",
";",
"if",
"(",
"response",
".",
"body",
"(",
")",
"!=",
"null",
")",
"{",
"responseContent",
"=",
"response",
".",
"body",
"(",
")",
".",
"string",
"(",
")",
";",
"response",
".",
"body",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"responseContent",
"==",
"null",
"||",
"responseContent",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"CloudException",
"(",
"\"polling response does not contain a valid body\"",
",",
"response",
")",
";",
"}",
"PollingResource",
"resource",
"=",
"serializerAdapter",
".",
"deserialize",
"(",
"responseContent",
",",
"PollingResource",
".",
"class",
")",
";",
"final",
"int",
"statusCode",
"=",
"response",
".",
"code",
"(",
")",
";",
"if",
"(",
"resource",
"!=",
"null",
"&&",
"resource",
".",
"properties",
"!=",
"null",
"&&",
"resource",
".",
"properties",
".",
"provisioningState",
"!=",
"null",
")",
"{",
"this",
".",
"withStatus",
"(",
"resource",
".",
"properties",
".",
"provisioningState",
",",
"statusCode",
")",
";",
"}",
"else",
"{",
"this",
".",
"withStatus",
"(",
"AzureAsyncOperation",
".",
"SUCCESS_STATUS",
",",
"statusCode",
")",
";",
"}",
"CloudError",
"error",
"=",
"new",
"CloudError",
"(",
")",
";",
"this",
".",
"withErrorBody",
"(",
"error",
")",
";",
"error",
".",
"withCode",
"(",
"this",
".",
"status",
"(",
")",
")",
";",
"error",
".",
"withMessage",
"(",
"\"Long running operation failed\"",
")",
";",
"this",
".",
"withResponse",
"(",
"response",
")",
";",
"this",
".",
"withResource",
"(",
"serializerAdapter",
".",
"<",
"T",
">",
"deserialize",
"(",
"responseContent",
",",
"resourceType",
")",
")",
";",
"}"
] | Updates the polling state from a PUT or PATCH operation.
@param response the response from Retrofit REST call
@throws CloudException thrown if the response is invalid
@throws IOException thrown by deserialization | [
"Updates",
"the",
"polling",
"state",
"from",
"a",
"PUT",
"or",
"PATCH",
"operation",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java#L261-L286 |
163,059 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java | PollingState.updateFromResponseOnDeletePost | void updateFromResponseOnDeletePost(Response<ResponseBody> response) throws IOException {
this.withResponse(response);
String responseContent = null;
if (response.body() != null) {
responseContent = response.body().string();
response.body().close();
}
this.withResource(serializerAdapter.<T>deserialize(responseContent, resourceType));
withStatus(AzureAsyncOperation.SUCCESS_STATUS, response.code());
} | java | void updateFromResponseOnDeletePost(Response<ResponseBody> response) throws IOException {
this.withResponse(response);
String responseContent = null;
if (response.body() != null) {
responseContent = response.body().string();
response.body().close();
}
this.withResource(serializerAdapter.<T>deserialize(responseContent, resourceType));
withStatus(AzureAsyncOperation.SUCCESS_STATUS, response.code());
} | [
"void",
"updateFromResponseOnDeletePost",
"(",
"Response",
"<",
"ResponseBody",
">",
"response",
")",
"throws",
"IOException",
"{",
"this",
".",
"withResponse",
"(",
"response",
")",
";",
"String",
"responseContent",
"=",
"null",
";",
"if",
"(",
"response",
".",
"body",
"(",
")",
"!=",
"null",
")",
"{",
"responseContent",
"=",
"response",
".",
"body",
"(",
")",
".",
"string",
"(",
")",
";",
"response",
".",
"body",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"this",
".",
"withResource",
"(",
"serializerAdapter",
".",
"<",
"T",
">",
"deserialize",
"(",
"responseContent",
",",
"resourceType",
")",
")",
";",
"withStatus",
"(",
"AzureAsyncOperation",
".",
"SUCCESS_STATUS",
",",
"response",
".",
"code",
"(",
")",
")",
";",
"}"
] | Updates the polling state from a DELETE or POST operation.
@param response the response from Retrofit REST call
@throws IOException thrown by deserialization | [
"Updates",
"the",
"polling",
"state",
"from",
"a",
"DELETE",
"or",
"POST",
"operation",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java#L295-L304 |
163,060 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java | PollingState.withStatus | PollingState<T> withStatus(String status, int statusCode) throws IllegalArgumentException {
if (status == null) {
throw new IllegalArgumentException("Status is null.");
}
this.status = status;
this.statusCode = statusCode;
return this;
} | java | PollingState<T> withStatus(String status, int statusCode) throws IllegalArgumentException {
if (status == null) {
throw new IllegalArgumentException("Status is null.");
}
this.status = status;
this.statusCode = statusCode;
return this;
} | [
"PollingState",
"<",
"T",
">",
"withStatus",
"(",
"String",
"status",
",",
"int",
"statusCode",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"status",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Status is null.\"",
")",
";",
"}",
"this",
".",
"status",
"=",
"status",
";",
"this",
".",
"statusCode",
"=",
"statusCode",
";",
"return",
"this",
";",
"}"
] | Sets the polling status.
@param status the polling status.
@param statusCode the HTTP status code
@throws IllegalArgumentException thrown if status is null. | [
"Sets",
"the",
"polling",
"status",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java#L399-L406 |
163,061 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java | PollingState.withResponse | PollingState<T> withResponse(Response<ResponseBody> response) {
this.response = response;
withPollingUrlFromResponse(response);
withPollingRetryTimeoutFromResponse(response);
return this;
} | java | PollingState<T> withResponse(Response<ResponseBody> response) {
this.response = response;
withPollingUrlFromResponse(response);
withPollingRetryTimeoutFromResponse(response);
return this;
} | [
"PollingState",
"<",
"T",
">",
"withResponse",
"(",
"Response",
"<",
"ResponseBody",
">",
"response",
")",
"{",
"this",
".",
"response",
"=",
"response",
";",
"withPollingUrlFromResponse",
"(",
"response",
")",
";",
"withPollingRetryTimeoutFromResponse",
"(",
"response",
")",
";",
"return",
"this",
";",
"}"
] | Sets the last operation response.
@param response the last operation response. | [
"Sets",
"the",
"last",
"operation",
"response",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java#L413-L418 |
163,062 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java | PollingState.throwCloudExceptionIfInFailedState | void throwCloudExceptionIfInFailedState() {
if (this.isStatusFailed()) {
if (this.errorBody() != null) {
throw new CloudException("Async operation failed with provisioning state: " + this.status(), this.response(), this.errorBody());
} else {
throw new CloudException("Async operation failed with provisioning state: " + this.status(), this.response());
}
}
} | java | void throwCloudExceptionIfInFailedState() {
if (this.isStatusFailed()) {
if (this.errorBody() != null) {
throw new CloudException("Async operation failed with provisioning state: " + this.status(), this.response(), this.errorBody());
} else {
throw new CloudException("Async operation failed with provisioning state: " + this.status(), this.response());
}
}
} | [
"void",
"throwCloudExceptionIfInFailedState",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isStatusFailed",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"errorBody",
"(",
")",
"!=",
"null",
")",
"{",
"throw",
"new",
"CloudException",
"(",
"\"Async operation failed with provisioning state: \"",
"+",
"this",
".",
"status",
"(",
")",
",",
"this",
".",
"response",
"(",
")",
",",
"this",
".",
"errorBody",
"(",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"CloudException",
"(",
"\"Async operation failed with provisioning state: \"",
"+",
"this",
".",
"status",
"(",
")",
",",
"this",
".",
"response",
"(",
")",
")",
";",
"}",
"}",
"}"
] | If status is in failed state then throw CloudException. | [
"If",
"status",
"is",
"in",
"failed",
"state",
"then",
"throw",
"CloudException",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java#L538-L546 |
163,063 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/AzureAsyncOperation.java | AzureAsyncOperation.fromResponse | static AzureAsyncOperation fromResponse(SerializerAdapter<?> serializerAdapter, Response<ResponseBody> response) throws CloudException {
AzureAsyncOperation asyncOperation = null;
String rawString = null;
if (response.body() != null) {
try {
rawString = response.body().string();
asyncOperation = serializerAdapter.deserialize(rawString, AzureAsyncOperation.class);
} catch (IOException exception) {
// Exception will be handled below
} finally {
response.body().close();
}
}
if (asyncOperation == null || asyncOperation.status() == null) {
throw new CloudException("polling response does not contain a valid body: " + rawString, response);
}
else {
asyncOperation.rawString = rawString;
}
return asyncOperation;
} | java | static AzureAsyncOperation fromResponse(SerializerAdapter<?> serializerAdapter, Response<ResponseBody> response) throws CloudException {
AzureAsyncOperation asyncOperation = null;
String rawString = null;
if (response.body() != null) {
try {
rawString = response.body().string();
asyncOperation = serializerAdapter.deserialize(rawString, AzureAsyncOperation.class);
} catch (IOException exception) {
// Exception will be handled below
} finally {
response.body().close();
}
}
if (asyncOperation == null || asyncOperation.status() == null) {
throw new CloudException("polling response does not contain a valid body: " + rawString, response);
}
else {
asyncOperation.rawString = rawString;
}
return asyncOperation;
} | [
"static",
"AzureAsyncOperation",
"fromResponse",
"(",
"SerializerAdapter",
"<",
"?",
">",
"serializerAdapter",
",",
"Response",
"<",
"ResponseBody",
">",
"response",
")",
"throws",
"CloudException",
"{",
"AzureAsyncOperation",
"asyncOperation",
"=",
"null",
";",
"String",
"rawString",
"=",
"null",
";",
"if",
"(",
"response",
".",
"body",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"rawString",
"=",
"response",
".",
"body",
"(",
")",
".",
"string",
"(",
")",
";",
"asyncOperation",
"=",
"serializerAdapter",
".",
"deserialize",
"(",
"rawString",
",",
"AzureAsyncOperation",
".",
"class",
")",
";",
"}",
"catch",
"(",
"IOException",
"exception",
")",
"{",
"// Exception will be handled below",
"}",
"finally",
"{",
"response",
".",
"body",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"}",
"if",
"(",
"asyncOperation",
"==",
"null",
"||",
"asyncOperation",
".",
"status",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"CloudException",
"(",
"\"polling response does not contain a valid body: \"",
"+",
"rawString",
",",
"response",
")",
";",
"}",
"else",
"{",
"asyncOperation",
".",
"rawString",
"=",
"rawString",
";",
"}",
"return",
"asyncOperation",
";",
"}"
] | Creates AzureAsyncOperation from the given HTTP response.
@param serializerAdapter the adapter to use for deserialization
@param response the response
@return the async operation object
@throws CloudException if the deserialization fails or response contains invalid body | [
"Creates",
"AzureAsyncOperation",
"from",
"the",
"given",
"HTTP",
"response",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/AzureAsyncOperation.java#L134-L154 |
163,064 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/Node.java | Node.setOwner | public void setOwner(Graph<DataT, NodeT> ownerGraph) {
if (this.ownerGraph != null) {
throw new RuntimeException("Changing owner graph is not allowed");
}
this.ownerGraph = ownerGraph;
} | java | public void setOwner(Graph<DataT, NodeT> ownerGraph) {
if (this.ownerGraph != null) {
throw new RuntimeException("Changing owner graph is not allowed");
}
this.ownerGraph = ownerGraph;
} | [
"public",
"void",
"setOwner",
"(",
"Graph",
"<",
"DataT",
",",
"NodeT",
">",
"ownerGraph",
")",
"{",
"if",
"(",
"this",
".",
"ownerGraph",
"!=",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Changing owner graph is not allowed\"",
")",
";",
"}",
"this",
".",
"ownerGraph",
"=",
"ownerGraph",
";",
"}"
] | Sets reference to the graph owning this node.
@param ownerGraph the owning graph | [
"Sets",
"reference",
"to",
"the",
"graph",
"owning",
"this",
"node",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/Node.java#L96-L101 |
163,065 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGNode.java | DAGNode.onFaultedResolution | protected void onFaultedResolution(String dependencyKey, Throwable throwable) {
if (toBeResolved == 0) {
throw new RuntimeException("invalid state - " + this.key() + ": The dependency '" + dependencyKey + "' is already reported or there is no such dependencyKey");
}
toBeResolved--;
} | java | protected void onFaultedResolution(String dependencyKey, Throwable throwable) {
if (toBeResolved == 0) {
throw new RuntimeException("invalid state - " + this.key() + ": The dependency '" + dependencyKey + "' is already reported or there is no such dependencyKey");
}
toBeResolved--;
} | [
"protected",
"void",
"onFaultedResolution",
"(",
"String",
"dependencyKey",
",",
"Throwable",
"throwable",
")",
"{",
"if",
"(",
"toBeResolved",
"==",
"0",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"invalid state - \"",
"+",
"this",
".",
"key",
"(",
")",
"+",
"\": The dependency '\"",
"+",
"dependencyKey",
"+",
"\"' is already reported or there is no such dependencyKey\"",
")",
";",
"}",
"toBeResolved",
"--",
";",
"}"
] | Reports a dependency of this node has been faulted.
@param dependencyKey the id of the dependency node
@param throwable the reason for unsuccessful resolution | [
"Reports",
"a",
"dependency",
"of",
"this",
"node",
"has",
"been",
"faulted",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGNode.java#L154-L159 |
163,066 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceClient.java | AzureServiceClient.userAgent | public String userAgent() {
return String.format("Azure-SDK-For-Java/%s OS:%s MacAddressHash:%s Java:%s",
getClass().getPackage().getImplementationVersion(),
OS,
MAC_ADDRESS_HASH,
JAVA_VERSION);
} | java | public String userAgent() {
return String.format("Azure-SDK-For-Java/%s OS:%s MacAddressHash:%s Java:%s",
getClass().getPackage().getImplementationVersion(),
OS,
MAC_ADDRESS_HASH,
JAVA_VERSION);
} | [
"public",
"String",
"userAgent",
"(",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"Azure-SDK-For-Java/%s OS:%s MacAddressHash:%s Java:%s\"",
",",
"getClass",
"(",
")",
".",
"getPackage",
"(",
")",
".",
"getImplementationVersion",
"(",
")",
",",
"OS",
",",
"MAC_ADDRESS_HASH",
",",
"JAVA_VERSION",
")",
";",
"}"
] | The default User-Agent header. Override this method to override the user agent.
@return the user agent string. | [
"The",
"default",
"User",
"-",
"Agent",
"header",
".",
"Override",
"this",
"method",
"to",
"override",
"the",
"user",
"agent",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceClient.java#L59-L65 |
163,067 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/ResourceUtilsCore.java | ResourceUtilsCore.groupFromResourceId | public static String groupFromResourceId(String id) {
return (id != null) ? ResourceId.fromString(id).resourceGroupName() : null;
} | java | public static String groupFromResourceId(String id) {
return (id != null) ? ResourceId.fromString(id).resourceGroupName() : null;
} | [
"public",
"static",
"String",
"groupFromResourceId",
"(",
"String",
"id",
")",
"{",
"return",
"(",
"id",
"!=",
"null",
")",
"?",
"ResourceId",
".",
"fromString",
"(",
"id",
")",
".",
"resourceGroupName",
"(",
")",
":",
"null",
";",
"}"
] | Extract resource group from a resource ID string.
@param id the resource ID string
@return the resource group name | [
"Extract",
"resource",
"group",
"from",
"a",
"resource",
"ID",
"string",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/ResourceUtilsCore.java#L23-L25 |
163,068 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/ResourceUtilsCore.java | ResourceUtilsCore.subscriptionFromResourceId | public static String subscriptionFromResourceId(String id) {
return (id != null) ? ResourceId.fromString(id).subscriptionId() : null;
} | java | public static String subscriptionFromResourceId(String id) {
return (id != null) ? ResourceId.fromString(id).subscriptionId() : null;
} | [
"public",
"static",
"String",
"subscriptionFromResourceId",
"(",
"String",
"id",
")",
"{",
"return",
"(",
"id",
"!=",
"null",
")",
"?",
"ResourceId",
".",
"fromString",
"(",
"id",
")",
".",
"subscriptionId",
"(",
")",
":",
"null",
";",
"}"
] | Extract the subscription ID from a resource ID string.
@param id the resource ID string
@return the subscription ID | [
"Extract",
"the",
"subscription",
"ID",
"from",
"a",
"resource",
"ID",
"string",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/ResourceUtilsCore.java#L32-L34 |
163,069 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/ResourceUtilsCore.java | ResourceUtilsCore.resourceProviderFromResourceId | public static String resourceProviderFromResourceId(String id) {
return (id != null) ? ResourceId.fromString(id).providerNamespace() : null;
} | java | public static String resourceProviderFromResourceId(String id) {
return (id != null) ? ResourceId.fromString(id).providerNamespace() : null;
} | [
"public",
"static",
"String",
"resourceProviderFromResourceId",
"(",
"String",
"id",
")",
"{",
"return",
"(",
"id",
"!=",
"null",
")",
"?",
"ResourceId",
".",
"fromString",
"(",
"id",
")",
".",
"providerNamespace",
"(",
")",
":",
"null",
";",
"}"
] | Extract resource provider from a resource ID string.
@param id the resource ID string
@return the resource group name | [
"Extract",
"resource",
"provider",
"from",
"a",
"resource",
"ID",
"string",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/ResourceUtilsCore.java#L41-L43 |
163,070 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/ResourceUtilsCore.java | ResourceUtilsCore.resourceTypeFromResourceId | public static String resourceTypeFromResourceId(String id) {
return (id != null) ? ResourceId.fromString(id).resourceType() : null;
} | java | public static String resourceTypeFromResourceId(String id) {
return (id != null) ? ResourceId.fromString(id).resourceType() : null;
} | [
"public",
"static",
"String",
"resourceTypeFromResourceId",
"(",
"String",
"id",
")",
"{",
"return",
"(",
"id",
"!=",
"null",
")",
"?",
"ResourceId",
".",
"fromString",
"(",
"id",
")",
".",
"resourceType",
"(",
")",
":",
"null",
";",
"}"
] | Extract resource type from a resource ID string.
@param id the resource ID string
@return the resource type | [
"Extract",
"resource",
"type",
"from",
"a",
"resource",
"ID",
"string",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/ResourceUtilsCore.java#L50-L52 |
163,071 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/ResourceUtilsCore.java | ResourceUtilsCore.extractFromResourceId | public static String extractFromResourceId(String id, String identifier) {
if (id == null || identifier == null) {
return id;
}
Pattern pattern = Pattern.compile(identifier + "/[-\\w._]+");
Matcher matcher = pattern.matcher(id);
if (matcher.find()) {
return matcher.group().split("/")[1];
} else {
return null;
}
} | java | public static String extractFromResourceId(String id, String identifier) {
if (id == null || identifier == null) {
return id;
}
Pattern pattern = Pattern.compile(identifier + "/[-\\w._]+");
Matcher matcher = pattern.matcher(id);
if (matcher.find()) {
return matcher.group().split("/")[1];
} else {
return null;
}
} | [
"public",
"static",
"String",
"extractFromResourceId",
"(",
"String",
"id",
",",
"String",
"identifier",
")",
"{",
"if",
"(",
"id",
"==",
"null",
"||",
"identifier",
"==",
"null",
")",
"{",
"return",
"id",
";",
"}",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"identifier",
"+",
"\"/[-\\\\w._]+\"",
")",
";",
"Matcher",
"matcher",
"=",
"pattern",
".",
"matcher",
"(",
"id",
")",
";",
"if",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"return",
"matcher",
".",
"group",
"(",
")",
".",
"split",
"(",
"\"/\"",
")",
"[",
"1",
"]",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Extract information from a resource ID string with the resource type
as the identifier.
@param id the resource ID
@param identifier the identifier to match, e.g. "resourceGroups", "storageAccounts"
@return the information extracted from the identifier | [
"Extract",
"information",
"from",
"a",
"resource",
"ID",
"string",
"with",
"the",
"resource",
"type",
"as",
"the",
"identifier",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/ResourceUtilsCore.java#L121-L132 |
163,072 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/ResourceUtilsCore.java | ResourceUtilsCore.nameFromResourceId | public static String nameFromResourceId(String id) {
return (id != null) ? ResourceId.fromString(id).name() : null;
} | java | public static String nameFromResourceId(String id) {
return (id != null) ? ResourceId.fromString(id).name() : null;
} | [
"public",
"static",
"String",
"nameFromResourceId",
"(",
"String",
"id",
")",
"{",
"return",
"(",
"id",
"!=",
"null",
")",
"?",
"ResourceId",
".",
"fromString",
"(",
"id",
")",
".",
"name",
"(",
")",
":",
"null",
";",
"}"
] | Extract name of the resource from a resource ID.
@param id the resource ID
@return the name of the resource | [
"Extract",
"name",
"of",
"the",
"resource",
"from",
"a",
"resource",
"ID",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/ResourceUtilsCore.java#L139-L141 |
163,073 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/ResourceUtilsCore.java | ResourceUtilsCore.constructResourceId | public static String constructResourceId(
final String subscriptionId,
final String resourceGroupName,
final String resourceProviderNamespace,
final String resourceType,
final String resourceName,
final String parentResourcePath) {
String prefixedParentPath = parentResourcePath;
if (parentResourcePath != null && !parentResourcePath.isEmpty()) {
prefixedParentPath = "/" + parentResourcePath;
}
return String.format(
"/subscriptions/%s/resourcegroups/%s/providers/%s%s/%s/%s",
subscriptionId,
resourceGroupName,
resourceProviderNamespace,
prefixedParentPath,
resourceType,
resourceName);
} | java | public static String constructResourceId(
final String subscriptionId,
final String resourceGroupName,
final String resourceProviderNamespace,
final String resourceType,
final String resourceName,
final String parentResourcePath) {
String prefixedParentPath = parentResourcePath;
if (parentResourcePath != null && !parentResourcePath.isEmpty()) {
prefixedParentPath = "/" + parentResourcePath;
}
return String.format(
"/subscriptions/%s/resourcegroups/%s/providers/%s%s/%s/%s",
subscriptionId,
resourceGroupName,
resourceProviderNamespace,
prefixedParentPath,
resourceType,
resourceName);
} | [
"public",
"static",
"String",
"constructResourceId",
"(",
"final",
"String",
"subscriptionId",
",",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"resourceProviderNamespace",
",",
"final",
"String",
"resourceType",
",",
"final",
"String",
"resourceName",
",",
"final",
"String",
"parentResourcePath",
")",
"{",
"String",
"prefixedParentPath",
"=",
"parentResourcePath",
";",
"if",
"(",
"parentResourcePath",
"!=",
"null",
"&&",
"!",
"parentResourcePath",
".",
"isEmpty",
"(",
")",
")",
"{",
"prefixedParentPath",
"=",
"\"/\"",
"+",
"parentResourcePath",
";",
"}",
"return",
"String",
".",
"format",
"(",
"\"/subscriptions/%s/resourcegroups/%s/providers/%s%s/%s/%s\"",
",",
"subscriptionId",
",",
"resourceGroupName",
",",
"resourceProviderNamespace",
",",
"prefixedParentPath",
",",
"resourceType",
",",
"resourceName",
")",
";",
"}"
] | Creates a resource ID from information of a generic resource.
@param subscriptionId the subscription UUID
@param resourceGroupName the resource group name
@param resourceProviderNamespace the resource provider namespace
@param resourceType the type of the resource or nested resource
@param resourceName name of the resource or nested resource
@param parentResourcePath parent resource's relative path to the provider,
if the resource is a generic resource
@return the resource ID string | [
"Creates",
"a",
"resource",
"ID",
"from",
"information",
"of",
"a",
"generic",
"resource",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/ResourceUtilsCore.java#L155-L174 |
163,074 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java | AzureClient.getPutOrPatchResult | private <T> ServiceResponse<T> getPutOrPatchResult(Observable<Response<ResponseBody>> observable, Type resourceType) throws CloudException, InterruptedException, IOException {
Observable<ServiceResponse<T>> asyncObservable = getPutOrPatchResultAsync(observable, resourceType);
return asyncObservable.toBlocking().last();
} | java | private <T> ServiceResponse<T> getPutOrPatchResult(Observable<Response<ResponseBody>> observable, Type resourceType) throws CloudException, InterruptedException, IOException {
Observable<ServiceResponse<T>> asyncObservable = getPutOrPatchResultAsync(observable, resourceType);
return asyncObservable.toBlocking().last();
} | [
"private",
"<",
"T",
">",
"ServiceResponse",
"<",
"T",
">",
"getPutOrPatchResult",
"(",
"Observable",
"<",
"Response",
"<",
"ResponseBody",
">",
">",
"observable",
",",
"Type",
"resourceType",
")",
"throws",
"CloudException",
",",
"InterruptedException",
",",
"IOException",
"{",
"Observable",
"<",
"ServiceResponse",
"<",
"T",
">>",
"asyncObservable",
"=",
"getPutOrPatchResultAsync",
"(",
"observable",
",",
"resourceType",
")",
";",
"return",
"asyncObservable",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
";",
"}"
] | Handles an initial response from a PUT or PATCH operation response by polling
the status of the operation until the long running operation terminates.
@param observable the initial observable from the PUT or PATCH operation.
@param <T> the return type of the caller
@param resourceType the java.lang.reflect.Type of the resource.
@return the terminal response for the operation.
@throws CloudException REST exception
@throws InterruptedException interrupted exception
@throws IOException thrown by deserialization | [
"Handles",
"an",
"initial",
"response",
"from",
"a",
"PUT",
"or",
"PATCH",
"operation",
"response",
"by",
"polling",
"the",
"status",
"of",
"the",
"operation",
"until",
"the",
"long",
"running",
"operation",
"terminates",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java#L88-L91 |
163,075 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java | AzureClient.getPutOrPatchResultAsync | public <T> Observable<ServiceResponse<T>> getPutOrPatchResultAsync(Observable<Response<ResponseBody>> observable, final Type resourceType) {
return this.<T>beginPutOrPatchAsync(observable, resourceType)
.toObservable()
.flatMap(new Func1<PollingState<T>, Observable<PollingState<T>>>() {
@Override
public Observable<PollingState<T>> call(PollingState<T> pollingState) {
return pollPutOrPatchAsync(pollingState, resourceType);
}
})
.last()
.map(new Func1<PollingState<T>, ServiceResponse<T>>() {
@Override
public ServiceResponse<T> call(PollingState<T> pollingState) {
return new ServiceResponse<>(pollingState.resource(), pollingState.response());
}
});
} | java | public <T> Observable<ServiceResponse<T>> getPutOrPatchResultAsync(Observable<Response<ResponseBody>> observable, final Type resourceType) {
return this.<T>beginPutOrPatchAsync(observable, resourceType)
.toObservable()
.flatMap(new Func1<PollingState<T>, Observable<PollingState<T>>>() {
@Override
public Observable<PollingState<T>> call(PollingState<T> pollingState) {
return pollPutOrPatchAsync(pollingState, resourceType);
}
})
.last()
.map(new Func1<PollingState<T>, ServiceResponse<T>>() {
@Override
public ServiceResponse<T> call(PollingState<T> pollingState) {
return new ServiceResponse<>(pollingState.resource(), pollingState.response());
}
});
} | [
"public",
"<",
"T",
">",
"Observable",
"<",
"ServiceResponse",
"<",
"T",
">",
">",
"getPutOrPatchResultAsync",
"(",
"Observable",
"<",
"Response",
"<",
"ResponseBody",
">",
">",
"observable",
",",
"final",
"Type",
"resourceType",
")",
"{",
"return",
"this",
".",
"<",
"T",
">",
"beginPutOrPatchAsync",
"(",
"observable",
",",
"resourceType",
")",
".",
"toObservable",
"(",
")",
".",
"flatMap",
"(",
"new",
"Func1",
"<",
"PollingState",
"<",
"T",
">",
",",
"Observable",
"<",
"PollingState",
"<",
"T",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"PollingState",
"<",
"T",
">",
">",
"call",
"(",
"PollingState",
"<",
"T",
">",
"pollingState",
")",
"{",
"return",
"pollPutOrPatchAsync",
"(",
"pollingState",
",",
"resourceType",
")",
";",
"}",
"}",
")",
".",
"last",
"(",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"PollingState",
"<",
"T",
">",
",",
"ServiceResponse",
"<",
"T",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ServiceResponse",
"<",
"T",
">",
"call",
"(",
"PollingState",
"<",
"T",
">",
"pollingState",
")",
"{",
"return",
"new",
"ServiceResponse",
"<>",
"(",
"pollingState",
".",
"resource",
"(",
")",
",",
"pollingState",
".",
"response",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] | Handles an initial response from a PUT or PATCH operation response by polling the status of the operation
asynchronously, once the operation finishes emits the final response.
@param observable the initial observable from the PUT or PATCH operation.
@param resourceType the java.lang.reflect.Type of the resource.
@param <T> the return type of the caller.
@return the observable of which a subscription will lead to a final response. | [
"Handles",
"an",
"initial",
"response",
"from",
"a",
"PUT",
"or",
"PATCH",
"operation",
"response",
"by",
"polling",
"the",
"status",
"of",
"the",
"operation",
"asynchronously",
"once",
"the",
"operation",
"finishes",
"emits",
"the",
"final",
"response",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java#L125-L141 |
163,076 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java | AzureClient.updateStateFromLocationHeaderOnPutAsync | private <T> Observable<PollingState<T>> updateStateFromLocationHeaderOnPutAsync(final PollingState<T> pollingState) {
return pollAsync(pollingState.locationHeaderLink(), pollingState.loggingContext())
.flatMap(new Func1<Response<ResponseBody>, Observable<PollingState<T>>>() {
@Override
public Observable<PollingState<T>> call(Response<ResponseBody> response) {
int statusCode = response.code();
if (statusCode == 202) {
pollingState.withResponse(response);
pollingState.withStatus(AzureAsyncOperation.IN_PROGRESS_STATUS, statusCode);
} else if (statusCode == 200 || statusCode == 201) {
try {
pollingState.updateFromResponseOnPutPatch(response);
} catch (CloudException | IOException e) {
return Observable.error(e);
}
}
return Observable.just(pollingState);
}
});
} | java | private <T> Observable<PollingState<T>> updateStateFromLocationHeaderOnPutAsync(final PollingState<T> pollingState) {
return pollAsync(pollingState.locationHeaderLink(), pollingState.loggingContext())
.flatMap(new Func1<Response<ResponseBody>, Observable<PollingState<T>>>() {
@Override
public Observable<PollingState<T>> call(Response<ResponseBody> response) {
int statusCode = response.code();
if (statusCode == 202) {
pollingState.withResponse(response);
pollingState.withStatus(AzureAsyncOperation.IN_PROGRESS_STATUS, statusCode);
} else if (statusCode == 200 || statusCode == 201) {
try {
pollingState.updateFromResponseOnPutPatch(response);
} catch (CloudException | IOException e) {
return Observable.error(e);
}
}
return Observable.just(pollingState);
}
});
} | [
"private",
"<",
"T",
">",
"Observable",
"<",
"PollingState",
"<",
"T",
">",
">",
"updateStateFromLocationHeaderOnPutAsync",
"(",
"final",
"PollingState",
"<",
"T",
">",
"pollingState",
")",
"{",
"return",
"pollAsync",
"(",
"pollingState",
".",
"locationHeaderLink",
"(",
")",
",",
"pollingState",
".",
"loggingContext",
"(",
")",
")",
".",
"flatMap",
"(",
"new",
"Func1",
"<",
"Response",
"<",
"ResponseBody",
">",
",",
"Observable",
"<",
"PollingState",
"<",
"T",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"PollingState",
"<",
"T",
">",
">",
"call",
"(",
"Response",
"<",
"ResponseBody",
">",
"response",
")",
"{",
"int",
"statusCode",
"=",
"response",
".",
"code",
"(",
")",
";",
"if",
"(",
"statusCode",
"==",
"202",
")",
"{",
"pollingState",
".",
"withResponse",
"(",
"response",
")",
";",
"pollingState",
".",
"withStatus",
"(",
"AzureAsyncOperation",
".",
"IN_PROGRESS_STATUS",
",",
"statusCode",
")",
";",
"}",
"else",
"if",
"(",
"statusCode",
"==",
"200",
"||",
"statusCode",
"==",
"201",
")",
"{",
"try",
"{",
"pollingState",
".",
"updateFromResponseOnPutPatch",
"(",
"response",
")",
";",
"}",
"catch",
"(",
"CloudException",
"|",
"IOException",
"e",
")",
"{",
"return",
"Observable",
".",
"error",
"(",
"e",
")",
";",
"}",
"}",
"return",
"Observable",
".",
"just",
"(",
"pollingState",
")",
";",
"}",
"}",
")",
";",
"}"
] | Polls from the location header and updates the polling state with the
polling response for a PUT operation.
@param pollingState the polling state for the current operation.
@param <T> the return type of the caller. | [
"Polls",
"from",
"the",
"location",
"header",
"and",
"updates",
"the",
"polling",
"state",
"with",
"the",
"polling",
"response",
"for",
"a",
"PUT",
"operation",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java#L564-L583 |
163,077 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java | AzureClient.updateStateFromGetResourceOperationAsync | private <T> Observable<PollingState<T>> updateStateFromGetResourceOperationAsync(final PollingState<T> pollingState, String url) {
return pollAsync(url, pollingState.loggingContext())
.flatMap(new Func1<Response<ResponseBody>, Observable<PollingState<T>>>() {
@Override
public Observable<PollingState<T>> call(Response<ResponseBody> response) {
try {
pollingState.updateFromResponseOnPutPatch(response);
return Observable.just(pollingState);
} catch (CloudException | IOException e) {
return Observable.error(e);
}
}
});
} | java | private <T> Observable<PollingState<T>> updateStateFromGetResourceOperationAsync(final PollingState<T> pollingState, String url) {
return pollAsync(url, pollingState.loggingContext())
.flatMap(new Func1<Response<ResponseBody>, Observable<PollingState<T>>>() {
@Override
public Observable<PollingState<T>> call(Response<ResponseBody> response) {
try {
pollingState.updateFromResponseOnPutPatch(response);
return Observable.just(pollingState);
} catch (CloudException | IOException e) {
return Observable.error(e);
}
}
});
} | [
"private",
"<",
"T",
">",
"Observable",
"<",
"PollingState",
"<",
"T",
">",
">",
"updateStateFromGetResourceOperationAsync",
"(",
"final",
"PollingState",
"<",
"T",
">",
"pollingState",
",",
"String",
"url",
")",
"{",
"return",
"pollAsync",
"(",
"url",
",",
"pollingState",
".",
"loggingContext",
"(",
")",
")",
".",
"flatMap",
"(",
"new",
"Func1",
"<",
"Response",
"<",
"ResponseBody",
">",
",",
"Observable",
"<",
"PollingState",
"<",
"T",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"PollingState",
"<",
"T",
">",
">",
"call",
"(",
"Response",
"<",
"ResponseBody",
">",
"response",
")",
"{",
"try",
"{",
"pollingState",
".",
"updateFromResponseOnPutPatch",
"(",
"response",
")",
";",
"return",
"Observable",
".",
"just",
"(",
"pollingState",
")",
";",
"}",
"catch",
"(",
"CloudException",
"|",
"IOException",
"e",
")",
"{",
"return",
"Observable",
".",
"error",
"(",
"e",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Polls from the provided URL and updates the polling state with the
polling response.
@param pollingState the polling state for the current operation.
@param url the url to poll from
@param <T> the return type of the caller. | [
"Polls",
"from",
"the",
"provided",
"URL",
"and",
"updates",
"the",
"polling",
"state",
"with",
"the",
"polling",
"response",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java#L621-L634 |
163,078 | Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java | AzureClient.pollAsync | private Observable<Response<ResponseBody>> pollAsync(String url, String loggingContext) {
URL endpoint;
try {
endpoint = new URL(url);
} catch (MalformedURLException e) {
return Observable.error(e);
}
AsyncService service = restClient().retrofit().create(AsyncService.class);
if (loggingContext != null && !loggingContext.endsWith(" (poll)")) {
loggingContext += " (poll)";
}
return service.get(endpoint.getFile(), serviceClientUserAgent, loggingContext)
.flatMap(new Func1<Response<ResponseBody>, Observable<Response<ResponseBody>>>() {
@Override
public Observable<Response<ResponseBody>> call(Response<ResponseBody> response) {
RuntimeException exception = createExceptionFromResponse(response, 200, 201, 202, 204);
if (exception != null) {
return Observable.error(exception);
} else {
return Observable.just(response);
}
}
});
} | java | private Observable<Response<ResponseBody>> pollAsync(String url, String loggingContext) {
URL endpoint;
try {
endpoint = new URL(url);
} catch (MalformedURLException e) {
return Observable.error(e);
}
AsyncService service = restClient().retrofit().create(AsyncService.class);
if (loggingContext != null && !loggingContext.endsWith(" (poll)")) {
loggingContext += " (poll)";
}
return service.get(endpoint.getFile(), serviceClientUserAgent, loggingContext)
.flatMap(new Func1<Response<ResponseBody>, Observable<Response<ResponseBody>>>() {
@Override
public Observable<Response<ResponseBody>> call(Response<ResponseBody> response) {
RuntimeException exception = createExceptionFromResponse(response, 200, 201, 202, 204);
if (exception != null) {
return Observable.error(exception);
} else {
return Observable.just(response);
}
}
});
} | [
"private",
"Observable",
"<",
"Response",
"<",
"ResponseBody",
">",
">",
"pollAsync",
"(",
"String",
"url",
",",
"String",
"loggingContext",
")",
"{",
"URL",
"endpoint",
";",
"try",
"{",
"endpoint",
"=",
"new",
"URL",
"(",
"url",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"return",
"Observable",
".",
"error",
"(",
"e",
")",
";",
"}",
"AsyncService",
"service",
"=",
"restClient",
"(",
")",
".",
"retrofit",
"(",
")",
".",
"create",
"(",
"AsyncService",
".",
"class",
")",
";",
"if",
"(",
"loggingContext",
"!=",
"null",
"&&",
"!",
"loggingContext",
".",
"endsWith",
"(",
"\" (poll)\"",
")",
")",
"{",
"loggingContext",
"+=",
"\" (poll)\"",
";",
"}",
"return",
"service",
".",
"get",
"(",
"endpoint",
".",
"getFile",
"(",
")",
",",
"serviceClientUserAgent",
",",
"loggingContext",
")",
".",
"flatMap",
"(",
"new",
"Func1",
"<",
"Response",
"<",
"ResponseBody",
">",
",",
"Observable",
"<",
"Response",
"<",
"ResponseBody",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"Response",
"<",
"ResponseBody",
">",
">",
"call",
"(",
"Response",
"<",
"ResponseBody",
">",
"response",
")",
"{",
"RuntimeException",
"exception",
"=",
"createExceptionFromResponse",
"(",
"response",
",",
"200",
",",
"201",
",",
"202",
",",
"204",
")",
";",
"if",
"(",
"exception",
"!=",
"null",
")",
"{",
"return",
"Observable",
".",
"error",
"(",
"exception",
")",
";",
"}",
"else",
"{",
"return",
"Observable",
".",
"just",
"(",
"response",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Polls from the URL provided.
@param url the URL to poll from.
@return the raw response. | [
"Polls",
"from",
"the",
"URL",
"provided",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java#L701-L724 |
163,079 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java | TaskGroup.taskResult | public Indexable taskResult(String taskId) {
TaskGroupEntry<TaskItem> taskGroupEntry = super.getNode(taskId);
if (taskGroupEntry != null) {
return taskGroupEntry.taskResult();
}
if (!this.proxyTaskGroupWrapper.isActive()) {
throw new IllegalArgumentException("A dependency task with id '" + taskId + "' is not found");
}
taskGroupEntry = this.proxyTaskGroupWrapper.proxyTaskGroup.getNode(taskId);
if (taskGroupEntry != null) {
return taskGroupEntry.taskResult();
}
throw new IllegalArgumentException("A dependency task or 'post-run' dependent task with with id '" + taskId + "' not found");
} | java | public Indexable taskResult(String taskId) {
TaskGroupEntry<TaskItem> taskGroupEntry = super.getNode(taskId);
if (taskGroupEntry != null) {
return taskGroupEntry.taskResult();
}
if (!this.proxyTaskGroupWrapper.isActive()) {
throw new IllegalArgumentException("A dependency task with id '" + taskId + "' is not found");
}
taskGroupEntry = this.proxyTaskGroupWrapper.proxyTaskGroup.getNode(taskId);
if (taskGroupEntry != null) {
return taskGroupEntry.taskResult();
}
throw new IllegalArgumentException("A dependency task or 'post-run' dependent task with with id '" + taskId + "' not found");
} | [
"public",
"Indexable",
"taskResult",
"(",
"String",
"taskId",
")",
"{",
"TaskGroupEntry",
"<",
"TaskItem",
">",
"taskGroupEntry",
"=",
"super",
".",
"getNode",
"(",
"taskId",
")",
";",
"if",
"(",
"taskGroupEntry",
"!=",
"null",
")",
"{",
"return",
"taskGroupEntry",
".",
"taskResult",
"(",
")",
";",
"}",
"if",
"(",
"!",
"this",
".",
"proxyTaskGroupWrapper",
".",
"isActive",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A dependency task with id '\"",
"+",
"taskId",
"+",
"\"' is not found\"",
")",
";",
"}",
"taskGroupEntry",
"=",
"this",
".",
"proxyTaskGroupWrapper",
".",
"proxyTaskGroup",
".",
"getNode",
"(",
"taskId",
")",
";",
"if",
"(",
"taskGroupEntry",
"!=",
"null",
")",
"{",
"return",
"taskGroupEntry",
".",
"taskResult",
"(",
")",
";",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A dependency task or 'post-run' dependent task with with id '\"",
"+",
"taskId",
"+",
"\"' not found\"",
")",
";",
"}"
] | Retrieve the result produced by a task with the given id in the group.
This method can be used to retrieve the result of invocation of both dependency
and "post-run" dependent tasks. If task with the given id does not exists then
IllegalArgumentException exception will be thrown.
@param taskId the task item id
@return the task result, null will be returned if task has not yet been invoked | [
"Retrieve",
"the",
"result",
"produced",
"by",
"a",
"task",
"with",
"the",
"given",
"id",
"in",
"the",
"group",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java#L124-L137 |
163,080 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java | TaskGroup.addDependency | public String addDependency(FunctionalTaskItem dependencyTaskItem) {
IndexableTaskItem dependency = IndexableTaskItem.create(dependencyTaskItem);
this.addDependency(dependency);
return dependency.key();
} | java | public String addDependency(FunctionalTaskItem dependencyTaskItem) {
IndexableTaskItem dependency = IndexableTaskItem.create(dependencyTaskItem);
this.addDependency(dependency);
return dependency.key();
} | [
"public",
"String",
"addDependency",
"(",
"FunctionalTaskItem",
"dependencyTaskItem",
")",
"{",
"IndexableTaskItem",
"dependency",
"=",
"IndexableTaskItem",
".",
"create",
"(",
"dependencyTaskItem",
")",
";",
"this",
".",
"addDependency",
"(",
"dependency",
")",
";",
"return",
"dependency",
".",
"key",
"(",
")",
";",
"}"
] | Mark root of this task task group depends on the given TaskItem.
This ensure this task group's root get picked for execution only after the completion
of invocation of provided TaskItem.
@param dependencyTaskItem the task item that this task group depends on
@return the key of the dependency | [
"Mark",
"root",
"of",
"this",
"task",
"task",
"group",
"depends",
"on",
"the",
"given",
"TaskItem",
".",
"This",
"ensure",
"this",
"task",
"group",
"s",
"root",
"get",
"picked",
"for",
"execution",
"only",
"after",
"the",
"completion",
"of",
"invocation",
"of",
"provided",
"TaskItem",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java#L164-L168 |
163,081 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java | TaskGroup.addDependencyTaskGroup | public void addDependencyTaskGroup(TaskGroup dependencyTaskGroup) {
if (dependencyTaskGroup.proxyTaskGroupWrapper.isActive()) {
dependencyTaskGroup.proxyTaskGroupWrapper.addDependentTaskGroup(this);
} else {
DAGraph<TaskItem, TaskGroupEntry<TaskItem>> dependencyGraph = dependencyTaskGroup;
super.addDependencyGraph(dependencyGraph);
}
} | java | public void addDependencyTaskGroup(TaskGroup dependencyTaskGroup) {
if (dependencyTaskGroup.proxyTaskGroupWrapper.isActive()) {
dependencyTaskGroup.proxyTaskGroupWrapper.addDependentTaskGroup(this);
} else {
DAGraph<TaskItem, TaskGroupEntry<TaskItem>> dependencyGraph = dependencyTaskGroup;
super.addDependencyGraph(dependencyGraph);
}
} | [
"public",
"void",
"addDependencyTaskGroup",
"(",
"TaskGroup",
"dependencyTaskGroup",
")",
"{",
"if",
"(",
"dependencyTaskGroup",
".",
"proxyTaskGroupWrapper",
".",
"isActive",
"(",
")",
")",
"{",
"dependencyTaskGroup",
".",
"proxyTaskGroupWrapper",
".",
"addDependentTaskGroup",
"(",
"this",
")",
";",
"}",
"else",
"{",
"DAGraph",
"<",
"TaskItem",
",",
"TaskGroupEntry",
"<",
"TaskItem",
">",
">",
"dependencyGraph",
"=",
"dependencyTaskGroup",
";",
"super",
".",
"addDependencyGraph",
"(",
"dependencyGraph",
")",
";",
"}",
"}"
] | Mark root of this task task group depends on the given task group's root.
This ensure this task group's root get picked for execution only after the completion
of all tasks in the given group.
@param dependencyTaskGroup the task group that this task group depends on | [
"Mark",
"root",
"of",
"this",
"task",
"task",
"group",
"depends",
"on",
"the",
"given",
"task",
"group",
"s",
"root",
".",
"This",
"ensure",
"this",
"task",
"group",
"s",
"root",
"get",
"picked",
"for",
"execution",
"only",
"after",
"the",
"completion",
"of",
"all",
"tasks",
"in",
"the",
"given",
"group",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java#L188-L195 |
163,082 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java | TaskGroup.addPostRunDependent | public String addPostRunDependent(FunctionalTaskItem dependentTaskItem) {
IndexableTaskItem taskItem = IndexableTaskItem.create(dependentTaskItem);
this.addPostRunDependent(taskItem);
return taskItem.key();
} | java | public String addPostRunDependent(FunctionalTaskItem dependentTaskItem) {
IndexableTaskItem taskItem = IndexableTaskItem.create(dependentTaskItem);
this.addPostRunDependent(taskItem);
return taskItem.key();
} | [
"public",
"String",
"addPostRunDependent",
"(",
"FunctionalTaskItem",
"dependentTaskItem",
")",
"{",
"IndexableTaskItem",
"taskItem",
"=",
"IndexableTaskItem",
".",
"create",
"(",
"dependentTaskItem",
")",
";",
"this",
".",
"addPostRunDependent",
"(",
"taskItem",
")",
";",
"return",
"taskItem",
".",
"key",
"(",
")",
";",
"}"
] | Mark the given TaskItem depends on this taskGroup.
@param dependentTaskItem the task item that depends on this task group
@return key to be used as parameter to taskResult(string) method to retrieve result of
invocation of given task item. | [
"Mark",
"the",
"given",
"TaskItem",
"depends",
"on",
"this",
"taskGroup",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java#L204-L208 |
163,083 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java | TaskGroup.invokeReadyTasksAsync | private Observable<Indexable> invokeReadyTasksAsync(final InvocationContext context) {
TaskGroupEntry<TaskItem> readyTaskEntry = super.getNext();
final List<Observable<Indexable>> observables = new ArrayList<>();
// Enumerate the ready tasks (those with dependencies resolved) and kickoff them concurrently
//
while (readyTaskEntry != null) {
final TaskGroupEntry<TaskItem> currentEntry = readyTaskEntry;
final TaskItem currentTaskItem = currentEntry.data();
if (currentTaskItem instanceof ProxyTaskItem) {
observables.add(invokeAfterPostRunAsync(currentEntry, context));
} else {
observables.add(invokeTaskAsync(currentEntry, context));
}
readyTaskEntry = super.getNext();
}
return Observable.mergeDelayError(observables);
} | java | private Observable<Indexable> invokeReadyTasksAsync(final InvocationContext context) {
TaskGroupEntry<TaskItem> readyTaskEntry = super.getNext();
final List<Observable<Indexable>> observables = new ArrayList<>();
// Enumerate the ready tasks (those with dependencies resolved) and kickoff them concurrently
//
while (readyTaskEntry != null) {
final TaskGroupEntry<TaskItem> currentEntry = readyTaskEntry;
final TaskItem currentTaskItem = currentEntry.data();
if (currentTaskItem instanceof ProxyTaskItem) {
observables.add(invokeAfterPostRunAsync(currentEntry, context));
} else {
observables.add(invokeTaskAsync(currentEntry, context));
}
readyTaskEntry = super.getNext();
}
return Observable.mergeDelayError(observables);
} | [
"private",
"Observable",
"<",
"Indexable",
">",
"invokeReadyTasksAsync",
"(",
"final",
"InvocationContext",
"context",
")",
"{",
"TaskGroupEntry",
"<",
"TaskItem",
">",
"readyTaskEntry",
"=",
"super",
".",
"getNext",
"(",
")",
";",
"final",
"List",
"<",
"Observable",
"<",
"Indexable",
">",
">",
"observables",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// Enumerate the ready tasks (those with dependencies resolved) and kickoff them concurrently",
"//",
"while",
"(",
"readyTaskEntry",
"!=",
"null",
")",
"{",
"final",
"TaskGroupEntry",
"<",
"TaskItem",
">",
"currentEntry",
"=",
"readyTaskEntry",
";",
"final",
"TaskItem",
"currentTaskItem",
"=",
"currentEntry",
".",
"data",
"(",
")",
";",
"if",
"(",
"currentTaskItem",
"instanceof",
"ProxyTaskItem",
")",
"{",
"observables",
".",
"add",
"(",
"invokeAfterPostRunAsync",
"(",
"currentEntry",
",",
"context",
")",
")",
";",
"}",
"else",
"{",
"observables",
".",
"add",
"(",
"invokeTaskAsync",
"(",
"currentEntry",
",",
"context",
")",
")",
";",
"}",
"readyTaskEntry",
"=",
"super",
".",
"getNext",
"(",
")",
";",
"}",
"return",
"Observable",
".",
"mergeDelayError",
"(",
"observables",
")",
";",
"}"
] | Invokes the ready tasks.
@param context group level shared context that need be passed to
{@link TaskGroupEntry#invokeTaskAsync(boolean, InvocationContext)}
method of each entry in the group when it is selected for execution
@return an observable that emits the result of tasks in the order they finishes. | [
"Invokes",
"the",
"ready",
"tasks",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java#L349-L365 |
163,084 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java | TaskGroup.processFaultedTaskAsync | private Observable<Indexable> processFaultedTaskAsync(final TaskGroupEntry<TaskItem> faultedEntry,
final Throwable throwable,
final InvocationContext context) {
markGroupAsCancelledIfTerminationStrategyIsIPTC();
reportError(faultedEntry, throwable);
if (isRootEntry(faultedEntry)) {
if (shouldPropagateException(throwable)) {
return toErrorObservable(throwable);
}
return Observable.empty();
} else if (shouldPropagateException(throwable)) {
return Observable.concatDelayError(invokeReadyTasksAsync(context), toErrorObservable(throwable));
} else {
return invokeReadyTasksAsync(context);
}
} | java | private Observable<Indexable> processFaultedTaskAsync(final TaskGroupEntry<TaskItem> faultedEntry,
final Throwable throwable,
final InvocationContext context) {
markGroupAsCancelledIfTerminationStrategyIsIPTC();
reportError(faultedEntry, throwable);
if (isRootEntry(faultedEntry)) {
if (shouldPropagateException(throwable)) {
return toErrorObservable(throwable);
}
return Observable.empty();
} else if (shouldPropagateException(throwable)) {
return Observable.concatDelayError(invokeReadyTasksAsync(context), toErrorObservable(throwable));
} else {
return invokeReadyTasksAsync(context);
}
} | [
"private",
"Observable",
"<",
"Indexable",
">",
"processFaultedTaskAsync",
"(",
"final",
"TaskGroupEntry",
"<",
"TaskItem",
">",
"faultedEntry",
",",
"final",
"Throwable",
"throwable",
",",
"final",
"InvocationContext",
"context",
")",
"{",
"markGroupAsCancelledIfTerminationStrategyIsIPTC",
"(",
")",
";",
"reportError",
"(",
"faultedEntry",
",",
"throwable",
")",
";",
"if",
"(",
"isRootEntry",
"(",
"faultedEntry",
")",
")",
"{",
"if",
"(",
"shouldPropagateException",
"(",
"throwable",
")",
")",
"{",
"return",
"toErrorObservable",
"(",
"throwable",
")",
";",
"}",
"return",
"Observable",
".",
"empty",
"(",
")",
";",
"}",
"else",
"if",
"(",
"shouldPropagateException",
"(",
"throwable",
")",
")",
"{",
"return",
"Observable",
".",
"concatDelayError",
"(",
"invokeReadyTasksAsync",
"(",
"context",
")",
",",
"toErrorObservable",
"(",
"throwable",
")",
")",
";",
"}",
"else",
"{",
"return",
"invokeReadyTasksAsync",
"(",
"context",
")",
";",
"}",
"}"
] | Handles a faulted task.
@param faultedEntry the entry holding faulted task
@param throwable the reason for fault
@param context the context object shared across all the task entries in this group during execution
@return an observable represents asynchronous operation in the next stage | [
"Handles",
"a",
"faulted",
"task",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java#L502-L517 |
163,085 | Azure/autorest-clientruntime-for-java | client-runtime/src/main/java/com/microsoft/rest/retry/ExponentialBackoffRetryStrategy.java | ExponentialBackoffRetryStrategy.shouldRetry | @Override
public boolean shouldRetry(int retryCount, Response response) {
int code = response.code();
//CHECKSTYLE IGNORE MagicNumber FOR NEXT 2 LINES
return retryCount < this.retryCount
&& (code == 408 || (code >= 500 && code != 501 && code != 505));
} | java | @Override
public boolean shouldRetry(int retryCount, Response response) {
int code = response.code();
//CHECKSTYLE IGNORE MagicNumber FOR NEXT 2 LINES
return retryCount < this.retryCount
&& (code == 408 || (code >= 500 && code != 501 && code != 505));
} | [
"@",
"Override",
"public",
"boolean",
"shouldRetry",
"(",
"int",
"retryCount",
",",
"Response",
"response",
")",
"{",
"int",
"code",
"=",
"response",
".",
"code",
"(",
")",
";",
"//CHECKSTYLE IGNORE MagicNumber FOR NEXT 2 LINES",
"return",
"retryCount",
"<",
"this",
".",
"retryCount",
"&&",
"(",
"code",
"==",
"408",
"||",
"(",
"code",
">=",
"500",
"&&",
"code",
"!=",
"501",
"&&",
"code",
"!=",
"505",
")",
")",
";",
"}"
] | Returns if a request should be retried based on the retry count, current response,
and the current strategy.
@param retryCount The current retry attempt count.
@param response The exception that caused the retry conditions to occur.
@return true if the request should be retried; false otherwise. | [
"Returns",
"if",
"a",
"request",
"should",
"be",
"retried",
"based",
"on",
"the",
"retry",
"count",
"current",
"response",
"and",
"the",
"current",
"strategy",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/retry/ExponentialBackoffRetryStrategy.java#L98-L104 |
163,086 | Azure/autorest-clientruntime-for-java | client-runtime/src/main/java/com/microsoft/rest/RestClient.java | RestClient.close | @Beta(SinceVersion.V1_1_0)
public void close() {
httpClient.dispatcher().executorService().shutdown();
httpClient.connectionPool().evictAll();
synchronized (httpClient.connectionPool()) {
httpClient.connectionPool().notifyAll();
}
synchronized (AsyncTimeout.class) {
AsyncTimeout.class.notifyAll();
}
} | java | @Beta(SinceVersion.V1_1_0)
public void close() {
httpClient.dispatcher().executorService().shutdown();
httpClient.connectionPool().evictAll();
synchronized (httpClient.connectionPool()) {
httpClient.connectionPool().notifyAll();
}
synchronized (AsyncTimeout.class) {
AsyncTimeout.class.notifyAll();
}
} | [
"@",
"Beta",
"(",
"SinceVersion",
".",
"V1_1_0",
")",
"public",
"void",
"close",
"(",
")",
"{",
"httpClient",
".",
"dispatcher",
"(",
")",
".",
"executorService",
"(",
")",
".",
"shutdown",
"(",
")",
";",
"httpClient",
".",
"connectionPool",
"(",
")",
".",
"evictAll",
"(",
")",
";",
"synchronized",
"(",
"httpClient",
".",
"connectionPool",
"(",
")",
")",
"{",
"httpClient",
".",
"connectionPool",
"(",
")",
".",
"notifyAll",
"(",
")",
";",
"}",
"synchronized",
"(",
"AsyncTimeout",
".",
"class",
")",
"{",
"AsyncTimeout",
".",
"class",
".",
"notifyAll",
"(",
")",
";",
"}",
"}"
] | Closes the HTTP client and recycles the resources associated. The threads will
be recycled after 60 seconds of inactivity. | [
"Closes",
"the",
"HTTP",
"client",
"and",
"recycles",
"the",
"resources",
"associated",
".",
"The",
"threads",
"will",
"be",
"recycled",
"after",
"60",
"seconds",
"of",
"inactivity",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/RestClient.java#L128-L138 |
163,087 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ReadableWrappersImpl.java | ReadableWrappersImpl.convertToPagedList | public static <InnerT> PagedList<InnerT> convertToPagedList(List<InnerT> list) {
PageImpl<InnerT> page = new PageImpl<>();
page.setItems(list);
page.setNextPageLink(null);
return new PagedList<InnerT>(page) {
@Override
public Page<InnerT> nextPage(String nextPageLink) {
return null;
}
};
} | java | public static <InnerT> PagedList<InnerT> convertToPagedList(List<InnerT> list) {
PageImpl<InnerT> page = new PageImpl<>();
page.setItems(list);
page.setNextPageLink(null);
return new PagedList<InnerT>(page) {
@Override
public Page<InnerT> nextPage(String nextPageLink) {
return null;
}
};
} | [
"public",
"static",
"<",
"InnerT",
">",
"PagedList",
"<",
"InnerT",
">",
"convertToPagedList",
"(",
"List",
"<",
"InnerT",
">",
"list",
")",
"{",
"PageImpl",
"<",
"InnerT",
">",
"page",
"=",
"new",
"PageImpl",
"<>",
"(",
")",
";",
"page",
".",
"setItems",
"(",
"list",
")",
";",
"page",
".",
"setNextPageLink",
"(",
"null",
")",
";",
"return",
"new",
"PagedList",
"<",
"InnerT",
">",
"(",
"page",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"InnerT",
">",
"nextPage",
"(",
"String",
"nextPageLink",
")",
"{",
"return",
"null",
";",
"}",
"}",
";",
"}"
] | Converts the List to PagedList.
@param list list to be converted in to paged list
@param <InnerT> the wrapper inner type
@return the Paged list for the inner type. | [
"Converts",
"the",
"List",
"to",
"PagedList",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ReadableWrappersImpl.java#L55-L65 |
163,088 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ReadableWrappersImpl.java | ReadableWrappersImpl.convertListToInnerAsync | public static <InnerT> Observable<InnerT> convertListToInnerAsync(Observable<List<InnerT>> innerList) {
return innerList.flatMap(new Func1<List<InnerT>, Observable<InnerT>>() {
@Override
public Observable<InnerT> call(List<InnerT> inners) {
return Observable.from(inners);
}
});
} | java | public static <InnerT> Observable<InnerT> convertListToInnerAsync(Observable<List<InnerT>> innerList) {
return innerList.flatMap(new Func1<List<InnerT>, Observable<InnerT>>() {
@Override
public Observable<InnerT> call(List<InnerT> inners) {
return Observable.from(inners);
}
});
} | [
"public",
"static",
"<",
"InnerT",
">",
"Observable",
"<",
"InnerT",
">",
"convertListToInnerAsync",
"(",
"Observable",
"<",
"List",
"<",
"InnerT",
">",
">",
"innerList",
")",
"{",
"return",
"innerList",
".",
"flatMap",
"(",
"new",
"Func1",
"<",
"List",
"<",
"InnerT",
">",
",",
"Observable",
"<",
"InnerT",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"InnerT",
">",
"call",
"(",
"List",
"<",
"InnerT",
">",
"inners",
")",
"{",
"return",
"Observable",
".",
"from",
"(",
"inners",
")",
";",
"}",
"}",
")",
";",
"}"
] | Converts Observable of list to Observable of Inner.
@param innerList list to be converted.
@param <InnerT> type of inner.
@return Observable for list of inner. | [
"Converts",
"Observable",
"of",
"list",
"to",
"Observable",
"of",
"Inner",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ReadableWrappersImpl.java#L82-L89 |
163,089 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ReadableWrappersImpl.java | ReadableWrappersImpl.convertPageToInnerAsync | public static <InnerT> Observable<InnerT> convertPageToInnerAsync(Observable<Page<InnerT>> innerPage) {
return innerPage.flatMap(new Func1<Page<InnerT>, Observable<InnerT>>() {
@Override
public Observable<InnerT> call(Page<InnerT> pageInner) {
return Observable.from(pageInner.items());
}
});
} | java | public static <InnerT> Observable<InnerT> convertPageToInnerAsync(Observable<Page<InnerT>> innerPage) {
return innerPage.flatMap(new Func1<Page<InnerT>, Observable<InnerT>>() {
@Override
public Observable<InnerT> call(Page<InnerT> pageInner) {
return Observable.from(pageInner.items());
}
});
} | [
"public",
"static",
"<",
"InnerT",
">",
"Observable",
"<",
"InnerT",
">",
"convertPageToInnerAsync",
"(",
"Observable",
"<",
"Page",
"<",
"InnerT",
">",
">",
"innerPage",
")",
"{",
"return",
"innerPage",
".",
"flatMap",
"(",
"new",
"Func1",
"<",
"Page",
"<",
"InnerT",
">",
",",
"Observable",
"<",
"InnerT",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"InnerT",
">",
"call",
"(",
"Page",
"<",
"InnerT",
">",
"pageInner",
")",
"{",
"return",
"Observable",
".",
"from",
"(",
"pageInner",
".",
"items",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] | Converts Observable of page to Observable of Inner.
@param <InnerT> type of inner.
@param innerPage Page to be converted.
@return Observable for list of inner. | [
"Converts",
"Observable",
"of",
"page",
"to",
"Observable",
"of",
"Inner",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ReadableWrappersImpl.java#L97-L104 |
163,090 | Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/PostRunTaskCollection.java | PostRunTaskCollection.add | public void add(final IndexableTaskItem taskItem) {
this.dependsOnTaskGroup.addPostRunDependentTaskGroup(taskItem.taskGroup());
this.collection.add(taskItem);
} | java | public void add(final IndexableTaskItem taskItem) {
this.dependsOnTaskGroup.addPostRunDependentTaskGroup(taskItem.taskGroup());
this.collection.add(taskItem);
} | [
"public",
"void",
"add",
"(",
"final",
"IndexableTaskItem",
"taskItem",
")",
"{",
"this",
".",
"dependsOnTaskGroup",
".",
"addPostRunDependentTaskGroup",
"(",
"taskItem",
".",
"taskGroup",
"(",
")",
")",
";",
"this",
".",
"collection",
".",
"add",
"(",
"taskItem",
")",
";",
"}"
] | Adds a "Post Run" task to the collection.
@param taskItem the "Post Run" task | [
"Adds",
"a",
"Post",
"Run",
"task",
"to",
"the",
"collection",
"."
] | 04621e07dbb0456dd5459dd641f06a9fd4f3abad | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/PostRunTaskCollection.java#L36-L39 |
163,091 | aol/micro-server | micro-s3/src/main/java/com/oath/micro/server/s3/data/S3ObjectWriter.java | S3ObjectWriter.putAsync | public Eval<UploadResult> putAsync(String key, Object value) {
return Eval.later(() -> put(key, value))
.map(t -> t.orElse(null))
.map(FluentFunctions.ofChecked(up -> up.waitForUploadResult()));
} | java | public Eval<UploadResult> putAsync(String key, Object value) {
return Eval.later(() -> put(key, value))
.map(t -> t.orElse(null))
.map(FluentFunctions.ofChecked(up -> up.waitForUploadResult()));
} | [
"public",
"Eval",
"<",
"UploadResult",
">",
"putAsync",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"return",
"Eval",
".",
"later",
"(",
"(",
")",
"->",
"put",
"(",
"key",
",",
"value",
")",
")",
".",
"map",
"(",
"t",
"->",
"t",
".",
"orElse",
"(",
"null",
")",
")",
".",
"map",
"(",
"FluentFunctions",
".",
"ofChecked",
"(",
"up",
"->",
"up",
".",
"waitForUploadResult",
"(",
")",
")",
")",
";",
"}"
] | Non-blocking call that will throw any Exceptions in the traditional
manner on access
@param key
@param value
@return | [
"Non",
"-",
"blocking",
"call",
"that",
"will",
"throw",
"any",
"Exceptions",
"in",
"the",
"traditional",
"manner",
"on",
"access"
] | 5c7103c5b43d2f4d16350dbd2f9802af307c63f7 | https://github.com/aol/micro-server/blob/5c7103c5b43d2f4d16350dbd2f9802af307c63f7/micro-s3/src/main/java/com/oath/micro/server/s3/data/S3ObjectWriter.java#L123-L128 |
163,092 | aol/micro-server | micro-s3/src/main/java/com/oath/micro/server/s3/data/S3StringWriter.java | S3StringWriter.putAsync | public Future<PutObjectResult> putAsync(String key, String value) {
return Future.of(() -> put(key, value), this.uploadService)
.flatMap(t->t.fold(p->Future.ofResult(p),e->Future.ofError(e)));
} | java | public Future<PutObjectResult> putAsync(String key, String value) {
return Future.of(() -> put(key, value), this.uploadService)
.flatMap(t->t.fold(p->Future.ofResult(p),e->Future.ofError(e)));
} | [
"public",
"Future",
"<",
"PutObjectResult",
">",
"putAsync",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"return",
"Future",
".",
"of",
"(",
"(",
")",
"->",
"put",
"(",
"key",
",",
"value",
")",
",",
"this",
".",
"uploadService",
")",
".",
"flatMap",
"(",
"t",
"->",
"t",
".",
"fold",
"(",
"p",
"->",
"Future",
".",
"ofResult",
"(",
"p",
")",
",",
"e",
"->",
"Future",
".",
"ofError",
"(",
"e",
")",
")",
")",
";",
"}"
] | Non-blocking call
@param key
@param value
@return | [
"Non",
"-",
"blocking",
"call"
] | 5c7103c5b43d2f4d16350dbd2f9802af307c63f7 | https://github.com/aol/micro-server/blob/5c7103c5b43d2f4d16350dbd2f9802af307c63f7/micro-s3/src/main/java/com/oath/micro/server/s3/data/S3StringWriter.java#L59-L62 |
163,093 | aol/micro-server | micro-events/src/main/java/com/oath/micro/server/events/LabelledEvents.java | LabelledEvents.finish | public static <T> void finish(T query, long correlationId, EventBus bus, String... labels) {
for (String type : labels) {
RemoveLabelledQuery<T> next = finish(query, correlationId, type);
bus.post(next);
}
} | java | public static <T> void finish(T query, long correlationId, EventBus bus, String... labels) {
for (String type : labels) {
RemoveLabelledQuery<T> next = finish(query, correlationId, type);
bus.post(next);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"finish",
"(",
"T",
"query",
",",
"long",
"correlationId",
",",
"EventBus",
"bus",
",",
"String",
"...",
"labels",
")",
"{",
"for",
"(",
"String",
"type",
":",
"labels",
")",
"{",
"RemoveLabelledQuery",
"<",
"T",
">",
"next",
"=",
"finish",
"(",
"query",
",",
"correlationId",
",",
"type",
")",
";",
"bus",
".",
"post",
"(",
"next",
")",
";",
"}",
"}"
] | Publish finish events for each of the specified query labels
<pre>
{@code
LabelledEvents.start("get", 1l, bus, "typeA", "custom");
try {
return "ok";
} finally {
RequestEvents.finish("get", 1l, bus, "typeA", "custom");
}
}
</pre>
@param query Completed query
@param correlationId Identifier
@param bus EventBus to post events to
@param labels Query types to post to event bus | [
"Publish",
"finish",
"events",
"for",
"each",
"of",
"the",
"specified",
"query",
"labels"
] | 5c7103c5b43d2f4d16350dbd2f9802af307c63f7 | https://github.com/aol/micro-server/blob/5c7103c5b43d2f4d16350dbd2f9802af307c63f7/micro-events/src/main/java/com/oath/micro/server/events/LabelledEvents.java#L96-L101 |
163,094 | aol/micro-server | micro-events/src/main/java/com/oath/micro/server/events/RequestEvents.java | RequestEvents.start | public static <T> AddQuery<T> start(T query, long correlationId) {
return start(query, correlationId, "default", null);
} | java | public static <T> AddQuery<T> start(T query, long correlationId) {
return start(query, correlationId, "default", null);
} | [
"public",
"static",
"<",
"T",
">",
"AddQuery",
"<",
"T",
">",
"start",
"(",
"T",
"query",
",",
"long",
"correlationId",
")",
"{",
"return",
"start",
"(",
"query",
",",
"correlationId",
",",
"\"default\"",
",",
"null",
")",
";",
"}"
] | Marks the start of a query identified by the provided correlationId
@param query - Query data
@param correlationId - Identifier
@return Start event to pass to the Events systems EventBus | [
"Marks",
"the",
"start",
"of",
"a",
"query",
"identified",
"by",
"the",
"provided",
"correlationId"
] | 5c7103c5b43d2f4d16350dbd2f9802af307c63f7 | https://github.com/aol/micro-server/blob/5c7103c5b43d2f4d16350dbd2f9802af307c63f7/micro-events/src/main/java/com/oath/micro/server/events/RequestEvents.java#L23-L25 |
163,095 | aol/micro-server | micro-events/src/main/java/com/oath/micro/server/events/RequestEvents.java | RequestEvents.finish | public static <T> void finish(T query, long correlationId, EventBus bus, String... types) {
for (String type : types) {
RemoveQuery<T> next = finish(query, correlationId, type);
bus.post(next);
}
} | java | public static <T> void finish(T query, long correlationId, EventBus bus, String... types) {
for (String type : types) {
RemoveQuery<T> next = finish(query, correlationId, type);
bus.post(next);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"finish",
"(",
"T",
"query",
",",
"long",
"correlationId",
",",
"EventBus",
"bus",
",",
"String",
"...",
"types",
")",
"{",
"for",
"(",
"String",
"type",
":",
"types",
")",
"{",
"RemoveQuery",
"<",
"T",
">",
"next",
"=",
"finish",
"(",
"query",
",",
"correlationId",
",",
"type",
")",
";",
"bus",
".",
"post",
"(",
"next",
")",
";",
"}",
"}"
] | Publish finish events for each of the specified query types
<pre>
{@code
RequestEvents.start("get", 1l, bus, "typeA", "custom");
try {
return "ok";
} finally {
RequestEvents.finish("get", 1l, bus, "typeA", "custom");
}
}
</pre>
@param query Completed query
@param correlationId Identifier
@param bus EventBus to post events to
@param types Query types to post to event bus | [
"Publish",
"finish",
"events",
"for",
"each",
"of",
"the",
"specified",
"query",
"types"
] | 5c7103c5b43d2f4d16350dbd2f9802af307c63f7 | https://github.com/aol/micro-server/blob/5c7103c5b43d2f4d16350dbd2f9802af307c63f7/micro-events/src/main/java/com/oath/micro/server/events/RequestEvents.java#L119-L124 |
163,096 | aol/micro-server | micro-transactions/src/main/java/com/oath/micro/server/transactions/TransactionFlow.java | TransactionFlow.execute | public Try<R,Throwable> execute(T input){
return Try.withCatch( ()->transactionTemplate.execute(status-> transaction.apply(input)));
} | java | public Try<R,Throwable> execute(T input){
return Try.withCatch( ()->transactionTemplate.execute(status-> transaction.apply(input)));
} | [
"public",
"Try",
"<",
"R",
",",
"Throwable",
">",
"execute",
"(",
"T",
"input",
")",
"{",
"return",
"Try",
".",
"withCatch",
"(",
"(",
")",
"->",
"transactionTemplate",
".",
"execute",
"(",
"status",
"->",
"transaction",
".",
"apply",
"(",
"input",
")",
")",
")",
";",
"}"
] | Execute the transactional flow - catch all exceptions
@param input Initial data input
@return Try that represents either success (with result) or failure (with errors) | [
"Execute",
"the",
"transactional",
"flow",
"-",
"catch",
"all",
"exceptions"
] | 5c7103c5b43d2f4d16350dbd2f9802af307c63f7 | https://github.com/aol/micro-server/blob/5c7103c5b43d2f4d16350dbd2f9802af307c63f7/micro-transactions/src/main/java/com/oath/micro/server/transactions/TransactionFlow.java#L93-L96 |
163,097 | aol/micro-server | micro-transactions/src/main/java/com/oath/micro/server/transactions/TransactionFlow.java | TransactionFlow.execute | public <Ex extends Throwable> Try<R,Ex> execute(T input,Class<Ex> classes){
return Try.withCatch( ()->transactionTemplate.execute(status-> transaction.apply(input)),classes);
} | java | public <Ex extends Throwable> Try<R,Ex> execute(T input,Class<Ex> classes){
return Try.withCatch( ()->transactionTemplate.execute(status-> transaction.apply(input)),classes);
} | [
"public",
"<",
"Ex",
"extends",
"Throwable",
">",
"Try",
"<",
"R",
",",
"Ex",
">",
"execute",
"(",
"T",
"input",
",",
"Class",
"<",
"Ex",
">",
"classes",
")",
"{",
"return",
"Try",
".",
"withCatch",
"(",
"(",
")",
"->",
"transactionTemplate",
".",
"execute",
"(",
"status",
"->",
"transaction",
".",
"apply",
"(",
"input",
")",
")",
",",
"classes",
")",
";",
"}"
] | Execute the transactional flow - catch only specified exceptions
@param input Initial data input
@param classes Exception types to catch
@return Try that represents either success (with result) or failure (with errors) | [
"Execute",
"the",
"transactional",
"flow",
"-",
"catch",
"only",
"specified",
"exceptions"
] | 5c7103c5b43d2f4d16350dbd2f9802af307c63f7 | https://github.com/aol/micro-server/blob/5c7103c5b43d2f4d16350dbd2f9802af307c63f7/micro-transactions/src/main/java/com/oath/micro/server/transactions/TransactionFlow.java#L104-L108 |
163,098 | darrachequesne/spring-data-jpa-datatables | src/main/java/org/springframework/data/jpa/datatables/mapping/DataTablesInput.java | DataTablesInput.getColumn | public Column getColumn(String columnName) {
if (columnName == null) {
return null;
}
for (Column column : columns) {
if (columnName.equals(column.getData())) {
return column;
}
}
return null;
} | java | public Column getColumn(String columnName) {
if (columnName == null) {
return null;
}
for (Column column : columns) {
if (columnName.equals(column.getData())) {
return column;
}
}
return null;
} | [
"public",
"Column",
"getColumn",
"(",
"String",
"columnName",
")",
"{",
"if",
"(",
"columnName",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"Column",
"column",
":",
"columns",
")",
"{",
"if",
"(",
"columnName",
".",
"equals",
"(",
"column",
".",
"getData",
"(",
")",
")",
")",
"{",
"return",
"column",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Find a column by its name
@param columnName the name of the column
@return the given Column, or <code>null</code> if not found | [
"Find",
"a",
"column",
"by",
"its",
"name"
] | 0174dec8f52595a8e4b79f32c79922d64b02b732 | https://github.com/darrachequesne/spring-data-jpa-datatables/blob/0174dec8f52595a8e4b79f32c79922d64b02b732/src/main/java/org/springframework/data/jpa/datatables/mapping/DataTablesInput.java#L80-L90 |
163,099 | darrachequesne/spring-data-jpa-datatables | src/main/java/org/springframework/data/jpa/datatables/mapping/DataTablesInput.java | DataTablesInput.addColumn | public void addColumn(String columnName, boolean searchable, boolean orderable,
String searchValue) {
this.columns.add(new Column(columnName, "", searchable, orderable,
new Search(searchValue, false)));
} | java | public void addColumn(String columnName, boolean searchable, boolean orderable,
String searchValue) {
this.columns.add(new Column(columnName, "", searchable, orderable,
new Search(searchValue, false)));
} | [
"public",
"void",
"addColumn",
"(",
"String",
"columnName",
",",
"boolean",
"searchable",
",",
"boolean",
"orderable",
",",
"String",
"searchValue",
")",
"{",
"this",
".",
"columns",
".",
"add",
"(",
"new",
"Column",
"(",
"columnName",
",",
"\"\"",
",",
"searchable",
",",
"orderable",
",",
"new",
"Search",
"(",
"searchValue",
",",
"false",
")",
")",
")",
";",
"}"
] | Add a new column
@param columnName the name of the column
@param searchable whether the column is searchable or not
@param orderable whether the column is orderable or not
@param searchValue if any, the search value to apply | [
"Add",
"a",
"new",
"column"
] | 0174dec8f52595a8e4b79f32c79922d64b02b732 | https://github.com/darrachequesne/spring-data-jpa-datatables/blob/0174dec8f52595a8e4b79f32c79922d64b02b732/src/main/java/org/springframework/data/jpa/datatables/mapping/DataTablesInput.java#L100-L104 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.