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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/schemageneration/postprocessing/javadoc/DomHelper.java | DomHelper.getFieldLocation | public static FieldLocation getFieldLocation(final Node aNode, final Set<FieldLocation> fieldLocations) {
FieldLocation toReturn = null;
if (aNode != null) {
if (CLASS_FIELD_METHOD_ELEMENT_NAMES.contains(aNode.getLocalName().toLowerCase())) {
// This is a ComplexType whic... | java | public static FieldLocation getFieldLocation(final Node aNode, final Set<FieldLocation> fieldLocations) {
FieldLocation toReturn = null;
if (aNode != null) {
if (CLASS_FIELD_METHOD_ELEMENT_NAMES.contains(aNode.getLocalName().toLowerCase())) {
// This is a ComplexType whic... | [
"public",
"static",
"FieldLocation",
"getFieldLocation",
"(",
"final",
"Node",
"aNode",
",",
"final",
"Set",
"<",
"FieldLocation",
">",
"fieldLocations",
")",
"{",
"FieldLocation",
"toReturn",
"=",
"null",
";",
"if",
"(",
"aNode",
"!=",
"null",
")",
"{",
"if... | Retrieves a FieldLocation from the supplied Set, provided that the FieldLocation matches the supplied Node.
@param aNode The non-null Node.
@param fieldLocations The Set of known/found FieldLocation instances.
@return The FieldLocation corresponding to the supplied DOM Node. | [
"Retrieves",
"a",
"FieldLocation",
"from",
"the",
"supplied",
"Set",
"provided",
"that",
"the",
"FieldLocation",
"matches",
"the",
"supplied",
"Node",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/postprocessing/javadoc/DomHelper.java#L281-L300 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/schemageneration/postprocessing/javadoc/DomHelper.java | DomHelper.getFieldOrMethodLocationIfValid | public static <T extends FieldLocation> T getFieldOrMethodLocationIfValid(
final Node aNode,
final Node containingClassNode,
final Set<? extends FieldLocation> locations) {
T toReturn = null;
if (containingClassNode != null) {
// Do we have a FieldLocat... | java | public static <T extends FieldLocation> T getFieldOrMethodLocationIfValid(
final Node aNode,
final Node containingClassNode,
final Set<? extends FieldLocation> locations) {
T toReturn = null;
if (containingClassNode != null) {
// Do we have a FieldLocat... | [
"public",
"static",
"<",
"T",
"extends",
"FieldLocation",
">",
"T",
"getFieldOrMethodLocationIfValid",
"(",
"final",
"Node",
"aNode",
",",
"final",
"Node",
"containingClassNode",
",",
"final",
"Set",
"<",
"?",
"extends",
"FieldLocation",
">",
"locations",
")",
"... | Retrieves a FieldLocation or MethodLocation from the supplied Set of Field- or MethodLocations, provided that
the supplied Node has the given containing Node corresponding to a Class or an Enum.
@param aNode A non-null DOM Node.
@param containingClassNode A Non-null DOM Node corresponding to a Class or E... | [
"Retrieves",
"a",
"FieldLocation",
"or",
"MethodLocation",
"from",
"the",
"supplied",
"Set",
"of",
"Field",
"-",
"or",
"MethodLocations",
"provided",
"that",
"the",
"supplied",
"Node",
"has",
"the",
"given",
"containing",
"Node",
"corresponding",
"to",
"a",
"Cla... | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/postprocessing/javadoc/DomHelper.java#L312-L368 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/schemageneration/postprocessing/javadoc/DomHelper.java | DomHelper.insertXmlDocumentationAnnotationsFor | public static void insertXmlDocumentationAnnotationsFor(
final Node aNode,
final SortedMap<ClassLocation, JavaDocData> classJavaDocs,
final SortedMap<FieldLocation, JavaDocData> fieldJavaDocs,
final SortedMap<MethodLocation, JavaDocData> methodJavaDocs,
final ... | java | public static void insertXmlDocumentationAnnotationsFor(
final Node aNode,
final SortedMap<ClassLocation, JavaDocData> classJavaDocs,
final SortedMap<FieldLocation, JavaDocData> fieldJavaDocs,
final SortedMap<MethodLocation, JavaDocData> methodJavaDocs,
final ... | [
"public",
"static",
"void",
"insertXmlDocumentationAnnotationsFor",
"(",
"final",
"Node",
"aNode",
",",
"final",
"SortedMap",
"<",
"ClassLocation",
",",
"JavaDocData",
">",
"classJavaDocs",
",",
"final",
"SortedMap",
"<",
"FieldLocation",
",",
"JavaDocData",
">",
"f... | Processes the supplied DOM Node, inserting XML Documentation annotations if applicable.
@param aNode The DOM Node to process.
@param classJavaDocs A Map relating {@link ClassLocation}s to {@link JavaDocData}.
@param fieldJavaDocs A Map relating {@link FieldLocation}s to {@link JavaDocData}.
@param methodJav... | [
"Processes",
"the",
"supplied",
"DOM",
"Node",
"inserting",
"XML",
"Documentation",
"annotations",
"if",
"applicable",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/postprocessing/javadoc/DomHelper.java#L379-L427 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/schemageneration/postprocessing/schemaenhancement/SimpleNamespaceResolver.java | SimpleNamespaceResolver.initialize | private void initialize(final Reader xmlFileStream) {
// Build a DOM model.
final Document parsedDocument = XsdGeneratorHelper.parseXmlStream(xmlFileStream);
// Process the DOM model.
XsdGeneratorHelper.process(parsedDocument.getFirstChild(), true, new NamespaceAttributeNodeProce... | java | private void initialize(final Reader xmlFileStream) {
// Build a DOM model.
final Document parsedDocument = XsdGeneratorHelper.parseXmlStream(xmlFileStream);
// Process the DOM model.
XsdGeneratorHelper.process(parsedDocument.getFirstChild(), true, new NamespaceAttributeNodeProce... | [
"private",
"void",
"initialize",
"(",
"final",
"Reader",
"xmlFileStream",
")",
"{",
"// Build a DOM model.\r",
"final",
"Document",
"parsedDocument",
"=",
"XsdGeneratorHelper",
".",
"parseXmlStream",
"(",
"xmlFileStream",
")",
";",
"// Process the DOM model.\r",
"XsdGener... | Initializes this SimpleNamespaceResolver to collect namespace data from the provided stream.
@param xmlFileStream A Reader connected to the XML file from which we should read namespace data. | [
"Initializes",
"this",
"SimpleNamespaceResolver",
"to",
"collect",
"namespace",
"data",
"from",
"the",
"provided",
"stream",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/postprocessing/schemaenhancement/SimpleNamespaceResolver.java#L148-L155 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/filters/pattern/AbstractPatternFilter.java | AbstractPatternFilter.setPatternPrefix | public final void setPatternPrefix(final String patternPrefix) {
// Check sanity
validateDiSetterCalledBeforeInitialization("patternPrefix");
// Check sanity
if (patternPrefix != null) {
// Assign internal state
this.patternPrefix = patternPrefix;
} els... | java | public final void setPatternPrefix(final String patternPrefix) {
// Check sanity
validateDiSetterCalledBeforeInitialization("patternPrefix");
// Check sanity
if (patternPrefix != null) {
// Assign internal state
this.patternPrefix = patternPrefix;
} els... | [
"public",
"final",
"void",
"setPatternPrefix",
"(",
"final",
"String",
"patternPrefix",
")",
"{",
"// Check sanity",
"validateDiSetterCalledBeforeInitialization",
"(",
"\"patternPrefix\"",
")",
";",
"// Check sanity",
"if",
"(",
"patternPrefix",
"!=",
"null",
")",
"{",
... | Assigns a prefix to be prepended to any patterns submitted to this AbstractPatternFilter.
@param patternPrefix A prefix to be prepended to each pattern to render a Pattern.
If a null argument is supplied, nothing will be prepended.
@see #convert(java.util.List, String) | [
"Assigns",
"a",
"prefix",
"to",
"be",
"prepended",
"to",
"any",
"patterns",
"submitted",
"to",
"this",
"AbstractPatternFilter",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/filters/pattern/AbstractPatternFilter.java#L70-L84 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/filters/pattern/AbstractPatternFilter.java | AbstractPatternFilter.setConverter | public void setConverter(final StringConverter<T> converter) {
// Check sanity
Validate.notNull(converter, "converter");
validateDiSetterCalledBeforeInitialization("converter");
// Assign internal state
this.converter = converter;
} | java | public void setConverter(final StringConverter<T> converter) {
// Check sanity
Validate.notNull(converter, "converter");
validateDiSetterCalledBeforeInitialization("converter");
// Assign internal state
this.converter = converter;
} | [
"public",
"void",
"setConverter",
"(",
"final",
"StringConverter",
"<",
"T",
">",
"converter",
")",
"{",
"// Check sanity",
"Validate",
".",
"notNull",
"(",
"converter",
",",
"\"converter\"",
")",
";",
"validateDiSetterCalledBeforeInitialization",
"(",
"\"converter\""... | Assigns the StringConverter used to convert T-type objects to Strings.
This StringConverter is used to acquire input comparison values for all Patterns to T-object candidates.
@param converter The StringConverter used to convert T-type objects to Strings which should
be matched by all supplied Patterns to T-object can... | [
"Assigns",
"the",
"StringConverter",
"used",
"to",
"convert",
"T",
"-",
"type",
"objects",
"to",
"Strings",
".",
"This",
"StringConverter",
"is",
"used",
"to",
"acquire",
"input",
"comparison",
"values",
"for",
"all",
"Patterns",
"to",
"T",
"-",
"object",
"c... | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/filters/pattern/AbstractPatternFilter.java#L139-L147 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/filters/Filters.java | Filters.matchAtLeastOnce | public static <T> boolean matchAtLeastOnce(final T object, final List<Filter<T>> filters) {
// Check sanity
Validate.notNull(filters, "filters");
boolean acceptedByAtLeastOneFilter = false;
for (Filter<T> current : filters) {
if (current.accept(object)) {
ac... | java | public static <T> boolean matchAtLeastOnce(final T object, final List<Filter<T>> filters) {
// Check sanity
Validate.notNull(filters, "filters");
boolean acceptedByAtLeastOneFilter = false;
for (Filter<T> current : filters) {
if (current.accept(object)) {
ac... | [
"public",
"static",
"<",
"T",
">",
"boolean",
"matchAtLeastOnce",
"(",
"final",
"T",
"object",
",",
"final",
"List",
"<",
"Filter",
"<",
"T",
">",
">",
"filters",
")",
"{",
"// Check sanity",
"Validate",
".",
"notNull",
"(",
"filters",
",",
"\"filters\"",
... | Algorithms for accepting the supplied object if at least one of the supplied Filters accepts it.
@param object The object to accept (or not).
@param filters The non-null list of Filters to examine the supplied object.
@param <T> The Filter type.
@return {@code true} if at least one of the filters return true from... | [
"Algorithms",
"for",
"accepting",
"the",
"supplied",
"object",
"if",
"at",
"least",
"one",
"of",
"the",
"supplied",
"Filters",
"accepts",
"it",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/filters/Filters.java#L51-L66 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/filters/Filters.java | Filters.rejectAtLeastOnce | public static <T> boolean rejectAtLeastOnce(final T object, final List<Filter<T>> filters) {
// Check sanity
Validate.notNull(filters, "filters");
boolean rejectedByAtLeastOneFilter = false;
for (Filter<T> current : filters) {
if (!current.accept(object)) {
... | java | public static <T> boolean rejectAtLeastOnce(final T object, final List<Filter<T>> filters) {
// Check sanity
Validate.notNull(filters, "filters");
boolean rejectedByAtLeastOneFilter = false;
for (Filter<T> current : filters) {
if (!current.accept(object)) {
... | [
"public",
"static",
"<",
"T",
">",
"boolean",
"rejectAtLeastOnce",
"(",
"final",
"T",
"object",
",",
"final",
"List",
"<",
"Filter",
"<",
"T",
">",
">",
"filters",
")",
"{",
"// Check sanity",
"Validate",
".",
"notNull",
"(",
"filters",
",",
"\"filters\"",... | Algorithms for rejecting the supplied object if at least one of the supplied Filters does not accept it.
@param object The object to reject (or not).
@param filters The non-null list of Filters to examine the supplied object.
@param <T> The Filter type.
@return {@code true} if at least one of the filters returns ... | [
"Algorithms",
"for",
"rejecting",
"the",
"supplied",
"object",
"if",
"at",
"least",
"one",
"of",
"the",
"supplied",
"Filters",
"does",
"not",
"accept",
"it",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/filters/Filters.java#L77-L92 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/filters/Filters.java | Filters.noFilterMatches | public static <T> boolean noFilterMatches(final T object, final List<Filter<T>> filters) {
// Check sanity
Validate.notNull(filters, "filters");
boolean matchedAtLeastOnce = false;
for (Filter<T> current : filters) {
if (current.accept(object)) {
matchedAtLe... | java | public static <T> boolean noFilterMatches(final T object, final List<Filter<T>> filters) {
// Check sanity
Validate.notNull(filters, "filters");
boolean matchedAtLeastOnce = false;
for (Filter<T> current : filters) {
if (current.accept(object)) {
matchedAtLe... | [
"public",
"static",
"<",
"T",
">",
"boolean",
"noFilterMatches",
"(",
"final",
"T",
"object",
",",
"final",
"List",
"<",
"Filter",
"<",
"T",
">",
">",
"filters",
")",
"{",
"// Check sanity",
"Validate",
".",
"notNull",
"(",
"filters",
",",
"\"filters\"",
... | Algorithms for rejecting the supplied object if at least one of the supplied Filters rejects it.
@param object The object to accept (or not).
@param filters The non-null list of Filters to examine the supplied object.
@param <T> The Filter type.
@return {@code true} if at least one of the filters return false fro... | [
"Algorithms",
"for",
"rejecting",
"the",
"supplied",
"object",
"if",
"at",
"least",
"one",
"of",
"the",
"supplied",
"Filters",
"rejects",
"it",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/filters/Filters.java#L103-L117 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/filters/Filters.java | Filters.adapt | public static FileFilter adapt(final Filter<File> toAdapt) {
// Check sanity
Validate.notNull(toAdapt, "toAdapt");
// Already a FileFilter?
if (toAdapt instanceof FileFilter) {
return (FileFilter) toAdapt;
}
// Wrap and return.
return new FileFilter... | java | public static FileFilter adapt(final Filter<File> toAdapt) {
// Check sanity
Validate.notNull(toAdapt, "toAdapt");
// Already a FileFilter?
if (toAdapt instanceof FileFilter) {
return (FileFilter) toAdapt;
}
// Wrap and return.
return new FileFilter... | [
"public",
"static",
"FileFilter",
"adapt",
"(",
"final",
"Filter",
"<",
"File",
">",
"toAdapt",
")",
"{",
"// Check sanity",
"Validate",
".",
"notNull",
"(",
"toAdapt",
",",
"\"toAdapt\"",
")",
";",
"// Already a FileFilter?",
"if",
"(",
"toAdapt",
"instanceof",... | Adapts the Filter specification to the FileFilter interface, to enable immediate use
for filtering File lists.
@param toAdapt The non-null Filter which should be adapted to a FileFilter interface.
@return If the {@code toAdapt} instance already implements the FileFilter interface, simply return the toAdapt
instance. O... | [
"Adapts",
"the",
"Filter",
"specification",
"to",
"the",
"FileFilter",
"interface",
"to",
"enable",
"immediate",
"use",
"for",
"filtering",
"File",
"lists",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/filters/Filters.java#L127-L144 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/filters/Filters.java | Filters.adapt | public static List<FileFilter> adapt(final List<Filter<File>> toAdapt) {
final List<FileFilter> toReturn = new ArrayList<FileFilter>();
if (toAdapt != null) {
for (Filter<File> current : toAdapt) {
toReturn.add(adapt(current));
}
}
// All done.
... | java | public static List<FileFilter> adapt(final List<Filter<File>> toAdapt) {
final List<FileFilter> toReturn = new ArrayList<FileFilter>();
if (toAdapt != null) {
for (Filter<File> current : toAdapt) {
toReturn.add(adapt(current));
}
}
// All done.
... | [
"public",
"static",
"List",
"<",
"FileFilter",
">",
"adapt",
"(",
"final",
"List",
"<",
"Filter",
"<",
"File",
">",
">",
"toAdapt",
")",
"{",
"final",
"List",
"<",
"FileFilter",
">",
"toReturn",
"=",
"new",
"ArrayList",
"<",
"FileFilter",
">",
"(",
")"... | Adapts the supplied List of Filter specifications to a List of FileFilters.
@param toAdapt The List of Filters to adapts.
@return A List holding FileFilter instances. If {@code toAdapt} is {@code null} or empty, an empty list is
returned from this method. Thus, this method will never return a {@code null} value. | [
"Adapts",
"the",
"supplied",
"List",
"of",
"Filter",
"specifications",
"to",
"a",
"List",
"of",
"FileFilters",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/filters/Filters.java#L153-L164 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/filters/Filters.java | Filters.initialize | public static <T> void initialize(final Log log, final List<Filter<T>> filters) {
// Check sanity
Validate.notNull(log, "log");
Validate.notNull(filters, "filters");
for (Filter<T> current : filters) {
current.initialize(log);
}
} | java | public static <T> void initialize(final Log log, final List<Filter<T>> filters) {
// Check sanity
Validate.notNull(log, "log");
Validate.notNull(filters, "filters");
for (Filter<T> current : filters) {
current.initialize(log);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"initialize",
"(",
"final",
"Log",
"log",
",",
"final",
"List",
"<",
"Filter",
"<",
"T",
">",
">",
"filters",
")",
"{",
"// Check sanity",
"Validate",
".",
"notNull",
"(",
"log",
",",
"\"log\"",
")",
";",
"V... | Initializes the supplied Filters by assigning the given Log.
@param log The active Maven Log.
@param filters The List of Filters to initialize.
@param <T> The Filter type. | [
"Initializes",
"the",
"supplied",
"Filters",
"by",
"assigning",
"the",
"given",
"Log",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/filters/Filters.java#L173-L182 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/FileSystemUtilities.java | FileSystemUtilities.getCanonicalFile | public static File getCanonicalFile(final File file) {
// Check sanity
Validate.notNull(file, "file");
// All done
try {
return file.getCanonicalFile();
} catch (IOException e) {
throw new IllegalArgumentException("Could not acquire the canonical file fo... | java | public static File getCanonicalFile(final File file) {
// Check sanity
Validate.notNull(file, "file");
// All done
try {
return file.getCanonicalFile();
} catch (IOException e) {
throw new IllegalArgumentException("Could not acquire the canonical file fo... | [
"public",
"static",
"File",
"getCanonicalFile",
"(",
"final",
"File",
"file",
")",
"{",
"// Check sanity",
"Validate",
".",
"notNull",
"(",
"file",
",",
"\"file\"",
")",
";",
"// All done",
"try",
"{",
"return",
"file",
".",
"getCanonicalFile",
"(",
")",
";"... | Acquires the canonical File for the supplied file.
@param file A non-null File for which the canonical File should be retrieved.
@return The canonical File of the supplied file. | [
"Acquires",
"the",
"canonical",
"File",
"for",
"the",
"supplied",
"file",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/FileSystemUtilities.java#L106-L118 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/FileSystemUtilities.java | FileSystemUtilities.getUrlFor | public static URL getUrlFor(final File aFile) throws IllegalArgumentException {
// Check sanity
Validate.notNull(aFile, "aFile");
try {
return aFile.toURI().normalize().toURL();
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Could not re... | java | public static URL getUrlFor(final File aFile) throws IllegalArgumentException {
// Check sanity
Validate.notNull(aFile, "aFile");
try {
return aFile.toURI().normalize().toURL();
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Could not re... | [
"public",
"static",
"URL",
"getUrlFor",
"(",
"final",
"File",
"aFile",
")",
"throws",
"IllegalArgumentException",
"{",
"// Check sanity",
"Validate",
".",
"notNull",
"(",
"aFile",
",",
"\"aFile\"",
")",
";",
"try",
"{",
"return",
"aFile",
".",
"toURI",
"(",
... | Retrieves the URL for the supplied File. Convenience method which hides exception handling
for the operation in question.
@param aFile A File for which the URL should be retrieved.
@return The URL for the supplied aFile.
@throws java.lang.IllegalArgumentException if getting the URL yielded a MalformedURLException. | [
"Retrieves",
"the",
"URL",
"for",
"the",
"supplied",
"File",
".",
"Convenience",
"method",
"which",
"hides",
"exception",
"handling",
"for",
"the",
"operation",
"in",
"question",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/FileSystemUtilities.java#L173-L184 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/FileSystemUtilities.java | FileSystemUtilities.getFileFor | public static File getFileFor(final URL anURL, final String encoding) {
// Check sanity
Validate.notNull(anURL, "anURL");
Validate.notNull(encoding, "encoding");
final String protocol = anURL.getProtocol();
File toReturn = null;
if ("file".equalsIgnoreCase(protocol)) {
... | java | public static File getFileFor(final URL anURL, final String encoding) {
// Check sanity
Validate.notNull(anURL, "anURL");
Validate.notNull(encoding, "encoding");
final String protocol = anURL.getProtocol();
File toReturn = null;
if ("file".equalsIgnoreCase(protocol)) {
... | [
"public",
"static",
"File",
"getFileFor",
"(",
"final",
"URL",
"anURL",
",",
"final",
"String",
"encoding",
")",
"{",
"// Check sanity",
"Validate",
".",
"notNull",
"(",
"anURL",
",",
"\"anURL\"",
")",
";",
"Validate",
".",
"notNull",
"(",
"encoding",
",",
... | Acquires the file for a supplied URL, provided that its protocol is is either a file or a jar.
@param anURL a non-null URL.
@param encoding The encoding to be used by the URLDecoder to decode the path found.
@return The File pointing to the supplied URL, for file or jar protocol URLs and null otherwise. | [
"Acquires",
"the",
"file",
"for",
"a",
"supplied",
"URL",
"provided",
"that",
"its",
"protocol",
"is",
"is",
"either",
"a",
"file",
"or",
"a",
"jar",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/FileSystemUtilities.java#L193-L236 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/FileSystemUtilities.java | FileSystemUtilities.createDirectory | public static void createDirectory(final File aDirectory, final boolean cleanBeforeCreate)
throws MojoExecutionException {
// Check sanity
Validate.notNull(aDirectory, "aDirectory");
validateFileOrDirectoryName(aDirectory);
// Clean an existing directory?
if (cleanB... | java | public static void createDirectory(final File aDirectory, final boolean cleanBeforeCreate)
throws MojoExecutionException {
// Check sanity
Validate.notNull(aDirectory, "aDirectory");
validateFileOrDirectoryName(aDirectory);
// Clean an existing directory?
if (cleanB... | [
"public",
"static",
"void",
"createDirectory",
"(",
"final",
"File",
"aDirectory",
",",
"final",
"boolean",
"cleanBeforeCreate",
")",
"throws",
"MojoExecutionException",
"{",
"// Check sanity",
"Validate",
".",
"notNull",
"(",
"aDirectory",
",",
"\"aDirectory\"",
")",... | Convenience method to successfully create a directory - or throw an exception if failing to create it.
@param aDirectory The directory to create.
@param cleanBeforeCreate if {@code true}, the directory and all its content will be deleted before being
re-created. This will ensure that the created directory is re... | [
"Convenience",
"method",
"to",
"successfully",
"create",
"a",
"directory",
"-",
"or",
"throw",
"an",
"exception",
"if",
"failing",
"to",
"create",
"it",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/FileSystemUtilities.java#L495-L519 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/FileSystemUtilities.java | FileSystemUtilities.relativize | public static String relativize(final String path,
final File parentDir,
final boolean removeInitialFileSep) {
// Check sanity
Validate.notNull(path, "path");
Validate.notNull(parentDir, "parentDir");
final String ... | java | public static String relativize(final String path,
final File parentDir,
final boolean removeInitialFileSep) {
// Check sanity
Validate.notNull(path, "path");
Validate.notNull(parentDir, "parentDir");
final String ... | [
"public",
"static",
"String",
"relativize",
"(",
"final",
"String",
"path",
",",
"final",
"File",
"parentDir",
",",
"final",
"boolean",
"removeInitialFileSep",
")",
"{",
"// Check sanity",
"Validate",
".",
"notNull",
"(",
"path",
",",
"\"path\"",
")",
";",
"Va... | If the supplied path refers to a file or directory below the supplied basedir, the returned
path is identical to the part below the basedir.
@param path The path to strip off basedir path from, and return.
@param parentDir The maven project basedir.
@param removeInitialFileSep If true, an initial {@code File#sepa... | [
"If",
"the",
"supplied",
"path",
"refers",
"to",
"a",
"file",
"or",
"directory",
"below",
"the",
"supplied",
"basedir",
"the",
"returned",
"path",
"is",
"identical",
"to",
"the",
"part",
"below",
"the",
"basedir",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/FileSystemUtilities.java#L530-L550 | train |
mojohaus/jaxb2-maven-plugin | src/it/mjaxb-55/src/main/java/se/west/validation/XmlNormalizer.java | XmlNormalizer.getNormalizedXml | public String getNormalizedXml(String filePath) {
// Read the provided filename
final StringWriter toReturn = new StringWriter();
final BufferedReader in;
try {
in = new BufferedReader(new FileReader(new File(filePath)));
} catch (FileNotFoundException e) {
... | java | public String getNormalizedXml(String filePath) {
// Read the provided filename
final StringWriter toReturn = new StringWriter();
final BufferedReader in;
try {
in = new BufferedReader(new FileReader(new File(filePath)));
} catch (FileNotFoundException e) {
... | [
"public",
"String",
"getNormalizedXml",
"(",
"String",
"filePath",
")",
"{",
"// Read the provided filename\r",
"final",
"StringWriter",
"toReturn",
"=",
"new",
"StringWriter",
"(",
")",
";",
"final",
"BufferedReader",
"in",
";",
"try",
"{",
"in",
"=",
"new",
"B... | Reads the XML file found at the provided filePath, returning a normalized
XML form suitable for comparison.
@param filePath The path to the XML file to read.
@return A normalized, human-readable, version of the given XML document. | [
"Reads",
"the",
"XML",
"file",
"found",
"at",
"the",
"provided",
"filePath",
"returning",
"a",
"normalized",
"XML",
"form",
"suitable",
"for",
"comparison",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/it/mjaxb-55/src/main/java/se/west/validation/XmlNormalizer.java#L37-L66 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java | XsdGeneratorHelper.getFileNameToResolverMap | public static Map<String, SimpleNamespaceResolver> getFileNameToResolverMap(final File outputDirectory)
throws MojoExecutionException {
final Map<String, SimpleNamespaceResolver> toReturn = new TreeMap<String, SimpleNamespaceResolver>();
// Each generated schema file should be written... | java | public static Map<String, SimpleNamespaceResolver> getFileNameToResolverMap(final File outputDirectory)
throws MojoExecutionException {
final Map<String, SimpleNamespaceResolver> toReturn = new TreeMap<String, SimpleNamespaceResolver>();
// Each generated schema file should be written... | [
"public",
"static",
"Map",
"<",
"String",
",",
"SimpleNamespaceResolver",
">",
"getFileNameToResolverMap",
"(",
"final",
"File",
"outputDirectory",
")",
"throws",
"MojoExecutionException",
"{",
"final",
"Map",
"<",
"String",
",",
"SimpleNamespaceResolver",
">",
"toRet... | Acquires a map relating generated schema filename to its SimpleNamespaceResolver.
@param outputDirectory The output directory of the generated schema files.
@return a map relating generated schema filename to an initialized SimpleNamespaceResolver.
@throws MojoExecutionException if two generated schema files used the ... | [
"Acquires",
"a",
"map",
"relating",
"generated",
"schema",
"filename",
"to",
"its",
"SimpleNamespaceResolver",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java#L116-L134 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java | XsdGeneratorHelper.validateSchemasInPluginConfiguration | public static void validateSchemasInPluginConfiguration(final List<TransformSchema> configuredTransformSchemas)
throws MojoExecutionException {
final List<String> uris = new ArrayList<String>();
final List<String> prefixes = new ArrayList<String>();
final List<String> fileNames... | java | public static void validateSchemasInPluginConfiguration(final List<TransformSchema> configuredTransformSchemas)
throws MojoExecutionException {
final List<String> uris = new ArrayList<String>();
final List<String> prefixes = new ArrayList<String>();
final List<String> fileNames... | [
"public",
"static",
"void",
"validateSchemasInPluginConfiguration",
"(",
"final",
"List",
"<",
"TransformSchema",
">",
"configuredTransformSchemas",
")",
"throws",
"MojoExecutionException",
"{",
"final",
"List",
"<",
"String",
">",
"uris",
"=",
"new",
"ArrayList",
"<"... | Validates that the list of Schemas provided within the configuration all contain unique values. Should a
MojoExecutionException be thrown, it contains informative text about the exact nature of the configuration
problem - we should simplify for all plugin users.
@param configuredTransformSchemas The List of configurat... | [
"Validates",
"that",
"the",
"list",
"of",
"Schemas",
"provided",
"within",
"the",
"configuration",
"all",
"contain",
"unique",
"values",
".",
"Should",
"a",
"MojoExecutionException",
"be",
"thrown",
"it",
"contains",
"informative",
"text",
"about",
"the",
"exact",... | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java#L147-L194 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java | XsdGeneratorHelper.insertJavaDocAsAnnotations | public static int insertJavaDocAsAnnotations(final Log log,
final String encoding,
final File outputDir,
final SearchableDocumentation docs,
... | java | public static int insertJavaDocAsAnnotations(final Log log,
final String encoding,
final File outputDir,
final SearchableDocumentation docs,
... | [
"public",
"static",
"int",
"insertJavaDocAsAnnotations",
"(",
"final",
"Log",
"log",
",",
"final",
"String",
"encoding",
",",
"final",
"File",
"outputDir",
",",
"final",
"SearchableDocumentation",
"docs",
",",
"final",
"JavaDocRenderer",
"renderer",
")",
"{",
"// ... | Inserts XML documentation annotations into all generated XSD files found
within the supplied outputDir.
@param log A Maven Log.
@param outputDir The outputDir, where generated XSD files are found.
@param docs The SearchableDocumentation for the source files within the compilation unit.
@param renderer The ... | [
"Inserts",
"XML",
"documentation",
"annotations",
"into",
"all",
"generated",
"XSD",
"files",
"found",
"within",
"the",
"supplied",
"outputDir",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java#L206-L252 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java | XsdGeneratorHelper.replaceNamespacePrefixes | public static void replaceNamespacePrefixes(
final Map<String, SimpleNamespaceResolver> resolverMap,
final List<TransformSchema> configuredTransformSchemas,
final Log mavenLog,
final File schemaDirectory,
final String encoding) throws MojoExecutionExcepti... | java | public static void replaceNamespacePrefixes(
final Map<String, SimpleNamespaceResolver> resolverMap,
final List<TransformSchema> configuredTransformSchemas,
final Log mavenLog,
final File schemaDirectory,
final String encoding) throws MojoExecutionExcepti... | [
"public",
"static",
"void",
"replaceNamespacePrefixes",
"(",
"final",
"Map",
"<",
"String",
",",
"SimpleNamespaceResolver",
">",
"resolverMap",
",",
"final",
"List",
"<",
"TransformSchema",
">",
"configuredTransformSchemas",
",",
"final",
"Log",
"mavenLog",
",",
"fi... | Replaces all namespaces within generated schema files, as instructed by the configured Schema instances.
@param resolverMap The map relating generated schema file name to SimpleNamespaceResolver instances.
@param configuredTransformSchemas The Schema instances read from the configuration of this plugin.... | [
"Replaces",
"all",
"namespaces",
"within",
"generated",
"schema",
"files",
"as",
"instructed",
"by",
"the",
"configured",
"Schema",
"instances",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java#L264-L319 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java | XsdGeneratorHelper.renameGeneratedSchemaFiles | public static void renameGeneratedSchemaFiles(final Map<String, SimpleNamespaceResolver> resolverMap,
final List<TransformSchema> configuredTransformSchemas,
final Log mavenLog,
... | java | public static void renameGeneratedSchemaFiles(final Map<String, SimpleNamespaceResolver> resolverMap,
final List<TransformSchema> configuredTransformSchemas,
final Log mavenLog,
... | [
"public",
"static",
"void",
"renameGeneratedSchemaFiles",
"(",
"final",
"Map",
"<",
"String",
",",
"SimpleNamespaceResolver",
">",
"resolverMap",
",",
"final",
"List",
"<",
"TransformSchema",
">",
"configuredTransformSchemas",
",",
"final",
"Log",
"mavenLog",
",",
"... | Updates all schemaLocation attributes within the generated schema files to match the 'file' properties within the
Schemas read from the plugin configuration. After that, the files are physically renamed.
@param resolverMap The map relating generated schema file name to SimpleNamespaceResolver instances.... | [
"Updates",
"all",
"schemaLocation",
"attributes",
"within",
"the",
"generated",
"schema",
"files",
"to",
"match",
"the",
"file",
"properties",
"within",
"the",
"Schemas",
"read",
"from",
"the",
"plugin",
"configuration",
".",
"After",
"that",
"the",
"files",
"ar... | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java#L331-L384 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java | XsdGeneratorHelper.parseXmlStream | public static Document parseXmlStream(final Reader xmlStream) {
// Build a DOM model of the provided xmlFileStream.
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
try {
return factory.newDocumentBuilder()... | java | public static Document parseXmlStream(final Reader xmlStream) {
// Build a DOM model of the provided xmlFileStream.
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
try {
return factory.newDocumentBuilder()... | [
"public",
"static",
"Document",
"parseXmlStream",
"(",
"final",
"Reader",
"xmlStream",
")",
"{",
"// Build a DOM model of the provided xmlFileStream.\r",
"final",
"DocumentBuilderFactory",
"factory",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"factory... | Parses the provided InputStream to create a dom Document.
@param xmlStream An InputStream connected to an XML document.
@return A DOM Document created from the contents of the provided stream. | [
"Parses",
"the",
"provided",
"InputStream",
"to",
"create",
"a",
"dom",
"Document",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java#L431-L442 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java | XsdGeneratorHelper.getHumanReadableXml | protected static String getHumanReadableXml(final Node node) {
StringWriter toReturn = new StringWriter();
try {
Transformer transformer = getFactory().newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(Outp... | java | protected static String getHumanReadableXml(final Node node) {
StringWriter toReturn = new StringWriter();
try {
Transformer transformer = getFactory().newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(Outp... | [
"protected",
"static",
"String",
"getHumanReadableXml",
"(",
"final",
"Node",
"node",
")",
"{",
"StringWriter",
"toReturn",
"=",
"new",
"StringWriter",
"(",
")",
";",
"try",
"{",
"Transformer",
"transformer",
"=",
"getFactory",
"(",
")",
".",
"newTransformer",
... | Converts the provided DOM Node to a pretty-printed XML-formatted string.
@param node The Node whose children should be converted to a String.
@return a pretty-printed XML-formatted string. | [
"Converts",
"the",
"provided",
"DOM",
"Node",
"to",
"a",
"pretty",
"-",
"printed",
"XML",
"-",
"formatted",
"string",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java#L450-L463 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java | XsdGeneratorHelper.parseXmlToDocument | private static Document parseXmlToDocument(final File xmlFile) {
Document result = null;
Reader reader = null;
try {
reader = new FileReader(xmlFile);
result = parseXmlStream(reader);
} catch (FileNotFoundException e) {
// This should never happ... | java | private static Document parseXmlToDocument(final File xmlFile) {
Document result = null;
Reader reader = null;
try {
reader = new FileReader(xmlFile);
result = parseXmlStream(reader);
} catch (FileNotFoundException e) {
// This should never happ... | [
"private",
"static",
"Document",
"parseXmlToDocument",
"(",
"final",
"File",
"xmlFile",
")",
"{",
"Document",
"result",
"=",
"null",
";",
"Reader",
"reader",
"=",
"null",
";",
"try",
"{",
"reader",
"=",
"new",
"FileReader",
"(",
"xmlFile",
")",
";",
"resul... | Creates a Document from parsing the XML within the provided xmlFile.
@param xmlFile The XML file to be parsed.
@return The Document corresponding to the xmlFile. | [
"Creates",
"a",
"Document",
"from",
"parsing",
"the",
"XML",
"within",
"the",
"provided",
"xmlFile",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java#L503-L516 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/arguments/ArgumentBuilder.java | ArgumentBuilder.withPreCompiledArguments | public ArgumentBuilder withPreCompiledArguments(final List<String> preCompiledArguments) {
// Check sanity
Validate.notNull(preCompiledArguments, "preCompiledArguments");
// Add the preCompiledArguments in the exact order they were given.
synchronized (lock) {
for (String c... | java | public ArgumentBuilder withPreCompiledArguments(final List<String> preCompiledArguments) {
// Check sanity
Validate.notNull(preCompiledArguments, "preCompiledArguments");
// Add the preCompiledArguments in the exact order they were given.
synchronized (lock) {
for (String c... | [
"public",
"ArgumentBuilder",
"withPreCompiledArguments",
"(",
"final",
"List",
"<",
"String",
">",
"preCompiledArguments",
")",
"{",
"// Check sanity",
"Validate",
".",
"notNull",
"(",
"preCompiledArguments",
",",
"\"preCompiledArguments\"",
")",
";",
"// Add the preCompi... | Adds the supplied pre-compiled arguments in the same order as they were given.
@param preCompiledArguments A non-null List holding pre-compiled arguments.
@return This ArgumentBuilder, for chaining. | [
"Adds",
"the",
"supplied",
"pre",
"-",
"compiled",
"arguments",
"in",
"the",
"same",
"order",
"as",
"they",
"were",
"given",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/arguments/ArgumentBuilder.java#L189-L203 | train |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/JavaVersion.java | JavaVersion.getJavaMajorVersion | public static int getJavaMajorVersion() {
final String[] versionElements = System.getProperty(JAVA_VERSION_PROPERTY).split("\\.");
final int[] versionNumbers = new int[versionElements.length];
for (int i = 0; i < versionElements.length; i++) {
try {
versionNumbers[i... | java | public static int getJavaMajorVersion() {
final String[] versionElements = System.getProperty(JAVA_VERSION_PROPERTY).split("\\.");
final int[] versionNumbers = new int[versionElements.length];
for (int i = 0; i < versionElements.length; i++) {
try {
versionNumbers[i... | [
"public",
"static",
"int",
"getJavaMajorVersion",
"(",
")",
"{",
"final",
"String",
"[",
"]",
"versionElements",
"=",
"System",
".",
"getProperty",
"(",
"JAVA_VERSION_PROPERTY",
")",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"final",
"int",
"[",
"]",
"versio... | Retrieves the major java runtime version as an integer.
@return the major java runtime version as an integer. | [
"Retrieves",
"the",
"major",
"java",
"runtime",
"version",
"as",
"an",
"integer",
"."
] | e3c4e47943b15282e5a6e850bbfb1588d8452a0a | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/JavaVersion.java#L37-L67 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/option/mapper/OptionsMapper.java | OptionsMapper.env | public <V, T extends Enum & Option> OptionsMapper env(final String name, final T option,
final Function<String, V> converter) {
register("env: " + name, option, System.getenv(name), converter);
return this;
} | java | public <V, T extends Enum & Option> OptionsMapper env(final String name, final T option,
final Function<String, V> converter) {
register("env: " + name, option, System.getenv(name), converter);
return this;
} | [
"public",
"<",
"V",
",",
"T",
"extends",
"Enum",
"&",
"Option",
">",
"OptionsMapper",
"env",
"(",
"final",
"String",
"name",
",",
"final",
"T",
"option",
",",
"final",
"Function",
"<",
"String",
",",
"V",
">",
"converter",
")",
"{",
"register",
"(",
... | Map environment variable value to option.
@param name environment variable name
@param option option
@param converter value converter (may be null to use default converters)
@param <V> helper value type
@param <T> helper option type
@return mapper instance for chained calls | [
"Map",
"environment",
"variable",
"value",
"to",
"option",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/option/mapper/OptionsMapper.java#L166-L170 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/option/mapper/OptionsMapper.java | OptionsMapper.string | public <V, T extends Enum & Option> OptionsMapper string(final T option, final String value,
final Function<String, V> converter) {
register("", option, value, converter);
return this;
} | java | public <V, T extends Enum & Option> OptionsMapper string(final T option, final String value,
final Function<String, V> converter) {
register("", option, value, converter);
return this;
} | [
"public",
"<",
"V",
",",
"T",
"extends",
"Enum",
"&",
"Option",
">",
"OptionsMapper",
"string",
"(",
"final",
"T",
"option",
",",
"final",
"String",
"value",
",",
"final",
"Function",
"<",
"String",
",",
"V",
">",
"converter",
")",
"{",
"register",
"("... | Map string to option. When value is null or empty - nothing happens.
@param option option
@param value value string (could be null)
@param converter value converter (may be null to use default converters)
@param <V> helper value type
@param <T> helper option type
@return mapper instance for chained ... | [
"Map",
"string",
"to",
"option",
".",
"When",
"value",
"is",
"null",
"or",
"empty",
"-",
"nothing",
"happens",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/option/mapper/OptionsMapper.java#L195-L199 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/injector/lookup/InjectorLookup.java | InjectorLookup.registerInjector | public static Managed registerInjector(final Application application, final Injector injector) {
Preconditions.checkNotNull(application, "Application instance required");
Preconditions.checkArgument(!INJECTORS.containsKey(application),
"Injector already registered for application %s", ap... | java | public static Managed registerInjector(final Application application, final Injector injector) {
Preconditions.checkNotNull(application, "Application instance required");
Preconditions.checkArgument(!INJECTORS.containsKey(application),
"Injector already registered for application %s", ap... | [
"public",
"static",
"Managed",
"registerInjector",
"(",
"final",
"Application",
"application",
",",
"final",
"Injector",
"injector",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"application",
",",
"\"Application instance required\"",
")",
";",
"Preconditions",
... | Used internally to register application specific injector.
@param application application instance
@param injector injector instance
@return managed object, which must be registered to remove injector on application stop | [
"Used",
"internally",
"to",
"register",
"application",
"specific",
"injector",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/injector/lookup/InjectorLookup.java#L32-L48 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/installer/util/FeatureUtils.java | FeatureUtils.getInstanceClass | @SuppressWarnings("unchecked")
public static <T> Class<T> getInstanceClass(final T object) {
final Class cls = object.getClass();
return cls.getName().contains("$$EnhancerByGuice") ? (Class<T>) cls.getSuperclass() : cls;
} | java | @SuppressWarnings("unchecked")
public static <T> Class<T> getInstanceClass(final T object) {
final Class cls = object.getClass();
return cls.getName().contains("$$EnhancerByGuice") ? (Class<T>) cls.getSuperclass() : cls;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Class",
"<",
"T",
">",
"getInstanceClass",
"(",
"final",
"T",
"object",
")",
"{",
"final",
"Class",
"cls",
"=",
"object",
".",
"getClass",
"(",
")",
";",
"return",
... | Used to get correct object type even if it's guice proxy.
@param object object to get class of
@param <T> object type
@return object class | [
"Used",
"to",
"get",
"correct",
"object",
"type",
"even",
"if",
"it",
"s",
"guice",
"proxy",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/installer/util/FeatureUtils.java#L151-L155 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/installer/scanner/ClasspathScanner.java | ClasspathScanner.scan | public void scan(final ClassVisitor visitor) {
if (scanned == null) {
performScan();
}
for (Class<?> cls : scanned) {
visitor.visit(cls);
}
} | java | public void scan(final ClassVisitor visitor) {
if (scanned == null) {
performScan();
}
for (Class<?> cls : scanned) {
visitor.visit(cls);
}
} | [
"public",
"void",
"scan",
"(",
"final",
"ClassVisitor",
"visitor",
")",
"{",
"if",
"(",
"scanned",
"==",
"null",
")",
"{",
"performScan",
"(",
")",
";",
"}",
"for",
"(",
"Class",
"<",
"?",
">",
"cls",
":",
"scanned",
")",
"{",
"visitor",
".",
"visi... | Scan configured classpath packages.
@param visitor visitor to investigate found classes | [
"Scan",
"configured",
"classpath",
"packages",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/installer/scanner/ClasspathScanner.java#L58-L65 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/installer/util/BundleSupport.java | BundleSupport.removeTypes | public static <T> List<T> removeTypes(final List<T> list, final List<Class<? extends T>> filter) {
final Iterator it = list.iterator();
while (it.hasNext()) {
final Class type = it.next().getClass();
if (filter.contains(type)) {
it.remove();
}
... | java | public static <T> List<T> removeTypes(final List<T> list, final List<Class<? extends T>> filter) {
final Iterator it = list.iterator();
while (it.hasNext()) {
final Class type = it.next().getClass();
if (filter.contains(type)) {
it.remove();
}
... | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"removeTypes",
"(",
"final",
"List",
"<",
"T",
">",
"list",
",",
"final",
"List",
"<",
"Class",
"<",
"?",
"extends",
"T",
">",
">",
"filter",
")",
"{",
"final",
"Iterator",
"it",
"=",
"lis... | Filter list from objects of type present in filter list.
@param list list to filter
@param filter types to filter
@param <T> required type
@return filtered list | [
"Filter",
"list",
"from",
"objects",
"of",
"type",
"present",
"in",
"filter",
"list",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/installer/util/BundleSupport.java#L98-L107 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/yaml/ConfigurationTree.java | ConfigurationTree.findByPath | public ConfigPath findByPath(final String path) {
return paths.stream()
.filter(it -> it.getPath().equalsIgnoreCase(path))
.findFirst()
.orElse(null);
} | java | public ConfigPath findByPath(final String path) {
return paths.stream()
.filter(it -> it.getPath().equalsIgnoreCase(path))
.findFirst()
.orElse(null);
} | [
"public",
"ConfigPath",
"findByPath",
"(",
"final",
"String",
"path",
")",
"{",
"return",
"paths",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"it",
"->",
"it",
".",
"getPath",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"path",
")",
")",
".",
"findFirst"... | Case insensitive exact match.
@param path path to find descriptor for
@return path descriptor or null if not found | [
"Case",
"insensitive",
"exact",
"match",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/yaml/ConfigurationTree.java#L106-L111 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/yaml/ConfigurationTree.java | ConfigurationTree.findAllRootPaths | public List<ConfigPath> findAllRootPaths() {
return paths.stream()
.filter(it -> !it.getPath().contains(DOT))
.collect(Collectors.toList());
} | java | public List<ConfigPath> findAllRootPaths() {
return paths.stream()
.filter(it -> !it.getPath().contains(DOT))
.collect(Collectors.toList());
} | [
"public",
"List",
"<",
"ConfigPath",
">",
"findAllRootPaths",
"(",
")",
"{",
"return",
"paths",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"it",
"->",
"!",
"it",
".",
"getPath",
"(",
")",
".",
"contains",
"(",
"DOT",
")",
")",
".",
"collect",
"("... | For example, it would always contain logging, metrics and server paths from dropwizard configuration.
@return all root objects and direct root values (only paths 1 level paths)
@see #findAllRootPathsFrom(Class) | [
"For",
"example",
"it",
"would",
"always",
"contain",
"logging",
"metrics",
"and",
"server",
"paths",
"from",
"dropwizard",
"configuration",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/yaml/ConfigurationTree.java#L157-L161 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/jersey/debug/service/ContextDebugService.java | ContextDebugService.hkManage | public void hkManage(final Class<?> type) {
if (!JerseyBinding.isHK2Managed(type, options.get(JerseyExtensionsManagedByGuice))) {
throw new WrongContextException("HK2 creates service %s which must be managed by guice.",
type.getName());
}
hkManaged.add(type);
... | java | public void hkManage(final Class<?> type) {
if (!JerseyBinding.isHK2Managed(type, options.get(JerseyExtensionsManagedByGuice))) {
throw new WrongContextException("HK2 creates service %s which must be managed by guice.",
type.getName());
}
hkManaged.add(type);
... | [
"public",
"void",
"hkManage",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"if",
"(",
"!",
"JerseyBinding",
".",
"isHK2Managed",
"(",
"type",
",",
"options",
".",
"get",
"(",
"JerseyExtensionsManagedByGuice",
")",
")",
")",
"{",
"throw",
"new"... | Called by specific HK2 lifecycle listener to check if bean is properly instantiated by HK2.
@param type instantiated bean type | [
"Called",
"by",
"specific",
"HK2",
"lifecycle",
"listener",
"to",
"check",
"if",
"bean",
"is",
"properly",
"instantiated",
"by",
"HK2",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/jersey/debug/service/ContextDebugService.java#L68-L74 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/jersey/debug/service/ContextDebugService.java | ContextDebugService.guiceManage | public void guiceManage(final Class<?> type) {
if (JerseyBinding.isHK2Managed(type, options.get(JerseyExtensionsManagedByGuice))) {
throw new WrongContextException("Guice creates service %s which must be managed by HK2.",
type.getName());
}
guiceManaged.add(type);... | java | public void guiceManage(final Class<?> type) {
if (JerseyBinding.isHK2Managed(type, options.get(JerseyExtensionsManagedByGuice))) {
throw new WrongContextException("Guice creates service %s which must be managed by HK2.",
type.getName());
}
guiceManaged.add(type);... | [
"public",
"void",
"guiceManage",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"if",
"(",
"JerseyBinding",
".",
"isHK2Managed",
"(",
"type",
",",
"options",
".",
"get",
"(",
"JerseyExtensionsManagedByGuice",
")",
")",
")",
"{",
"throw",
"new",
... | Called by specific guice provision listener to check if bean is properly instantiated by guice.
@param type instantiated bean type | [
"Called",
"by",
"specific",
"guice",
"provision",
"listener",
"to",
"check",
"if",
"bean",
"is",
"properly",
"instantiated",
"by",
"guice",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/jersey/debug/service/ContextDebugService.java#L81-L87 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/jersey/Jersey2Module.java | Jersey2Module.checkHkFirstMode | private void checkHkFirstMode() {
final boolean guiceyFirstMode = context.option(JerseyExtensionsManagedByGuice);
if (!guiceyFirstMode) {
Preconditions.checkState(context.option(UseHkBridge),
"HK2 management for jersey extensions is enabled by default "
... | java | private void checkHkFirstMode() {
final boolean guiceyFirstMode = context.option(JerseyExtensionsManagedByGuice);
if (!guiceyFirstMode) {
Preconditions.checkState(context.option(UseHkBridge),
"HK2 management for jersey extensions is enabled by default "
... | [
"private",
"void",
"checkHkFirstMode",
"(",
")",
"{",
"final",
"boolean",
"guiceyFirstMode",
"=",
"context",
".",
"option",
"(",
"JerseyExtensionsManagedByGuice",
")",
";",
"if",
"(",
"!",
"guiceyFirstMode",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"co... | When HK2 management for jersey extensions is enabled by default, then guice bridge must be enabled.
Without it guice beans could not be used in resources and other jersey extensions. If this is
expected then guice support is not needed at all. | [
"When",
"HK2",
"management",
"for",
"jersey",
"extensions",
"is",
"enabled",
"by",
"default",
"then",
"guice",
"bridge",
"must",
"be",
"enabled",
".",
"Without",
"it",
"guice",
"beans",
"could",
"not",
"be",
"used",
"in",
"resources",
"and",
"other",
"jersey... | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/jersey/Jersey2Module.java#L71-L80 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/hook/ConfigurationHooksSupport.java | ConfigurationHooksSupport.register | public static void register(final GuiceyConfigurationHook hook) {
if (HOOKS.get() == null) {
// to avoid duplicate registrations
HOOKS.set(new LinkedHashSet<>());
}
HOOKS.get().add(hook);
} | java | public static void register(final GuiceyConfigurationHook hook) {
if (HOOKS.get() == null) {
// to avoid duplicate registrations
HOOKS.set(new LinkedHashSet<>());
}
HOOKS.get().add(hook);
} | [
"public",
"static",
"void",
"register",
"(",
"final",
"GuiceyConfigurationHook",
"hook",
")",
"{",
"if",
"(",
"HOOKS",
".",
"get",
"(",
")",
"==",
"null",
")",
"{",
"// to avoid duplicate registrations",
"HOOKS",
".",
"set",
"(",
"new",
"LinkedHashSet",
"<>",
... | Register hook for current thread. Must be called before application initialization, otherwise will not
be used at all.
@param hook hook to register | [
"Register",
"hook",
"for",
"current",
"thread",
".",
"Must",
"be",
"called",
"before",
"application",
"initialization",
"otherwise",
"will",
"not",
"be",
"used",
"at",
"all",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/hook/ConfigurationHooksSupport.java#L33-L39 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/installer/internal/ModulesSupport.java | ModulesSupport.configureModules | @SuppressWarnings("unchecked")
public static void configureModules(final ConfigurationContext context) {
final Options options = new Options(context.options());
for (Module mod : context.getEnabledModules()) {
if (mod instanceof BootstrapAwareModule) {
((BootstrapAwareMod... | java | @SuppressWarnings("unchecked")
public static void configureModules(final ConfigurationContext context) {
final Options options = new Options(context.options());
for (Module mod : context.getEnabledModules()) {
if (mod instanceof BootstrapAwareModule) {
((BootstrapAwareMod... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"void",
"configureModules",
"(",
"final",
"ConfigurationContext",
"context",
")",
"{",
"final",
"Options",
"options",
"=",
"new",
"Options",
"(",
"context",
".",
"options",
"(",
")",
")",
... | Post-process registered modules by injecting bootstrap, configuration, environment and options objects.
@param context configuration context | [
"Post",
"-",
"process",
"registered",
"modules",
"by",
"injecting",
"bootstrap",
"configuration",
"environment",
"and",
"options",
"objects",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/installer/internal/ModulesSupport.java#L29-L49 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/jersey/hk2/GuiceBridgeActivator.java | GuiceBridgeActivator.activate | public void activate() {
GuiceBridge.getGuiceBridge().initializeGuiceBridge(locator);
final GuiceIntoHK2Bridge guiceBridge = locator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(injector);
} | java | public void activate() {
GuiceBridge.getGuiceBridge().initializeGuiceBridge(locator);
final GuiceIntoHK2Bridge guiceBridge = locator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(injector);
} | [
"public",
"void",
"activate",
"(",
")",
"{",
"GuiceBridge",
".",
"getGuiceBridge",
"(",
")",
".",
"initializeGuiceBridge",
"(",
"locator",
")",
";",
"final",
"GuiceIntoHK2Bridge",
"guiceBridge",
"=",
"locator",
".",
"getService",
"(",
"GuiceIntoHK2Bridge",
".",
... | Activate HK2 guice bridge. | [
"Activate",
"HK2",
"guice",
"bridge",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/jersey/hk2/GuiceBridgeActivator.java#L31-L35 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/installer/feature/jersey/AbstractJerseyInstaller.java | AbstractJerseyInstaller.isForceSingleton | protected boolean isForceSingleton(final Class<?> type, final boolean hkManaged) {
return ((Boolean) option(ForceSingletonForJerseyExtensions)) && !hasScopeAnnotation(type, hkManaged);
} | java | protected boolean isForceSingleton(final Class<?> type, final boolean hkManaged) {
return ((Boolean) option(ForceSingletonForJerseyExtensions)) && !hasScopeAnnotation(type, hkManaged);
} | [
"protected",
"boolean",
"isForceSingleton",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
",",
"final",
"boolean",
"hkManaged",
")",
"{",
"return",
"(",
"(",
"Boolean",
")",
"option",
"(",
"ForceSingletonForJerseyExtensions",
")",
")",
"&&",
"!",
"hasScopeAnno... | Singleton binding should not be forced if bean has explicit scope declaration.
@param type bean type
@param hkManaged true if bean is going to be managed by hk, false for guice management
@return true to force singleton bindings for hk extensions (resources, filters etc), false otherwise | [
"Singleton",
"binding",
"should",
"not",
"be",
"forced",
"if",
"bean",
"has",
"explicit",
"scope",
"declaration",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/installer/feature/jersey/AbstractJerseyInstaller.java#L80-L82 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/installer/feature/jersey/AbstractJerseyInstaller.java | AbstractJerseyInstaller.hasScopeAnnotation | private boolean hasScopeAnnotation(final Class<?> type, final boolean hkManaged) {
boolean found = false;
for (Annotation ann : type.getAnnotations()) {
final Class<? extends Annotation> annType = ann.annotationType();
if (annType.isAnnotationPresent(Scope.class)) {
... | java | private boolean hasScopeAnnotation(final Class<?> type, final boolean hkManaged) {
boolean found = false;
for (Annotation ann : type.getAnnotations()) {
final Class<? extends Annotation> annType = ann.annotationType();
if (annType.isAnnotationPresent(Scope.class)) {
... | [
"private",
"boolean",
"hasScopeAnnotation",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
",",
"final",
"boolean",
"hkManaged",
")",
"{",
"boolean",
"found",
"=",
"false",
";",
"for",
"(",
"Annotation",
"ann",
":",
"type",
".",
"getAnnotations",
"(",
")",
... | Checks scope annotation presence directly on bean. Base classes are not checked as scope is not
inheritable.
@param type bean type
@param hkManaged true if bean is going to be managed by hk, false for guice management
@return true if scope annotation found, false otherwise | [
"Checks",
"scope",
"annotation",
"presence",
"directly",
"on",
"bean",
".",
"Base",
"classes",
"are",
"not",
"checked",
"as",
"scope",
"is",
"not",
"inheritable",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/installer/feature/jersey/AbstractJerseyInstaller.java#L92-L107 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java | ConfigurationContext.registerCommands | public void registerCommands(final List<Class<Command>> commands) {
setScope(ConfigScope.ClasspathScan.getType());
for (Class<Command> cmd : commands) {
register(ConfigItem.Command, cmd);
}
closeScope();
} | java | public void registerCommands(final List<Class<Command>> commands) {
setScope(ConfigScope.ClasspathScan.getType());
for (Class<Command> cmd : commands) {
register(ConfigItem.Command, cmd);
}
closeScope();
} | [
"public",
"void",
"registerCommands",
"(",
"final",
"List",
"<",
"Class",
"<",
"Command",
">",
">",
"commands",
")",
"{",
"setScope",
"(",
"ConfigScope",
".",
"ClasspathScan",
".",
"getType",
"(",
")",
")",
";",
"for",
"(",
"Class",
"<",
"Command",
">",
... | Register commands resolved with classpath scan.
@param commands installed commands
@see ru.vyarus.dropwizard.guice.GuiceBundle.Builder#searchCommands() | [
"Register",
"commands",
"resolved",
"with",
"classpath",
"scan",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java#L131-L137 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java | ConfigurationContext.applyPredicatesForRegisteredItems | private void applyPredicatesForRegisteredItems(final List<PredicateHandler> predicates) {
ImmutableList.builder()
.addAll(getEnabledModules())
.addAll(getEnabledBundles())
.addAll(getEnabledExtensions())
.addAll(getEnabledInstallers())
... | java | private void applyPredicatesForRegisteredItems(final List<PredicateHandler> predicates) {
ImmutableList.builder()
.addAll(getEnabledModules())
.addAll(getEnabledBundles())
.addAll(getEnabledExtensions())
.addAll(getEnabledInstallers())
... | [
"private",
"void",
"applyPredicatesForRegisteredItems",
"(",
"final",
"List",
"<",
"PredicateHandler",
">",
"predicates",
")",
"{",
"ImmutableList",
".",
"builder",
"(",
")",
".",
"addAll",
"(",
"getEnabledModules",
"(",
")",
")",
".",
"addAll",
"(",
"getEnabled... | Disable predicate could be registered after some items registration and to make sure that predicate
affects all these items - apply to all currenlty registered items.
@param predicates new predicates | [
"Disable",
"predicate",
"could",
"be",
"registered",
"after",
"some",
"items",
"registration",
"and",
"to",
"make",
"sure",
"that",
"predicate",
"affects",
"all",
"these",
"items",
"-",
"apply",
"to",
"all",
"currenlty",
"registered",
"items",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java#L620-L630 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java | ConfigurationContext.getOrCreateInfo | @SuppressWarnings("unchecked")
private <T extends ItemInfoImpl> T getOrCreateInfo(final ConfigItem type, final Object item) {
final Class<?> itemType = getType(item);
final T info;
// details holder allows to implicitly filter by type and avoid duplicate registration
if (detailsHolde... | java | @SuppressWarnings("unchecked")
private <T extends ItemInfoImpl> T getOrCreateInfo(final ConfigItem type, final Object item) {
final Class<?> itemType = getType(item);
final T info;
// details holder allows to implicitly filter by type and avoid duplicate registration
if (detailsHolde... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
"extends",
"ItemInfoImpl",
">",
"T",
"getOrCreateInfo",
"(",
"final",
"ConfigItem",
"type",
",",
"final",
"Object",
"item",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"itemType",
"=",
... | Disabled items may not be actually registered. In order to register disable info in uniform way
dummy container is created.
@param type item type
@param item item object
@param <T> expected container type
@return info container instance | [
"Disabled",
"items",
"may",
"not",
"be",
"actually",
"registered",
".",
"In",
"order",
"to",
"register",
"disable",
"info",
"in",
"uniform",
"way",
"dummy",
"container",
"is",
"created",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java#L675-L689 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/option/OptionsConfig.java | OptionsConfig.hideGroups | @SafeVarargs
public final OptionsConfig hideGroups(final Class<Enum>... groups) {
hiddenGroups.addAll(Arrays.asList(groups));
return this;
} | java | @SafeVarargs
public final OptionsConfig hideGroups(final Class<Enum>... groups) {
hiddenGroups.addAll(Arrays.asList(groups));
return this;
} | [
"@",
"SafeVarargs",
"public",
"final",
"OptionsConfig",
"hideGroups",
"(",
"final",
"Class",
"<",
"Enum",
">",
"...",
"groups",
")",
"{",
"hiddenGroups",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"groups",
")",
")",
";",
"return",
"this",
";",
"}... | Hide option groups from reporting.
@param groups option enum classes to hide
@return config instance for chained calls | [
"Hide",
"option",
"groups",
"from",
"reporting",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/option/OptionsConfig.java#L84-L88 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/info/impl/ModuleItemInfoImpl.java | ModuleItemInfoImpl.overrideScope | public static void overrideScope(final Runnable action) {
override.set(true);
try {
action.run();
} finally {
override.remove();
}
} | java | public static void overrideScope(final Runnable action) {
override.set(true);
try {
action.run();
} finally {
override.remove();
}
} | [
"public",
"static",
"void",
"overrideScope",
"(",
"final",
"Runnable",
"action",
")",
"{",
"override",
".",
"set",
"(",
"true",
")",
";",
"try",
"{",
"action",
".",
"run",
"(",
")",
";",
"}",
"finally",
"{",
"override",
".",
"remove",
"(",
")",
";",
... | Use to register overriding modules. Such complex approach was used because overriding modules
is the only item that require additional parameter during registration. This parameter may be used
in disable predicate to differentiate overriding modules from normal modules.
@param action registration action | [
"Use",
"to",
"register",
"overriding",
"modules",
".",
"Such",
"complex",
"approach",
"was",
"used",
"because",
"overriding",
"modules",
"is",
"the",
"only",
"item",
"that",
"require",
"additional",
"parameter",
"during",
"registration",
".",
"This",
"parameter",
... | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/info/impl/ModuleItemInfoImpl.java#L49-L56 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/installer/util/Reporter.java | Reporter.line | public final Reporter line(final String line, final Object... args) {
counter++;
wasEmptyLine = false;
message.append(TAB).append(String.format(line, args)).append(NEWLINE);
return this;
} | java | public final Reporter line(final String line, final Object... args) {
counter++;
wasEmptyLine = false;
message.append(TAB).append(String.format(line, args)).append(NEWLINE);
return this;
} | [
"public",
"final",
"Reporter",
"line",
"(",
"final",
"String",
"line",
",",
"final",
"Object",
"...",
"args",
")",
"{",
"counter",
"++",
";",
"wasEmptyLine",
"=",
"false",
";",
"message",
".",
"append",
"(",
"TAB",
")",
".",
"append",
"(",
"String",
".... | Prints formatted line.
@param line line with {@code String.format} syntax
@param args message arguments
@return reporter instance | [
"Prints",
"formatted",
"line",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/installer/util/Reporter.java#L53-L58 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/tree/ContextTreeRenderer.java | ContextTreeRenderer.renderReport | @Override
public String renderReport(final ContextTreeConfig config) {
final Set<Class<?>> scopes = service.getActiveScopes(!config.isHideDisables());
final TreeNode root = new TreeNode("APPLICATION");
if (!config.getHiddenScopes().contains(Application.getType())) {
renderScope... | java | @Override
public String renderReport(final ContextTreeConfig config) {
final Set<Class<?>> scopes = service.getActiveScopes(!config.isHideDisables());
final TreeNode root = new TreeNode("APPLICATION");
if (!config.getHiddenScopes().contains(Application.getType())) {
renderScope... | [
"@",
"Override",
"public",
"String",
"renderReport",
"(",
"final",
"ContextTreeConfig",
"config",
")",
"{",
"final",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"scopes",
"=",
"service",
".",
"getActiveScopes",
"(",
"!",
"config",
".",
"isHideDisables",
"(",
... | Renders configuration tree report according to provided config.
By default report padded left with one tab. Subtrees are always padded with empty lines for better
visibility.
@param config tree rendering config
@return rendered tree | [
"Renders",
"configuration",
"tree",
"report",
"according",
"to",
"provided",
"config",
".",
"By",
"default",
"report",
"padded",
"left",
"with",
"one",
"tab",
".",
"Subtrees",
"are",
"always",
"padded",
"with",
"empty",
"lines",
"for",
"better",
"visibility",
... | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/tree/ContextTreeRenderer.java#L51-L69 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/tree/ContextTreeRenderer.java | ContextTreeRenderer.renderBundle | private void renderBundle(final ContextTreeConfig config, final TreeNode root,
final Class<?> scope, final Class<Object> bundle) {
final BundleItemInfo info = service.getData().getInfo(bundle);
if (isHidden(config, info, scope)) {
return;
}
final... | java | private void renderBundle(final ContextTreeConfig config, final TreeNode root,
final Class<?> scope, final Class<Object> bundle) {
final BundleItemInfo info = service.getData().getInfo(bundle);
if (isHidden(config, info, scope)) {
return;
}
final... | [
"private",
"void",
"renderBundle",
"(",
"final",
"ContextTreeConfig",
"config",
",",
"final",
"TreeNode",
"root",
",",
"final",
"Class",
"<",
"?",
">",
"scope",
",",
"final",
"Class",
"<",
"Object",
">",
"bundle",
")",
"{",
"final",
"BundleItemInfo",
"info",... | Renders bundle if allowed.
@param config tree config
@param root current node
@param scope current scope
@param bundle bundle class | [
"Renders",
"bundle",
"if",
"allowed",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/tree/ContextTreeRenderer.java#L154-L172 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/tree/ContextTreeRenderer.java | ContextTreeRenderer.isHidden | @SuppressWarnings("checkstyle:BooleanExpressionComplexity")
private boolean isHidden(final ContextTreeConfig config, final ItemInfo info, final Class<?> scope) {
// item explicitly hidden
final boolean hidden = config.getHiddenItems().contains(info.getItemType());
// installer disabled
... | java | @SuppressWarnings("checkstyle:BooleanExpressionComplexity")
private boolean isHidden(final ContextTreeConfig config, final ItemInfo info, final Class<?> scope) {
// item explicitly hidden
final boolean hidden = config.getHiddenItems().contains(info.getItemType());
// installer disabled
... | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:BooleanExpressionComplexity\"",
")",
"private",
"boolean",
"isHidden",
"(",
"final",
"ContextTreeConfig",
"config",
",",
"final",
"ItemInfo",
"info",
",",
"final",
"Class",
"<",
"?",
">",
"scope",
")",
"{",
"// item explic... | Checks element visibility according to config. Universal place to check visibility for either simple config
items or bundles and special scopes.
@param config tree configuration
@param info current item info
@param scope current item rendering scope
@return true if item is hidden, false otherwise | [
"Checks",
"element",
"visibility",
"according",
"to",
"config",
".",
"Universal",
"place",
"to",
"check",
"visibility",
"for",
"either",
"simple",
"config",
"items",
"or",
"bundles",
"and",
"special",
"scopes",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/tree/ContextTreeRenderer.java#L203-L220 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/yaml/ConfigTreeBuilder.java | ConfigTreeBuilder.build | public static ConfigurationTree build(final Bootstrap bootstrap,
final Configuration configuration,
final boolean introspect) {
final List<Class> roots = resolveRootTypes(new ArrayList<>(), configuration.getClass());
if ... | java | public static ConfigurationTree build(final Bootstrap bootstrap,
final Configuration configuration,
final boolean introspect) {
final List<Class> roots = resolveRootTypes(new ArrayList<>(), configuration.getClass());
if ... | [
"public",
"static",
"ConfigurationTree",
"build",
"(",
"final",
"Bootstrap",
"bootstrap",
",",
"final",
"Configuration",
"configuration",
",",
"final",
"boolean",
"introspect",
")",
"{",
"final",
"List",
"<",
"Class",
">",
"roots",
"=",
"resolveRootTypes",
"(",
... | Analyze configuration object to extract bindable parts.
@param bootstrap bootstrap instance
@param configuration configuration instance
@param introspect true to introspect configuration object and extract values by path and unique
sub configurations
@return parsed configuration info | [
"Analyze",
"configuration",
"object",
"to",
"extract",
"bindable",
"parts",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/yaml/ConfigTreeBuilder.java#L98-L115 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/option/OptionsRenderer.java | OptionsRenderer.renderReport | @Override
public String renderReport(final OptionsConfig config) {
final StringBuilder res = new StringBuilder();
render(config, res);
return res.toString();
} | java | @Override
public String renderReport(final OptionsConfig config) {
final StringBuilder res = new StringBuilder();
render(config, res);
return res.toString();
} | [
"@",
"Override",
"public",
"String",
"renderReport",
"(",
"final",
"OptionsConfig",
"config",
")",
"{",
"final",
"StringBuilder",
"res",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"render",
"(",
"config",
",",
"res",
")",
";",
"return",
"res",
".",
"toStr... | Renders options report.
@param config rendering config
@return rendered report | [
"Renders",
"options",
"report",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/option/OptionsRenderer.java#L53-L58 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/stat/StatsTracker.java | StatsTracker.count | public void count(final Stat name, final int count) {
Integer value = counters.get(name);
value = value == null ? count : value + count;
counters.put(name, value);
} | java | public void count(final Stat name, final int count) {
Integer value = counters.get(name);
value = value == null ? count : value + count;
counters.put(name, value);
} | [
"public",
"void",
"count",
"(",
"final",
"Stat",
"name",
",",
"final",
"int",
"count",
")",
"{",
"Integer",
"value",
"=",
"counters",
".",
"get",
"(",
"name",
")",
";",
"value",
"=",
"value",
"==",
"null",
"?",
"count",
":",
"value",
"+",
"count",
... | Inserts value for first call and sum values for consequent calls.
@param name statistics name
@param count counter value | [
"Inserts",
"value",
"for",
"first",
"call",
"and",
"sum",
"values",
"for",
"consequent",
"calls",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/stat/StatsTracker.java#L44-L48 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/stat/StatsTracker.java | StatsTracker.startHkTimer | public void startHkTimer(final Stat name) {
timer(GuiceyTime);
if (!HKTime.equals(name)) {
timer(HKTime);
}
timer(name);
} | java | public void startHkTimer(final Stat name) {
timer(GuiceyTime);
if (!HKTime.equals(name)) {
timer(HKTime);
}
timer(name);
} | [
"public",
"void",
"startHkTimer",
"(",
"final",
"Stat",
"name",
")",
"{",
"timer",
"(",
"GuiceyTime",
")",
";",
"if",
"(",
"!",
"HKTime",
".",
"equals",
"(",
"name",
")",
")",
"{",
"timer",
"(",
"HKTime",
")",
";",
"}",
"timer",
"(",
"name",
")",
... | Special methods for tracking time in HK2 scope.
Such complication used to avoid using 3 different trackers in code.
HK2 initialization is performed after bundles run and so out of scope of GuiceBundle.
@param name HK2 statistics name | [
"Special",
"methods",
"for",
"tracking",
"time",
"in",
"HK2",
"scope",
".",
"Such",
"complication",
"used",
"to",
"avoid",
"using",
"3",
"different",
"trackers",
"in",
"code",
".",
"HK2",
"initialization",
"is",
"performed",
"after",
"bundles",
"run",
"and",
... | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/stat/StatsTracker.java#L57-L63 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/installer/InstallerModule.java | InstallerModule.prepareInstallers | private List<FeatureInstaller> prepareInstallers(
final List<Class<? extends FeatureInstaller>> installerClasses) {
final List<FeatureInstaller> installers = Lists.newArrayList();
// different instance then used in guice context, but it's just an accessor object
final Options options... | java | private List<FeatureInstaller> prepareInstallers(
final List<Class<? extends FeatureInstaller>> installerClasses) {
final List<FeatureInstaller> installers = Lists.newArrayList();
// different instance then used in guice context, but it's just an accessor object
final Options options... | [
"private",
"List",
"<",
"FeatureInstaller",
">",
"prepareInstallers",
"(",
"final",
"List",
"<",
"Class",
"<",
"?",
"extends",
"FeatureInstaller",
">",
">",
"installerClasses",
")",
"{",
"final",
"List",
"<",
"FeatureInstaller",
">",
"installers",
"=",
"Lists",
... | Instantiate all found installers using default constructor.
@param installerClasses found installer classes
@return list of installer instances | [
"Instantiate",
"all",
"found",
"installers",
"using",
"default",
"constructor",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/installer/InstallerModule.java#L110-L127 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/installer/InstallerModule.java | InstallerModule.resolveExtensions | @SuppressWarnings("PMD.PrematureDeclaration")
private void resolveExtensions(final ExtensionsHolder holder) {
final Stopwatch timer = context.stat().timer(Stat.ExtensionsRecognitionTime);
final boolean guiceFirstMode = context.option(JerseyExtensionsManagedByGuice);
final List<Class<?>> manu... | java | @SuppressWarnings("PMD.PrematureDeclaration")
private void resolveExtensions(final ExtensionsHolder holder) {
final Stopwatch timer = context.stat().timer(Stat.ExtensionsRecognitionTime);
final boolean guiceFirstMode = context.option(JerseyExtensionsManagedByGuice);
final List<Class<?>> manu... | [
"@",
"SuppressWarnings",
"(",
"\"PMD.PrematureDeclaration\"",
")",
"private",
"void",
"resolveExtensions",
"(",
"final",
"ExtensionsHolder",
"holder",
")",
"{",
"final",
"Stopwatch",
"timer",
"=",
"context",
".",
"stat",
"(",
")",
".",
"timer",
"(",
"Stat",
".",... | Performs one more classpath scan to search for extensions or simply install manually provided extension classes.
@param holder holder to store found extension classes until injector creation | [
"Performs",
"one",
"more",
"classpath",
"scan",
"to",
"search",
"for",
"extensions",
"or",
"simply",
"install",
"manually",
"provided",
"extension",
"classes",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/installer/InstallerModule.java#L134-L158 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/installer/InstallerModule.java | InstallerModule.bindExtension | @SuppressWarnings("unchecked")
private void bindExtension(final ExtensionItemInfo item, final FeatureInstaller installer,
final ExtensionsHolder holder) {
final Class<? extends FeatureInstaller> installerClass = installer.getClass();
final Class<?> type = item.getType(... | java | @SuppressWarnings("unchecked")
private void bindExtension(final ExtensionItemInfo item, final FeatureInstaller installer,
final ExtensionsHolder holder) {
final Class<? extends FeatureInstaller> installerClass = installer.getClass();
final Class<?> type = item.getType(... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"bindExtension",
"(",
"final",
"ExtensionItemInfo",
"item",
",",
"final",
"FeatureInstaller",
"installer",
",",
"final",
"ExtensionsHolder",
"holder",
")",
"{",
"final",
"Class",
"<",
"?",
"ext... | Bind extension to guice context.
@param item extension item descriptor
@param installer detected extension installer
@param holder extensions holder bean | [
"Bind",
"extension",
"to",
"guice",
"context",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/installer/InstallerModule.java#L204-L216 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/util/RenderUtils.java | RenderUtils.renderDisabledInstaller | public static String renderDisabledInstaller(final Class<FeatureInstaller> type) {
return String.format("-%-19s %-38s",
FeatureUtils.getInstallerExtName(type), brackets(renderClass(type)));
} | java | public static String renderDisabledInstaller(final Class<FeatureInstaller> type) {
return String.format("-%-19s %-38s",
FeatureUtils.getInstallerExtName(type), brackets(renderClass(type)));
} | [
"public",
"static",
"String",
"renderDisabledInstaller",
"(",
"final",
"Class",
"<",
"FeatureInstaller",
">",
"type",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"-%-19s %-38s\"",
",",
"FeatureUtils",
".",
"getInstallerExtName",
"(",
"type",
")",
",",
"b... | Renders disabled installer line. The same as installer line, but with '-' before installer name and
without markers.
@param type disabled installer class
@return rendered disabled installer line | [
"Renders",
"disabled",
"installer",
"line",
".",
"The",
"same",
"as",
"installer",
"line",
"but",
"with",
"-",
"before",
"installer",
"name",
"and",
"without",
"markers",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/util/RenderUtils.java#L49-L52 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/util/RenderUtils.java | RenderUtils.renderPackage | public static String renderPackage(final Class<?> type) {
return PACKAGE_FORMATTER.abbreviate(type.isMemberClass() && !type.isAnonymousClass()
? type.getDeclaringClass().getName() : type.getPackage().getName());
} | java | public static String renderPackage(final Class<?> type) {
return PACKAGE_FORMATTER.abbreviate(type.isMemberClass() && !type.isAnonymousClass()
? type.getDeclaringClass().getName() : type.getPackage().getName());
} | [
"public",
"static",
"String",
"renderPackage",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"PACKAGE_FORMATTER",
".",
"abbreviate",
"(",
"type",
".",
"isMemberClass",
"(",
")",
"&&",
"!",
"type",
".",
"isAnonymousClass",
"(",
")",
"?",... | If provided type is inner class then declaring class will be rendered instead of package.
@param type class to render package
@return class package rendered in abbreviated manner (to fit nto 20 chars)
@see TargetLengthBasedClassNameAbbreviator | [
"If",
"provided",
"type",
"is",
"inner",
"class",
"then",
"declaring",
"class",
"will",
"be",
"rendered",
"instead",
"of",
"package",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/util/RenderUtils.java#L92-L95 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/diagnostic/DiagnosticRenderer.java | DiagnosticRenderer.renderReport | @Override
public String renderReport(final DiagnosticConfig config) {
final StringBuilder res = new StringBuilder();
printCommands(config, res);
printBundles(config, res);
if (config.isPrintInstallers()) {
printInstallers(config, res);
printDisabledExtensions(... | java | @Override
public String renderReport(final DiagnosticConfig config) {
final StringBuilder res = new StringBuilder();
printCommands(config, res);
printBundles(config, res);
if (config.isPrintInstallers()) {
printInstallers(config, res);
printDisabledExtensions(... | [
"@",
"Override",
"public",
"String",
"renderReport",
"(",
"final",
"DiagnosticConfig",
"config",
")",
"{",
"final",
"StringBuilder",
"res",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"printCommands",
"(",
"config",
",",
"res",
")",
";",
"printBundles",
"(",
... | Renders diagnostic report according to config.
@param config print config
@return rendered diagnostic | [
"Renders",
"diagnostic",
"report",
"according",
"to",
"config",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/diagnostic/DiagnosticRenderer.java#L84-L97 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/GuiceBundle.java | GuiceBundle.configureFromBundles | private void configureFromBundles() {
context.lifecycle().runPhase(context.getConfiguration(), context.getConfigurationTree(),
context.getEnvironment());
final Stopwatch timer = context.stat().timer(BundleTime);
final Stopwatch resolutionTimer = context.stat().timer(BundleResolut... | java | private void configureFromBundles() {
context.lifecycle().runPhase(context.getConfiguration(), context.getConfigurationTree(),
context.getEnvironment());
final Stopwatch timer = context.stat().timer(BundleTime);
final Stopwatch resolutionTimer = context.stat().timer(BundleResolut... | [
"private",
"void",
"configureFromBundles",
"(",
")",
"{",
"context",
".",
"lifecycle",
"(",
")",
".",
"runPhase",
"(",
"context",
".",
"getConfiguration",
"(",
")",
",",
"context",
".",
"getConfigurationTree",
"(",
")",
",",
"context",
".",
"getEnvironment",
... | Apply configuration from registered bundles. If dropwizard bundles support is enabled, lookup them too. | [
"Apply",
"configuration",
"from",
"registered",
"bundles",
".",
"If",
"dropwizard",
"bundles",
"support",
"is",
"enabled",
"lookup",
"them",
"too",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/GuiceBundle.java#L164-L176 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/GuiceBootstrapModule.java | GuiceBootstrapModule.bindEnvironment | @SuppressWarnings("deprecation")
private void bindEnvironment() {
bind(Bootstrap.class).toInstance(bootstrap());
bind(Environment.class).toInstance(environment());
install(new ConfigBindingModule(configuration(), configurationTree(),
context.option(BindConfigurationInterfaces... | java | @SuppressWarnings("deprecation")
private void bindEnvironment() {
bind(Bootstrap.class).toInstance(bootstrap());
bind(Environment.class).toInstance(environment());
install(new ConfigBindingModule(configuration(), configurationTree(),
context.option(BindConfigurationInterfaces... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"void",
"bindEnvironment",
"(",
")",
"{",
"bind",
"(",
"Bootstrap",
".",
"class",
")",
".",
"toInstance",
"(",
"bootstrap",
"(",
")",
")",
";",
"bind",
"(",
"Environment",
".",
"class",
")",
... | Bind bootstrap, configuration and environment objects to be able to use them
as injectable. | [
"Bind",
"bootstrap",
"configuration",
"and",
"environment",
"objects",
"to",
"be",
"able",
"to",
"use",
"them",
"as",
"injectable",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/GuiceBootstrapModule.java#L78-L84 | train |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/bundle/lookup/PropertyBundleLookup.java | PropertyBundleLookup.enableBundles | @SafeVarargs
public static void enableBundles(final Class<? extends GuiceyBundle>... bundles) {
final String prop = Joiner.on(',').join(toStrings(Lists.newArrayList(bundles)));
System.setProperty(BUNDLES_PROPERTY, prop);
} | java | @SafeVarargs
public static void enableBundles(final Class<? extends GuiceyBundle>... bundles) {
final String prop = Joiner.on(',').join(toStrings(Lists.newArrayList(bundles)));
System.setProperty(BUNDLES_PROPERTY, prop);
} | [
"@",
"SafeVarargs",
"public",
"static",
"void",
"enableBundles",
"(",
"final",
"Class",
"<",
"?",
"extends",
"GuiceyBundle",
">",
"...",
"bundles",
")",
"{",
"final",
"String",
"prop",
"=",
"Joiner",
".",
"on",
"(",
"'",
"'",
")",
".",
"join",
"(",
"to... | Sets system property value to provided classes. Shortcut is useful to set property from code, for example,
in unit tests.
@param bundles bundles to enable | [
"Sets",
"system",
"property",
"value",
"to",
"provided",
"classes",
".",
"Shortcut",
"is",
"useful",
"to",
"set",
"property",
"from",
"code",
"for",
"example",
"in",
"unit",
"tests",
"."
] | dd39ad77283555be21f606d5ebf0f11207a733d4 | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/bundle/lookup/PropertyBundleLookup.java#L54-L58 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/internal/OperationFuture.java | OperationFuture.cancel | public boolean cancel(boolean ign) {
assert op != null : "No operation";
op.cancel();
notifyListeners();
return op.getState() == OperationState.WRITE_QUEUED;
} | java | public boolean cancel(boolean ign) {
assert op != null : "No operation";
op.cancel();
notifyListeners();
return op.getState() == OperationState.WRITE_QUEUED;
} | [
"public",
"boolean",
"cancel",
"(",
"boolean",
"ign",
")",
"{",
"assert",
"op",
"!=",
"null",
":",
"\"No operation\"",
";",
"op",
".",
"cancel",
"(",
")",
";",
"notifyListeners",
"(",
")",
";",
"return",
"op",
".",
"getState",
"(",
")",
"==",
"Operatio... | Cancel this operation, if possible.
@param ign not used
@deprecated
@return true if the operation has not yet been written to the network | [
"Cancel",
"this",
"operation",
"if",
"possible",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/internal/OperationFuture.java#L109-L114 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/internal/OperationFuture.java | OperationFuture.getCas | public Long getCas() {
if (cas == null) {
try {
get();
} catch (InterruptedException e) {
status = new OperationStatus(false, "Interrupted", StatusCode.INTERRUPTED);
} catch (ExecutionException e) {
getLogger().warn("Error getting cas of operation", e);
}
}
if... | java | public Long getCas() {
if (cas == null) {
try {
get();
} catch (InterruptedException e) {
status = new OperationStatus(false, "Interrupted", StatusCode.INTERRUPTED);
} catch (ExecutionException e) {
getLogger().warn("Error getting cas of operation", e);
}
}
if... | [
"public",
"Long",
"getCas",
"(",
")",
"{",
"if",
"(",
"cas",
"==",
"null",
")",
"{",
"try",
"{",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"status",
"=",
"new",
"OperationStatus",
"(",
"false",
",",
"\"Interrupte... | Get the CAS for this operation.
The interrupted status of the current thread is cleared by this method.
Inspect the returned OperationStatus to check whether an interruption has taken place.
@throws UnsupportedOperationException If this is for an ASCII protocol
configured client.
@return the CAS for this operation or... | [
"Get",
"the",
"CAS",
"for",
"this",
"operation",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/internal/OperationFuture.java#L218-L233 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/internal/OperationFuture.java | OperationFuture.getStatus | public OperationStatus getStatus() {
if (status == null) {
try {
get();
} catch (InterruptedException e) {
status = new OperationStatus(false, "Interrupted", StatusCode.INTERRUPTED);
} catch (ExecutionException e) {
getLogger().warn("Error getting status of operation", e);
... | java | public OperationStatus getStatus() {
if (status == null) {
try {
get();
} catch (InterruptedException e) {
status = new OperationStatus(false, "Interrupted", StatusCode.INTERRUPTED);
} catch (ExecutionException e) {
getLogger().warn("Error getting status of operation", e);
... | [
"public",
"OperationStatus",
"getStatus",
"(",
")",
"{",
"if",
"(",
"status",
"==",
"null",
")",
"{",
"try",
"{",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"status",
"=",
"new",
"OperationStatus",
"(",
"false",
","... | Get the current status of this operation.
Note that the operation status may change as the operation is tried and
potentially retried against the servers specified by the NodeLocator.
The interrupted status of the current thread is cleared by this method.
Inspect the returned OperationStatus to check whether an inter... | [
"Get",
"the",
"current",
"status",
"of",
"this",
"operation",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/internal/OperationFuture.java#L245-L256 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/internal/OperationFuture.java | OperationFuture.set | public void set(T o, OperationStatus s) {
objRef.set(o);
status = s;
} | java | public void set(T o, OperationStatus s) {
objRef.set(o);
status = s;
} | [
"public",
"void",
"set",
"(",
"T",
"o",
",",
"OperationStatus",
"s",
")",
"{",
"objRef",
".",
"set",
"(",
"o",
")",
";",
"status",
"=",
"s",
";",
"}"
] | Set the Operation associated with this OperationFuture.
This is intended for internal use only.
@param o the Operation object itself
@param s the OperationStatus associated with this operation | [
"Set",
"the",
"Operation",
"associated",
"with",
"this",
"OperationFuture",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/internal/OperationFuture.java#L266-L269 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/compat/log/LoggerFactory.java | LoggerFactory.getLogger | public static Logger getLogger(String name) {
if (name == null) {
throw new NullPointerException("Logger name may not be null.");
}
init();
return (instance.internalGetLogger(name));
} | java | public static Logger getLogger(String name) {
if (name == null) {
throw new NullPointerException("Logger name may not be null.");
}
init();
return (instance.internalGetLogger(name));
} | [
"public",
"static",
"Logger",
"getLogger",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Logger name may not be null.\"",
")",
";",
"}",
"init",
"(",
")",
";",
"return",
"(",
"in... | Get a logger by name.
@param name the name for which we want the logger
@return a Logger instance | [
"Get",
"a",
"logger",
"by",
"name",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/compat/log/LoggerFactory.java#L82-L88 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/compat/log/LoggerFactory.java | LoggerFactory.internalGetLogger | private Logger internalGetLogger(String name) {
assert name != null : "Name was null";
Logger rv = instances.get(name);
if (rv == null) {
Logger newLogger = null;
try {
newLogger = getNewInstance(name);
} catch (Exception e) {
throw new RuntimeException("Problem getting lo... | java | private Logger internalGetLogger(String name) {
assert name != null : "Name was null";
Logger rv = instances.get(name);
if (rv == null) {
Logger newLogger = null;
try {
newLogger = getNewInstance(name);
} catch (Exception e) {
throw new RuntimeException("Problem getting lo... | [
"private",
"Logger",
"internalGetLogger",
"(",
"String",
"name",
")",
"{",
"assert",
"name",
"!=",
"null",
":",
"\"Name was null\"",
";",
"Logger",
"rv",
"=",
"instances",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"rv",
"==",
"null",
")",
"{",
"Log... | Get an instance of Logger from internal mechanisms. | [
"Get",
"an",
"instance",
"of",
"Logger",
"from",
"internal",
"mechanisms",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/compat/log/LoggerFactory.java#L91-L109 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/compat/log/LoggerFactory.java | LoggerFactory.getConstructor | @SuppressWarnings("unchecked")
private void getConstructor() {
Class<? extends Logger> c = DefaultLogger.class;
String className = System.getProperty("net.spy.log.LoggerImpl");
if (className != null) {
try {
c = (Class<? extends Logger>) Class.forName(className);
} catch (NoClassDefFo... | java | @SuppressWarnings("unchecked")
private void getConstructor() {
Class<? extends Logger> c = DefaultLogger.class;
String className = System.getProperty("net.spy.log.LoggerImpl");
if (className != null) {
try {
c = (Class<? extends Logger>) Class.forName(className);
} catch (NoClassDefFo... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"getConstructor",
"(",
")",
"{",
"Class",
"<",
"?",
"extends",
"Logger",
">",
"c",
"=",
"DefaultLogger",
".",
"class",
";",
"String",
"className",
"=",
"System",
".",
"getProperty",
"(",
... | Find the appropriate constructor | [
"Find",
"the",
"appropriate",
"constructor"
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/compat/log/LoggerFactory.java#L124-L173 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/compat/log/AbstractLogger.java | AbstractLogger.getThrowable | public Throwable getThrowable(Object[] args) {
Throwable rv = null;
if (args.length > 0) {
if (args[args.length - 1] instanceof Throwable) {
rv = (Throwable) args[args.length - 1];
}
}
return rv;
} | java | public Throwable getThrowable(Object[] args) {
Throwable rv = null;
if (args.length > 0) {
if (args[args.length - 1] instanceof Throwable) {
rv = (Throwable) args[args.length - 1];
}
}
return rv;
} | [
"public",
"Throwable",
"getThrowable",
"(",
"Object",
"[",
"]",
"args",
")",
"{",
"Throwable",
"rv",
"=",
"null",
";",
"if",
"(",
"args",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"args",
"[",
"args",
".",
"length",
"-",
"1",
"]",
"instanceof",... | Get the throwable from the last element of this array if it is Throwable,
else null. | [
"Get",
"the",
"throwable",
"from",
"the",
"last",
"element",
"of",
"this",
"array",
"if",
"it",
"is",
"Throwable",
"else",
"null",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/compat/log/AbstractLogger.java#L55-L63 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/compat/log/AbstractLogger.java | AbstractLogger.trace | public void trace(Object message, Throwable exception) {
log(Level.TRACE, message, exception);
} | java | public void trace(Object message, Throwable exception) {
log(Level.TRACE, message, exception);
} | [
"public",
"void",
"trace",
"(",
"Object",
"message",
",",
"Throwable",
"exception",
")",
"{",
"log",
"(",
"Level",
".",
"TRACE",
",",
"message",
",",
"exception",
")",
";",
"}"
] | Log a message at trace level.
@param message the message to log
@param exception the exception that caused the message to be generated | [
"Log",
"a",
"message",
"at",
"trace",
"level",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/compat/log/AbstractLogger.java#L87-L89 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/compat/log/AbstractLogger.java | AbstractLogger.trace | public void trace(String message, Object... args) {
if (isDebugEnabled()) {
trace(String.format(message, args), getThrowable(args));
}
} | java | public void trace(String message, Object... args) {
if (isDebugEnabled()) {
trace(String.format(message, args), getThrowable(args));
}
} | [
"public",
"void",
"trace",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isDebugEnabled",
"(",
")",
")",
"{",
"trace",
"(",
"String",
".",
"format",
"(",
"message",
",",
"args",
")",
",",
"getThrowable",
"(",
"args",
"... | Log a formatted message at trace level.
@param message the message to log
@param args the arguments for that message | [
"Log",
"a",
"formatted",
"message",
"at",
"trace",
"level",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/compat/log/AbstractLogger.java#L97-L101 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/compat/log/AbstractLogger.java | AbstractLogger.debug | public void debug(Object message, Throwable exception) {
log(Level.DEBUG, message, exception);
} | java | public void debug(Object message, Throwable exception) {
log(Level.DEBUG, message, exception);
} | [
"public",
"void",
"debug",
"(",
"Object",
"message",
",",
"Throwable",
"exception",
")",
"{",
"log",
"(",
"Level",
".",
"DEBUG",
",",
"message",
",",
"exception",
")",
";",
"}"
] | Log a message at debug level.
@param message the message to log
@param exception the exception that caused the message to be generated | [
"Log",
"a",
"message",
"at",
"debug",
"level",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/compat/log/AbstractLogger.java#L118-L120 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/compat/log/AbstractLogger.java | AbstractLogger.info | public void info(String message, Object... args) {
if (isInfoEnabled()) {
info(String.format(message, args), getThrowable(args));
}
} | java | public void info(String message, Object... args) {
if (isInfoEnabled()) {
info(String.format(message, args), getThrowable(args));
}
} | [
"public",
"void",
"info",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isInfoEnabled",
"(",
")",
")",
"{",
"info",
"(",
"String",
".",
"format",
"(",
"message",
",",
"args",
")",
",",
"getThrowable",
"(",
"args",
")",... | Log a formatted message at info level.
@param message the message to log
@param args the arguments for that message | [
"Log",
"a",
"formatted",
"message",
"at",
"info",
"level",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/compat/log/AbstractLogger.java#L159-L163 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/compat/log/AbstractLogger.java | AbstractLogger.warn | public void warn(Object message, Throwable exception) {
log(Level.WARN, message, exception);
} | java | public void warn(Object message, Throwable exception) {
log(Level.WARN, message, exception);
} | [
"public",
"void",
"warn",
"(",
"Object",
"message",
",",
"Throwable",
"exception",
")",
"{",
"log",
"(",
"Level",
".",
"WARN",
",",
"message",
",",
"exception",
")",
";",
"}"
] | Log a message at warning level.
@param message the message to log
@param exception the exception that caused the message to be generated | [
"Log",
"a",
"message",
"at",
"warning",
"level",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/compat/log/AbstractLogger.java#L180-L182 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/compat/log/AbstractLogger.java | AbstractLogger.error | public void error(Object message, Throwable exception) {
log(Level.ERROR, message, exception);
} | java | public void error(Object message, Throwable exception) {
log(Level.ERROR, message, exception);
} | [
"public",
"void",
"error",
"(",
"Object",
"message",
",",
"Throwable",
"exception",
")",
"{",
"log",
"(",
"Level",
".",
"ERROR",
",",
"message",
",",
"exception",
")",
";",
"}"
] | Log a message at error level.
@param message the message to log
@param exception the exception that caused the message to be generated | [
"Log",
"a",
"message",
"at",
"error",
"level",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/compat/log/AbstractLogger.java#L209-L211 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/compat/log/AbstractLogger.java | AbstractLogger.fatal | public void fatal(Object message, Throwable exception) {
log(Level.FATAL, message, exception);
} | java | public void fatal(Object message, Throwable exception) {
log(Level.FATAL, message, exception);
} | [
"public",
"void",
"fatal",
"(",
"Object",
"message",
",",
"Throwable",
"exception",
")",
"{",
"log",
"(",
"Level",
".",
"FATAL",
",",
"message",
",",
"exception",
")",
";",
"}"
] | Log a message at fatal level.
@param message the message to log
@param exception the exception that caused the message to be generated | [
"Log",
"a",
"message",
"at",
"fatal",
"level",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/compat/log/AbstractLogger.java#L238-L240 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/compat/log/SLF4JLogger.java | SLF4JLogger.log | @Override
public void log(Level level, Object message, Throwable e) {
if(level == null) {
level = Level.FATAL;
}
switch(level) {
case TRACE:
logger.trace(message.toString(), e);
break;
case DEBUG:
logger.debug(message.toString(), e);
break;
case INFO:
logge... | java | @Override
public void log(Level level, Object message, Throwable e) {
if(level == null) {
level = Level.FATAL;
}
switch(level) {
case TRACE:
logger.trace(message.toString(), e);
break;
case DEBUG:
logger.debug(message.toString(), e);
break;
case INFO:
logge... | [
"@",
"Override",
"public",
"void",
"log",
"(",
"Level",
"level",
",",
"Object",
"message",
",",
"Throwable",
"e",
")",
"{",
"if",
"(",
"level",
"==",
"null",
")",
"{",
"level",
"=",
"Level",
".",
"FATAL",
";",
"}",
"switch",
"(",
"level",
")",
"{",... | Wrapper around SLF4J logger facade.
@param level net.spy.compat.log.Level level.
@param message object message
@param e optional throwable | [
"Wrapper",
"around",
"SLF4J",
"logger",
"facade",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/compat/log/SLF4JLogger.java#L73-L102 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/auth/AuthThreadMonitor.java | AuthThreadMonitor.authConnection | public synchronized void authConnection(MemcachedConnection conn,
OperationFactory opFact, AuthDescriptor authDescriptor,
MemcachedNode node) {
interruptOldAuth(node);
AuthThread newSASLAuthenticator =
new AuthThread(conn, opFact, authDescriptor, node);
nodeMap.put(node, newSASLAuthentic... | java | public synchronized void authConnection(MemcachedConnection conn,
OperationFactory opFact, AuthDescriptor authDescriptor,
MemcachedNode node) {
interruptOldAuth(node);
AuthThread newSASLAuthenticator =
new AuthThread(conn, opFact, authDescriptor, node);
nodeMap.put(node, newSASLAuthentic... | [
"public",
"synchronized",
"void",
"authConnection",
"(",
"MemcachedConnection",
"conn",
",",
"OperationFactory",
"opFact",
",",
"AuthDescriptor",
"authDescriptor",
",",
"MemcachedNode",
"node",
")",
"{",
"interruptOldAuth",
"(",
"node",
")",
";",
"AuthThread",
"newSAS... | Authenticate a new connection. This is typically used by a MemcachedNode in
order to authenticate a connection right after it has been established.
If an old, but not yet completed authentication exists this will stop it in
order to create a new authentication attempt.
@param conn
@param opFact
@param authDescriptor
... | [
"Authenticate",
"a",
"new",
"connection",
".",
"This",
"is",
"typically",
"used",
"by",
"a",
"MemcachedNode",
"in",
"order",
"to",
"authenticate",
"a",
"connection",
"right",
"after",
"it",
"has",
"been",
"established",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/auth/AuthThreadMonitor.java#L57-L64 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java | OperationImpl.parseHeaderFromBuffer | private void parseHeaderFromBuffer() {
int magic = header[0];
assert magic == RES_MAGIC : "Invalid magic: " + magic;
responseCmd = header[1];
assert cmd == DUMMY_OPCODE || responseCmd == cmd
: "Unexpected response command value";
keyLen = decodeShort(header, 2);
errorCode = decodeShort(he... | java | private void parseHeaderFromBuffer() {
int magic = header[0];
assert magic == RES_MAGIC : "Invalid magic: " + magic;
responseCmd = header[1];
assert cmd == DUMMY_OPCODE || responseCmd == cmd
: "Unexpected response command value";
keyLen = decodeShort(header, 2);
errorCode = decodeShort(he... | [
"private",
"void",
"parseHeaderFromBuffer",
"(",
")",
"{",
"int",
"magic",
"=",
"header",
"[",
"0",
"]",
";",
"assert",
"magic",
"==",
"RES_MAGIC",
":",
"\"Invalid magic: \"",
"+",
"magic",
";",
"responseCmd",
"=",
"header",
"[",
"1",
"]",
";",
"assert",
... | Parse the header info out of the buffer. | [
"Parse",
"the",
"header",
"info",
"out",
"of",
"the",
"buffer",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java#L164-L177 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java | OperationImpl.readPayloadFromBuffer | private void readPayloadFromBuffer(final ByteBuffer buffer)
throws IOException {
int toRead = payload.length - payloadOffset;
int available = buffer.remaining();
toRead = Math.min(toRead, available);
getLogger().debug("Reading %d payload bytes", toRead);
buffer.get(payload, payloadOffset, toRead... | java | private void readPayloadFromBuffer(final ByteBuffer buffer)
throws IOException {
int toRead = payload.length - payloadOffset;
int available = buffer.remaining();
toRead = Math.min(toRead, available);
getLogger().debug("Reading %d payload bytes", toRead);
buffer.get(payload, payloadOffset, toRead... | [
"private",
"void",
"readPayloadFromBuffer",
"(",
"final",
"ByteBuffer",
"buffer",
")",
"throws",
"IOException",
"{",
"int",
"toRead",
"=",
"payload",
".",
"length",
"-",
"payloadOffset",
";",
"int",
"available",
"=",
"buffer",
".",
"remaining",
"(",
")",
";",
... | Read the payload from the buffer.
@param buffer the buffer to read from.
@throws IOException if an error occures during payload finishing. | [
"Read",
"the",
"payload",
"from",
"the",
"buffer",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java#L185-L198 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java | OperationImpl.getStatusForErrorCode | protected OperationStatus getStatusForErrorCode(int errCode, byte[] errPl)
throws IOException {
if(errCode == SUCCESS) {
return STATUS_OK;
} else {
StatusCode statusCode = StatusCode.fromBinaryCode(errCode);
errorMsg = errPl.clone();
switch (errCode) {
case ERR_... | java | protected OperationStatus getStatusForErrorCode(int errCode, byte[] errPl)
throws IOException {
if(errCode == SUCCESS) {
return STATUS_OK;
} else {
StatusCode statusCode = StatusCode.fromBinaryCode(errCode);
errorMsg = errPl.clone();
switch (errCode) {
case ERR_... | [
"protected",
"OperationStatus",
"getStatusForErrorCode",
"(",
"int",
"errCode",
",",
"byte",
"[",
"]",
"errPl",
")",
"throws",
"IOException",
"{",
"if",
"(",
"errCode",
"==",
"SUCCESS",
")",
"{",
"return",
"STATUS_OK",
";",
"}",
"else",
"{",
"StatusCode",
"s... | Get the OperationStatus object for the given error code.
@param errCode the error code
@return the status to return, or null if this is an exceptional case | [
"Get",
"the",
"OperationStatus",
"object",
"for",
"the",
"given",
"error",
"code",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java#L223-L258 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java | OperationImpl.prepareBuffer | protected void prepareBuffer(final String key, final long cas,
final byte[] val, final Object... extraHeaders) {
int extraLen = 0;
int extraHeadersLength = extraHeaders.length;
if (extraHeadersLength > 0) {
extraLen = calculateExtraLength(extraHeaders);
}
final byte[] keyBytes = KeyUtil.... | java | protected void prepareBuffer(final String key, final long cas,
final byte[] val, final Object... extraHeaders) {
int extraLen = 0;
int extraHeadersLength = extraHeaders.length;
if (extraHeadersLength > 0) {
extraLen = calculateExtraLength(extraHeaders);
}
final byte[] keyBytes = KeyUtil.... | [
"protected",
"void",
"prepareBuffer",
"(",
"final",
"String",
"key",
",",
"final",
"long",
"cas",
",",
"final",
"byte",
"[",
"]",
"val",
",",
"final",
"Object",
"...",
"extraHeaders",
")",
"{",
"int",
"extraLen",
"=",
"0",
";",
"int",
"extraHeadersLength",... | Prepare the buffer for sending.
@param key the key (for keyed ops).
@param cas the cas value.
@param val the data payload.
@param extraHeaders any additional headers that need to be sent. | [
"Prepare",
"the",
"buffer",
"for",
"sending",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java#L323-L356 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/metrics/DefaultMetricCollector.java | DefaultMetricCollector.initReporter | private void initReporter() {
String reporterType =
System.getProperty("net.spy.metrics.reporter.type", DEFAULT_REPORTER_TYPE);
String reporterInterval =
System.getProperty("net.spy.metrics.reporter.interval", DEFAULT_REPORTER_INTERVAL);
String reporterDir =
System.getProperty("net.spy.met... | java | private void initReporter() {
String reporterType =
System.getProperty("net.spy.metrics.reporter.type", DEFAULT_REPORTER_TYPE);
String reporterInterval =
System.getProperty("net.spy.metrics.reporter.interval", DEFAULT_REPORTER_INTERVAL);
String reporterDir =
System.getProperty("net.spy.met... | [
"private",
"void",
"initReporter",
"(",
")",
"{",
"String",
"reporterType",
"=",
"System",
".",
"getProperty",
"(",
"\"net.spy.metrics.reporter.type\"",
",",
"DEFAULT_REPORTER_TYPE",
")",
";",
"String",
"reporterInterval",
"=",
"System",
".",
"getProperty",
"(",
"\"... | Initialize the proper metrics Reporter. | [
"Initialize",
"the",
"proper",
"metrics",
"Reporter",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/metrics/DefaultMetricCollector.java#L98-L134 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/TapClient.java | TapClient.getNextMessage | public ResponseMessage getNextMessage(long time, TimeUnit timeunit) {
try {
Object m = rqueue.poll(time, timeunit);
if (m == null) {
return null;
} else if (m instanceof ResponseMessage) {
return (ResponseMessage) m;
} else if (m instanceof TapAck) {
TapAck ack = (Tap... | java | public ResponseMessage getNextMessage(long time, TimeUnit timeunit) {
try {
Object m = rqueue.poll(time, timeunit);
if (m == null) {
return null;
} else if (m instanceof ResponseMessage) {
return (ResponseMessage) m;
} else if (m instanceof TapAck) {
TapAck ack = (Tap... | [
"public",
"ResponseMessage",
"getNextMessage",
"(",
"long",
"time",
",",
"TimeUnit",
"timeunit",
")",
"{",
"try",
"{",
"Object",
"m",
"=",
"rqueue",
".",
"poll",
"(",
"time",
",",
"timeunit",
")",
";",
"if",
"(",
"m",
"==",
"null",
")",
"{",
"return",
... | Gets the next tap message from the queue of received tap messages.
@param time the amount of time to wait for a message.
@param timeunit the unit of time to use.
@return The tap message at the head of the queue or null if the queue is
empty for the given amount of time. | [
"Gets",
"the",
"next",
"tap",
"message",
"from",
"the",
"queue",
"of",
"received",
"tap",
"messages",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/TapClient.java#L105-L124 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/TapClient.java | TapClient.hasMoreMessages | public boolean hasMoreMessages() {
if (!rqueue.isEmpty()) {
return true;
} else {
synchronized (omap) {
Iterator<TapStream> itr = omap.keySet().iterator();
while (itr.hasNext()) {
TapStream ts = itr.next();
if (ts.isCompleted() || ts.isCancelled() || ts.hasErrored... | java | public boolean hasMoreMessages() {
if (!rqueue.isEmpty()) {
return true;
} else {
synchronized (omap) {
Iterator<TapStream> itr = omap.keySet().iterator();
while (itr.hasNext()) {
TapStream ts = itr.next();
if (ts.isCompleted() || ts.isCancelled() || ts.hasErrored... | [
"public",
"boolean",
"hasMoreMessages",
"(",
")",
"{",
"if",
"(",
"!",
"rqueue",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"synchronized",
"(",
"omap",
")",
"{",
"Iterator",
"<",
"TapStream",
">",
"itr",
"=",
"omap"... | Decides whether the client has received tap messages or will receive more
messages in the future.
@return true if the client has tap responses or expects to have responses
in the future. False otherwise. | [
"Decides",
"whether",
"the",
"client",
"has",
"received",
"tap",
"messages",
"or",
"will",
"receive",
"more",
"messages",
"in",
"the",
"future",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/TapClient.java#L133-L152 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/TapClient.java | TapClient.tapCustom | public TapStream tapCustom(final String id, final RequestMessage message)
throws ConfigurationException, IOException {
final TapConnectionProvider conn = new TapConnectionProvider(addrs);
final TapStream ts = new TapStream();
conn.broadcastOp(new BroadcastOpFactory() {
public Operation newOp(final... | java | public TapStream tapCustom(final String id, final RequestMessage message)
throws ConfigurationException, IOException {
final TapConnectionProvider conn = new TapConnectionProvider(addrs);
final TapStream ts = new TapStream();
conn.broadcastOp(new BroadcastOpFactory() {
public Operation newOp(final... | [
"public",
"TapStream",
"tapCustom",
"(",
"final",
"String",
"id",
",",
"final",
"RequestMessage",
"message",
")",
"throws",
"ConfigurationException",
",",
"IOException",
"{",
"final",
"TapConnectionProvider",
"conn",
"=",
"new",
"TapConnectionProvider",
"(",
"addrs",
... | Allows the user to specify a custom tap message.
@param id the named tap id that can be used to resume a disconnected tap
stream
@param message the custom tap message that will be used to initiate the tap
stream.
@return the operation that controls the tap stream.
@throws ConfigurationException a bad configuration was... | [
"Allows",
"the",
"user",
"to",
"specify",
"a",
"custom",
"tap",
"message",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/TapClient.java#L166-L197 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/TapClient.java | TapClient.shutdown | public void shutdown() {
synchronized (omap) {
for (Map.Entry<TapStream, TapConnectionProvider> me : omap.entrySet()) {
me.getValue().shutdown();
}
}
} | java | public void shutdown() {
synchronized (omap) {
for (Map.Entry<TapStream, TapConnectionProvider> me : omap.entrySet()) {
me.getValue().shutdown();
}
}
} | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"synchronized",
"(",
"omap",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"TapStream",
",",
"TapConnectionProvider",
">",
"me",
":",
"omap",
".",
"entrySet",
"(",
")",
")",
"{",
"me",
".",
"getValue",
"... | Shuts down all tap streams that are currently running. | [
"Shuts",
"down",
"all",
"tap",
"streams",
"that",
"are",
"currently",
"running",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/TapClient.java#L252-L258 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/tapmessage/Util.java | Util.fieldToValue | public static long fieldToValue(byte[] buffer, int offset, int length) {
long total = 0;
long val = 0;
for (int i = 0; i < length; i++) {
val = buffer[offset + i];
if (val < 0) {
val = val + 256;
}
total += (long) Math.pow(256.0, (double) (length - 1 - i)) * val;
}
re... | java | public static long fieldToValue(byte[] buffer, int offset, int length) {
long total = 0;
long val = 0;
for (int i = 0; i < length; i++) {
val = buffer[offset + i];
if (val < 0) {
val = val + 256;
}
total += (long) Math.pow(256.0, (double) (length - 1 - i)) * val;
}
re... | [
"public",
"static",
"long",
"fieldToValue",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"long",
"total",
"=",
"0",
";",
"long",
"val",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"l... | Converts a field in a byte array into a value.
@param buffer The byte array that contains the value
@param offset The offset of where the value begins in the byte array
@param length The length of the field to be converted
@return A long that represent the value of the field | [
"Converts",
"a",
"field",
"in",
"a",
"byte",
"array",
"into",
"a",
"value",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/tapmessage/Util.java#L43-L54 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/tapmessage/Util.java | Util.valueToFieldOffest | public static void valueToFieldOffest(byte[] buffer, int offset, int length,
long l) {
long divisor;
for (int i = 0; i < length; i++) {
divisor = (long) Math.pow(256.0, (double) (length - 1 - i));
buffer[offset + i] = (byte) (l / divisor);
l = l % divisor;
}
} | java | public static void valueToFieldOffest(byte[] buffer, int offset, int length,
long l) {
long divisor;
for (int i = 0; i < length; i++) {
divisor = (long) Math.pow(256.0, (double) (length - 1 - i));
buffer[offset + i] = (byte) (l / divisor);
l = l % divisor;
}
} | [
"public",
"static",
"void",
"valueToFieldOffest",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
",",
"long",
"l",
")",
"{",
"long",
"divisor",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
... | Puts a value into a specific location in a byte buffer.
@param buffer The buffer that the value will be written to.
@param offset The offset for where the value begins in the buffer.
@param length The length of the field in the array
@param l The value to be encoded into the byte array | [
"Puts",
"a",
"value",
"into",
"a",
"specific",
"location",
"in",
"a",
"byte",
"buffer",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/tapmessage/Util.java#L64-L72 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/protocol/BaseOperationImpl.java | BaseOperationImpl.transitionState | protected final synchronized void transitionState(OperationState newState) {
getLogger().debug("Transitioned state from %s to %s", state, newState);
state = newState;
// Discard our buffer when we no longer need it.
if(state != OperationState.WRITE_QUEUED
&& state != OperationState.WRITING) {
... | java | protected final synchronized void transitionState(OperationState newState) {
getLogger().debug("Transitioned state from %s to %s", state, newState);
state = newState;
// Discard our buffer when we no longer need it.
if(state != OperationState.WRITE_QUEUED
&& state != OperationState.WRITING) {
... | [
"protected",
"final",
"synchronized",
"void",
"transitionState",
"(",
"OperationState",
"newState",
")",
"{",
"getLogger",
"(",
")",
".",
"debug",
"(",
"\"Transitioned state from %s to %s\"",
",",
"state",
",",
"newState",
")",
";",
"state",
"=",
"newState",
";",
... | Transition the state of this operation to the given state. | [
"Transition",
"the",
"state",
"of",
"this",
"operation",
"to",
"the",
"given",
"state",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/protocol/BaseOperationImpl.java#L158-L169 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/tapmessage/TapStream.java | TapStream.isCompleted | public boolean isCompleted() {
for (TapOperation op : ops) {
if (!op.getState().equals(OperationState.COMPLETE)) {
return false;
}
}
return true;
} | java | public boolean isCompleted() {
for (TapOperation op : ops) {
if (!op.getState().equals(OperationState.COMPLETE)) {
return false;
}
}
return true;
} | [
"public",
"boolean",
"isCompleted",
"(",
")",
"{",
"for",
"(",
"TapOperation",
"op",
":",
"ops",
")",
"{",
"if",
"(",
"!",
"op",
".",
"getState",
"(",
")",
".",
"equals",
"(",
"OperationState",
".",
"COMPLETE",
")",
")",
"{",
"return",
"false",
";",
... | Check if all operations in the TapStream are completed.
@return true if all operations currently in the TapStream are completed | [
"Check",
"if",
"all",
"operations",
"in",
"the",
"TapStream",
"are",
"completed",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/tapmessage/TapStream.java#L64-L71 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/tapmessage/RequestMessage.java | RequestMessage.setFlags | public void setFlags(TapRequestFlag f) {
if (!flagList.contains(f)) {
if (!hasFlags) {
hasFlags = true;
extralength += 4;
totalbody += 4;
}
if (f.equals(TapRequestFlag.BACKFILL)) {
hasBackfill = true;
totalbody += 8;
}
if (f.equals(TapRequestFlag... | java | public void setFlags(TapRequestFlag f) {
if (!flagList.contains(f)) {
if (!hasFlags) {
hasFlags = true;
extralength += 4;
totalbody += 4;
}
if (f.equals(TapRequestFlag.BACKFILL)) {
hasBackfill = true;
totalbody += 8;
}
if (f.equals(TapRequestFlag... | [
"public",
"void",
"setFlags",
"(",
"TapRequestFlag",
"f",
")",
"{",
"if",
"(",
"!",
"flagList",
".",
"contains",
"(",
"f",
")",
")",
"{",
"if",
"(",
"!",
"hasFlags",
")",
"{",
"hasFlags",
"=",
"true",
";",
"extralength",
"+=",
"4",
";",
"totalbody",
... | Sets the flags for the tap stream. These flags decide what kind of tap
stream will be received.
@param f The flags to use for this tap stream. | [
"Sets",
"the",
"flags",
"for",
"the",
"tap",
"stream",
".",
"These",
"flags",
"decide",
"what",
"kind",
"of",
"tap",
"stream",
"will",
"be",
"received",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/tapmessage/RequestMessage.java#L66-L88 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/tapmessage/RequestMessage.java | RequestMessage.setVbucketlist | public void setVbucketlist(short[] vbs) {
int oldSize = (vblist.length + 1) * 2;
int newSize = (vbs.length + 1) * 2;
totalbody += newSize - oldSize;
vblist = vbs;
} | java | public void setVbucketlist(short[] vbs) {
int oldSize = (vblist.length + 1) * 2;
int newSize = (vbs.length + 1) * 2;
totalbody += newSize - oldSize;
vblist = vbs;
} | [
"public",
"void",
"setVbucketlist",
"(",
"short",
"[",
"]",
"vbs",
")",
"{",
"int",
"oldSize",
"=",
"(",
"vblist",
".",
"length",
"+",
"1",
")",
"*",
"2",
";",
"int",
"newSize",
"=",
"(",
"vbs",
".",
"length",
"+",
"1",
")",
"*",
"2",
";",
"tot... | Sets a list of vbuckets to stream keys from.
@param vbs - A list of vbuckets. | [
"Sets",
"a",
"list",
"of",
"vbuckets",
"to",
"stream",
"keys",
"from",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/tapmessage/RequestMessage.java#L113-L118 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/tapmessage/RequestMessage.java | RequestMessage.setvBucketCheckpoints | public void setvBucketCheckpoints(Map<Short, Long> vbchkpnts) {
int oldSize = (vBucketCheckpoints.size()) * 10;
int newSize = (vbchkpnts.size()) * 10;
totalbody += newSize - oldSize;
vBucketCheckpoints = vbchkpnts;
} | java | public void setvBucketCheckpoints(Map<Short, Long> vbchkpnts) {
int oldSize = (vBucketCheckpoints.size()) * 10;
int newSize = (vbchkpnts.size()) * 10;
totalbody += newSize - oldSize;
vBucketCheckpoints = vbchkpnts;
} | [
"public",
"void",
"setvBucketCheckpoints",
"(",
"Map",
"<",
"Short",
",",
"Long",
">",
"vbchkpnts",
")",
"{",
"int",
"oldSize",
"=",
"(",
"vBucketCheckpoints",
".",
"size",
"(",
")",
")",
"*",
"10",
";",
"int",
"newSize",
"=",
"(",
"vbchkpnts",
".",
"s... | Sets a map of vbucket checkpoints.
@param vbchkpnts - A map of vbucket checkpoint identifiers | [
"Sets",
"a",
"map",
"of",
"vbucket",
"checkpoints",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/tapmessage/RequestMessage.java#L125-L130 | train |
dustin/java-memcached-client | src/main/java/net/spy/memcached/tapmessage/RequestMessage.java | RequestMessage.setName | public void setName(String n) {
if (n.length() > 65535) {
throw new IllegalArgumentException("Tap name too long");
}
totalbody += n.length() - name.length();
keylength = (short) n.length();
name = n;
} | java | public void setName(String n) {
if (n.length() > 65535) {
throw new IllegalArgumentException("Tap name too long");
}
totalbody += n.length() - name.length();
keylength = (short) n.length();
name = n;
} | [
"public",
"void",
"setName",
"(",
"String",
"n",
")",
"{",
"if",
"(",
"n",
".",
"length",
"(",
")",
">",
"65535",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Tap name too long\"",
")",
";",
"}",
"totalbody",
"+=",
"n",
".",
"length",
... | Sets a name for this tap stream. If the tap stream fails this name can be
used to try to restart the tap stream from where it last left off.
@param n The name for the tap stream. | [
"Sets",
"a",
"name",
"for",
"this",
"tap",
"stream",
".",
"If",
"the",
"tap",
"stream",
"fails",
"this",
"name",
"can",
"be",
"used",
"to",
"try",
"to",
"restart",
"the",
"tap",
"stream",
"from",
"where",
"it",
"last",
"left",
"off",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/tapmessage/RequestMessage.java#L138-L145 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.