repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/core/N1qlQueryExecutor.java | N1qlQueryExecutor.createN1qlRequest | private GenericQueryRequest createN1qlRequest(final N1qlQuery query, String bucket, String username, String password,
InetAddress targetNode) {
String rawQuery = query.n1ql().toString();
rawQuery = rawQuery.replaceAll(
CouchbaseAsyncBucket.CURRENT_BUCKET_IDENTIFIER,
"`" +... | java | private GenericQueryRequest createN1qlRequest(final N1qlQuery query, String bucket, String username, String password,
InetAddress targetNode) {
String rawQuery = query.n1ql().toString();
rawQuery = rawQuery.replaceAll(
CouchbaseAsyncBucket.CURRENT_BUCKET_IDENTIFIER,
"`" +... | [
"private",
"GenericQueryRequest",
"createN1qlRequest",
"(",
"final",
"N1qlQuery",
"query",
",",
"String",
"bucket",
",",
"String",
"username",
",",
"String",
"password",
",",
"InetAddress",
"targetNode",
")",
"{",
"String",
"rawQuery",
"=",
"query",
".",
"n1ql",
... | Creates the core query request and performs centralized string substitution. | [
"Creates",
"the",
"core",
"query",
"request",
"and",
"performs",
"centralized",
"string",
"substitution",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/core/N1qlQueryExecutor.java#L573-L588 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/StringFunctions.java | StringFunctions.replace | public static Expression replace(Expression expression, String substring, String repl) {
return x("REPLACE(" + expression.toString() + ", \"" + substring + "\", \"" + repl + "\")");
} | java | public static Expression replace(Expression expression, String substring, String repl) {
return x("REPLACE(" + expression.toString() + ", \"" + substring + "\", \"" + repl + "\")");
} | [
"public",
"static",
"Expression",
"replace",
"(",
"Expression",
"expression",
",",
"String",
"substring",
",",
"String",
"repl",
")",
"{",
"return",
"x",
"(",
"\"REPLACE(\"",
"+",
"expression",
".",
"toString",
"(",
")",
"+",
"\", \\\"\"",
"+",
"substring",
... | Returned expression results in a string with all occurrences of substr replaced with repl. | [
"Returned",
"expression",
"results",
"in",
"a",
"string",
"with",
"all",
"occurrences",
"of",
"substr",
"replaced",
"with",
"repl",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/StringFunctions.java#L175-L177 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/StringFunctions.java | StringFunctions.substr | public static Expression substr(Expression expression, int position, int length) {
return x("SUBSTR(" + expression.toString() + ", " + position + ", " + length + ")");
} | java | public static Expression substr(Expression expression, int position, int length) {
return x("SUBSTR(" + expression.toString() + ", " + position + ", " + length + ")");
} | [
"public",
"static",
"Expression",
"substr",
"(",
"Expression",
"expression",
",",
"int",
"position",
",",
"int",
"length",
")",
"{",
"return",
"x",
"(",
"\"SUBSTR(\"",
"+",
"expression",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"position",
"+",
"\", ... | Returned expression results in a substring from the integer position of the given length.
The position is zero-based, i.e. the first position is 0.
If position is negative, it is counted from the end of the string; -1 is the last position in the string. | [
"Returned",
"expression",
"results",
"in",
"a",
"substring",
"from",
"the",
"integer",
"position",
"of",
"the",
"given",
"length",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/StringFunctions.java#L264-L266 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.ifMissing | public static Expression ifMissing(Expression expression1, Expression expression2, Expression... others) {
return build("IFMISSING", expression1, expression2, others);
} | java | public static Expression ifMissing(Expression expression1, Expression expression2, Expression... others) {
return build("IFMISSING", expression1, expression2, others);
} | [
"public",
"static",
"Expression",
"ifMissing",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
",",
"Expression",
"...",
"others",
")",
"{",
"return",
"build",
"(",
"\"IFMISSING\"",
",",
"expression1",
",",
"expression2",
",",
"others",
")",
... | Returned expression results in the first non-MISSING value. | [
"Returned",
"expression",
"results",
"in",
"the",
"first",
"non",
"-",
"MISSING",
"value",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L60-L62 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.ifMissingOrNull | public static Expression ifMissingOrNull(Expression expression1, Expression expression2, Expression... others) {
return build("IFMISSINGORNULL", expression1, expression2, others);
} | java | public static Expression ifMissingOrNull(Expression expression1, Expression expression2, Expression... others) {
return build("IFMISSINGORNULL", expression1, expression2, others);
} | [
"public",
"static",
"Expression",
"ifMissingOrNull",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
",",
"Expression",
"...",
"others",
")",
"{",
"return",
"build",
"(",
"\"IFMISSINGORNULL\"",
",",
"expression1",
",",
"expression2",
",",
"others... | Returned expression results in first non-NULL, non-MISSING value. | [
"Returned",
"expression",
"results",
"in",
"first",
"non",
"-",
"NULL",
"non",
"-",
"MISSING",
"value",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L67-L69 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.ifNull | public static Expression ifNull(Expression expression1, Expression expression2, Expression... others) {
return build("IFNULL", expression1, expression2, others);
} | java | public static Expression ifNull(Expression expression1, Expression expression2, Expression... others) {
return build("IFNULL", expression1, expression2, others);
} | [
"public",
"static",
"Expression",
"ifNull",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
",",
"Expression",
"...",
"others",
")",
"{",
"return",
"build",
"(",
"\"IFNULL\"",
",",
"expression1",
",",
"expression2",
",",
"others",
")",
";",
... | Returned expression results in first non-NULL value.
Note that this function might return MISSING if there is no non-NULL value. | [
"Returned",
"expression",
"results",
"in",
"first",
"non",
"-",
"NULL",
"value",
".",
"Note",
"that",
"this",
"function",
"might",
"return",
"MISSING",
"if",
"there",
"is",
"no",
"non",
"-",
"NULL",
"value",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L75-L77 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.missingIf | public static Expression missingIf(Expression expression1, Expression expression2) {
return x("MISSINGIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | java | public static Expression missingIf(Expression expression1, Expression expression2) {
return x("MISSINGIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | [
"public",
"static",
"Expression",
"missingIf",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
")",
"{",
"return",
"x",
"(",
"\"MISSINGIF(\"",
"+",
"expression1",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"expression2",
".",
"toString",
... | Returned expression results in MISSING if expression1 = expression2, otherwise returns expression1.
Returns MISSING or NULL if either input is MISSING or NULL.. | [
"Returned",
"expression",
"results",
"in",
"MISSING",
"if",
"expression1",
"=",
"expression2",
"otherwise",
"returns",
"expression1",
".",
"Returns",
"MISSING",
"or",
"NULL",
"if",
"either",
"input",
"is",
"MISSING",
"or",
"NULL",
".."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L83-L85 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.nullIf | public static Expression nullIf(Expression expression1, Expression expression2) {
return x("NULLIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | java | public static Expression nullIf(Expression expression1, Expression expression2) {
return x("NULLIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | [
"public",
"static",
"Expression",
"nullIf",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
")",
"{",
"return",
"x",
"(",
"\"NULLIF(\"",
"+",
"expression1",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"expression2",
".",
"toString",
"(",... | Returned expression results in NULL if expression1 = expression2, otherwise returns expression1.
Returns MISSING or NULL if either input is MISSING or NULL.. | [
"Returned",
"expression",
"results",
"in",
"NULL",
"if",
"expression1",
"=",
"expression2",
"otherwise",
"returns",
"expression1",
".",
"Returns",
"MISSING",
"or",
"NULL",
"if",
"either",
"input",
"is",
"MISSING",
"or",
"NULL",
".."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L91-L93 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.ifInf | public static Expression ifInf(Expression expression1, Expression expression2, Expression... others) {
return build("IFINF", expression1, expression2, others);
} | java | public static Expression ifInf(Expression expression1, Expression expression2, Expression... others) {
return build("IFINF", expression1, expression2, others);
} | [
"public",
"static",
"Expression",
"ifInf",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
",",
"Expression",
"...",
"others",
")",
"{",
"return",
"build",
"(",
"\"IFINF\"",
",",
"expression1",
",",
"expression2",
",",
"others",
")",
";",
"... | Returned expression results in first non-MISSING, non-Inf number.
Returns MISSING or NULL if a non-number input is encountered first. | [
"Returned",
"expression",
"results",
"in",
"first",
"non",
"-",
"MISSING",
"non",
"-",
"Inf",
"number",
".",
"Returns",
"MISSING",
"or",
"NULL",
"if",
"a",
"non",
"-",
"number",
"input",
"is",
"encountered",
"first",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L100-L102 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.ifNaN | public static Expression ifNaN(Expression expression1, Expression expression2, Expression... others) {
return build("IFNAN", expression1, expression2, others);
} | java | public static Expression ifNaN(Expression expression1, Expression expression2, Expression... others) {
return build("IFNAN", expression1, expression2, others);
} | [
"public",
"static",
"Expression",
"ifNaN",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
",",
"Expression",
"...",
"others",
")",
"{",
"return",
"build",
"(",
"\"IFNAN\"",
",",
"expression1",
",",
"expression2",
",",
"others",
")",
";",
"... | Returned expression results in first non-MISSING, non-NaN number.
Returns MISSING or NULL if a non-number input is encountered first | [
"Returned",
"expression",
"results",
"in",
"first",
"non",
"-",
"MISSING",
"non",
"-",
"NaN",
"number",
".",
"Returns",
"MISSING",
"or",
"NULL",
"if",
"a",
"non",
"-",
"number",
"input",
"is",
"encountered",
"first"
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L108-L110 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.ifNaNOrInf | public static Expression ifNaNOrInf(Expression expression1, Expression expression2, Expression... others) {
return build("IFNANORINF", expression1, expression2, others);
} | java | public static Expression ifNaNOrInf(Expression expression1, Expression expression2, Expression... others) {
return build("IFNANORINF", expression1, expression2, others);
} | [
"public",
"static",
"Expression",
"ifNaNOrInf",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
",",
"Expression",
"...",
"others",
")",
"{",
"return",
"build",
"(",
"\"IFNANORINF\"",
",",
"expression1",
",",
"expression2",
",",
"others",
")",
... | Returned expression results in first non-MISSING, non-Inf, or non-NaN number.
Returns MISSING or NULL if a non-number input is encountered first. | [
"Returned",
"expression",
"results",
"in",
"first",
"non",
"-",
"MISSING",
"non",
"-",
"Inf",
"or",
"non",
"-",
"NaN",
"number",
".",
"Returns",
"MISSING",
"or",
"NULL",
"if",
"a",
"non",
"-",
"number",
"input",
"is",
"encountered",
"first",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L116-L118 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.nanIf | public static Expression nanIf(Expression expression1, Expression expression2) {
return x("NANIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | java | public static Expression nanIf(Expression expression1, Expression expression2) {
return x("NANIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | [
"public",
"static",
"Expression",
"nanIf",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
")",
"{",
"return",
"x",
"(",
"\"NANIF(\"",
"+",
"expression1",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"expression2",
".",
"toString",
"(",
... | Returned expression results in NaN if expression1 = expression2, otherwise returns expression1.
Returns MISSING or NULL if either input is MISSING or NULL. | [
"Returned",
"expression",
"results",
"in",
"NaN",
"if",
"expression1",
"=",
"expression2",
"otherwise",
"returns",
"expression1",
".",
"Returns",
"MISSING",
"or",
"NULL",
"if",
"either",
"input",
"is",
"MISSING",
"or",
"NULL",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L124-L126 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.negInfIf | public static Expression negInfIf(Expression expression1, Expression expression2) {
return x("NEGINFIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | java | public static Expression negInfIf(Expression expression1, Expression expression2) {
return x("NEGINFIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | [
"public",
"static",
"Expression",
"negInfIf",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
")",
"{",
"return",
"x",
"(",
"\"NEGINFIF(\"",
"+",
"expression1",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"expression2",
".",
"toString",
... | Returned expression results in NegInf if expression1 = expression2, otherwise returns expression1.
Returns MISSING or NULL if either input is MISSING or NULL. | [
"Returned",
"expression",
"results",
"in",
"NegInf",
"if",
"expression1",
"=",
"expression2",
"otherwise",
"returns",
"expression1",
".",
"Returns",
"MISSING",
"or",
"NULL",
"if",
"either",
"input",
"is",
"MISSING",
"or",
"NULL",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L132-L134 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.posInfIf | public static Expression posInfIf(Expression expression1, Expression expression2) {
return x("POSINFIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | java | public static Expression posInfIf(Expression expression1, Expression expression2) {
return x("POSINFIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | [
"public",
"static",
"Expression",
"posInfIf",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
")",
"{",
"return",
"x",
"(",
"\"POSINFIF(\"",
"+",
"expression1",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"expression2",
".",
"toString",
... | Returned expression results in PosInf if expression1 = expression2, otherwise returns expression1.
Returns MISSING or NULL if either input is MISSING or NULL. | [
"Returned",
"expression",
"results",
"in",
"PosInf",
"if",
"expression1",
"=",
"expression2",
"otherwise",
"returns",
"expression1",
".",
"Returns",
"MISSING",
"or",
"NULL",
"if",
"either",
"input",
"is",
"MISSING",
"or",
"NULL",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L140-L142 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/util/TransparentReplicaGetHelper.java | TransparentReplicaGetHelper.getFirstPrimaryOrReplica | @InterfaceStability.Experimental
@InterfaceAudience.Public
public static <D extends Document<?>> Single<D> getFirstPrimaryOrReplica(final String id,
final Class<D> target, final Bucket bucket, final long primaryTimeout, final long replicaTimeout) {
if (primaryTimeout <= 0) {
throw ne... | java | @InterfaceStability.Experimental
@InterfaceAudience.Public
public static <D extends Document<?>> Single<D> getFirstPrimaryOrReplica(final String id,
final Class<D> target, final Bucket bucket, final long primaryTimeout, final long replicaTimeout) {
if (primaryTimeout <= 0) {
throw ne... | [
"@",
"InterfaceStability",
".",
"Experimental",
"@",
"InterfaceAudience",
".",
"Public",
"public",
"static",
"<",
"D",
"extends",
"Document",
"<",
"?",
">",
">",
"Single",
"<",
"D",
">",
"getFirstPrimaryOrReplica",
"(",
"final",
"String",
"id",
",",
"final",
... | Asynchronously fetch the document from the primary and if that operations fails try
all the replicas and return the first document that comes back from them.
@param id the document ID to fetch.
@param target the custom document type to use.
@param bucket the bucket to use when fetching the doc.
@param primaryTimeout t... | [
"Asynchronously",
"fetch",
"the",
"document",
"from",
"the",
"primary",
"and",
"if",
"that",
"operations",
"fails",
"try",
"all",
"the",
"replicas",
"and",
"return",
"the",
"first",
"document",
"that",
"comes",
"back",
"from",
"them",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/util/TransparentReplicaGetHelper.java#L140-L169 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/view/ViewQuery.java | ViewQuery.includeDocsOrdered | public ViewQuery includeDocsOrdered(boolean includeDocs, Class<? extends Document<?>> target) {
this.includeDocs = includeDocs;
this.retainOrder = includeDocs; //deactivate if includeDocs is deactivated
this.includeDocsTarget = target;
return this;
} | java | public ViewQuery includeDocsOrdered(boolean includeDocs, Class<? extends Document<?>> target) {
this.includeDocs = includeDocs;
this.retainOrder = includeDocs; //deactivate if includeDocs is deactivated
this.includeDocsTarget = target;
return this;
} | [
"public",
"ViewQuery",
"includeDocsOrdered",
"(",
"boolean",
"includeDocs",
",",
"Class",
"<",
"?",
"extends",
"Document",
"<",
"?",
">",
">",
"target",
")",
"{",
"this",
".",
"includeDocs",
"=",
"includeDocs",
";",
"this",
".",
"retainOrder",
"=",
"includeD... | Proactively load the full document for the row returned, while strictly retaining view row order.
This only works if reduce is false, since with reduce the original document ID is not included anymore.
@param includeDocs if it should be enabled or not.
@param target the custom document type target.
@return the {@link ... | [
"Proactively",
"load",
"the",
"full",
"document",
"for",
"the",
"row",
"returned",
"while",
"strictly",
"retaining",
"view",
"row",
"order",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/view/ViewQuery.java#L141-L146 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/view/ViewQuery.java | ViewQuery.groupLevel | public ViewQuery groupLevel(final int grouplevel) {
params[PARAM_GROUPLEVEL_OFFSET] = "group_level";
params[PARAM_GROUPLEVEL_OFFSET+1] = Integer.toString(grouplevel);
return this;
} | java | public ViewQuery groupLevel(final int grouplevel) {
params[PARAM_GROUPLEVEL_OFFSET] = "group_level";
params[PARAM_GROUPLEVEL_OFFSET+1] = Integer.toString(grouplevel);
return this;
} | [
"public",
"ViewQuery",
"groupLevel",
"(",
"final",
"int",
"grouplevel",
")",
"{",
"params",
"[",
"PARAM_GROUPLEVEL_OFFSET",
"]",
"=",
"\"group_level\"",
";",
"params",
"[",
"PARAM_GROUPLEVEL_OFFSET",
"+",
"1",
"]",
"=",
"Integer",
".",
"toString",
"(",
"grouplev... | Specify the group level to be used.
Important: {@link #group()} and this setter should not be used
together in the same {@link ViewQuery}. It is sufficient to only use this
setter and use {@link #group()} in cases where you always want
the highest group level implictly.
@param grouplevel How deep the grouping level s... | [
"Specify",
"the",
"group",
"level",
"to",
"be",
"used",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/view/ViewQuery.java#L274-L278 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/view/ViewQuery.java | ViewQuery.encode | protected String encode(final String source) {
try {
return URLEncoder.encode(source, "UTF-8");
} catch(Exception ex) {
throw new RuntimeException("Could not prepare view argument: " + ex);
}
} | java | protected String encode(final String source) {
try {
return URLEncoder.encode(source, "UTF-8");
} catch(Exception ex) {
throw new RuntimeException("Could not prepare view argument: " + ex);
}
} | [
"protected",
"String",
"encode",
"(",
"final",
"String",
"source",
")",
"{",
"try",
"{",
"return",
"URLEncoder",
".",
"encode",
"(",
"source",
",",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"RuntimeException",
... | Helper method to properly encode a string.
This method can be overridden if a different encoding logic needs to be
used. If so, note that {@link #keys(JsonArray) keys} is not encoded via
this method, but by the core.
@param source source string.
@return encoded target string. | [
"Helper",
"method",
"to",
"properly",
"encode",
"a",
"string",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/view/ViewQuery.java#L528-L534 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/util/DigestUtils.java | DigestUtils.digestSha1Hex | public static String digestSha1Hex(String source) {
String sha1 = "";
try {
MessageDigest crypt = MessageDigest.getInstance("SHA-1");
crypt.reset();
crypt.update(source.getBytes("UTF-8"));
sha1 = byteToHex(crypt.digest());
} catch (NoSuchAlgorithmE... | java | public static String digestSha1Hex(String source) {
String sha1 = "";
try {
MessageDigest crypt = MessageDigest.getInstance("SHA-1");
crypt.reset();
crypt.update(source.getBytes("UTF-8"));
sha1 = byteToHex(crypt.digest());
} catch (NoSuchAlgorithmE... | [
"public",
"static",
"String",
"digestSha1Hex",
"(",
"String",
"source",
")",
"{",
"String",
"sha1",
"=",
"\"\"",
";",
"try",
"{",
"MessageDigest",
"crypt",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"SHA-1\"",
")",
";",
"crypt",
".",
"reset",
"(",
")... | Hashes the source with SHA1 and returns the resulting hash as an hexadecimal string.
@param source the text to hash.
@return the SHA1 hash of the source, in hexadecimal form. | [
"Hashes",
"the",
"source",
"with",
"SHA1",
"and",
"returns",
"the",
"resulting",
"hash",
"as",
"an",
"hexadecimal",
"string",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/util/DigestUtils.java#L42-L55 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/util/Bootstrap.java | Bootstrap.fromDnsSrv | public static List<String> fromDnsSrv(final String serviceName, boolean full, boolean secure) throws NamingException {
return fromDnsSrv(serviceName, full, secure, null);
} | java | public static List<String> fromDnsSrv(final String serviceName, boolean full, boolean secure) throws NamingException {
return fromDnsSrv(serviceName, full, secure, null);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"fromDnsSrv",
"(",
"final",
"String",
"serviceName",
",",
"boolean",
"full",
",",
"boolean",
"secure",
")",
"throws",
"NamingException",
"{",
"return",
"fromDnsSrv",
"(",
"serviceName",
",",
"full",
",",
"secure"... | Fetch a bootstrap list from DNS SRV using default OS name resolution.
@param serviceName the DNS SRV locator.
@param full if the service name is the full one or needs to be enriched by the couchbase prefixes.
@param secure if the secure service prefix should be used.
@return a list of DNS SRV records.
@throws NamingEx... | [
"Fetch",
"a",
"bootstrap",
"list",
"from",
"DNS",
"SRV",
"using",
"default",
"OS",
"name",
"resolution",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/util/Bootstrap.java#L74-L76 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/util/Bootstrap.java | Bootstrap.fromDnsSrv | public static List<String> fromDnsSrv(final String serviceName, boolean full, boolean secure,
String nameServerIP) throws NamingException {
String fullService;
if (full) {
fullService = serviceName;
} else {
fullService = (secure ? DEFAULT_DNS_SECURE_SERVICE :... | java | public static List<String> fromDnsSrv(final String serviceName, boolean full, boolean secure,
String nameServerIP) throws NamingException {
String fullService;
if (full) {
fullService = serviceName;
} else {
fullService = (secure ? DEFAULT_DNS_SECURE_SERVICE :... | [
"public",
"static",
"List",
"<",
"String",
">",
"fromDnsSrv",
"(",
"final",
"String",
"serviceName",
",",
"boolean",
"full",
",",
"boolean",
"secure",
",",
"String",
"nameServerIP",
")",
"throws",
"NamingException",
"{",
"String",
"fullService",
";",
"if",
"("... | Fetch a bootstrap list from DNS SRV using a specific nameserver IP.
@param serviceName the DNS SRV locator.
@param full if the service name is the full one or needs to be enriched by the couchbase prefixes.
@param secure if the secure service prefix should be used.
@param nameServerIP an IPv4 for the name server to us... | [
"Fetch",
"a",
"bootstrap",
"list",
"from",
"DNS",
"SRV",
"using",
"a",
"specific",
"nameserver",
"IP",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/util/Bootstrap.java#L88-L106 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/util/Bootstrap.java | Bootstrap.loadDnsRecords | static List<String> loadDnsRecords(final String serviceName, final DirContext ctx) throws NamingException {
Attributes attrs = ctx.getAttributes(serviceName, new String[] { "SRV" });
NamingEnumeration<?> servers = attrs.get("srv").getAll();
List<String> records = new ArrayList<String>();
... | java | static List<String> loadDnsRecords(final String serviceName, final DirContext ctx) throws NamingException {
Attributes attrs = ctx.getAttributes(serviceName, new String[] { "SRV" });
NamingEnumeration<?> servers = attrs.get("srv").getAll();
List<String> records = new ArrayList<String>();
... | [
"static",
"List",
"<",
"String",
">",
"loadDnsRecords",
"(",
"final",
"String",
"serviceName",
",",
"final",
"DirContext",
"ctx",
")",
"throws",
"NamingException",
"{",
"Attributes",
"attrs",
"=",
"ctx",
".",
"getAttributes",
"(",
"serviceName",
",",
"new",
"S... | Helper method to load a list of DNS SRV records.
@param serviceName the service to locate.
@param ctx the directory context to fetch from.
@return the list of dns records
@throws NamingException if something goes wrong during the load process. | [
"Helper",
"method",
"to",
"load",
"a",
"list",
"of",
"DNS",
"SRV",
"records",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/util/Bootstrap.java#L116-L125 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java | DateFunctions.millisToUtc | public static Expression millisToUtc(String expression, String format) {
return millisToUtc(x(expression), format);
} | java | public static Expression millisToUtc(String expression, String format) {
return millisToUtc(x(expression), format);
} | [
"public",
"static",
"Expression",
"millisToUtc",
"(",
"String",
"expression",
",",
"String",
"format",
")",
"{",
"return",
"millisToUtc",
"(",
"x",
"(",
"expression",
")",
",",
"format",
")",
";",
"}"
] | Returned expression results in the UTC string to which the UNIX time stamp
has been converted in the supported format. | [
"Returned",
"expression",
"results",
"in",
"the",
"UTC",
"string",
"to",
"which",
"the",
"UNIX",
"time",
"stamp",
"has",
"been",
"converted",
"in",
"the",
"supported",
"format",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L262-L264 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java | DateFunctions.nowStr | public static Expression nowStr(String format) {
if (format == null || format.isEmpty()) {
return x("NOW_STR()");
}
return x("NOW_STR(\"" + format + "\")");
} | java | public static Expression nowStr(String format) {
if (format == null || format.isEmpty()) {
return x("NOW_STR()");
}
return x("NOW_STR(\"" + format + "\")");
} | [
"public",
"static",
"Expression",
"nowStr",
"(",
"String",
"format",
")",
"{",
"if",
"(",
"format",
"==",
"null",
"||",
"format",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"x",
"(",
"\"NOW_STR()\"",
")",
";",
"}",
"return",
"x",
"(",
"\"NOW_STR(\\\... | Returned expression results in statement time stamp as a string in a supported format;
does not vary during a query. | [
"Returned",
"expression",
"results",
"in",
"statement",
"time",
"stamp",
"as",
"a",
"string",
"in",
"a",
"supported",
"format",
";",
"does",
"not",
"vary",
"during",
"a",
"query",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L295-L300 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/MutationState.java | MutationState.addToken | private void addToken(final MutationToken token) {
if (token != null) {
ListIterator<MutationToken> tokenIterator = tokens.listIterator();
while (tokenIterator.hasNext()) {
MutationToken t = tokenIterator.next();
if (t.vbucketID() == token.vbucketID() && t... | java | private void addToken(final MutationToken token) {
if (token != null) {
ListIterator<MutationToken> tokenIterator = tokens.listIterator();
while (tokenIterator.hasNext()) {
MutationToken t = tokenIterator.next();
if (t.vbucketID() == token.vbucketID() && t... | [
"private",
"void",
"addToken",
"(",
"final",
"MutationToken",
"token",
")",
"{",
"if",
"(",
"token",
"!=",
"null",
")",
"{",
"ListIterator",
"<",
"MutationToken",
">",
"tokenIterator",
"=",
"tokens",
".",
"listIterator",
"(",
")",
";",
"while",
"(",
"token... | Helper method to check the incoming token and store it if needed.
Note that the token is only stored if it doesn't exist for the given vbucket already or the given sequence
number is higher than the one stored.
@param token the token to check and maybe store. | [
"Helper",
"method",
"to",
"check",
"the",
"incoming",
"token",
"and",
"store",
"it",
"if",
"needed",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/MutationState.java#L116-L131 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/cluster/api/RestBuilder.java | RestBuilder.execute | public RestApiResponse execute(long timeout, TimeUnit timeUnit) {
return Blocking.blockForSingle(delegate.execute(), timeout, timeUnit);
} | java | public RestApiResponse execute(long timeout, TimeUnit timeUnit) {
return Blocking.blockForSingle(delegate.execute(), timeout, timeUnit);
} | [
"public",
"RestApiResponse",
"execute",
"(",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"return",
"Blocking",
".",
"blockForSingle",
"(",
"delegate",
".",
"execute",
"(",
")",
",",
"timeout",
",",
"timeUnit",
")",
";",
"}"
] | Executes the API request in a synchronous fashion, using the given timeout.
@param timeout the custom timeout to use for the request.
@param timeUnit the {@link TimeUnit} for the timeout.
@return the result of the API call, as a {@link RestApiResponse}.
@throws RuntimeException wrapping a {@link TimeoutException} in c... | [
"Executes",
"the",
"API",
"request",
"in",
"a",
"synchronous",
"fashion",
"using",
"the",
"given",
"timeout",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/cluster/api/RestBuilder.java#L213-L215 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/search/queries/DateRangeQuery.java | DateRangeQuery.start | public DateRangeQuery start(Date start, boolean inclusive) {
this.start = SearchUtils.toFtsUtcString(start);
this.inclusiveStart = inclusive;
return this;
} | java | public DateRangeQuery start(Date start, boolean inclusive) {
this.start = SearchUtils.toFtsUtcString(start);
this.inclusiveStart = inclusive;
return this;
} | [
"public",
"DateRangeQuery",
"start",
"(",
"Date",
"start",
",",
"boolean",
"inclusive",
")",
"{",
"this",
".",
"start",
"=",
"SearchUtils",
".",
"toFtsUtcString",
"(",
"start",
")",
";",
"this",
".",
"inclusiveStart",
"=",
"inclusive",
";",
"return",
"this",... | Sets the lower boundary of the range, inclusive or not depending on the second parameter.
Works with a {@link Date} object, which is converted to RFC 3339 format using
{@link SearchUtils#toFtsUtcString(Date)}, so you shouldn't use a non-default {@link #dateTimeParser(String)}
after that. | [
"Sets",
"the",
"lower",
"boundary",
"of",
"the",
"range",
"inclusive",
"or",
"not",
"depending",
"on",
"the",
"second",
"parameter",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/search/queries/DateRangeQuery.java#L96-L100 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/search/queries/DateRangeQuery.java | DateRangeQuery.start | public DateRangeQuery start(Date start) {
this.start = SearchUtils.toFtsUtcString(start);
this.inclusiveStart = null;
return this;
} | java | public DateRangeQuery start(Date start) {
this.start = SearchUtils.toFtsUtcString(start);
this.inclusiveStart = null;
return this;
} | [
"public",
"DateRangeQuery",
"start",
"(",
"Date",
"start",
")",
"{",
"this",
".",
"start",
"=",
"SearchUtils",
".",
"toFtsUtcString",
"(",
"start",
")",
";",
"this",
".",
"inclusiveStart",
"=",
"null",
";",
"return",
"this",
";",
"}"
] | Sets the lower boundary of the range.
The lower boundary is considered inclusive by default on the server side.
Works with a {@link Date} object, which is converted to RFC 3339 format using
{@link SearchUtils#toFtsUtcString(Date)}, so you shouldn't use a non-default {@link #dateTimeParser(String)}
after that.
@see #s... | [
"Sets",
"the",
"lower",
"boundary",
"of",
"the",
"range",
".",
"The",
"lower",
"boundary",
"is",
"considered",
"inclusive",
"by",
"default",
"on",
"the",
"server",
"side",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/search/queries/DateRangeQuery.java#L112-L116 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/search/queries/DateRangeQuery.java | DateRangeQuery.end | public DateRangeQuery end(Date end, boolean inclusive) {
this.end = SearchUtils.toFtsUtcString(end);
this.inclusiveEnd = inclusive;
return this;
} | java | public DateRangeQuery end(Date end, boolean inclusive) {
this.end = SearchUtils.toFtsUtcString(end);
this.inclusiveEnd = inclusive;
return this;
} | [
"public",
"DateRangeQuery",
"end",
"(",
"Date",
"end",
",",
"boolean",
"inclusive",
")",
"{",
"this",
".",
"end",
"=",
"SearchUtils",
".",
"toFtsUtcString",
"(",
"end",
")",
";",
"this",
".",
"inclusiveEnd",
"=",
"inclusive",
";",
"return",
"this",
";",
... | Sets the upper boundary of the range, inclusive or not depending on the second parameter.
Works with a {@link Date} object, which is converted to RFC 3339 format using
{@link SearchUtils#toFtsUtcString(Date)}, so you shouldn't use a non-default {@link #dateTimeParser(String)}
after that. | [
"Sets",
"the",
"upper",
"boundary",
"of",
"the",
"range",
"inclusive",
"or",
"not",
"depending",
"on",
"the",
"second",
"parameter",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/search/queries/DateRangeQuery.java#L125-L129 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/search/queries/DateRangeQuery.java | DateRangeQuery.end | public DateRangeQuery end(Date end) {
this.end = SearchUtils.toFtsUtcString(end);
this.inclusiveEnd = null;
return this;
} | java | public DateRangeQuery end(Date end) {
this.end = SearchUtils.toFtsUtcString(end);
this.inclusiveEnd = null;
return this;
} | [
"public",
"DateRangeQuery",
"end",
"(",
"Date",
"end",
")",
"{",
"this",
".",
"end",
"=",
"SearchUtils",
".",
"toFtsUtcString",
"(",
"end",
")",
";",
"this",
".",
"inclusiveEnd",
"=",
"null",
";",
"return",
"this",
";",
"}"
] | Sets the upper boundary of the range.
The upper boundary is considered exclusive by default on the server side.
Works with a {@link Date} object, which is converted to RFC 3339 format using
{@link SearchUtils#toFtsUtcString(Date)}, so you shouldn't use a non-default {@link #dateTimeParser(String)}
after that.
@see #e... | [
"Sets",
"the",
"upper",
"boundary",
"of",
"the",
"range",
".",
"The",
"upper",
"boundary",
"is",
"considered",
"exclusive",
"by",
"default",
"on",
"the",
"server",
"side",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/search/queries/DateRangeQuery.java#L141-L145 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/NumberFunctions.java | NumberFunctions.power | public static Expression power(Expression expression1, Expression expression2) {
return x("POWER(" + expression1.toString() + ", " + expression2.toString() + ")");
} | java | public static Expression power(Expression expression1, Expression expression2) {
return x("POWER(" + expression1.toString() + ", " + expression2.toString() + ")");
} | [
"public",
"static",
"Expression",
"power",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
")",
"{",
"return",
"x",
"(",
"\"POWER(\"",
"+",
"expression1",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"expression2",
".",
"toString",
"(",
... | Returned expression results in expression1 to the power of expression2. | [
"Returned",
"expression",
"results",
"in",
"expression1",
"to",
"the",
"power",
"of",
"expression2",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/NumberFunctions.java#L223-L225 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/NumberFunctions.java | NumberFunctions.power | public static Expression power(Number value1, Number value2) {
return power(x(value1), x(value2));
} | java | public static Expression power(Number value1, Number value2) {
return power(x(value1), x(value2));
} | [
"public",
"static",
"Expression",
"power",
"(",
"Number",
"value1",
",",
"Number",
"value2",
")",
"{",
"return",
"power",
"(",
"x",
"(",
"value1",
")",
",",
"x",
"(",
"value2",
")",
")",
";",
"}"
] | Returned expression results in value1 to the power of value2. | [
"Returned",
"expression",
"results",
"in",
"value1",
"to",
"the",
"power",
"of",
"value2",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/NumberFunctions.java#L230-L232 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/bucket/api/Utils.java | Utils.formatTimeout | static String formatTimeout(final CouchbaseRequest request, final long timeout) {
Map<String, Object> fieldMap = new HashMap<String, Object>();
fieldMap.put("t", timeout);
if (request != null) {
fieldMap.put("s", formatServiceType(request));
putIfNotNull(fieldMap, "i", r... | java | static String formatTimeout(final CouchbaseRequest request, final long timeout) {
Map<String, Object> fieldMap = new HashMap<String, Object>();
fieldMap.put("t", timeout);
if (request != null) {
fieldMap.put("s", formatServiceType(request));
putIfNotNull(fieldMap, "i", r... | [
"static",
"String",
"formatTimeout",
"(",
"final",
"CouchbaseRequest",
"request",
",",
"final",
"long",
"timeout",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"fieldMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"f... | This method take the given request and produces the correct additional timeout
information according to the RFC. | [
"This",
"method",
"take",
"the",
"given",
"request",
"and",
"produces",
"the",
"correct",
"additional",
"timeout",
"information",
"according",
"to",
"the",
"RFC",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/bucket/api/Utils.java#L70-L89 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/bucket/api/Utils.java | Utils.formatServiceType | private static String formatServiceType(final CouchbaseRequest request) {
if (request instanceof BinaryRequest) {
return ThresholdLogReporter.SERVICE_KV;
} else if (request instanceof QueryRequest) {
return ThresholdLogReporter.SERVICE_N1QL;
} else if (request instanceof ... | java | private static String formatServiceType(final CouchbaseRequest request) {
if (request instanceof BinaryRequest) {
return ThresholdLogReporter.SERVICE_KV;
} else if (request instanceof QueryRequest) {
return ThresholdLogReporter.SERVICE_N1QL;
} else if (request instanceof ... | [
"private",
"static",
"String",
"formatServiceType",
"(",
"final",
"CouchbaseRequest",
"request",
")",
"{",
"if",
"(",
"request",
"instanceof",
"BinaryRequest",
")",
"{",
"return",
"ThresholdLogReporter",
".",
"SERVICE_KV",
";",
"}",
"else",
"if",
"(",
"request",
... | Helper method to turn the request into the proper string service type. | [
"Helper",
"method",
"to",
"turn",
"the",
"request",
"into",
"the",
"proper",
"string",
"service",
"type",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/bucket/api/Utils.java#L103-L120 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/cluster/DefaultAsyncClusterManager.java | DefaultAsyncClusterManager.ensureBucketIsHealthy | private Observable<BucketSettings> ensureBucketIsHealthy(final Observable<BucketSettings> input) {
return input.flatMap(new Func1<BucketSettings, Observable<BucketSettings>>() {
@Override
public Observable<BucketSettings> call(final BucketSettings bucketSettings) {
return... | java | private Observable<BucketSettings> ensureBucketIsHealthy(final Observable<BucketSettings> input) {
return input.flatMap(new Func1<BucketSettings, Observable<BucketSettings>>() {
@Override
public Observable<BucketSettings> call(final BucketSettings bucketSettings) {
return... | [
"private",
"Observable",
"<",
"BucketSettings",
">",
"ensureBucketIsHealthy",
"(",
"final",
"Observable",
"<",
"BucketSettings",
">",
"input",
")",
"{",
"return",
"input",
".",
"flatMap",
"(",
"new",
"Func1",
"<",
"BucketSettings",
",",
"Observable",
"<",
"Bucke... | Helper method to ensure that the state of a bucket on all nodes is healthy.
This polling logic is in place as a workaround because the bucket could still be warming up or completing
its creation process before any actual operation can be performed.
@return the original input stream once done. | [
"Helper",
"method",
"to",
"ensure",
"that",
"the",
"state",
"of",
"a",
"bucket",
"on",
"all",
"nodes",
"is",
"healthy",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/cluster/DefaultAsyncClusterManager.java#L626-L656 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java | MutateInBuilder.withDurability | public MutateInBuilder withDurability(PersistTo persistTo, ReplicateTo replicateTo) {
asyncBuilder.withDurability(persistTo, replicateTo);
return this;
} | java | public MutateInBuilder withDurability(PersistTo persistTo, ReplicateTo replicateTo) {
asyncBuilder.withDurability(persistTo, replicateTo);
return this;
} | [
"public",
"MutateInBuilder",
"withDurability",
"(",
"PersistTo",
"persistTo",
",",
"ReplicateTo",
"replicateTo",
")",
"{",
"asyncBuilder",
".",
"withDurability",
"(",
"persistTo",
",",
"replicateTo",
")",
";",
"return",
"this",
";",
"}"
] | Set both a persistence and replication durability constraints for the whole mutation.
@param persistTo the persistence durability constraint to observe.
@param replicateTo the replication durability constraint to observe.
@return this builder for chaining. | [
"Set",
"both",
"a",
"persistence",
"and",
"replication",
"durability",
"constraints",
"for",
"the",
"whole",
"mutation",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java#L480-L483 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/datastructures/ResultMappingUtils.java | ResultMappingUtils.getMapResultFnForSubdocMutationToBoolean | public static Func1<DocumentFragment<Mutation>, Boolean> getMapResultFnForSubdocMutationToBoolean() {
return new Func1<DocumentFragment<Mutation>, Boolean>() {
@Override
public Boolean call(DocumentFragment<Mutation> documentFragment) {
ResponseStatus status = documentFra... | java | public static Func1<DocumentFragment<Mutation>, Boolean> getMapResultFnForSubdocMutationToBoolean() {
return new Func1<DocumentFragment<Mutation>, Boolean>() {
@Override
public Boolean call(DocumentFragment<Mutation> documentFragment) {
ResponseStatus status = documentFra... | [
"public",
"static",
"Func1",
"<",
"DocumentFragment",
"<",
"Mutation",
">",
",",
"Boolean",
">",
"getMapResultFnForSubdocMutationToBoolean",
"(",
")",
"{",
"return",
"new",
"Func1",
"<",
"DocumentFragment",
"<",
"Mutation",
">",
",",
"Boolean",
">",
"(",
")",
... | Creates anonymous function for mapping document fragment result to boolean
@return anonymous function | [
"Creates",
"anonymous",
"function",
"for",
"mapping",
"document",
"fragment",
"result",
"to",
"boolean"
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/datastructures/ResultMappingUtils.java#L42-L54 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/datastructures/ResultMappingUtils.java | ResultMappingUtils.getMapFullDocResultToSubDocFn | public static Func1<JsonDocument, DocumentFragment<Mutation>> getMapFullDocResultToSubDocFn(final Mutation mutation) {
return new Func1<JsonDocument, DocumentFragment<Mutation>>() {
@Override
public DocumentFragment<Mutation> call(JsonDocument document) {
return new Docum... | java | public static Func1<JsonDocument, DocumentFragment<Mutation>> getMapFullDocResultToSubDocFn(final Mutation mutation) {
return new Func1<JsonDocument, DocumentFragment<Mutation>>() {
@Override
public DocumentFragment<Mutation> call(JsonDocument document) {
return new Docum... | [
"public",
"static",
"Func1",
"<",
"JsonDocument",
",",
"DocumentFragment",
"<",
"Mutation",
">",
">",
"getMapFullDocResultToSubDocFn",
"(",
"final",
"Mutation",
"mutation",
")",
"{",
"return",
"new",
"Func1",
"<",
"JsonDocument",
",",
"DocumentFragment",
"<",
"Mut... | Creates anonymous function for mapping full JsonDocument insert result to document fragment result
@return anonymous function | [
"Creates",
"anonymous",
"function",
"for",
"mapping",
"full",
"JsonDocument",
"insert",
"result",
"to",
"document",
"fragment",
"result"
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/datastructures/ResultMappingUtils.java#L61-L69 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/datastructures/ResultMappingUtils.java | ResultMappingUtils.convertToSubDocumentResult | public static <E> DocumentFragment<Mutation> convertToSubDocumentResult(ResponseStatus status, Mutation mutation, E element) {
return new DocumentFragment<Mutation>(null, 0, null,
Collections.singletonList(SubdocOperationResult.createResult(null, mutation, status, element)));
} | java | public static <E> DocumentFragment<Mutation> convertToSubDocumentResult(ResponseStatus status, Mutation mutation, E element) {
return new DocumentFragment<Mutation>(null, 0, null,
Collections.singletonList(SubdocOperationResult.createResult(null, mutation, status, element)));
} | [
"public",
"static",
"<",
"E",
">",
"DocumentFragment",
"<",
"Mutation",
">",
"convertToSubDocumentResult",
"(",
"ResponseStatus",
"status",
",",
"Mutation",
"mutation",
",",
"E",
"element",
")",
"{",
"return",
"new",
"DocumentFragment",
"<",
"Mutation",
">",
"("... | Useful for mapping exceptions of Multimutation or to be silent by mapping success to a valid subdocument result
@return document fragment result | [
"Useful",
"for",
"mapping",
"exceptions",
"of",
"Multimutation",
"or",
"to",
"be",
"silent",
"by",
"mapping",
"success",
"to",
"a",
"valid",
"subdocument",
"result"
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/datastructures/ResultMappingUtils.java#L91-L94 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/N1qlParams.java | N1qlParams.consistency | public N1qlParams consistency(ScanConsistency consistency) {
this.consistency = consistency;
if (consistency == ScanConsistency.NOT_BOUNDED) {
this.scanWait = null;
}
return this;
} | java | public N1qlParams consistency(ScanConsistency consistency) {
this.consistency = consistency;
if (consistency == ScanConsistency.NOT_BOUNDED) {
this.scanWait = null;
}
return this;
} | [
"public",
"N1qlParams",
"consistency",
"(",
"ScanConsistency",
"consistency",
")",
"{",
"this",
".",
"consistency",
"=",
"consistency",
";",
"if",
"(",
"consistency",
"==",
"ScanConsistency",
".",
"NOT_BOUNDED",
")",
"{",
"this",
".",
"scanWait",
"=",
"null",
... | Sets scan consistency.
Note that {@link ScanConsistency#NOT_BOUNDED NOT_BOUNDED} will unset the {@link #scanWait} if it was set.
@return this {@link N1qlParams} for chaining. | [
"Sets",
"scan",
"consistency",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/N1qlParams.java#L237-L243 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/N1qlParams.java | N1qlParams.rawParam | @InterfaceStability.Uncommitted
public N1qlParams rawParam(String name, Object value) {
if (this.rawParams == null) {
this.rawParams = new HashMap<String, Object>();
}
if (!JsonValue.checkType(value)) {
throw new IllegalArgumentException("Only JSON types are supporte... | java | @InterfaceStability.Uncommitted
public N1qlParams rawParam(String name, Object value) {
if (this.rawParams == null) {
this.rawParams = new HashMap<String, Object>();
}
if (!JsonValue.checkType(value)) {
throw new IllegalArgumentException("Only JSON types are supporte... | [
"@",
"InterfaceStability",
".",
"Uncommitted",
"public",
"N1qlParams",
"rawParam",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"this",
".",
"rawParams",
"==",
"null",
")",
"{",
"this",
".",
"rawParams",
"=",
"new",
"HashMap",
"<",
... | Allows to specify an arbitrary, raw N1QL param.
Use with care and only provide options that are supported by the server and are not exposed as part of the
overall stable API in the {@link N1qlParams} class.
@param name the name of the property.
@param value the value of the property, only JSON value types are support... | [
"Allows",
"to",
"specify",
"an",
"arbitrary",
"raw",
"N1QL",
"param",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/N1qlParams.java#L448-L460 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/view/ViewRetryHandler.java | ViewRetryHandler.passThroughOrThrow | private static Observable<ViewQueryResponse> passThroughOrThrow(final ViewQueryResponse response) {
final int responseCode = response.responseCode();
if (responseCode == 200) {
return Observable.just(response);
}
return response
.error()
.map(new Func... | java | private static Observable<ViewQueryResponse> passThroughOrThrow(final ViewQueryResponse response) {
final int responseCode = response.responseCode();
if (responseCode == 200) {
return Observable.just(response);
}
return response
.error()
.map(new Func... | [
"private",
"static",
"Observable",
"<",
"ViewQueryResponse",
">",
"passThroughOrThrow",
"(",
"final",
"ViewQueryResponse",
"response",
")",
"{",
"final",
"int",
"responseCode",
"=",
"response",
".",
"responseCode",
"(",
")",
";",
"if",
"(",
"responseCode",
"==",
... | Helper method which decides if the response is good to pass through or needs to be retried.
@param response the response to look at.
@return the {@link ViewQueryResponse} if it can pass through or an error if it needs to be retried. | [
"Helper",
"method",
"which",
"decides",
"if",
"the",
"response",
"is",
"good",
"to",
"pass",
"through",
"or",
"needs",
"to",
"be",
"retried",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/view/ViewRetryHandler.java#L89-L107 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/view/ViewRetryHandler.java | ViewRetryHandler.shouldRetry | private static boolean shouldRetry(final int status, final String content) {
switch (status) {
case 200:
return false;
case 404:
return analyse404Response(content);
case 500:
return analyse500Response(content);
case ... | java | private static boolean shouldRetry(final int status, final String content) {
switch (status) {
case 200:
return false;
case 404:
return analyse404Response(content);
case 500:
return analyse500Response(content);
case ... | [
"private",
"static",
"boolean",
"shouldRetry",
"(",
"final",
"int",
"status",
",",
"final",
"String",
"content",
")",
"{",
"switch",
"(",
"status",
")",
"{",
"case",
"200",
":",
"return",
"false",
";",
"case",
"404",
":",
"return",
"analyse404Response",
"(... | Analyses status codes and checks if a retry needs to happen.
Some status codes are ambiguous, so their contents are inspected further.
@param status the status code.
@param content the error body from the response.
@return true if retry is needed, false otherwise. | [
"Analyses",
"status",
"codes",
"and",
"checks",
"if",
"a",
"retry",
"needs",
"to",
"happen",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/view/ViewRetryHandler.java#L118-L146 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/view/ViewRetryHandler.java | ViewRetryHandler.analyse404Response | private static boolean analyse404Response(final String content) {
if (content.contains("\"reason\":\"missing\"")) {
return true;
}
LOGGER.debug("Design document not found, error is {}", content);
return false;
} | java | private static boolean analyse404Response(final String content) {
if (content.contains("\"reason\":\"missing\"")) {
return true;
}
LOGGER.debug("Design document not found, error is {}", content);
return false;
} | [
"private",
"static",
"boolean",
"analyse404Response",
"(",
"final",
"String",
"content",
")",
"{",
"if",
"(",
"content",
".",
"contains",
"(",
"\"\\\"reason\\\":\\\"missing\\\"\"",
")",
")",
"{",
"return",
"true",
";",
"}",
"LOGGER",
".",
"debug",
"(",
"\"Desi... | Analyses the content of a 404 response to see if it is legible for retry.
If the content contains ""reason":"missing"", it is a clear indication that the responding node
is unprovisioned and therefore it should be retried. All other cases indicate a provisioned node,
but the design document/view is not found, which sh... | [
"Analyses",
"the",
"content",
"of",
"a",
"404",
"response",
"to",
"see",
"if",
"it",
"is",
"legible",
"for",
"retry",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/view/ViewRetryHandler.java#L158-L165 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/view/ViewRetryHandler.java | ViewRetryHandler.analyse500Response | private static boolean analyse500Response(final String content) {
if (content.contains("error") && content.contains("{not_found, missing_named_view}")) {
LOGGER.debug("Design document not found, error is {}", content);
return false;
}
if (content.contains("error") && cont... | java | private static boolean analyse500Response(final String content) {
if (content.contains("error") && content.contains("{not_found, missing_named_view}")) {
LOGGER.debug("Design document not found, error is {}", content);
return false;
}
if (content.contains("error") && cont... | [
"private",
"static",
"boolean",
"analyse500Response",
"(",
"final",
"String",
"content",
")",
"{",
"if",
"(",
"content",
".",
"contains",
"(",
"\"error\"",
")",
"&&",
"content",
".",
"contains",
"(",
"\"{not_found, missing_named_view}\"",
")",
")",
"{",
"LOGGER"... | Analyses the content of a 500 response to see if it is legible for retry.
@param content the parsed error content.
@return true if it needs to be retried, false otherwise. | [
"Analyses",
"the",
"content",
"of",
"a",
"500",
"response",
"to",
"see",
"if",
"it",
"is",
"legible",
"for",
"retry",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/view/ViewRetryHandler.java#L173-L183 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/CouchbaseCluster.java | CouchbaseCluster.getCachedBucket | private Bucket getCachedBucket(final String name) {
Bucket cachedBucket = bucketCache.get(name);
if(cachedBucket != null) {
if (cachedBucket.isClosed()) {
LOGGER.debug("Not returning cached bucket \"{}\", because it is closed.", name);
bucketCache.remove(name... | java | private Bucket getCachedBucket(final String name) {
Bucket cachedBucket = bucketCache.get(name);
if(cachedBucket != null) {
if (cachedBucket.isClosed()) {
LOGGER.debug("Not returning cached bucket \"{}\", because it is closed.", name);
bucketCache.remove(name... | [
"private",
"Bucket",
"getCachedBucket",
"(",
"final",
"String",
"name",
")",
"{",
"Bucket",
"cachedBucket",
"=",
"bucketCache",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"cachedBucket",
"!=",
"null",
")",
"{",
"if",
"(",
"cachedBucket",
".",
"isClosed"... | Helper method to get a bucket instead of opening it if it is cached already.
@param name the name of the bucket
@return the cached bucket if found, null if not. | [
"Helper",
"method",
"to",
"get",
"a",
"bucket",
"instead",
"of",
"opening",
"it",
"if",
"it",
"is",
"cached",
"already",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/CouchbaseCluster.java#L368-L382 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/AbstractDocument.java | AbstractDocument.writeToSerializedStream | protected void writeToSerializedStream(ObjectOutputStream stream) throws IOException {
stream.writeLong(cas);
stream.writeInt(expiry);
stream.writeUTF(id);
stream.writeObject(content);
stream.writeObject(mutationToken);
} | java | protected void writeToSerializedStream(ObjectOutputStream stream) throws IOException {
stream.writeLong(cas);
stream.writeInt(expiry);
stream.writeUTF(id);
stream.writeObject(content);
stream.writeObject(mutationToken);
} | [
"protected",
"void",
"writeToSerializedStream",
"(",
"ObjectOutputStream",
"stream",
")",
"throws",
"IOException",
"{",
"stream",
".",
"writeLong",
"(",
"cas",
")",
";",
"stream",
".",
"writeInt",
"(",
"expiry",
")",
";",
"stream",
".",
"writeUTF",
"(",
"id",
... | Helper method to write the current document state to the output stream for serialization purposes.
@param stream the stream to write to.
@throws IOException | [
"Helper",
"method",
"to",
"write",
"the",
"current",
"document",
"state",
"to",
"the",
"output",
"stream",
"for",
"serialization",
"purposes",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/AbstractDocument.java#L139-L145 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/AbstractDocument.java | AbstractDocument.readFromSerializedStream | @SuppressWarnings("unchecked")
protected void readFromSerializedStream(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
cas = stream.readLong();
expiry = stream.readInt();
id = stream.readUTF();
content = (T) stream.readObject();
mutationToken = (M... | java | @SuppressWarnings("unchecked")
protected void readFromSerializedStream(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
cas = stream.readLong();
expiry = stream.readInt();
id = stream.readUTF();
content = (T) stream.readObject();
mutationToken = (M... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"void",
"readFromSerializedStream",
"(",
"final",
"ObjectInputStream",
"stream",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"cas",
"=",
"stream",
".",
"readLong",
"(",
")",
";",
... | Helper method to create the document from an object input stream, used for serialization purposes.
@param stream the stream to read from.
@throws IOException
@throws ClassNotFoundException | [
"Helper",
"method",
"to",
"create",
"the",
"document",
"from",
"an",
"object",
"input",
"stream",
"used",
"for",
"serialization",
"purposes",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/AbstractDocument.java#L154-L161 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/view/DefaultView.java | DefaultView.create | public static View create(String name, String map, String reduce) {
return new DefaultView(name, map, reduce);
} | java | public static View create(String name, String map, String reduce) {
return new DefaultView(name, map, reduce);
} | [
"public",
"static",
"View",
"create",
"(",
"String",
"name",
",",
"String",
"map",
",",
"String",
"reduce",
")",
"{",
"return",
"new",
"DefaultView",
"(",
"name",
",",
"map",
",",
"reduce",
")",
";",
"}"
] | Create a new representation of a regular, non-spatial view.
@param name the name of the view.
@param map the map function (javascript) for the view.
@param reduce the reduce function (prebuilt name or custom javascript) for the view.
Use {@link #create(String, String)} or null if you don't need one.
@return the view o... | [
"Create",
"a",
"new",
"representation",
"of",
"a",
"regular",
"non",
"-",
"spatial",
"view",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/view/DefaultView.java#L45-L47 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/view/DefaultView.java | DefaultView.create | public static View create(String name, String map) {
return new DefaultView(name, map, null);
} | java | public static View create(String name, String map) {
return new DefaultView(name, map, null);
} | [
"public",
"static",
"View",
"create",
"(",
"String",
"name",
",",
"String",
"map",
")",
"{",
"return",
"new",
"DefaultView",
"(",
"name",
",",
"map",
",",
"null",
")",
";",
"}"
] | Create a new representation of a regular, non-spatial view without reduce function.
@param name the name of the view.
@param map the map function (javascript) for the view.
@return the view object. | [
"Create",
"a",
"new",
"representation",
"of",
"a",
"regular",
"non",
"-",
"spatial",
"view",
"without",
"reduce",
"function",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/view/DefaultView.java#L56-L58 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/search/SearchQuery.java | SearchQuery.highlight | public SearchQuery highlight(HighlightStyle style, String... fields) {
this.highlightStyle = style;
if (fields != null && fields.length > 0) {
highlightFields = fields;
}
return this;
} | java | public SearchQuery highlight(HighlightStyle style, String... fields) {
this.highlightStyle = style;
if (fields != null && fields.length > 0) {
highlightFields = fields;
}
return this;
} | [
"public",
"SearchQuery",
"highlight",
"(",
"HighlightStyle",
"style",
",",
"String",
"...",
"fields",
")",
"{",
"this",
".",
"highlightStyle",
"=",
"style",
";",
"if",
"(",
"fields",
"!=",
"null",
"&&",
"fields",
".",
"length",
">",
"0",
")",
"{",
"highl... | Configures the highlighting of matches in the response.
This drives the inclusion of the {@link SearchQueryRow#fragments() fragments} in each {@link SearchQueryRow hit}.
Note that to be highlighted, the fields must be stored in the FTS index.
@param style the {@link HighlightStyle} to apply.
@param fields the option... | [
"Configures",
"the",
"highlighting",
"of",
"matches",
"in",
"the",
"response",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/search/SearchQuery.java#L259-L265 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/search/SearchQuery.java | SearchQuery.consistentWith | public SearchQuery consistentWith(Document... docs) {
this.consistency = null;
this.mutationState = MutationState.from(docs);
return this;
} | java | public SearchQuery consistentWith(Document... docs) {
this.consistency = null;
this.mutationState = MutationState.from(docs);
return this;
} | [
"public",
"SearchQuery",
"consistentWith",
"(",
"Document",
"...",
"docs",
")",
"{",
"this",
".",
"consistency",
"=",
"null",
";",
"this",
".",
"mutationState",
"=",
"MutationState",
".",
"from",
"(",
"docs",
")",
";",
"return",
"this",
";",
"}"
] | Sets the consistency to consider for this FTS query to AT_PLUS and
uses the mutation information from the given documents to parameterize
the consistency. This replaces any consistency tuning previously set.
@param docs one or mode {@link Document} to get mutation state information from.
@return this SearchQuery for c... | [
"Sets",
"the",
"consistency",
"to",
"consider",
"for",
"this",
"FTS",
"query",
"to",
"AT_PLUS",
"and",
"uses",
"the",
"mutation",
"information",
"from",
"the",
"given",
"documents",
"to",
"parameterize",
"the",
"consistency",
".",
"This",
"replaces",
"any",
"c... | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/search/SearchQuery.java#L428-L432 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/search/SearchQuery.java | SearchQuery.consistentWith | public SearchQuery consistentWith(DocumentFragment... fragments) {
this.consistency = null;
this.mutationState = MutationState.from(fragments);
return this;
} | java | public SearchQuery consistentWith(DocumentFragment... fragments) {
this.consistency = null;
this.mutationState = MutationState.from(fragments);
return this;
} | [
"public",
"SearchQuery",
"consistentWith",
"(",
"DocumentFragment",
"...",
"fragments",
")",
"{",
"this",
".",
"consistency",
"=",
"null",
";",
"this",
".",
"mutationState",
"=",
"MutationState",
".",
"from",
"(",
"fragments",
")",
";",
"return",
"this",
";",
... | Sets the consistency to consider for this FTS query to AT_PLUS and
uses the mutation information from the given document fragments to parameterize
the consistency. This replaces any consistency tuning previously set.
@param fragments one or mode {@link DocumentFragment} to get mutation state information from.
@return ... | [
"Sets",
"the",
"consistency",
"to",
"consider",
"for",
"this",
"FTS",
"query",
"to",
"AT_PLUS",
"and",
"uses",
"the",
"mutation",
"information",
"from",
"the",
"given",
"document",
"fragments",
"to",
"parameterize",
"the",
"consistency",
".",
"This",
"replaces",... | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/search/SearchQuery.java#L442-L446 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java | Collections.anyIn | public static SatisfiesBuilder anyIn(String variable, Expression expression) {
return new SatisfiesBuilder(x("ANY"), variable, expression, true);
} | java | public static SatisfiesBuilder anyIn(String variable, Expression expression) {
return new SatisfiesBuilder(x("ANY"), variable, expression, true);
} | [
"public",
"static",
"SatisfiesBuilder",
"anyIn",
"(",
"String",
"variable",
",",
"Expression",
"expression",
")",
"{",
"return",
"new",
"SatisfiesBuilder",
"(",
"x",
"(",
"\"ANY\"",
")",
",",
"variable",
",",
"expression",
",",
"true",
")",
";",
"}"
] | Create an ANY comprehension with a first IN range.
ANY is a range predicate that allows you to test a Boolean condition over the
elements or attributes of a collection, object, or objects. It uses the IN and WITHIN operators to range through
the collection. IN ranges in the direct elements of its array expression, WIT... | [
"Create",
"an",
"ANY",
"comprehension",
"with",
"a",
"first",
"IN",
"range",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java#L155-L157 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java | Collections.anyAndEveryIn | public static SatisfiesBuilder anyAndEveryIn(String variable, Expression expression) {
return new SatisfiesBuilder(x("ANY AND EVERY"), variable, expression, true);
} | java | public static SatisfiesBuilder anyAndEveryIn(String variable, Expression expression) {
return new SatisfiesBuilder(x("ANY AND EVERY"), variable, expression, true);
} | [
"public",
"static",
"SatisfiesBuilder",
"anyAndEveryIn",
"(",
"String",
"variable",
",",
"Expression",
"expression",
")",
"{",
"return",
"new",
"SatisfiesBuilder",
"(",
"x",
"(",
"\"ANY AND EVERY\"",
")",
",",
"variable",
",",
"expression",
",",
"true",
")",
";"... | Create an ANY AND EVERY comprehension with a first IN range.
ANY is a range predicate that allows you to test a Boolean condition over the
elements or attributes of a collection, object, or objects. It uses the IN and WITHIN operators to range through
the collection.
EVERY is a range predicate that allows you to test... | [
"Create",
"an",
"ANY",
"AND",
"EVERY",
"comprehension",
"with",
"a",
"first",
"IN",
"range",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java#L170-L172 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java | Collections.anyWithin | public static SatisfiesBuilder anyWithin(String variable, Expression expression) {
return new SatisfiesBuilder(x("ANY"), variable, expression, false);
} | java | public static SatisfiesBuilder anyWithin(String variable, Expression expression) {
return new SatisfiesBuilder(x("ANY"), variable, expression, false);
} | [
"public",
"static",
"SatisfiesBuilder",
"anyWithin",
"(",
"String",
"variable",
",",
"Expression",
"expression",
")",
"{",
"return",
"new",
"SatisfiesBuilder",
"(",
"x",
"(",
"\"ANY\"",
")",
",",
"variable",
",",
"expression",
",",
"false",
")",
";",
"}"
] | Create an ANY comprehension with a first WITHIN range.
ANY is a range predicate that allows you to test a Boolean condition over the
elements or attributes of a collection, object, or objects. It uses the IN and WITHIN operators to range through
the collection.
IN ranges in the direct elements of its array expression,... | [
"Create",
"an",
"ANY",
"comprehension",
"with",
"a",
"first",
"WITHIN",
"range",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java#L184-L186 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java | Collections.everyIn | public static SatisfiesBuilder everyIn(String variable, Expression expression) {
return new SatisfiesBuilder(x("EVERY"), variable, expression, true);
} | java | public static SatisfiesBuilder everyIn(String variable, Expression expression) {
return new SatisfiesBuilder(x("EVERY"), variable, expression, true);
} | [
"public",
"static",
"SatisfiesBuilder",
"everyIn",
"(",
"String",
"variable",
",",
"Expression",
"expression",
")",
"{",
"return",
"new",
"SatisfiesBuilder",
"(",
"x",
"(",
"\"EVERY\"",
")",
",",
"variable",
",",
"expression",
",",
"true",
")",
";",
"}"
] | Create an EVERY comprehension with a first IN range.
EVERY is a range predicate that allows you to test a Boolean condition over the elements or attributes of a
collection, object, or objects. It uses the IN and WITHIN operators to range through the collection.
IN ranges in the direct elements of its array expression... | [
"Create",
"an",
"EVERY",
"comprehension",
"with",
"a",
"first",
"IN",
"range",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java#L199-L201 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java | Collections.everyWithin | public static SatisfiesBuilder everyWithin(String variable, Expression expression) {
return new SatisfiesBuilder(x("EVERY"), variable, expression, false);
} | java | public static SatisfiesBuilder everyWithin(String variable, Expression expression) {
return new SatisfiesBuilder(x("EVERY"), variable, expression, false);
} | [
"public",
"static",
"SatisfiesBuilder",
"everyWithin",
"(",
"String",
"variable",
",",
"Expression",
"expression",
")",
"{",
"return",
"new",
"SatisfiesBuilder",
"(",
"x",
"(",
"\"EVERY\"",
")",
",",
"variable",
",",
"expression",
",",
"false",
")",
";",
"}"
] | Create an EVERY comprehension with a first WITHIN range.
EVERY is a range predicate that allows you to test a Boolean condition over the elements or attributes of a
collection, object, or objects. It uses the IN and WITHIN operators to range through the collection.
IN ranges in the direct elements of its array expres... | [
"Create",
"an",
"EVERY",
"comprehension",
"with",
"a",
"first",
"WITHIN",
"range",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java#L214-L216 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java | Collections.arrayIn | public static WhenBuilder arrayIn(Expression arrayExpression, String variable, Expression expression) {
return new WhenBuilder(x("ARRAY " + arrayExpression.toString() + " FOR"),
variable, expression, true);
} | java | public static WhenBuilder arrayIn(Expression arrayExpression, String variable, Expression expression) {
return new WhenBuilder(x("ARRAY " + arrayExpression.toString() + " FOR"),
variable, expression, true);
} | [
"public",
"static",
"WhenBuilder",
"arrayIn",
"(",
"Expression",
"arrayExpression",
",",
"String",
"variable",
",",
"Expression",
"expression",
")",
"{",
"return",
"new",
"WhenBuilder",
"(",
"x",
"(",
"\"ARRAY \"",
"+",
"arrayExpression",
".",
"toString",
"(",
"... | Create an ARRAY comprehension with a first IN range.
The ARRAY operator lets you map and filter the elements or attributes of a collection, object, or objects.
It evaluates to an array of the operand expression, that satisfies the WHEN clause, if provided.
For elements, IN ranges in the direct elements of its array e... | [
"Create",
"an",
"ARRAY",
"comprehension",
"with",
"a",
"first",
"IN",
"range",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java#L226-L229 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java | Collections.arrayWithin | public static WhenBuilder arrayWithin(Expression arrayExpression, String variable, Expression expression) {
return new WhenBuilder(x("ARRAY " + arrayExpression.toString() + " FOR"),
variable, expression, false);
} | java | public static WhenBuilder arrayWithin(Expression arrayExpression, String variable, Expression expression) {
return new WhenBuilder(x("ARRAY " + arrayExpression.toString() + " FOR"),
variable, expression, false);
} | [
"public",
"static",
"WhenBuilder",
"arrayWithin",
"(",
"Expression",
"arrayExpression",
",",
"String",
"variable",
",",
"Expression",
"expression",
")",
"{",
"return",
"new",
"WhenBuilder",
"(",
"x",
"(",
"\"ARRAY \"",
"+",
"arrayExpression",
".",
"toString",
"(",... | Create an ARRAY comprehension with a first WITHIN range.
The ARRAY operator lets you map and filter the elements or attributes of a collection, object, or objects.
It evaluates to an array of the operand expression, that satisfies the WHEN clause, if provided.
For elements, IN ranges in the direct elements of its arr... | [
"Create",
"an",
"ARRAY",
"comprehension",
"with",
"a",
"first",
"WITHIN",
"range",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java#L239-L242 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/transcoder/AbstractTranscoder.java | AbstractTranscoder.newDocument | @Override
public D newDocument(String id, int expiry, T content, long cas, MutationToken mutationToken) {
LOGGER.warn("This transcoder ({}) does not support mutation tokens - this method is a " +
"stub and needs to be implemented on custom transcoders.", this.getClass().getSimpleName());
... | java | @Override
public D newDocument(String id, int expiry, T content, long cas, MutationToken mutationToken) {
LOGGER.warn("This transcoder ({}) does not support mutation tokens - this method is a " +
"stub and needs to be implemented on custom transcoders.", this.getClass().getSimpleName());
... | [
"@",
"Override",
"public",
"D",
"newDocument",
"(",
"String",
"id",
",",
"int",
"expiry",
",",
"T",
"content",
",",
"long",
"cas",
",",
"MutationToken",
"mutationToken",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"This transcoder ({}) does not support mutation tokens... | Default implementation for backwards compatibility. | [
"Default",
"implementation",
"for",
"backwards",
"compatibility",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/transcoder/AbstractTranscoder.java#L131-L136 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/transcoder/TranscoderUtils.java | TranscoderUtils.deserialize | public static Serializable deserialize(final ByteBuf content) throws Exception {
byte[] serialized = new byte[content.readableBytes()];
content.getBytes(0, serialized);
ByteArrayInputStream bis = new ByteArrayInputStream(serialized);
ObjectInputStream is = new ObjectInputStream(bis);
... | java | public static Serializable deserialize(final ByteBuf content) throws Exception {
byte[] serialized = new byte[content.readableBytes()];
content.getBytes(0, serialized);
ByteArrayInputStream bis = new ByteArrayInputStream(serialized);
ObjectInputStream is = new ObjectInputStream(bis);
... | [
"public",
"static",
"Serializable",
"deserialize",
"(",
"final",
"ByteBuf",
"content",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"serialized",
"=",
"new",
"byte",
"[",
"content",
".",
"readableBytes",
"(",
")",
"]",
";",
"content",
".",
"getBytes",
... | Takes the input content and deserializes it.
@param content the content to deserialize.
@return the serializable object.
@throws Exception if something goes wrong during deserialization. | [
"Takes",
"the",
"input",
"content",
"and",
"deserializes",
"it",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/transcoder/TranscoderUtils.java#L214-L223 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/transcoder/TranscoderUtils.java | TranscoderUtils.serialize | public static ByteBuf serialize(final Serializable serializable) throws Exception {
ByteArrayOutputStream bos = new ByteArrayOutputStream();;
ObjectOutputStream os = new ObjectOutputStream(bos);
os.writeObject(serializable);
byte[] serialized = bos.toByteArray();
os.close();
... | java | public static ByteBuf serialize(final Serializable serializable) throws Exception {
ByteArrayOutputStream bos = new ByteArrayOutputStream();;
ObjectOutputStream os = new ObjectOutputStream(bos);
os.writeObject(serializable);
byte[] serialized = bos.toByteArray();
os.close();
... | [
"public",
"static",
"ByteBuf",
"serialize",
"(",
"final",
"Serializable",
"serializable",
")",
"throws",
"Exception",
"{",
"ByteArrayOutputStream",
"bos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
";",
"ObjectOutputStream",
"os",
"=",
"new",
"ObjectOutputS... | Serializes the input into a ByteBuf.
@param serializable the object to serialize.
@return the serialized object.
@throws Exception if something goes wrong during serialization. | [
"Serializes",
"the",
"input",
"into",
"a",
"ByteBuf",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/transcoder/TranscoderUtils.java#L232-L241 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/transcoder/TranscoderUtils.java | TranscoderUtils.encodeStringAsUtf8 | public static ByteBuf encodeStringAsUtf8(String source) {
ByteBuf target = Unpooled.buffer(source.length());
ByteBufUtil.writeUtf8(target, source);
return target;
} | java | public static ByteBuf encodeStringAsUtf8(String source) {
ByteBuf target = Unpooled.buffer(source.length());
ByteBufUtil.writeUtf8(target, source);
return target;
} | [
"public",
"static",
"ByteBuf",
"encodeStringAsUtf8",
"(",
"String",
"source",
")",
"{",
"ByteBuf",
"target",
"=",
"Unpooled",
".",
"buffer",
"(",
"source",
".",
"length",
"(",
")",
")",
";",
"ByteBufUtil",
".",
"writeUtf8",
"(",
"target",
",",
"source",
")... | Helper method to encode a String into UTF8 via fast-path methods.
@param source the source document.
@return the encoded byte buffer. | [
"Helper",
"method",
"to",
"encode",
"a",
"String",
"into",
"UTF8",
"via",
"fast",
"-",
"path",
"methods",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/transcoder/TranscoderUtils.java#L249-L253 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java | AsyncMutateInBuilder.withDurability | public AsyncMutateInBuilder withDurability(PersistTo persistTo, ReplicateTo replicateTo) {
this.persistTo = persistTo;
this.replicateTo = replicateTo;
return this;
} | java | public AsyncMutateInBuilder withDurability(PersistTo persistTo, ReplicateTo replicateTo) {
this.persistTo = persistTo;
this.replicateTo = replicateTo;
return this;
} | [
"public",
"AsyncMutateInBuilder",
"withDurability",
"(",
"PersistTo",
"persistTo",
",",
"ReplicateTo",
"replicateTo",
")",
"{",
"this",
".",
"persistTo",
"=",
"persistTo",
";",
"this",
".",
"replicateTo",
"=",
"replicateTo",
";",
"return",
"this",
";",
"}"
] | Set both a persistence and a replication durability constraints for the whole mutation.
@param persistTo the persistence durability constraint to observe.
@param replicateTo the replication durability constraint to observe.
@return this builder for chaining. | [
"Set",
"both",
"a",
"persistence",
"and",
"a",
"replication",
"durability",
"constraints",
"for",
"the",
"whole",
"mutation",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L599-L603 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java | AsyncMutateInBuilder.insertDocument | @InterfaceStability.Committed
public AsyncMutateInBuilder insertDocument(boolean insertDocument) {
if (this.upsertDocument && insertDocument) {
throw new IllegalArgumentException("Cannot set both upsertDocument and insertDocument to true");
}
this.insertDocument = insertDocument;... | java | @InterfaceStability.Committed
public AsyncMutateInBuilder insertDocument(boolean insertDocument) {
if (this.upsertDocument && insertDocument) {
throw new IllegalArgumentException("Cannot set both upsertDocument and insertDocument to true");
}
this.insertDocument = insertDocument;... | [
"@",
"InterfaceStability",
".",
"Committed",
"public",
"AsyncMutateInBuilder",
"insertDocument",
"(",
"boolean",
"insertDocument",
")",
"{",
"if",
"(",
"this",
".",
"upsertDocument",
"&&",
"insertDocument",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
... | Set insertDocument to true, if the document has to be created only if it does not exist
@param insertDocument true to insert document. | [
"Set",
"insertDocument",
"to",
"true",
"if",
"the",
"document",
"has",
"to",
"be",
"created",
"only",
"if",
"it",
"does",
"not",
"exist"
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L634-L641 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java | AsyncMutateInBuilder.insert | public <T> AsyncMutateInBuilder insert(String path, T fragment, SubdocOptionsBuilder optionsBuilder) {
if (StringUtil.isNullOrEmpty(path)) {
throw new IllegalArgumentException("Path must not be empty for insert");
}
this.mutationSpecs.add(new MutationSpec(Mutation.DICT_ADD, path, fra... | java | public <T> AsyncMutateInBuilder insert(String path, T fragment, SubdocOptionsBuilder optionsBuilder) {
if (StringUtil.isNullOrEmpty(path)) {
throw new IllegalArgumentException("Path must not be empty for insert");
}
this.mutationSpecs.add(new MutationSpec(Mutation.DICT_ADD, path, fra... | [
"public",
"<",
"T",
">",
"AsyncMutateInBuilder",
"insert",
"(",
"String",
"path",
",",
"T",
"fragment",
",",
"SubdocOptionsBuilder",
"optionsBuilder",
")",
"{",
"if",
"(",
"StringUtil",
".",
"isNullOrEmpty",
"(",
"path",
")",
")",
"{",
"throw",
"new",
"Illeg... | Insert a fragment, provided the last element of the path doesn't exist.
@param path the path where to insert a new dictionary value.
@param fragment the new dictionary value to insert.
@param optionsBuilder {@link SubdocOptionsBuilder} | [
"Insert",
"a",
"fragment",
"provided",
"the",
"last",
"element",
"of",
"the",
"path",
"doesn",
"t",
"exist",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L707-L713 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java | AsyncMutateInBuilder.upsert | @InterfaceStability.Committed
public AsyncMutateInBuilder upsert(JsonObject content) {
this.mutationSpecs.add(new MutationSpec(Mutation.UPSERTDOC, "", content));
return this;
} | java | @InterfaceStability.Committed
public AsyncMutateInBuilder upsert(JsonObject content) {
this.mutationSpecs.add(new MutationSpec(Mutation.UPSERTDOC, "", content));
return this;
} | [
"@",
"InterfaceStability",
".",
"Committed",
"public",
"AsyncMutateInBuilder",
"upsert",
"(",
"JsonObject",
"content",
")",
"{",
"this",
".",
"mutationSpecs",
".",
"add",
"(",
"new",
"MutationSpec",
"(",
"Mutation",
".",
"UPSERTDOC",
",",
"\"\"",
",",
"content",... | Upsert a full JSON document.
@param content full content of the JSON document | [
"Upsert",
"a",
"full",
"JSON",
"document",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L747-L751 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java | AsyncMutateInBuilder.doSingleMutate | protected Observable<DocumentFragment<Mutation>> doSingleMutate(MutationSpec spec, long timeout, TimeUnit timeUnit) {
Observable<DocumentFragment<Mutation>> mutation;
switch (spec.type()) {
case DICT_UPSERT:
mutation = doSingleMutate(spec, DICT_UPSERT_FACTORY, DICT_UPSERT_EVA... | java | protected Observable<DocumentFragment<Mutation>> doSingleMutate(MutationSpec spec, long timeout, TimeUnit timeUnit) {
Observable<DocumentFragment<Mutation>> mutation;
switch (spec.type()) {
case DICT_UPSERT:
mutation = doSingleMutate(spec, DICT_UPSERT_FACTORY, DICT_UPSERT_EVA... | [
"protected",
"Observable",
"<",
"DocumentFragment",
"<",
"Mutation",
">",
">",
"doSingleMutate",
"(",
"MutationSpec",
"spec",
",",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"Observable",
"<",
"DocumentFragment",
"<",
"Mutation",
">>",
"mutation",
... | Single operation implementations | [
"Single",
"operation",
"implementations"
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L1342-L1375 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java | AsyncMutateInBuilder.subdocObserveMutation | private <T> Observable<DocumentFragment<T>> subdocObserveMutation(Observable<DocumentFragment<T>> mutation, final long timeout, final TimeUnit timeUnit) {
if (persistTo == PersistTo.NONE && replicateTo == ReplicateTo.NONE) {
return mutation;
}
return mutation.flatMap(new Func1<Docum... | java | private <T> Observable<DocumentFragment<T>> subdocObserveMutation(Observable<DocumentFragment<T>> mutation, final long timeout, final TimeUnit timeUnit) {
if (persistTo == PersistTo.NONE && replicateTo == ReplicateTo.NONE) {
return mutation;
}
return mutation.flatMap(new Func1<Docum... | [
"private",
"<",
"T",
">",
"Observable",
"<",
"DocumentFragment",
"<",
"T",
">",
">",
"subdocObserveMutation",
"(",
"Observable",
"<",
"DocumentFragment",
"<",
"T",
">",
">",
"mutation",
",",
"final",
"long",
"timeout",
",",
"final",
"TimeUnit",
"timeUnit",
"... | utility methods for mutations | [
"utility",
"methods",
"for",
"mutations"
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L1779-L1810 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/CouchbaseAsyncBucket.java | CouchbaseAsyncBucket.startTracing | private Span startTracing(String spanName) {
if (!environment.operationTracingEnabled()) {
return null;
}
Scope scope = environment.tracer()
.buildSpan(spanName)
.startActive(false);
Span parent = scope.span();
scope.close();
return par... | java | private Span startTracing(String spanName) {
if (!environment.operationTracingEnabled()) {
return null;
}
Scope scope = environment.tracer()
.buildSpan(spanName)
.startActive(false);
Span parent = scope.span();
scope.close();
return par... | [
"private",
"Span",
"startTracing",
"(",
"String",
"spanName",
")",
"{",
"if",
"(",
"!",
"environment",
".",
"operationTracingEnabled",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"Scope",
"scope",
"=",
"environment",
".",
"tracer",
"(",
")",
".",
"bu... | Helper method to start tracing and return the span. | [
"Helper",
"method",
"to",
"start",
"tracing",
"and",
"return",
"the",
"span",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/CouchbaseAsyncBucket.java#L2071-L2081 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/CouchbaseAsyncBucket.java | CouchbaseAsyncBucket.stopTracing | private Action0 stopTracing(final Span parent) {
return new Action0() {
@Override
public void call() {
if (parent != null) {
environment.tracer().scopeManager()
.activate(parent, true)
.close();
... | java | private Action0 stopTracing(final Span parent) {
return new Action0() {
@Override
public void call() {
if (parent != null) {
environment.tracer().scopeManager()
.activate(parent, true)
.close();
... | [
"private",
"Action0",
"stopTracing",
"(",
"final",
"Span",
"parent",
")",
"{",
"return",
"new",
"Action0",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"call",
"(",
")",
"{",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"environment",
".",
"tracer... | Helper method to stop tracing for the parent span given. | [
"Helper",
"method",
"to",
"stop",
"tracing",
"for",
"the",
"parent",
"span",
"given",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/CouchbaseAsyncBucket.java#L2086-L2097 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/bucket/BucketFlusher.java | BucketFlusher.createMarkerDocuments | private static Observable<List<String>> createMarkerDocuments(final ClusterFacade core, final String bucket) {
return Observable
.from(FLUSH_MARKERS)
.flatMap(new Func1<String, Observable<UpsertResponse>>() {
@Override
public Observable<UpsertResponse> cal... | java | private static Observable<List<String>> createMarkerDocuments(final ClusterFacade core, final String bucket) {
return Observable
.from(FLUSH_MARKERS)
.flatMap(new Func1<String, Observable<UpsertResponse>>() {
@Override
public Observable<UpsertResponse> cal... | [
"private",
"static",
"Observable",
"<",
"List",
"<",
"String",
">",
">",
"createMarkerDocuments",
"(",
"final",
"ClusterFacade",
"core",
",",
"final",
"String",
"bucket",
")",
"{",
"return",
"Observable",
".",
"from",
"(",
"FLUSH_MARKERS",
")",
".",
"flatMap",... | Helper method to create marker documents for each partition.
@param core the core reference.
@param bucket the name of the bucket.
@return a list of created flush marker IDs once they are completely upserted. | [
"Helper",
"method",
"to",
"create",
"marker",
"documents",
"for",
"each",
"partition",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/bucket/BucketFlusher.java#L118-L149 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/bucket/BucketFlusher.java | BucketFlusher.initiateFlush | private static Observable<Boolean> initiateFlush(final ClusterFacade core, final String bucket, final String username, final String password) {
return deferAndWatch(new Func1<Subscriber, Observable<FlushResponse>>() {
@Override
public Observable<FlushResponse> call(Subscriber sub... | java | private static Observable<Boolean> initiateFlush(final ClusterFacade core, final String bucket, final String username, final String password) {
return deferAndWatch(new Func1<Subscriber, Observable<FlushResponse>>() {
@Override
public Observable<FlushResponse> call(Subscriber sub... | [
"private",
"static",
"Observable",
"<",
"Boolean",
">",
"initiateFlush",
"(",
"final",
"ClusterFacade",
"core",
",",
"final",
"String",
"bucket",
",",
"final",
"String",
"username",
",",
"final",
"String",
"password",
")",
"{",
"return",
"deferAndWatch",
"(",
... | Initiates a flush request against the server.
The result indicates if polling needs to be done or the flush is already complete. It can also fail in case
flush is disabled or something else went wrong in the server response.
@param core the core reference.
@param bucket the bucket to flush.
@param username the user a... | [
"Initiates",
"a",
"flush",
"request",
"against",
"the",
"server",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/bucket/BucketFlusher.java#L163-L186 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/bucket/BucketFlusher.java | BucketFlusher.pollMarkerDocuments | private static Observable<Boolean> pollMarkerDocuments(final ClusterFacade core, final String bucket) {
return Observable
.from(FLUSH_MARKERS)
.flatMap(new Func1<String, Observable<GetResponse>>() {
@Override
public Observable<GetResponse> call(final Strin... | java | private static Observable<Boolean> pollMarkerDocuments(final ClusterFacade core, final String bucket) {
return Observable
.from(FLUSH_MARKERS)
.flatMap(new Func1<String, Observable<GetResponse>>() {
@Override
public Observable<GetResponse> call(final Strin... | [
"private",
"static",
"Observable",
"<",
"Boolean",
">",
"pollMarkerDocuments",
"(",
"final",
"ClusterFacade",
"core",
",",
"final",
"String",
"bucket",
")",
"{",
"return",
"Observable",
".",
"from",
"(",
"FLUSH_MARKERS",
")",
".",
"flatMap",
"(",
"new",
"Func1... | Helper method to poll the list of marker documents until all of them are gone.
@param core the core reference.
@param bucket the name of the bucket.
@return an observable completing when all marker documents are gone. | [
"Helper",
"method",
"to",
"poll",
"the",
"list",
"of",
"marker",
"documents",
"until",
"all",
"of",
"them",
"are",
"gone",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/bucket/BucketFlusher.java#L195-L247 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncLookupInBuilder.java | AsyncLookupInBuilder.existsIn | private Observable<DocumentFragment<Lookup>> existsIn(final String id, final LookupSpec spec,
final long timeout, final TimeUnit timeUnit) {
return Observable.defer(new Func0<Observable<DocumentFragment<Lookup>>>() {
@Override
public Observable<DocumentFragment<Lookup>> call() {
... | java | private Observable<DocumentFragment<Lookup>> existsIn(final String id, final LookupSpec spec,
final long timeout, final TimeUnit timeUnit) {
return Observable.defer(new Func0<Observable<DocumentFragment<Lookup>>>() {
@Override
public Observable<DocumentFragment<Lookup>> call() {
... | [
"private",
"Observable",
"<",
"DocumentFragment",
"<",
"Lookup",
">",
">",
"existsIn",
"(",
"final",
"String",
"id",
",",
"final",
"LookupSpec",
"spec",
",",
"final",
"long",
"timeout",
",",
"final",
"TimeUnit",
"timeUnit",
")",
"{",
"return",
"Observable",
... | Helper method to actually perform the subdoc exists operation. | [
"Helper",
"method",
"to",
"actually",
"perform",
"the",
"subdoc",
"exists",
"operation",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncLookupInBuilder.java#L669-L716 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncLookupInBuilder.java | AsyncLookupInBuilder.getCountIn | private Observable<DocumentFragment<Lookup>> getCountIn(final String id, final LookupSpec spec,
final long timeout, final TimeUnit timeUnit) {
return Observable.defer(new Func0<Observable<DocumentFragment<Lookup>>>() {
@Override
public Observable<DocumentFragment<Lookup>> call() ... | java | private Observable<DocumentFragment<Lookup>> getCountIn(final String id, final LookupSpec spec,
final long timeout, final TimeUnit timeUnit) {
return Observable.defer(new Func0<Observable<DocumentFragment<Lookup>>>() {
@Override
public Observable<DocumentFragment<Lookup>> call() ... | [
"private",
"Observable",
"<",
"DocumentFragment",
"<",
"Lookup",
">",
">",
"getCountIn",
"(",
"final",
"String",
"id",
",",
"final",
"LookupSpec",
"spec",
",",
"final",
"long",
"timeout",
",",
"final",
"TimeUnit",
"timeUnit",
")",
"{",
"return",
"Observable",
... | Helper method to actually perform the subdoc get count operation. | [
"Helper",
"method",
"to",
"actually",
"perform",
"the",
"subdoc",
"get",
"count",
"operation",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncLookupInBuilder.java#L721-L776 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonValue.java | JsonValue.checkType | public static boolean checkType(Object item) {
return item == null
|| item instanceof String
|| item instanceof Integer
|| item instanceof Long
|| item instanceof Double
|| item instanceof Boolean
|| item instanceof BigInteger
|... | java | public static boolean checkType(Object item) {
return item == null
|| item instanceof String
|| item instanceof Integer
|| item instanceof Long
|| item instanceof Double
|| item instanceof Boolean
|| item instanceof BigInteger
|... | [
"public",
"static",
"boolean",
"checkType",
"(",
"Object",
"item",
")",
"{",
"return",
"item",
"==",
"null",
"||",
"item",
"instanceof",
"String",
"||",
"item",
"instanceof",
"Integer",
"||",
"item",
"instanceof",
"Long",
"||",
"item",
"instanceof",
"Double",
... | Helper method to check if the given item is a supported JSON item.
@param item the value to check.
@return true if supported, false otherwise. | [
"Helper",
"method",
"to",
"check",
"if",
"the",
"given",
"item",
"is",
"a",
"supported",
"JSON",
"item",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonValue.java#L58-L69 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/repository/mapping/ReflectionBasedEntityMetadata.java | ReflectionBasedEntityMetadata.getAllDeclaredFields | private static List<Field> getAllDeclaredFields(final Class<?> sourceEntity) {
List<Field> fields = new ArrayList<Field>();
Class<?> clazz = sourceEntity;
while (clazz != null) {
Field[] f = clazz.getDeclaredFields();
fields.addAll(Arrays.asList(f));
clazz = c... | java | private static List<Field> getAllDeclaredFields(final Class<?> sourceEntity) {
List<Field> fields = new ArrayList<Field>();
Class<?> clazz = sourceEntity;
while (clazz != null) {
Field[] f = clazz.getDeclaredFields();
fields.addAll(Arrays.asList(f));
clazz = c... | [
"private",
"static",
"List",
"<",
"Field",
">",
"getAllDeclaredFields",
"(",
"final",
"Class",
"<",
"?",
">",
"sourceEntity",
")",
"{",
"List",
"<",
"Field",
">",
"fields",
"=",
"new",
"ArrayList",
"<",
"Field",
">",
"(",
")",
";",
"Class",
"<",
"?",
... | Helper method to grab all the declared fields from the given class but also
from its inherited parents!
@param sourceEntity the source entity to start from.
@return an iterable of found fields. | [
"Helper",
"method",
"to",
"grab",
"all",
"the",
"declared",
"fields",
"from",
"the",
"given",
"class",
"but",
"also",
"from",
"its",
"inherited",
"parents!"
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/repository/mapping/ReflectionBasedEntityMetadata.java#L56-L65 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/datastructures/collections/CouchbaseArraySet.java | CouchbaseArraySet.enforcePrimitive | protected void enforcePrimitive(Object t) throws ClassCastException {
if (!JsonValue.checkType(t)
|| t instanceof JsonValue) {
throw new ClassCastException("Only primitive types are supported in CouchbaseArraySet, got a " + t.getClass().getName());
}
} | java | protected void enforcePrimitive(Object t) throws ClassCastException {
if (!JsonValue.checkType(t)
|| t instanceof JsonValue) {
throw new ClassCastException("Only primitive types are supported in CouchbaseArraySet, got a " + t.getClass().getName());
}
} | [
"protected",
"void",
"enforcePrimitive",
"(",
"Object",
"t",
")",
"throws",
"ClassCastException",
"{",
"if",
"(",
"!",
"JsonValue",
".",
"checkType",
"(",
"t",
")",
"||",
"t",
"instanceof",
"JsonValue",
")",
"{",
"throw",
"new",
"ClassCastException",
"(",
"\... | Verify that the type of object t is compatible with CouchbaseArraySet storage.
@param t the object to check.
@throws ClassCastException if the object is incompatible. | [
"Verify",
"that",
"the",
"type",
"of",
"object",
"t",
"is",
"compatible",
"with",
"CouchbaseArraySet",
"storage",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/datastructures/collections/CouchbaseArraySet.java#L213-L218 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/Expression.java | Expression.infix | private static Expression infix(String infix, String left, String right) {
return new Expression(left + " " + infix + " " + right);
} | java | private static Expression infix(String infix, String left, String right) {
return new Expression(left + " " + infix + " " + right);
} | [
"private",
"static",
"Expression",
"infix",
"(",
"String",
"infix",
",",
"String",
"left",
",",
"String",
"right",
")",
"{",
"return",
"new",
"Expression",
"(",
"left",
"+",
"\" \"",
"+",
"infix",
"+",
"\" \"",
"+",
"right",
")",
";",
"}"
] | Helper method to infix a string.
@param infix the infix.
@param left the left side of the expression.
@param right the right side of the expression.
@return a infixed expression. | [
"Helper",
"method",
"to",
"infix",
"a",
"string",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/Expression.java#L1864-L1866 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/Expression.java | Expression.wrapWith | private static String wrapWith(char wrapper, String... input) {
StringBuilder escaped = new StringBuilder();
for (String i : input) {
escaped.append(", ");
escaped.append(wrapper).append(i).append(wrapper);
}
if (escaped.length() > 2) {
escaped.delete(... | java | private static String wrapWith(char wrapper, String... input) {
StringBuilder escaped = new StringBuilder();
for (String i : input) {
escaped.append(", ");
escaped.append(wrapper).append(i).append(wrapper);
}
if (escaped.length() > 2) {
escaped.delete(... | [
"private",
"static",
"String",
"wrapWith",
"(",
"char",
"wrapper",
",",
"String",
"...",
"input",
")",
"{",
"StringBuilder",
"escaped",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"String",
"i",
":",
"input",
")",
"{",
"escaped",
".",
"append... | Helper method to wrap varargs with the given character.
@param wrapper the wrapper character.
@param input the input fields to wrap.
@return a concatenated string with characters wrapped. | [
"Helper",
"method",
"to",
"wrap",
"varargs",
"with",
"the",
"given",
"character",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/Expression.java#L1886-L1896 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/CouchbaseAsyncCluster.java | CouchbaseAsyncCluster.assembleSeedNodes | private static List<String> assembleSeedNodes(ConnectionString connectionString,
CouchbaseEnvironment environment) {
List<String> seedNodes = new ArrayList<String>();
if (environment.dnsSrvEnabled()) {
seedNodesViaDnsSrv(connectionString, environment, seedNodes);
} else {
... | java | private static List<String> assembleSeedNodes(ConnectionString connectionString,
CouchbaseEnvironment environment) {
List<String> seedNodes = new ArrayList<String>();
if (environment.dnsSrvEnabled()) {
seedNodesViaDnsSrv(connectionString, environment, seedNodes);
} else {
... | [
"private",
"static",
"List",
"<",
"String",
">",
"assembleSeedNodes",
"(",
"ConnectionString",
"connectionString",
",",
"CouchbaseEnvironment",
"environment",
")",
"{",
"List",
"<",
"String",
">",
"seedNodes",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")... | Helper method to assemble list of seed nodes depending on the given input.
If DNS SRV is enabled, see
{@link #seedNodesViaDnsSrv(ConnectionString, CouchbaseEnvironment, List)} for more
details.
@param connectionString the connection string to check.
@param environment the environment for context.
@return a list of se... | [
"Helper",
"method",
"to",
"assemble",
"list",
"of",
"seed",
"nodes",
"depending",
"on",
"the",
"given",
"input",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/CouchbaseAsyncCluster.java#L304-L321 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/CouchbaseAsyncCluster.java | CouchbaseAsyncCluster.seedNodesViaDnsSrv | private static void seedNodesViaDnsSrv(ConnectionString connectionString,
CouchbaseEnvironment environment, List<String> seedNodes) {
if (connectionString.allHosts().size() == 1) {
InetSocketAddress lookupNode = connectionString.allHosts().get(0);
LOGGER.debug(
"At... | java | private static void seedNodesViaDnsSrv(ConnectionString connectionString,
CouchbaseEnvironment environment, List<String> seedNodes) {
if (connectionString.allHosts().size() == 1) {
InetSocketAddress lookupNode = connectionString.allHosts().get(0);
LOGGER.debug(
"At... | [
"private",
"static",
"void",
"seedNodesViaDnsSrv",
"(",
"ConnectionString",
"connectionString",
",",
"CouchbaseEnvironment",
"environment",
",",
"List",
"<",
"String",
">",
"seedNodes",
")",
"{",
"if",
"(",
"connectionString",
".",
"allHosts",
"(",
")",
".",
"size... | Helper method to assemble the list of seed nodes via DNS SRV.
If DNS SRV is enabled on the environment and exactly one hostname is passed in (not an IP
address), the code performs a DNS SRV lookup, but falls back to the A record if nothing
suitable is found. Since the user is expected to enable it manually, a warning ... | [
"Helper",
"method",
"to",
"assemble",
"the",
"list",
"of",
"seed",
"nodes",
"via",
"DNS",
"SRV",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/CouchbaseAsyncCluster.java#L335-L363 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/cluster/api/AsyncRestBuilder.java | AsyncRestBuilder.execute | public Observable<RestApiResponse> execute() {
return deferAndWatch(new Func1<Subscriber, Observable<? extends RestApiResponse>>() {
@Override
public Observable<? extends RestApiResponse> call(Subscriber subscriber) {
RestApiRequest apiRequest = asRequest();
... | java | public Observable<RestApiResponse> execute() {
return deferAndWatch(new Func1<Subscriber, Observable<? extends RestApiResponse>>() {
@Override
public Observable<? extends RestApiResponse> call(Subscriber subscriber) {
RestApiRequest apiRequest = asRequest();
... | [
"public",
"Observable",
"<",
"RestApiResponse",
">",
"execute",
"(",
")",
"{",
"return",
"deferAndWatch",
"(",
"new",
"Func1",
"<",
"Subscriber",
",",
"Observable",
"<",
"?",
"extends",
"RestApiResponse",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
... | Executes the API request in an asynchronous fashion.
The return type is an {@link Observable} that will only emit the result of executing the request.
It is a cold Observable (and the request is only sent when it is subscribed to).
@return an {@link Observable} of the result of the API call, which is a {@link RestApi... | [
"Executes",
"the",
"API",
"request",
"in",
"an",
"asynchronous",
"fashion",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/cluster/api/AsyncRestBuilder.java#L240-L250 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/repository/mapping/DefaultEntityConverter.java | DefaultEntityConverter.metadata | private EntityMetadata metadata(final Class<?> source) {
EntityMetadata metadata = metadataCache.get(source);
if (metadata == null) {
EntityMetadata generated = new ReflectionBasedEntityMetadata(source);
metadataCache.put(source, generated);
return generated;
... | java | private EntityMetadata metadata(final Class<?> source) {
EntityMetadata metadata = metadataCache.get(source);
if (metadata == null) {
EntityMetadata generated = new ReflectionBasedEntityMetadata(source);
metadataCache.put(source, generated);
return generated;
... | [
"private",
"EntityMetadata",
"metadata",
"(",
"final",
"Class",
"<",
"?",
">",
"source",
")",
"{",
"EntityMetadata",
"metadata",
"=",
"metadataCache",
".",
"get",
"(",
"source",
")",
";",
"if",
"(",
"metadata",
"==",
"null",
")",
"{",
"EntityMetadata",
"ge... | Helper method to return and cache the entity metadata.
@param source the source class.
@return the metadata. | [
"Helper",
"method",
"to",
"return",
"and",
"cache",
"the",
"entity",
"metadata",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/repository/mapping/DefaultEntityConverter.java#L110-L120 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/repository/mapping/DefaultEntityConverter.java | DefaultEntityConverter.verifyId | private static void verifyId(final EntityMetadata entityMetadata) {
if (!entityMetadata.hasIdProperty()) {
throw new RepositoryMappingException("No field annotated with @Id present.");
}
if (entityMetadata.idProperty().type() != String.class) {
throw new RepositoryMappin... | java | private static void verifyId(final EntityMetadata entityMetadata) {
if (!entityMetadata.hasIdProperty()) {
throw new RepositoryMappingException("No field annotated with @Id present.");
}
if (entityMetadata.idProperty().type() != String.class) {
throw new RepositoryMappin... | [
"private",
"static",
"void",
"verifyId",
"(",
"final",
"EntityMetadata",
"entityMetadata",
")",
"{",
"if",
"(",
"!",
"entityMetadata",
".",
"hasIdProperty",
"(",
")",
")",
"{",
"throw",
"new",
"RepositoryMappingException",
"(",
"\"No field annotated with @Id present.\... | Helper method to check that the ID field is present and is of the desired types.
@param entityMetadata the entity metadata. | [
"Helper",
"method",
"to",
"check",
"that",
"the",
"ID",
"field",
"is",
"present",
"and",
"is",
"of",
"the",
"desired",
"types",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/repository/mapping/DefaultEntityConverter.java#L128-L136 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/PatternMatchingFunctions.java | PatternMatchingFunctions.regexpReplace | public static Expression regexpReplace(Expression expression, String pattern, String repl) {
return x("REGEXP_REPLACE(" + expression.toString() + ", \"" + pattern + "\", \"" + repl + "\")");
} | java | public static Expression regexpReplace(Expression expression, String pattern, String repl) {
return x("REGEXP_REPLACE(" + expression.toString() + ", \"" + pattern + "\", \"" + repl + "\")");
} | [
"public",
"static",
"Expression",
"regexpReplace",
"(",
"Expression",
"expression",
",",
"String",
"pattern",
",",
"String",
"repl",
")",
"{",
"return",
"x",
"(",
"\"REGEXP_REPLACE(\"",
"+",
"expression",
".",
"toString",
"(",
")",
"+",
"\", \\\"\"",
"+",
"pat... | Returned expression results in a new string with all occurrences of pattern replaced with repl. | [
"Returned",
"expression",
"results",
"in",
"a",
"new",
"string",
"with",
"all",
"occurrences",
"of",
"pattern",
"replaced",
"with",
"repl",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/PatternMatchingFunctions.java#L100-L102 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/JsonFunctions.java | JsonFunctions.decodeJson | public static Expression decodeJson(JsonObject json) {
char[] encoded = JsonStringEncoder.getInstance().quoteAsString(json.toString());
return x("DECODE_JSON(\"" + new String(encoded) + "\")");
} | java | public static Expression decodeJson(JsonObject json) {
char[] encoded = JsonStringEncoder.getInstance().quoteAsString(json.toString());
return x("DECODE_JSON(\"" + new String(encoded) + "\")");
} | [
"public",
"static",
"Expression",
"decodeJson",
"(",
"JsonObject",
"json",
")",
"{",
"char",
"[",
"]",
"encoded",
"=",
"JsonStringEncoder",
".",
"getInstance",
"(",
")",
".",
"quoteAsString",
"(",
"json",
".",
"toString",
"(",
")",
")",
";",
"return",
"x",... | The returned Expression unmarshals the JSON constant
into a N1QL value. The empty string results in MISSING. | [
"The",
"returned",
"Expression",
"unmarshals",
"the",
"JSON",
"constant",
"into",
"a",
"N1QL",
"value",
".",
"The",
"empty",
"string",
"results",
"in",
"MISSING",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/JsonFunctions.java#L51-L54 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/JsonFunctions.java | JsonFunctions.decodeJson | public static Expression decodeJson(String jsonString) {
try {
JsonObject jsonObject = CouchbaseAsyncBucket.JSON_OBJECT_TRANSCODER.stringToJsonObject(jsonString);
return decodeJson(jsonObject);
} catch (Exception e) {
throw new IllegalArgumentException("String is not ... | java | public static Expression decodeJson(String jsonString) {
try {
JsonObject jsonObject = CouchbaseAsyncBucket.JSON_OBJECT_TRANSCODER.stringToJsonObject(jsonString);
return decodeJson(jsonObject);
} catch (Exception e) {
throw new IllegalArgumentException("String is not ... | [
"public",
"static",
"Expression",
"decodeJson",
"(",
"String",
"jsonString",
")",
"{",
"try",
"{",
"JsonObject",
"jsonObject",
"=",
"CouchbaseAsyncBucket",
".",
"JSON_OBJECT_TRANSCODER",
".",
"stringToJsonObject",
"(",
"jsonString",
")",
";",
"return",
"decodeJson",
... | The returned Expression unmarshals the JSON-encoded string
into a N1QL value. The empty string results in MISSING.
The string must represent JSON object marshalled into a JSON String,
eg. "{\"test\": true}" (excluding surrounding quotes). | [
"The",
"returned",
"Expression",
"unmarshals",
"the",
"JSON",
"-",
"encoded",
"string",
"into",
"a",
"N1QL",
"value",
".",
"The",
"empty",
"string",
"results",
"in",
"MISSING",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/JsonFunctions.java#L63-L70 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonObject.java | JsonObject.getAndDecrypt | public Object getAndDecrypt(final String name, String providerName) throws Exception {
return decrypt((JsonObject) content.get(ENCRYPTION_PREFIX + name), providerName);
} | java | public Object getAndDecrypt(final String name, String providerName) throws Exception {
return decrypt((JsonObject) content.get(ENCRYPTION_PREFIX + name), providerName);
} | [
"public",
"Object",
"getAndDecrypt",
"(",
"final",
"String",
"name",
",",
"String",
"providerName",
")",
"throws",
"Exception",
"{",
"return",
"decrypt",
"(",
"(",
"JsonObject",
")",
"content",
".",
"get",
"(",
"ENCRYPTION_PREFIX",
"+",
"name",
")",
",",
"pr... | Retrieve and decrypt content and not casting its type
Note: Use of the Field Level Encryption functionality provided in the
com.couchbase.client.encryption namespace provided by Couchbase is
subject to the Couchbase Inc. Enterprise Subscription License Agreement
at https://www.couchbase.com/ESLA-11132015.
@param name... | [
"Retrieve",
"and",
"decrypt",
"content",
"and",
"not",
"casting",
"its",
"type"
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L323-L325 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonObject.java | JsonObject.putNullAndEncrypt | public JsonObject putNullAndEncrypt(String name, String providerName) {
addValueEncryptionInfo(name, providerName, true);
content.put(name, null);
return this;
} | java | public JsonObject putNullAndEncrypt(String name, String providerName) {
addValueEncryptionInfo(name, providerName, true);
content.put(name, null);
return this;
} | [
"public",
"JsonObject",
"putNullAndEncrypt",
"(",
"String",
"name",
",",
"String",
"providerName",
")",
"{",
"addValueEncryptionInfo",
"(",
"name",
",",
"providerName",
",",
"true",
")",
";",
"content",
".",
"put",
"(",
"name",
",",
"null",
")",
";",
"return... | Store a null value as encrypted identified by the field's name.
This method is equivalent to calling {@link #put(String, Object)} with either
{@link JsonValue#NULL JsonValue.NULL} or a null value explicitly cast to Object.
Note: Use of the Field Level Encryption functionality provided in the
com.couchbase.client.encr... | [
"Store",
"a",
"null",
"value",
"as",
"encrypted",
"identified",
"by",
"the",
"field",
"s",
"name",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L1010-L1014 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonObject.java | JsonObject.addValueEncryptionInfo | @InterfaceAudience.Private
private void addValueEncryptionInfo(String path, String providerName, boolean escape) {
if (escape) {
path = path.replaceAll("~", "~0").replaceAll("/", "~1");
}
if (this.encryptionPathInfo == null) {
this.encryptionPathInfo = new HashMap<Str... | java | @InterfaceAudience.Private
private void addValueEncryptionInfo(String path, String providerName, boolean escape) {
if (escape) {
path = path.replaceAll("~", "~0").replaceAll("/", "~1");
}
if (this.encryptionPathInfo == null) {
this.encryptionPathInfo = new HashMap<Str... | [
"@",
"InterfaceAudience",
".",
"Private",
"private",
"void",
"addValueEncryptionInfo",
"(",
"String",
"path",
",",
"String",
"providerName",
",",
"boolean",
"escape",
")",
"{",
"if",
"(",
"escape",
")",
"{",
"path",
"=",
"path",
".",
"replaceAll",
"(",
"\"~\... | Adds to the encryption info with optional escape for json pointer syntax
@param path Name of the key
@param providerName Value encryption configuration | [
"Adds",
"to",
"the",
"encryption",
"info",
"with",
"optional",
"escape",
"for",
"json",
"pointer",
"syntax"
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L1219-L1228 | train |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/util/retry/Retry.java | Retry.errorsWithAttempts | protected static Observable<Tuple2<Integer, Throwable>> errorsWithAttempts(Observable<? extends Throwable> errors,
final int expectedAttempts) {
return errors.zipWith(
Observable.range(1, expectedAttempts),
new Func2<Throwable, Integer, Tuple2<Integer, Throwable>>() {... | java | protected static Observable<Tuple2<Integer, Throwable>> errorsWithAttempts(Observable<? extends Throwable> errors,
final int expectedAttempts) {
return errors.zipWith(
Observable.range(1, expectedAttempts),
new Func2<Throwable, Integer, Tuple2<Integer, Throwable>>() {... | [
"protected",
"static",
"Observable",
"<",
"Tuple2",
"<",
"Integer",
",",
"Throwable",
">",
">",
"errorsWithAttempts",
"(",
"Observable",
"<",
"?",
"extends",
"Throwable",
">",
"errors",
",",
"final",
"int",
"expectedAttempts",
")",
"{",
"return",
"errors",
"."... | Internal utility method to combine errors in an observable with their attempt number.
@param errors the errors.
@param expectedAttempts the maximum of combinations to make (for retry, should be the maximum number of
authorized retries + 1).
@return an Observable that combines the index/attempt number of each error wit... | [
"Internal",
"utility",
"method",
"to",
"combine",
"errors",
"in",
"an",
"observable",
"with",
"their",
"attempt",
"number",
"."
] | f36a0ee0c66923bdde47838ca543e50cbaa99e14 | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/util/retry/Retry.java#L91-L102 | train |
fengwenyi/JavaLib | bak/DateTime.java | DateTime.parseDate | public static Date parseDate(String strdate) {
/* Return in case the string date is not set */
if (strdate == null || strdate.length() == 0) return null;
Date result = null;
strdate = strdate.trim();
if (strdate.length() > 10) {
/* Open: deal with +4:00 (no zero be... | java | public static Date parseDate(String strdate) {
/* Return in case the string date is not set */
if (strdate == null || strdate.length() == 0) return null;
Date result = null;
strdate = strdate.trim();
if (strdate.length() > 10) {
/* Open: deal with +4:00 (no zero be... | [
"public",
"static",
"Date",
"parseDate",
"(",
"String",
"strdate",
")",
"{",
"/* Return in case the string date is not set */",
"if",
"(",
"strdate",
"==",
"null",
"||",
"strdate",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"Date",
"result... | Tries different date formats to parse against the given string
representation to retrieve a valid Date object.
@param strdate Date as String
@return Date The parsed Date | [
"Tries",
"different",
"date",
"formats",
"to",
"parse",
"against",
"the",
"given",
"string",
"representation",
"to",
"retrieve",
"a",
"valid",
"Date",
"object",
"."
] | 14838b13fb11c024e41be766aa3e13ead4be1703 | https://github.com/fengwenyi/JavaLib/blob/14838b13fb11c024e41be766aa3e13ead4be1703/bak/DateTime.java#L37-L86 | train |
fengwenyi/JavaLib | src/main/java/com/fengwenyi/javalib/third/Base64.java | Base64.base64ToByteArray | private static byte[] base64ToByteArray(String s, boolean alternate) {
byte[] alphaToInt = (alternate ? altBase64ToInt : base64ToInt);
int sLen = s.length();
int numGroups = sLen / 4;
if (4 * numGroups != sLen) {
throw new IllegalArgumentException("String length must be a mul... | java | private static byte[] base64ToByteArray(String s, boolean alternate) {
byte[] alphaToInt = (alternate ? altBase64ToInt : base64ToInt);
int sLen = s.length();
int numGroups = sLen / 4;
if (4 * numGroups != sLen) {
throw new IllegalArgumentException("String length must be a mul... | [
"private",
"static",
"byte",
"[",
"]",
"base64ToByteArray",
"(",
"String",
"s",
",",
"boolean",
"alternate",
")",
"{",
"byte",
"[",
"]",
"alphaToInt",
"=",
"(",
"alternate",
"?",
"altBase64ToInt",
":",
"base64ToInt",
")",
";",
"int",
"sLen",
"=",
"s",
".... | Translates the specified "alternate representation" Base64 string into a byte array.
@param s [ellipsis]
@param alternate [ellipsis]
@return [ellipsis] | [
"Translates",
"the",
"specified",
"alternate",
"representation",
"Base64",
"string",
"into",
"a",
"byte",
"array",
"."
] | 14838b13fb11c024e41be766aa3e13ead4be1703 | https://github.com/fengwenyi/JavaLib/blob/14838b13fb11c024e41be766aa3e13ead4be1703/src/main/java/com/fengwenyi/javalib/third/Base64.java#L138-L184 | train |
fengwenyi/JavaLib | src/main/java/com/fengwenyi/javalib/third/Base64.java | Base64.base64toInt | private static int base64toInt(char c, byte[] alphaToInt) {
int result = alphaToInt[c];
if (result < 0) {
throw new IllegalArgumentException("Illegal character " + c);
}
return result;
} | java | private static int base64toInt(char c, byte[] alphaToInt) {
int result = alphaToInt[c];
if (result < 0) {
throw new IllegalArgumentException("Illegal character " + c);
}
return result;
} | [
"private",
"static",
"int",
"base64toInt",
"(",
"char",
"c",
",",
"byte",
"[",
"]",
"alphaToInt",
")",
"{",
"int",
"result",
"=",
"alphaToInt",
"[",
"c",
"]",
";",
"if",
"(",
"result",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"("... | Translates the specified character, which is assumed to be in the "Base 64 Alphabet" into its equivalent 6-bit
positive integer.
@throw IllegalArgumentException or ArrayOutOfBoundsException if c is not in the Base64 Alphabet.
@param c [ellipsis]
@param alphaToInt [ellipsis]
@return [ellipsis] | [
"Translates",
"the",
"specified",
"character",
"which",
"is",
"assumed",
"to",
"be",
"in",
"the",
"Base",
"64",
"Alphabet",
"into",
"its",
"equivalent",
"6",
"-",
"bit",
"positive",
"integer",
"."
] | 14838b13fb11c024e41be766aa3e13ead4be1703 | https://github.com/fengwenyi/JavaLib/blob/14838b13fb11c024e41be766aa3e13ead4be1703/src/main/java/com/fengwenyi/javalib/third/Base64.java#L195-L201 | train |
raydac/java-comment-preprocessor | jcp/src/main/java/com/igormaznitsa/meta/common/utils/GetUtils.java | GetUtils.ensureNonNull | @Nonnull
public static <T> T ensureNonNull(@Nullable final T value, @Nonnull final T defaultValue) {
return value == null ? Assertions.assertNotNull(defaultValue) : value;
} | java | @Nonnull
public static <T> T ensureNonNull(@Nullable final T value, @Nonnull final T defaultValue) {
return value == null ? Assertions.assertNotNull(defaultValue) : value;
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"T",
">",
"T",
"ensureNonNull",
"(",
"@",
"Nullable",
"final",
"T",
"value",
",",
"@",
"Nonnull",
"final",
"T",
"defaultValue",
")",
"{",
"return",
"value",
"==",
"null",
"?",
"Assertions",
".",
"assertNotNull",
"... | Get value and ensure that the value is not null
@param <T> type of value
@param value the value
@param defaultValue the default value to be returned if the value is null
@return not null value
@throws AssertionError if both the value and the default value are null
@since 1.0 | [
"Get",
"value",
"and",
"ensure",
"that",
"the",
"value",
"is",
"not",
"null"
] | 83ac87b575ac084914d77695a8c8673de3b8300c | https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/meta/common/utils/GetUtils.java#L56-L59 | train |
raydac/java-comment-preprocessor | jcp/src/main/java/com/igormaznitsa/meta/common/utils/GetUtils.java | GetUtils.ensureNonNull | @Nonnull
public static <T> T ensureNonNull(@Nonnull final T value) {
return Assertions.assertNotNull(value);
} | java | @Nonnull
public static <T> T ensureNonNull(@Nonnull final T value) {
return Assertions.assertNotNull(value);
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"T",
">",
"T",
"ensureNonNull",
"(",
"@",
"Nonnull",
"final",
"T",
"value",
")",
"{",
"return",
"Assertions",
".",
"assertNotNull",
"(",
"value",
")",
";",
"}"
] | Get value if it is not null.
@param <T> type of value
@param value the value
@return the value if it is not null
@throws AssertionError if the value is null
@since 1.0 | [
"Get",
"value",
"if",
"it",
"is",
"not",
"null",
"."
] | 83ac87b575ac084914d77695a8c8673de3b8300c | https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/meta/common/utils/GetUtils.java#L70-L73 | train |
raydac/java-comment-preprocessor | jcp/src/main/java/com/igormaznitsa/meta/common/utils/GetUtils.java | GetUtils.findFirstNonNull | @SafeVarargs
@Nonnull
public static <T> T findFirstNonNull(@Nonnull final T... objects) {
for (final T obj : ensureNonNull(objects)) {
if (obj != null) {
return obj;
}
}
throw Assertions.fail("Can't find non-null item in array");
} | java | @SafeVarargs
@Nonnull
public static <T> T findFirstNonNull(@Nonnull final T... objects) {
for (final T obj : ensureNonNull(objects)) {
if (obj != null) {
return obj;
}
}
throw Assertions.fail("Can't find non-null item in array");
} | [
"@",
"SafeVarargs",
"@",
"Nonnull",
"public",
"static",
"<",
"T",
">",
"T",
"findFirstNonNull",
"(",
"@",
"Nonnull",
"final",
"T",
"...",
"objects",
")",
"{",
"for",
"(",
"final",
"T",
"obj",
":",
"ensureNonNull",
"(",
"objects",
")",
")",
"{",
"if",
... | Find the first non-null value in an array and return that.
@param <T> type of value
@param objects array to find value
@return the first non-null value from the array
@throws AssertionError if the array is null or it doesn't contain a
non-null value
@since 1.0 | [
"Find",
"the",
"first",
"non",
"-",
"null",
"value",
"in",
"an",
"array",
"and",
"return",
"that",
"."
] | 83ac87b575ac084914d77695a8c8673de3b8300c | https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/meta/common/utils/GetUtils.java#L85-L94 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.