id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
29,900 | mapbox/mapbox-plugins-android | plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java | AnnotationManager.delete | @UiThread
public void delete(List<T> annotationList) {
for (T annotation : annotationList) {
annotations.remove(annotation.getId());
}
updateSource();
} | java | @UiThread
public void delete(List<T> annotationList) {
for (T annotation : annotationList) {
annotations.remove(annotation.getId());
}
updateSource();
} | [
"@",
"UiThread",
"public",
"void",
"delete",
"(",
"List",
"<",
"T",
">",
"annotationList",
")",
"{",
"for",
"(",
"T",
"annotation",
":",
"annotationList",
")",
"{",
"annotations",
".",
"remove",
"(",
"annotation",
".",
"getId",
"(",
")",
")",
";",
"}",... | Deletes annotations from the map.
@param annotationList the list of annotations to be deleted | [
"Deletes",
"annotations",
"from",
"the",
"map",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java#L161-L167 |
29,901 | mapbox/mapbox-plugins-android | plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java | AnnotationManager.update | @UiThread
public void update(T annotation) {
if (annotations.containsValue(annotation)) {
annotations.put(annotation.getId(), annotation);
updateSource();
} else {
Logger.e(TAG, "Can't update annotation: "
+ annotation.toString()
+ ", the annotation isn't active annotation.")... | java | @UiThread
public void update(T annotation) {
if (annotations.containsValue(annotation)) {
annotations.put(annotation.getId(), annotation);
updateSource();
} else {
Logger.e(TAG, "Can't update annotation: "
+ annotation.toString()
+ ", the annotation isn't active annotation.")... | [
"@",
"UiThread",
"public",
"void",
"update",
"(",
"T",
"annotation",
")",
"{",
"if",
"(",
"annotations",
".",
"containsValue",
"(",
"annotation",
")",
")",
"{",
"annotations",
".",
"put",
"(",
"annotation",
".",
"getId",
"(",
")",
",",
"annotation",
")",... | Update an annotation on the map.
@param annotation annotation to be updated | [
"Update",
"an",
"annotation",
"on",
"the",
"map",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java#L183-L193 |
29,902 | mapbox/mapbox-plugins-android | plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java | AnnotationManager.update | @UiThread
public void update(List<T> annotationList) {
for (T annotation : annotationList) {
annotations.put(annotation.getId(), annotation);
}
updateSource();
} | java | @UiThread
public void update(List<T> annotationList) {
for (T annotation : annotationList) {
annotations.put(annotation.getId(), annotation);
}
updateSource();
} | [
"@",
"UiThread",
"public",
"void",
"update",
"(",
"List",
"<",
"T",
">",
"annotationList",
")",
"{",
"for",
"(",
"T",
"annotation",
":",
"annotationList",
")",
"{",
"annotations",
".",
"put",
"(",
"annotation",
".",
"getId",
"(",
")",
",",
"annotation",
... | Update annotations on the map.
@param annotationList list of annotation to be updated | [
"Update",
"annotations",
"on",
"the",
"map",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java#L200-L206 |
29,903 | mapbox/mapbox-plugins-android | plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java | AnnotationManager.onDestroy | @UiThread
public void onDestroy() {
mapboxMap.removeOnMapClickListener(mapClickResolver);
mapboxMap.removeOnMapLongClickListener(mapClickResolver);
dragListeners.clear();
clickListeners.clear();
longClickListeners.clear();
} | java | @UiThread
public void onDestroy() {
mapboxMap.removeOnMapClickListener(mapClickResolver);
mapboxMap.removeOnMapLongClickListener(mapClickResolver);
dragListeners.clear();
clickListeners.clear();
longClickListeners.clear();
} | [
"@",
"UiThread",
"public",
"void",
"onDestroy",
"(",
")",
"{",
"mapboxMap",
".",
"removeOnMapClickListener",
"(",
"mapClickResolver",
")",
";",
"mapboxMap",
".",
"removeOnMapLongClickListener",
"(",
"mapClickResolver",
")",
";",
"dragListeners",
".",
"clear",
"(",
... | Cleanup annotation manager, used to clear listeners | [
"Cleanup",
"annotation",
"manager",
"used",
"to",
"clear",
"listeners"
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java#L322-L329 |
29,904 | mapbox/mapbox-plugins-android | plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/model/OfflineDownloadOptions.java | OfflineDownloadOptions.builder | public static Builder builder() {
return new AutoValue_OfflineDownloadOptions.Builder()
.uuid(UUID.randomUUID().getMostSignificantBits())
.metadata(new byte[] {})
.progress(0);
// TODO user must provide a notificationOptions object
} | java | public static Builder builder() {
return new AutoValue_OfflineDownloadOptions.Builder()
.uuid(UUID.randomUUID().getMostSignificantBits())
.metadata(new byte[] {})
.progress(0);
// TODO user must provide a notificationOptions object
} | [
"public",
"static",
"Builder",
"builder",
"(",
")",
"{",
"return",
"new",
"AutoValue_OfflineDownloadOptions",
".",
"Builder",
"(",
")",
".",
"uuid",
"(",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"getMostSignificantBits",
"(",
")",
")",
".",
"metadata",
"(",... | Used to build a new instance of this class.
@return this classes builder class
@since 0.1.0 | [
"Used",
"to",
"build",
"a",
"new",
"instance",
"of",
"this",
"class",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/model/OfflineDownloadOptions.java#L94-L100 |
29,905 | mapbox/mapbox-plugins-android | plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/FillOptions.java | FillOptions.withLatLngs | public FillOptions withLatLngs(List<List<LatLng>> latLngs) {
List<List<Point>> points = new ArrayList<>();
for (List<LatLng> innerLatLngs : latLngs) {
List<Point>innerList = new ArrayList<>();
for (LatLng latLng : innerLatLngs) {
innerList.add(Point.fromLngLat(latLng.getLongitude(), latLng.g... | java | public FillOptions withLatLngs(List<List<LatLng>> latLngs) {
List<List<Point>> points = new ArrayList<>();
for (List<LatLng> innerLatLngs : latLngs) {
List<Point>innerList = new ArrayList<>();
for (LatLng latLng : innerLatLngs) {
innerList.add(Point.fromLngLat(latLng.getLongitude(), latLng.g... | [
"public",
"FillOptions",
"withLatLngs",
"(",
"List",
"<",
"List",
"<",
"LatLng",
">",
">",
"latLngs",
")",
"{",
"List",
"<",
"List",
"<",
"Point",
">>",
"points",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"List",
"<",
"LatLng",
">",
... | Set a list of lists of LatLng for the fill, which represents the locations of the fill on the map
@param latLngs a list of a lists of the locations of the line in a longitude and latitude pairs
@return this | [
"Set",
"a",
"list",
"of",
"lists",
"of",
"LatLng",
"for",
"the",
"fill",
"which",
"represents",
"the",
"locations",
"of",
"the",
"fill",
"on",
"the",
"map"
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/FillOptions.java#L143-L154 |
29,906 | mapbox/mapbox-plugins-android | plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java | TrafficPlugin.setVisibility | public void setVisibility(boolean visible) {
this.visible = visible;
if (!style.isFullyLoaded()) {
// We are in progress of loading a new style
return;
}
Source source = style.getSource(TrafficData.SOURCE_ID);
if (source == null) {
initialise();
}
List<Layer> layers = st... | java | public void setVisibility(boolean visible) {
this.visible = visible;
if (!style.isFullyLoaded()) {
// We are in progress of loading a new style
return;
}
Source source = style.getSource(TrafficData.SOURCE_ID);
if (source == null) {
initialise();
}
List<Layer> layers = st... | [
"public",
"void",
"setVisibility",
"(",
"boolean",
"visible",
")",
"{",
"this",
".",
"visible",
"=",
"visible",
";",
"if",
"(",
"!",
"style",
".",
"isFullyLoaded",
"(",
")",
")",
"{",
"// We are in progress of loading a new style",
"return",
";",
"}",
"Source"... | Toggles the visibility of the traffic layers.
@param visible true for visible, false for none | [
"Toggles",
"the",
"visibility",
"of",
"the",
"traffic",
"layers",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java#L105-L124 |
29,907 | mapbox/mapbox-plugins-android | plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java | TrafficPlugin.initialise | private void initialise() {
try {
addTrafficSource();
addTrafficLayers();
} catch (Exception exception) {
Timber.e(exception, "Unable to attach Traffic to current style: ");
} catch (UnsatisfiedLinkError error) {
Timber.e(error, "Unable to load native libraries: ");
}
} | java | private void initialise() {
try {
addTrafficSource();
addTrafficLayers();
} catch (Exception exception) {
Timber.e(exception, "Unable to attach Traffic to current style: ");
} catch (UnsatisfiedLinkError error) {
Timber.e(error, "Unable to load native libraries: ");
}
} | [
"private",
"void",
"initialise",
"(",
")",
"{",
"try",
"{",
"addTrafficSource",
"(",
")",
";",
"addTrafficLayers",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"exception",
")",
"{",
"Timber",
".",
"e",
"(",
"exception",
",",
"\"Unable to attach Traffic to... | Initialise the traffic source and layers. | [
"Initialise",
"the",
"traffic",
"source",
"and",
"layers",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java#L129-L138 |
29,908 | mapbox/mapbox-plugins-android | plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java | TrafficPlugin.addTrafficSource | private void addTrafficSource() {
VectorSource trafficSource = new VectorSource(TrafficData.SOURCE_ID, TrafficData.SOURCE_URL);
style.addSource(trafficSource);
} | java | private void addTrafficSource() {
VectorSource trafficSource = new VectorSource(TrafficData.SOURCE_ID, TrafficData.SOURCE_URL);
style.addSource(trafficSource);
} | [
"private",
"void",
"addTrafficSource",
"(",
")",
"{",
"VectorSource",
"trafficSource",
"=",
"new",
"VectorSource",
"(",
"TrafficData",
".",
"SOURCE_ID",
",",
"TrafficData",
".",
"SOURCE_URL",
")",
";",
"style",
".",
"addSource",
"(",
"trafficSource",
")",
";",
... | Adds traffic source to the map. | [
"Adds",
"traffic",
"source",
"to",
"the",
"map",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java#L143-L146 |
29,909 | mapbox/mapbox-plugins-android | plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java | TrafficPlugin.addLocalLayer | private void addLocalLayer() {
LineLayer local = TrafficLayer.getLineLayer(
Local.BASE_LAYER_ID,
Local.ZOOM_LEVEL,
Local.FILTER,
Local.FUNCTION_LINE_COLOR,
Local.FUNCTION_LINE_WIDTH,
Local.FUNCTION_LINE_OFFSET
);
LineLayer localCase = TrafficLayer.getLineLayer(
Loc... | java | private void addLocalLayer() {
LineLayer local = TrafficLayer.getLineLayer(
Local.BASE_LAYER_ID,
Local.ZOOM_LEVEL,
Local.FILTER,
Local.FUNCTION_LINE_COLOR,
Local.FUNCTION_LINE_WIDTH,
Local.FUNCTION_LINE_OFFSET
);
LineLayer localCase = TrafficLayer.getLineLayer(
Loc... | [
"private",
"void",
"addLocalLayer",
"(",
")",
"{",
"LineLayer",
"local",
"=",
"TrafficLayer",
".",
"getLineLayer",
"(",
"Local",
".",
"BASE_LAYER_ID",
",",
"Local",
".",
"ZOOM_LEVEL",
",",
"Local",
".",
"FILTER",
",",
"Local",
".",
"FUNCTION_LINE_COLOR",
",",
... | Add local layer to the map. | [
"Add",
"local",
"layer",
"to",
"the",
"map",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java#L162-L183 |
29,910 | mapbox/mapbox-plugins-android | plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java | TrafficPlugin.placeLayerBelow | private String placeLayerBelow() {
if (belowLayer == null || belowLayer.isEmpty()) {
List<Layer> styleLayers = style.getLayers();
Layer layer;
for (int i = styleLayers.size() - 1; i >= 0; i--) {
layer = styleLayers.get(i);
if (!(layer instanceof SymbolLayer)) {
return lay... | java | private String placeLayerBelow() {
if (belowLayer == null || belowLayer.isEmpty()) {
List<Layer> styleLayers = style.getLayers();
Layer layer;
for (int i = styleLayers.size() - 1; i >= 0; i--) {
layer = styleLayers.get(i);
if (!(layer instanceof SymbolLayer)) {
return lay... | [
"private",
"String",
"placeLayerBelow",
"(",
")",
"{",
"if",
"(",
"belowLayer",
"==",
"null",
"||",
"belowLayer",
".",
"isEmpty",
"(",
")",
")",
"{",
"List",
"<",
"Layer",
">",
"styleLayers",
"=",
"style",
".",
"getLayers",
"(",
")",
";",
"Layer",
"lay... | Attempts to find the layer which the traffic should be placed below. Depending on the style, this might not always
be accurate. | [
"Attempts",
"to",
"find",
"the",
"layer",
"which",
"the",
"traffic",
"should",
"be",
"placed",
"below",
".",
"Depending",
"on",
"the",
"style",
"this",
"might",
"not",
"always",
"be",
"accurate",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java#L189-L201 |
29,911 | mapbox/mapbox-plugins-android | plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java | TrafficPlugin.addSecondaryLayer | private void addSecondaryLayer() {
LineLayer secondary = TrafficLayer.getLineLayer(
Secondary.BASE_LAYER_ID,
Secondary.ZOOM_LEVEL,
Secondary.FILTER,
Secondary.FUNCTION_LINE_COLOR,
Secondary.FUNCTION_LINE_WIDTH,
Secondary.FUNCTION_LINE_OFFSET
);
LineLayer secondaryCase = ... | java | private void addSecondaryLayer() {
LineLayer secondary = TrafficLayer.getLineLayer(
Secondary.BASE_LAYER_ID,
Secondary.ZOOM_LEVEL,
Secondary.FILTER,
Secondary.FUNCTION_LINE_COLOR,
Secondary.FUNCTION_LINE_WIDTH,
Secondary.FUNCTION_LINE_OFFSET
);
LineLayer secondaryCase = ... | [
"private",
"void",
"addSecondaryLayer",
"(",
")",
"{",
"LineLayer",
"secondary",
"=",
"TrafficLayer",
".",
"getLineLayer",
"(",
"Secondary",
".",
"BASE_LAYER_ID",
",",
"Secondary",
".",
"ZOOM_LEVEL",
",",
"Secondary",
".",
"FILTER",
",",
"Secondary",
".",
"FUNCT... | Add secondary layer to the map. | [
"Add",
"secondary",
"layer",
"to",
"the",
"map",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java#L206-L227 |
29,912 | mapbox/mapbox-plugins-android | plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java | TrafficPlugin.addPrimaryLayer | private void addPrimaryLayer() {
LineLayer primary = TrafficLayer.getLineLayer(
Primary.BASE_LAYER_ID,
Primary.ZOOM_LEVEL,
Primary.FILTER,
Primary.FUNCTION_LINE_COLOR,
Primary.FUNCTION_LINE_WIDTH,
Primary.FUNCTION_LINE_OFFSET
);
LineLayer primaryCase = TrafficLayer.getLi... | java | private void addPrimaryLayer() {
LineLayer primary = TrafficLayer.getLineLayer(
Primary.BASE_LAYER_ID,
Primary.ZOOM_LEVEL,
Primary.FILTER,
Primary.FUNCTION_LINE_COLOR,
Primary.FUNCTION_LINE_WIDTH,
Primary.FUNCTION_LINE_OFFSET
);
LineLayer primaryCase = TrafficLayer.getLi... | [
"private",
"void",
"addPrimaryLayer",
"(",
")",
"{",
"LineLayer",
"primary",
"=",
"TrafficLayer",
".",
"getLineLayer",
"(",
"Primary",
".",
"BASE_LAYER_ID",
",",
"Primary",
".",
"ZOOM_LEVEL",
",",
"Primary",
".",
"FILTER",
",",
"Primary",
".",
"FUNCTION_LINE_COL... | Add primary layer to the map. | [
"Add",
"primary",
"layer",
"to",
"the",
"map",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java#L232-L253 |
29,913 | mapbox/mapbox-plugins-android | plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java | TrafficPlugin.addTrunkLayer | private void addTrunkLayer() {
LineLayer trunk = TrafficLayer.getLineLayer(
Trunk.BASE_LAYER_ID,
Trunk.ZOOM_LEVEL,
Trunk.FILTER,
Trunk.FUNCTION_LINE_COLOR,
Trunk.FUNCTION_LINE_WIDTH,
Trunk.FUNCTION_LINE_OFFSET
);
LineLayer trunkCase = TrafficLayer.getLineLayer(
Tru... | java | private void addTrunkLayer() {
LineLayer trunk = TrafficLayer.getLineLayer(
Trunk.BASE_LAYER_ID,
Trunk.ZOOM_LEVEL,
Trunk.FILTER,
Trunk.FUNCTION_LINE_COLOR,
Trunk.FUNCTION_LINE_WIDTH,
Trunk.FUNCTION_LINE_OFFSET
);
LineLayer trunkCase = TrafficLayer.getLineLayer(
Tru... | [
"private",
"void",
"addTrunkLayer",
"(",
")",
"{",
"LineLayer",
"trunk",
"=",
"TrafficLayer",
".",
"getLineLayer",
"(",
"Trunk",
".",
"BASE_LAYER_ID",
",",
"Trunk",
".",
"ZOOM_LEVEL",
",",
"Trunk",
".",
"FILTER",
",",
"Trunk",
".",
"FUNCTION_LINE_COLOR",
",",
... | Add trunk layer to the map. | [
"Add",
"trunk",
"layer",
"to",
"the",
"map",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java#L258-L278 |
29,914 | mapbox/mapbox-plugins-android | plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java | TrafficPlugin.addMotorwayLayer | private void addMotorwayLayer() {
LineLayer motorWay = TrafficLayer.getLineLayer(
MotorWay.BASE_LAYER_ID,
MotorWay.ZOOM_LEVEL,
MotorWay.FILTER,
MotorWay.FUNCTION_LINE_COLOR,
MotorWay.FUNCTION_LINE_WIDTH,
MotorWay.FUNCTION_LINE_OFFSET
);
LineLayer motorwayCase = TrafficLa... | java | private void addMotorwayLayer() {
LineLayer motorWay = TrafficLayer.getLineLayer(
MotorWay.BASE_LAYER_ID,
MotorWay.ZOOM_LEVEL,
MotorWay.FILTER,
MotorWay.FUNCTION_LINE_COLOR,
MotorWay.FUNCTION_LINE_WIDTH,
MotorWay.FUNCTION_LINE_OFFSET
);
LineLayer motorwayCase = TrafficLa... | [
"private",
"void",
"addMotorwayLayer",
"(",
")",
"{",
"LineLayer",
"motorWay",
"=",
"TrafficLayer",
".",
"getLineLayer",
"(",
"MotorWay",
".",
"BASE_LAYER_ID",
",",
"MotorWay",
".",
"ZOOM_LEVEL",
",",
"MotorWay",
".",
"FILTER",
",",
"MotorWay",
".",
"FUNCTION_LI... | Add motorway layer to the map. | [
"Add",
"motorway",
"layer",
"to",
"the",
"map",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java#L283-L303 |
29,915 | mapbox/mapbox-plugins-android | plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java | TrafficPlugin.addTrafficLayersToMap | private void addTrafficLayersToMap(Layer layerCase, Layer layer, String idAboveLayer) {
style.addLayerBelow(layerCase, idAboveLayer);
style.addLayerAbove(layer, layerCase.getId());
layerIds.add(layerCase.getId());
layerIds.add(layer.getId());
} | java | private void addTrafficLayersToMap(Layer layerCase, Layer layer, String idAboveLayer) {
style.addLayerBelow(layerCase, idAboveLayer);
style.addLayerAbove(layer, layerCase.getId());
layerIds.add(layerCase.getId());
layerIds.add(layer.getId());
} | [
"private",
"void",
"addTrafficLayersToMap",
"(",
"Layer",
"layerCase",
",",
"Layer",
"layer",
",",
"String",
"idAboveLayer",
")",
"{",
"style",
".",
"addLayerBelow",
"(",
"layerCase",
",",
"idAboveLayer",
")",
";",
"style",
".",
"addLayerAbove",
"(",
"layer",
... | Add Layer to the map and track the id.
@param layer the layer to be added to the map
@param idAboveLayer the id of the layer above | [
"Add",
"Layer",
"to",
"the",
"map",
"and",
"track",
"the",
"id",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java#L320-L325 |
29,916 | mapbox/mapbox-plugins-android | plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java | OfflinePlugin.cancelDownload | public void cancelDownload(OfflineDownloadOptions offlineDownload) {
Intent intent = new Intent(context, OfflineDownloadService.class);
intent.setAction(OfflineConstants.ACTION_CANCEL_DOWNLOAD);
intent.putExtra(KEY_BUNDLE, offlineDownload);
context.startService(intent);
} | java | public void cancelDownload(OfflineDownloadOptions offlineDownload) {
Intent intent = new Intent(context, OfflineDownloadService.class);
intent.setAction(OfflineConstants.ACTION_CANCEL_DOWNLOAD);
intent.putExtra(KEY_BUNDLE, offlineDownload);
context.startService(intent);
} | [
"public",
"void",
"cancelDownload",
"(",
"OfflineDownloadOptions",
"offlineDownload",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"context",
",",
"OfflineDownloadService",
".",
"class",
")",
";",
"intent",
".",
"setAction",
"(",
"OfflineConstants",
".... | Cancel an ongoing download.
@param offlineDownload the offline download
@since 0.1.0 | [
"Cancel",
"an",
"ongoing",
"download",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java#L94-L99 |
29,917 | mapbox/mapbox-plugins-android | plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java | OfflinePlugin.getActiveDownloadForOfflineRegion | @Nullable
public OfflineDownloadOptions getActiveDownloadForOfflineRegion(OfflineRegion offlineRegion) {
OfflineDownloadOptions offlineDownload = null;
if (!offlineDownloads.isEmpty()) {
for (OfflineDownloadOptions download : offlineDownloads) {
if (download.uuid() == offlineRegion.getID()) {
... | java | @Nullable
public OfflineDownloadOptions getActiveDownloadForOfflineRegion(OfflineRegion offlineRegion) {
OfflineDownloadOptions offlineDownload = null;
if (!offlineDownloads.isEmpty()) {
for (OfflineDownloadOptions download : offlineDownloads) {
if (download.uuid() == offlineRegion.getID()) {
... | [
"@",
"Nullable",
"public",
"OfflineDownloadOptions",
"getActiveDownloadForOfflineRegion",
"(",
"OfflineRegion",
"offlineRegion",
")",
"{",
"OfflineDownloadOptions",
"offlineDownload",
"=",
"null",
";",
"if",
"(",
"!",
"offlineDownloads",
".",
"isEmpty",
"(",
")",
")",
... | Get the OfflineDownloadOptions for an offline region, returns null if no download is active for region.
@param offlineRegion the offline region to get related offline download for
@return the active offline download, null if not downloading the region.
@since 0.1.0 | [
"Get",
"the",
"OfflineDownloadOptions",
"for",
"an",
"offline",
"region",
"returns",
"null",
"if",
"no",
"download",
"is",
"active",
"for",
"region",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java#L108-L119 |
29,918 | mapbox/mapbox-plugins-android | plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java | OfflinePlugin.removeDownload | void removeDownload(OfflineDownloadOptions offlineDownload, boolean canceled) {
if (canceled) {
stateChangeDispatcher.onCancel(offlineDownload);
} else {
stateChangeDispatcher.onSuccess(offlineDownload);
}
offlineDownloads.remove(offlineDownload);
} | java | void removeDownload(OfflineDownloadOptions offlineDownload, boolean canceled) {
if (canceled) {
stateChangeDispatcher.onCancel(offlineDownload);
} else {
stateChangeDispatcher.onSuccess(offlineDownload);
}
offlineDownloads.remove(offlineDownload);
} | [
"void",
"removeDownload",
"(",
"OfflineDownloadOptions",
"offlineDownload",
",",
"boolean",
"canceled",
")",
"{",
"if",
"(",
"canceled",
")",
"{",
"stateChangeDispatcher",
".",
"onCancel",
"(",
"offlineDownload",
")",
";",
"}",
"else",
"{",
"stateChangeDispatcher",
... | Called when the OfflineDownloadService has finished downloading.
@param offlineDownload the offline download to stop tracking
@since 0.1.0 | [
"Called",
"when",
"the",
"OfflineDownloadService",
"has",
"finished",
"downloading",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java#L169-L176 |
29,919 | mapbox/mapbox-plugins-android | plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java | OfflinePlugin.errorDownload | void errorDownload(OfflineDownloadOptions offlineDownload, String error, String errorMessage) {
stateChangeDispatcher.onError(offlineDownload, error, errorMessage);
offlineDownloads.remove(offlineDownload);
} | java | void errorDownload(OfflineDownloadOptions offlineDownload, String error, String errorMessage) {
stateChangeDispatcher.onError(offlineDownload, error, errorMessage);
offlineDownloads.remove(offlineDownload);
} | [
"void",
"errorDownload",
"(",
"OfflineDownloadOptions",
"offlineDownload",
",",
"String",
"error",
",",
"String",
"errorMessage",
")",
"{",
"stateChangeDispatcher",
".",
"onError",
"(",
"offlineDownload",
",",
"error",
",",
"errorMessage",
")",
";",
"offlineDownloads"... | Called when the OfflineDownloadService produced an error while downloading
@param offlineDownload the offline download that produced an error
@param error short description of the error
@param errorMessage full description of the error
@since 0.1.0 | [
"Called",
"when",
"the",
"OfflineDownloadService",
"produced",
"an",
"error",
"while",
"downloading"
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java#L186-L189 |
29,920 | mapbox/mapbox-plugins-android | plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java | BuildingPlugin.initLayer | private void initLayer(String belowLayer) {
light = style.getLight();
fillExtrusionLayer = new FillExtrusionLayer(LAYER_ID, "composite");
fillExtrusionLayer.setSourceLayer("building");
fillExtrusionLayer.setMinZoom(minZoomLevel);
fillExtrusionLayer.setProperties(
visibility(visible ? VISIBLE :... | java | private void initLayer(String belowLayer) {
light = style.getLight();
fillExtrusionLayer = new FillExtrusionLayer(LAYER_ID, "composite");
fillExtrusionLayer.setSourceLayer("building");
fillExtrusionLayer.setMinZoom(minZoomLevel);
fillExtrusionLayer.setProperties(
visibility(visible ? VISIBLE :... | [
"private",
"void",
"initLayer",
"(",
"String",
"belowLayer",
")",
"{",
"light",
"=",
"style",
".",
"getLight",
"(",
")",
";",
"fillExtrusionLayer",
"=",
"new",
"FillExtrusionLayer",
"(",
"LAYER_ID",
",",
"\"composite\"",
")",
";",
"fillExtrusionLayer",
".",
"s... | Initialises and adds the fill extrusion layer used by this plugin.
@param belowLayer optionally place the buildings layer below a provided layer id | [
"Initialises",
"and",
"adds",
"the",
"fill",
"extrusion",
"layer",
"used",
"by",
"this",
"plugin",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java#L101-L120 |
29,921 | mapbox/mapbox-plugins-android | plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java | BuildingPlugin.setVisibility | public void setVisibility(boolean visible) {
this.visible = visible;
if (!style.isFullyLoaded()) {
// We are in progress of loading a new style
return;
}
fillExtrusionLayer.setProperties(visibility(visible ? VISIBLE : NONE));
} | java | public void setVisibility(boolean visible) {
this.visible = visible;
if (!style.isFullyLoaded()) {
// We are in progress of loading a new style
return;
}
fillExtrusionLayer.setProperties(visibility(visible ? VISIBLE : NONE));
} | [
"public",
"void",
"setVisibility",
"(",
"boolean",
"visible",
")",
"{",
"this",
".",
"visible",
"=",
"visible",
";",
"if",
"(",
"!",
"style",
".",
"isFullyLoaded",
"(",
")",
")",
"{",
"// We are in progress of loading a new style",
"return",
";",
"}",
"fillExt... | Toggles the visibility of the building layer.
@param visible true for visible, false for none
@since 0.1.0 | [
"Toggles",
"the",
"visibility",
"of",
"the",
"building",
"layer",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java#L146-L154 |
29,922 | mapbox/mapbox-plugins-android | plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java | BuildingPlugin.setOpacity | public void setOpacity(@FloatRange(from = 0.0f, to = 1.0f) float opacity) {
this.opacity = opacity;
if (!style.isFullyLoaded()) {
// We are in progress of loading a new style
return;
}
fillExtrusionLayer.setProperties(fillExtrusionOpacity(opacity));
} | java | public void setOpacity(@FloatRange(from = 0.0f, to = 1.0f) float opacity) {
this.opacity = opacity;
if (!style.isFullyLoaded()) {
// We are in progress of loading a new style
return;
}
fillExtrusionLayer.setProperties(fillExtrusionOpacity(opacity));
} | [
"public",
"void",
"setOpacity",
"(",
"@",
"FloatRange",
"(",
"from",
"=",
"0.0f",
",",
"to",
"=",
"1.0f",
")",
"float",
"opacity",
")",
"{",
"this",
".",
"opacity",
"=",
"opacity",
";",
"if",
"(",
"!",
"style",
".",
"isFullyLoaded",
"(",
")",
")",
... | Change the building opacity. Calls into changing the fill extrusion fill opacity.
@param opacity {@code float} value between 0 (invisible) and 1 (solid)
@since 0.1.0 | [
"Change",
"the",
"building",
"opacity",
".",
"Calls",
"into",
"changing",
"the",
"fill",
"extrusion",
"fill",
"opacity",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java#L162-L170 |
29,923 | mapbox/mapbox-plugins-android | plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java | BuildingPlugin.setMinZoomLevel | public void setMinZoomLevel(@FloatRange(from = MINIMUM_ZOOM, to = MAXIMUM_ZOOM)
float minZoomLevel) {
this.minZoomLevel = minZoomLevel;
if (!style.isFullyLoaded()) {
// We are in progress of loading a new style
return;
}
fillExtrusionLayer.setMinZoom(minZoomL... | java | public void setMinZoomLevel(@FloatRange(from = MINIMUM_ZOOM, to = MAXIMUM_ZOOM)
float minZoomLevel) {
this.minZoomLevel = minZoomLevel;
if (!style.isFullyLoaded()) {
// We are in progress of loading a new style
return;
}
fillExtrusionLayer.setMinZoom(minZoomL... | [
"public",
"void",
"setMinZoomLevel",
"(",
"@",
"FloatRange",
"(",
"from",
"=",
"MINIMUM_ZOOM",
",",
"to",
"=",
"MAXIMUM_ZOOM",
")",
"float",
"minZoomLevel",
")",
"{",
"this",
".",
"minZoomLevel",
"=",
"minZoomLevel",
";",
"if",
"(",
"!",
"style",
".",
"isF... | Change the building min zoom level. This is the minimum zoom level where buildings will start
to show. useful to limit showing buildings at higher zoom levels.
@param minZoomLevel a {@code float} value between the maps minimum and maximum zoom level which
defines at which level the buildings should show up
@since 0.1.... | [
"Change",
"the",
"building",
"min",
"zoom",
"level",
".",
"This",
"is",
"the",
"minimum",
"zoom",
"level",
"where",
"buildings",
"will",
"start",
"to",
"show",
".",
"useful",
"to",
"limit",
"showing",
"buildings",
"at",
"higher",
"zoom",
"levels",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java#L196-L205 |
29,924 | mapbox/mapbox-plugins-android | plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflineDownloadService.java | OfflineDownloadService.finishDownload | void finishDownload(OfflineDownloadOptions offlineDownload, OfflineRegion offlineRegion) {
OfflineDownloadStateReceiver.dispatchSuccessBroadcast(this, offlineDownload);
offlineRegion.setDownloadState(OfflineRegion.STATE_INACTIVE);
offlineRegion.setObserver(null);
removeOfflineRegion(offlineDownload.uuid... | java | void finishDownload(OfflineDownloadOptions offlineDownload, OfflineRegion offlineRegion) {
OfflineDownloadStateReceiver.dispatchSuccessBroadcast(this, offlineDownload);
offlineRegion.setDownloadState(OfflineRegion.STATE_INACTIVE);
offlineRegion.setObserver(null);
removeOfflineRegion(offlineDownload.uuid... | [
"void",
"finishDownload",
"(",
"OfflineDownloadOptions",
"offlineDownload",
",",
"OfflineRegion",
"offlineRegion",
")",
"{",
"OfflineDownloadStateReceiver",
".",
"dispatchSuccessBroadcast",
"(",
"this",
",",
"offlineDownload",
")",
";",
"offlineRegion",
".",
"setDownloadSta... | When a particular download has been completed, this method's called which handles removing the
notification and setting the download state.
@param offlineRegion the region which has finished being downloaded
@param offlineDownload the corresponding options used to define the offline region
@since 0.1.0 | [
"When",
"a",
"particular",
"download",
"has",
"been",
"completed",
"this",
"method",
"s",
"called",
"which",
"handles",
"removing",
"the",
"notification",
"and",
"setting",
"the",
"download",
"state",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflineDownloadService.java#L251-L256 |
29,925 | mapbox/mapbox-plugins-android | plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/LocalizationPlugin.java | LocalizationPlugin.sourceIsFromMapbox | private boolean sourceIsFromMapbox(Source singleSource) {
if (singleSource instanceof VectorSource) {
String url = ((VectorSource) singleSource).getUrl();
if (url != null) {
for (String supportedSource : SUPPORTED_SOURCES) {
if (url.contains(supportedSource)) {
return true;... | java | private boolean sourceIsFromMapbox(Source singleSource) {
if (singleSource instanceof VectorSource) {
String url = ((VectorSource) singleSource).getUrl();
if (url != null) {
for (String supportedSource : SUPPORTED_SOURCES) {
if (url.contains(supportedSource)) {
return true;... | [
"private",
"boolean",
"sourceIsFromMapbox",
"(",
"Source",
"singleSource",
")",
"{",
"if",
"(",
"singleSource",
"instanceof",
"VectorSource",
")",
"{",
"String",
"url",
"=",
"(",
"(",
"VectorSource",
")",
"singleSource",
")",
".",
"getUrl",
"(",
")",
";",
"i... | Checks whether the map's source is a source provided by Mapbox, rather than a custom source.
@param singleSource an individual source object from the map
@return true if the source is from the Mapbox Streets vector source, false if it's not. | [
"Checks",
"whether",
"the",
"map",
"s",
"source",
"is",
"a",
"source",
"provided",
"by",
"Mapbox",
"rather",
"than",
"a",
"custom",
"source",
"."
] | c683cad4d8306945d71838d96fae73b8cbe2e6c9 | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/LocalizationPlugin.java#L363-L375 |
29,926 | reactiverse/reactive-pg-client | src/main/java/io/reactiverse/pgclient/impl/PgConnectionFactory.java | PgConnectionFactory.close | private void close(Handler<AsyncResult<Void>> completionHandler) {
client.close();
completionHandler.handle(Future.succeededFuture());
} | java | private void close(Handler<AsyncResult<Void>> completionHandler) {
client.close();
completionHandler.handle(Future.succeededFuture());
} | [
"private",
"void",
"close",
"(",
"Handler",
"<",
"AsyncResult",
"<",
"Void",
">",
">",
"completionHandler",
")",
"{",
"client",
".",
"close",
"(",
")",
";",
"completionHandler",
".",
"handle",
"(",
"Future",
".",
"succeededFuture",
"(",
")",
")",
";",
"}... | Called by hook | [
"Called",
"by",
"hook"
] | be75cc5462f0945f81d325f58db5f297403067bf | https://github.com/reactiverse/reactive-pg-client/blob/be75cc5462f0945f81d325f58db5f297403067bf/src/main/java/io/reactiverse/pgclient/impl/PgConnectionFactory.java#L80-L83 |
29,927 | reactiverse/reactive-pg-client | src/main/java/io/reactiverse/pgclient/PgConnectOptions.java | PgConnectOptions.init | private void init() {
host = DEFAULT_HOST;
port = DEFAULT_PORT;
database = DEFAULT_DATABASE;
user = DEFAULT_USER;
password = DEFAULT_PASSWORD;
cachePreparedStatements = DEFAULT_CACHE_PREPARED_STATEMENTS;
pipeliningLimit = DEFAULT_PIPELINING_LIMIT;
sslMode = DEFAULT_SSLMODE;
} | java | private void init() {
host = DEFAULT_HOST;
port = DEFAULT_PORT;
database = DEFAULT_DATABASE;
user = DEFAULT_USER;
password = DEFAULT_PASSWORD;
cachePreparedStatements = DEFAULT_CACHE_PREPARED_STATEMENTS;
pipeliningLimit = DEFAULT_PIPELINING_LIMIT;
sslMode = DEFAULT_SSLMODE;
} | [
"private",
"void",
"init",
"(",
")",
"{",
"host",
"=",
"DEFAULT_HOST",
";",
"port",
"=",
"DEFAULT_PORT",
";",
"database",
"=",
"DEFAULT_DATABASE",
";",
"user",
"=",
"DEFAULT_USER",
";",
"password",
"=",
"DEFAULT_PASSWORD",
";",
"cachePreparedStatements",
"=",
... | Initialize with the default options. | [
"Initialize",
"with",
"the",
"default",
"options",
"."
] | be75cc5462f0945f81d325f58db5f297403067bf | https://github.com/reactiverse/reactive-pg-client/blob/be75cc5462f0945f81d325f58db5f297403067bf/src/main/java/io/reactiverse/pgclient/PgConnectOptions.java#L421-L430 |
29,928 | reactiverse/reactive-pg-client | src/main/java/io/reactiverse/pgclient/impl/codec/DataTypeCodec.java | DataTypeCodec.textDecodeMultiplePoints | private static List<Point> textDecodeMultiplePoints(int index, int len, ByteBuf buff) {
// representation: p1,p2,p3...pn
List<Point> points = new ArrayList<>();
int start = index;
int end = index + len - 1;
while (start < end) {
int rightParenthesis = buff.indexOf(start, end + 1, (byte) ')');
... | java | private static List<Point> textDecodeMultiplePoints(int index, int len, ByteBuf buff) {
// representation: p1,p2,p3...pn
List<Point> points = new ArrayList<>();
int start = index;
int end = index + len - 1;
while (start < end) {
int rightParenthesis = buff.indexOf(start, end + 1, (byte) ')');
... | [
"private",
"static",
"List",
"<",
"Point",
">",
"textDecodeMultiplePoints",
"(",
"int",
"index",
",",
"int",
"len",
",",
"ByteBuf",
"buff",
")",
"{",
"// representation: p1,p2,p3...pn",
"List",
"<",
"Point",
">",
"points",
"=",
"new",
"ArrayList",
"<>",
"(",
... | this might be useful for decoding Lseg, Box, Path, Polygon Data Type. | [
"this",
"might",
"be",
"useful",
"for",
"decoding",
"Lseg",
"Box",
"Path",
"Polygon",
"Data",
"Type",
"."
] | be75cc5462f0945f81d325f58db5f297403067bf | https://github.com/reactiverse/reactive-pg-client/blob/be75cc5462f0945f81d325f58db5f297403067bf/src/main/java/io/reactiverse/pgclient/impl/codec/DataTypeCodec.java#L769-L783 |
29,929 | reactiverse/reactive-pg-client | src/main/java/io/reactiverse/pgclient/impl/PgConnectionUriParser.java | PgConnectionUriParser.doParse | private static void doParse(String connectionUri, JsonObject configuration) {
Pattern pattern = Pattern.compile(FULL_URI_REGEX);
Matcher matcher = pattern.matcher(connectionUri);
if (matcher.matches()) {
// parse the user and password
parseUserandPassword(matcher.group(USER_INFO_GROUP), configu... | java | private static void doParse(String connectionUri, JsonObject configuration) {
Pattern pattern = Pattern.compile(FULL_URI_REGEX);
Matcher matcher = pattern.matcher(connectionUri);
if (matcher.matches()) {
// parse the user and password
parseUserandPassword(matcher.group(USER_INFO_GROUP), configu... | [
"private",
"static",
"void",
"doParse",
"(",
"String",
"connectionUri",
",",
"JsonObject",
"configuration",
")",
"{",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"FULL_URI_REGEX",
")",
";",
"Matcher",
"matcher",
"=",
"pattern",
".",
"matcher",
"... | execute the parsing process and store options in the configuration | [
"execute",
"the",
"parsing",
"process",
"and",
"store",
"options",
"in",
"the",
"configuration"
] | be75cc5462f0945f81d325f58db5f297403067bf | https://github.com/reactiverse/reactive-pg-client/blob/be75cc5462f0945f81d325f58db5f297403067bf/src/main/java/io/reactiverse/pgclient/impl/PgConnectionUriParser.java#L57-L80 |
29,930 | dropwizard/dropwizard | dropwizard-json-logging/src/main/java/io/dropwizard/logging/json/layout/MapBuilder.java | MapBuilder.addNumber | public MapBuilder addNumber(String fieldName, boolean include, Supplier<Number> supplier) {
if (include) {
Number value = supplier.get();
if (value != null) {
map.put(getFieldName(fieldName), value);
}
}
return this;
} | java | public MapBuilder addNumber(String fieldName, boolean include, Supplier<Number> supplier) {
if (include) {
Number value = supplier.get();
if (value != null) {
map.put(getFieldName(fieldName), value);
}
}
return this;
} | [
"public",
"MapBuilder",
"addNumber",
"(",
"String",
"fieldName",
",",
"boolean",
"include",
",",
"Supplier",
"<",
"Number",
">",
"supplier",
")",
"{",
"if",
"(",
"include",
")",
"{",
"Number",
"value",
"=",
"supplier",
".",
"get",
"(",
")",
";",
"if",
... | Adds the number value to the provided map under the provided field name,
if it should be included. The supplier is only invoked if the field is to be included. | [
"Adds",
"the",
"number",
"value",
"to",
"the",
"provided",
"map",
"under",
"the",
"provided",
"field",
"name",
"if",
"it",
"should",
"be",
"included",
".",
"The",
"supplier",
"is",
"only",
"invoked",
"if",
"the",
"field",
"is",
"to",
"be",
"included",
".... | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-json-logging/src/main/java/io/dropwizard/logging/json/layout/MapBuilder.java#L77-L85 |
29,931 | dropwizard/dropwizard | dropwizard-json-logging/src/main/java/io/dropwizard/logging/json/layout/MapBuilder.java | MapBuilder.addMap | public MapBuilder addMap(String fieldName, boolean include, Supplier<Map<String, ?>> supplier) {
if (include) {
Map<String, ?> value = supplier.get();
if (value != null && !value.isEmpty()) {
map.put(getFieldName(fieldName), value);
}
}
return ... | java | public MapBuilder addMap(String fieldName, boolean include, Supplier<Map<String, ?>> supplier) {
if (include) {
Map<String, ?> value = supplier.get();
if (value != null && !value.isEmpty()) {
map.put(getFieldName(fieldName), value);
}
}
return ... | [
"public",
"MapBuilder",
"addMap",
"(",
"String",
"fieldName",
",",
"boolean",
"include",
",",
"Supplier",
"<",
"Map",
"<",
"String",
",",
"?",
">",
">",
"supplier",
")",
"{",
"if",
"(",
"include",
")",
"{",
"Map",
"<",
"String",
",",
"?",
">",
"value... | Adds the map value to the provided map under the provided field name, if it should be
included. The supplier is only invoked if the field is to be included. | [
"Adds",
"the",
"map",
"value",
"to",
"the",
"provided",
"map",
"under",
"the",
"provided",
"field",
"name",
"if",
"it",
"should",
"be",
"included",
".",
"The",
"supplier",
"is",
"only",
"invoked",
"if",
"the",
"field",
"is",
"to",
"be",
"included",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-json-logging/src/main/java/io/dropwizard/logging/json/layout/MapBuilder.java#L101-L109 |
29,932 | dropwizard/dropwizard | dropwizard-json-logging/src/main/java/io/dropwizard/logging/json/layout/MapBuilder.java | MapBuilder.addTimestamp | public MapBuilder addTimestamp(String fieldName, boolean include, long timestamp) {
if (include && timestamp > 0) {
map.put(getFieldName(fieldName), timestampFormatter.format(timestamp));
}
return this;
} | java | public MapBuilder addTimestamp(String fieldName, boolean include, long timestamp) {
if (include && timestamp > 0) {
map.put(getFieldName(fieldName), timestampFormatter.format(timestamp));
}
return this;
} | [
"public",
"MapBuilder",
"addTimestamp",
"(",
"String",
"fieldName",
",",
"boolean",
"include",
",",
"long",
"timestamp",
")",
"{",
"if",
"(",
"include",
"&&",
"timestamp",
">",
"0",
")",
"{",
"map",
".",
"put",
"(",
"getFieldName",
"(",
"fieldName",
")",
... | Adds and optionally formats the timestamp to the provided map under the provided field name,
if it's should be included. | [
"Adds",
"and",
"optionally",
"formats",
"the",
"timestamp",
"to",
"the",
"provided",
"map",
"under",
"the",
"provided",
"field",
"name",
"if",
"it",
"s",
"should",
"be",
"included",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-json-logging/src/main/java/io/dropwizard/logging/json/layout/MapBuilder.java#L116-L121 |
29,933 | dropwizard/dropwizard | dropwizard-core/src/main/java/io/dropwizard/cli/Command.java | Command.onError | public void onError(Cli cli, Namespace namespace, Throwable e) {
e.printStackTrace(cli.getStdErr());
} | java | public void onError(Cli cli, Namespace namespace, Throwable e) {
e.printStackTrace(cli.getStdErr());
} | [
"public",
"void",
"onError",
"(",
"Cli",
"cli",
",",
"Namespace",
"namespace",
",",
"Throwable",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
"cli",
".",
"getStdErr",
"(",
")",
")",
";",
"}"
] | Method is called if there is an issue parsing configuration, setting up the
environment, or running the command itself. The default is printing the stacktrace
to facilitate debugging, but can be customized per command.
@param cli contains the streams for stdout and stderr
@param namespace the parsed arguments from the... | [
"Method",
"is",
"called",
"if",
"there",
"is",
"an",
"issue",
"parsing",
"configuration",
"setting",
"up",
"the",
"environment",
"or",
"running",
"the",
"command",
"itself",
".",
"The",
"default",
"is",
"printing",
"the",
"stacktrace",
"to",
"facilitate",
"deb... | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-core/src/main/java/io/dropwizard/cli/Command.java#L68-L70 |
29,934 | dropwizard/dropwizard | dropwizard-auth/src/main/java/io/dropwizard/auth/CachingAuthorizer.java | CachingAuthorizer.invalidate | public void invalidate(P principal, String role) {
cache.invalidate(ImmutablePair.of(principal, role));
} | java | public void invalidate(P principal, String role) {
cache.invalidate(ImmutablePair.of(principal, role));
} | [
"public",
"void",
"invalidate",
"(",
"P",
"principal",
",",
"String",
"role",
")",
"{",
"cache",
".",
"invalidate",
"(",
"ImmutablePair",
".",
"of",
"(",
"principal",
",",
"role",
")",
")",
";",
"}"
] | Discards any cached role associations for the given principal and role.
@param principal
@param role | [
"Discards",
"any",
"cached",
"role",
"associations",
"for",
"the",
"given",
"principal",
"and",
"role",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-auth/src/main/java/io/dropwizard/auth/CachingAuthorizer.java#L108-L110 |
29,935 | dropwizard/dropwizard | dropwizard-auth/src/main/java/io/dropwizard/auth/CachingAuthorizer.java | CachingAuthorizer.invalidate | public void invalidate(P principal) {
final Set<ImmutablePair<P, String>> keys = cache.asMap().keySet().stream()
.filter(cacheKey -> cacheKey.getLeft().equals(principal))
.collect(Collectors.toSet());
cache.invalidateAll(keys);
} | java | public void invalidate(P principal) {
final Set<ImmutablePair<P, String>> keys = cache.asMap().keySet().stream()
.filter(cacheKey -> cacheKey.getLeft().equals(principal))
.collect(Collectors.toSet());
cache.invalidateAll(keys);
} | [
"public",
"void",
"invalidate",
"(",
"P",
"principal",
")",
"{",
"final",
"Set",
"<",
"ImmutablePair",
"<",
"P",
",",
"String",
">",
">",
"keys",
"=",
"cache",
".",
"asMap",
"(",
")",
".",
"keySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",... | Discards any cached role associations for the given principal.
@param principal | [
"Discards",
"any",
"cached",
"role",
"associations",
"for",
"the",
"given",
"principal",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-auth/src/main/java/io/dropwizard/auth/CachingAuthorizer.java#L117-L123 |
29,936 | dropwizard/dropwizard | dropwizard-auth/src/main/java/io/dropwizard/auth/CachingAuthorizer.java | CachingAuthorizer.invalidateAll | public void invalidateAll(Iterable<P> principals) {
final Set<P> principalSet = Sets.of(principals);
final Set<ImmutablePair<P, String>> keys = cache.asMap().keySet().stream()
.filter(cacheKey -> principalSet.contains(cacheKey.getLeft()))
.collect(Collectors.toSet());
... | java | public void invalidateAll(Iterable<P> principals) {
final Set<P> principalSet = Sets.of(principals);
final Set<ImmutablePair<P, String>> keys = cache.asMap().keySet().stream()
.filter(cacheKey -> principalSet.contains(cacheKey.getLeft()))
.collect(Collectors.toSet());
... | [
"public",
"void",
"invalidateAll",
"(",
"Iterable",
"<",
"P",
">",
"principals",
")",
"{",
"final",
"Set",
"<",
"P",
">",
"principalSet",
"=",
"Sets",
".",
"of",
"(",
"principals",
")",
";",
"final",
"Set",
"<",
"ImmutablePair",
"<",
"P",
",",
"String"... | Discards any cached role associations for the given collection
of principals.
@param principals a list of principals | [
"Discards",
"any",
"cached",
"role",
"associations",
"for",
"the",
"given",
"collection",
"of",
"principals",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-auth/src/main/java/io/dropwizard/auth/CachingAuthorizer.java#L131-L137 |
29,937 | dropwizard/dropwizard | dropwizard-auth/src/main/java/io/dropwizard/auth/CachingAuthorizer.java | CachingAuthorizer.invalidateAll | public void invalidateAll(Predicate<? super P> predicate) {
final Set<ImmutablePair<P, String>> keys = cache.asMap().keySet().stream()
.filter(cacheKey -> predicate.test(cacheKey.getLeft()))
.collect(Collectors.toSet());
cache.invalidateAll(keys);
} | java | public void invalidateAll(Predicate<? super P> predicate) {
final Set<ImmutablePair<P, String>> keys = cache.asMap().keySet().stream()
.filter(cacheKey -> predicate.test(cacheKey.getLeft()))
.collect(Collectors.toSet());
cache.invalidateAll(keys);
} | [
"public",
"void",
"invalidateAll",
"(",
"Predicate",
"<",
"?",
"super",
"P",
">",
"predicate",
")",
"{",
"final",
"Set",
"<",
"ImmutablePair",
"<",
"P",
",",
"String",
">",
">",
"keys",
"=",
"cache",
".",
"asMap",
"(",
")",
".",
"keySet",
"(",
")",
... | Discards any cached role associations for principals satisfying
the given predicate.
@param predicate a predicate to filter credentials | [
"Discards",
"any",
"cached",
"role",
"associations",
"for",
"principals",
"satisfying",
"the",
"given",
"predicate",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-auth/src/main/java/io/dropwizard/auth/CachingAuthorizer.java#L145-L151 |
29,938 | dropwizard/dropwizard | dropwizard-jetty/src/main/java/io/dropwizard/jetty/HttpsConnectorFactory.java | HttpsConnectorFactory.logSslInfoOnStart | protected AbstractLifeCycle.AbstractLifeCycleListener logSslInfoOnStart(final SslContextFactory sslContextFactory) {
return new AbstractLifeCycle.AbstractLifeCycleListener() {
@Override
public void lifeCycleStarted(LifeCycle event) {
logSupportedParameters(sslContextFacto... | java | protected AbstractLifeCycle.AbstractLifeCycleListener logSslInfoOnStart(final SslContextFactory sslContextFactory) {
return new AbstractLifeCycle.AbstractLifeCycleListener() {
@Override
public void lifeCycleStarted(LifeCycle event) {
logSupportedParameters(sslContextFacto... | [
"protected",
"AbstractLifeCycle",
".",
"AbstractLifeCycleListener",
"logSslInfoOnStart",
"(",
"final",
"SslContextFactory",
"sslContextFactory",
")",
"{",
"return",
"new",
"AbstractLifeCycle",
".",
"AbstractLifeCycleListener",
"(",
")",
"{",
"@",
"Override",
"public",
"vo... | Register a listener that waits until the ssl context factory has started. Once it has
started we can grab the fully initialized context so we can log the parameters. | [
"Register",
"a",
"listener",
"that",
"waits",
"until",
"the",
"ssl",
"context",
"factory",
"has",
"started",
".",
"Once",
"it",
"has",
"started",
"we",
"can",
"grab",
"the",
"fully",
"initialized",
"context",
"so",
"we",
"can",
"log",
"the",
"parameters",
... | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jetty/src/main/java/io/dropwizard/jetty/HttpsConnectorFactory.java#L633-L640 |
29,939 | dropwizard/dropwizard | dropwizard-jersey/src/main/java/io/dropwizard/jersey/validation/ConstraintMessage.java | ConstraintMessage.getMessage | public static String getMessage(ConstraintViolation<?> v, Invocable invocable) {
final Pair<Path, ? extends ConstraintDescriptor<?>> of =
Pair.of(v.getPropertyPath(), v.getConstraintDescriptor());
final String cachePrefix = PREFIX_CACHE.getIfPresent(of);
if (cachePrefix == null) ... | java | public static String getMessage(ConstraintViolation<?> v, Invocable invocable) {
final Pair<Path, ? extends ConstraintDescriptor<?>> of =
Pair.of(v.getPropertyPath(), v.getConstraintDescriptor());
final String cachePrefix = PREFIX_CACHE.getIfPresent(of);
if (cachePrefix == null) ... | [
"public",
"static",
"String",
"getMessage",
"(",
"ConstraintViolation",
"<",
"?",
">",
"v",
",",
"Invocable",
"invocable",
")",
"{",
"final",
"Pair",
"<",
"Path",
",",
"?",
"extends",
"ConstraintDescriptor",
"<",
"?",
">",
">",
"of",
"=",
"Pair",
".",
"o... | Gets the human friendly location of where the violation was raised. | [
"Gets",
"the",
"human",
"friendly",
"location",
"of",
"where",
"the",
"violation",
"was",
"raised",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jersey/src/main/java/io/dropwizard/jersey/validation/ConstraintMessage.java#L40-L50 |
29,940 | dropwizard/dropwizard | dropwizard-jersey/src/main/java/io/dropwizard/jersey/validation/ConstraintMessage.java | ConstraintMessage.getMethodReturnValueName | private static Optional<String> getMethodReturnValueName(ConstraintViolation<?> violation) {
int returnValueNames = -1;
final StringBuilder result = new StringBuilder("server response");
for (Path.Node node : violation.getPropertyPath()) {
if (node.getKind().equals(ElementKind.RETUR... | java | private static Optional<String> getMethodReturnValueName(ConstraintViolation<?> violation) {
int returnValueNames = -1;
final StringBuilder result = new StringBuilder("server response");
for (Path.Node node : violation.getPropertyPath()) {
if (node.getKind().equals(ElementKind.RETUR... | [
"private",
"static",
"Optional",
"<",
"String",
">",
"getMethodReturnValueName",
"(",
"ConstraintViolation",
"<",
"?",
">",
"violation",
")",
"{",
"int",
"returnValueNames",
"=",
"-",
"1",
";",
"final",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"("... | Gets the method return value name, if the violation is raised in it | [
"Gets",
"the",
"method",
"return",
"value",
"name",
"if",
"the",
"violation",
"is",
"raised",
"in",
"it"
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jersey/src/main/java/io/dropwizard/jersey/validation/ConstraintMessage.java#L147-L160 |
29,941 | dropwizard/dropwizard | dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java | ServletEnvironment.addServlet | public ServletRegistration.Dynamic addServlet(String name, Servlet servlet) {
final ServletHolder holder = new NonblockingServletHolder(requireNonNull(servlet));
holder.setName(name);
handler.getServletHandler().addServlet(holder);
final ServletRegistration.Dynamic registration = holder... | java | public ServletRegistration.Dynamic addServlet(String name, Servlet servlet) {
final ServletHolder holder = new NonblockingServletHolder(requireNonNull(servlet));
holder.setName(name);
handler.getServletHandler().addServlet(holder);
final ServletRegistration.Dynamic registration = holder... | [
"public",
"ServletRegistration",
".",
"Dynamic",
"addServlet",
"(",
"String",
"name",
",",
"Servlet",
"servlet",
")",
"{",
"final",
"ServletHolder",
"holder",
"=",
"new",
"NonblockingServletHolder",
"(",
"requireNonNull",
"(",
"servlet",
")",
")",
";",
"holder",
... | Add a servlet instance.
@param name the servlet's name
@param servlet the servlet instance
@return a {@link javax.servlet.ServletRegistration.Dynamic} instance allowing for further
configuration | [
"Add",
"a",
"servlet",
"instance",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java#L45-L54 |
29,942 | dropwizard/dropwizard | dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java | ServletEnvironment.addFilter | public FilterRegistration.Dynamic addFilter(String name, Filter filter) {
return addFilter(name, new FilterHolder(requireNonNull(filter)));
} | java | public FilterRegistration.Dynamic addFilter(String name, Filter filter) {
return addFilter(name, new FilterHolder(requireNonNull(filter)));
} | [
"public",
"FilterRegistration",
".",
"Dynamic",
"addFilter",
"(",
"String",
"name",
",",
"Filter",
"filter",
")",
"{",
"return",
"addFilter",
"(",
"name",
",",
"new",
"FilterHolder",
"(",
"requireNonNull",
"(",
"filter",
")",
")",
")",
";",
"}"
] | Add a filter instance.
@param name the filter's name
@param filter the filter instance
@return a {@link javax.servlet.FilterRegistration.Dynamic} instance allowing for further
configuration | [
"Add",
"a",
"filter",
"instance",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java#L82-L84 |
29,943 | dropwizard/dropwizard | dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java | ServletEnvironment.addFilter | public FilterRegistration.Dynamic addFilter(String name, Class<? extends Filter> klass) {
return addFilter(name, new FilterHolder(requireNonNull(klass)));
} | java | public FilterRegistration.Dynamic addFilter(String name, Class<? extends Filter> klass) {
return addFilter(name, new FilterHolder(requireNonNull(klass)));
} | [
"public",
"FilterRegistration",
".",
"Dynamic",
"addFilter",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
"extends",
"Filter",
">",
"klass",
")",
"{",
"return",
"addFilter",
"(",
"name",
",",
"new",
"FilterHolder",
"(",
"requireNonNull",
"(",
"klass",
")",... | Add a filter class.
@param name the filter's name
@param klass the filter class
@return a {@link javax.servlet.FilterRegistration.Dynamic} instance allowing for further configuration | [
"Add",
"a",
"filter",
"class",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java#L93-L95 |
29,944 | dropwizard/dropwizard | dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java | ServletEnvironment.setProtectedTargets | public void setProtectedTargets(String... targets) {
handler.setProtectedTargets(Arrays.copyOf(targets, targets.length));
} | java | public void setProtectedTargets(String... targets) {
handler.setProtectedTargets(Arrays.copyOf(targets, targets.length));
} | [
"public",
"void",
"setProtectedTargets",
"(",
"String",
"...",
"targets",
")",
"{",
"handler",
".",
"setProtectedTargets",
"(",
"Arrays",
".",
"copyOf",
"(",
"targets",
",",
"targets",
".",
"length",
")",
")",
";",
"}"
] | Set protected targets.
@param targets Array of URL prefix. Each prefix is in the form /path and
will match either /path exactly or /path/anything | [
"Set",
"protected",
"targets",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java#L127-L129 |
29,945 | dropwizard/dropwizard | dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java | ServletEnvironment.setSessionHandler | public void setSessionHandler(SessionHandler sessionHandler) {
handler.setSessionsEnabled(sessionHandler != null);
handler.setSessionHandler(sessionHandler);
} | java | public void setSessionHandler(SessionHandler sessionHandler) {
handler.setSessionsEnabled(sessionHandler != null);
handler.setSessionHandler(sessionHandler);
} | [
"public",
"void",
"setSessionHandler",
"(",
"SessionHandler",
"sessionHandler",
")",
"{",
"handler",
".",
"setSessionsEnabled",
"(",
"sessionHandler",
"!=",
"null",
")",
";",
"handler",
".",
"setSessionHandler",
"(",
"sessionHandler",
")",
";",
"}"
] | Set the session handler.
@param sessionHandler The sessionHandler to set. | [
"Set",
"the",
"session",
"handler",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java#L186-L189 |
29,946 | dropwizard/dropwizard | dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java | ServletEnvironment.setSecurityHandler | public void setSecurityHandler(SecurityHandler securityHandler) {
handler.setSecurityEnabled(securityHandler != null);
handler.setSecurityHandler(securityHandler);
} | java | public void setSecurityHandler(SecurityHandler securityHandler) {
handler.setSecurityEnabled(securityHandler != null);
handler.setSecurityHandler(securityHandler);
} | [
"public",
"void",
"setSecurityHandler",
"(",
"SecurityHandler",
"securityHandler",
")",
"{",
"handler",
".",
"setSecurityEnabled",
"(",
"securityHandler",
"!=",
"null",
")",
";",
"handler",
".",
"setSecurityHandler",
"(",
"securityHandler",
")",
";",
"}"
] | Set the security handler.
@param securityHandler The securityHandler to set. | [
"Set",
"the",
"security",
"handler",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java#L196-L199 |
29,947 | dropwizard/dropwizard | dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java | ServletEnvironment.addMimeMapping | public void addMimeMapping(String extension, String type) {
handler.getMimeTypes().addMimeMapping(extension, type);
} | java | public void addMimeMapping(String extension, String type) {
handler.getMimeTypes().addMimeMapping(extension, type);
} | [
"public",
"void",
"addMimeMapping",
"(",
"String",
"extension",
",",
"String",
"type",
")",
"{",
"handler",
".",
"getMimeTypes",
"(",
")",
".",
"addMimeMapping",
"(",
"extension",
",",
"type",
")",
";",
"}"
] | Set a mime mapping.
@param extension Extension
@param type Mime type | [
"Set",
"a",
"mime",
"mapping",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java#L207-L209 |
29,948 | dropwizard/dropwizard | dropwizard-jersey/src/main/java/io/dropwizard/jersey/validation/JerseyParameterNameProvider.java | JerseyParameterNameProvider.getParameterNameFromAnnotations | public static Optional<String> getParameterNameFromAnnotations(Annotation[] memberAnnotations) {
for (Annotation a : memberAnnotations) {
if (a instanceof QueryParam) {
return Optional.of("query param " + ((QueryParam) a).value());
} else if (a instanceof PathParam) {
... | java | public static Optional<String> getParameterNameFromAnnotations(Annotation[] memberAnnotations) {
for (Annotation a : memberAnnotations) {
if (a instanceof QueryParam) {
return Optional.of("query param " + ((QueryParam) a).value());
} else if (a instanceof PathParam) {
... | [
"public",
"static",
"Optional",
"<",
"String",
">",
"getParameterNameFromAnnotations",
"(",
"Annotation",
"[",
"]",
"memberAnnotations",
")",
"{",
"for",
"(",
"Annotation",
"a",
":",
"memberAnnotations",
")",
"{",
"if",
"(",
"a",
"instanceof",
"QueryParam",
")",... | Derives member's name and type from it's annotations | [
"Derives",
"member",
"s",
"name",
"and",
"type",
"from",
"it",
"s",
"annotations"
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jersey/src/main/java/io/dropwizard/jersey/validation/JerseyParameterNameProvider.java#L44-L64 |
29,949 | dropwizard/dropwizard | dropwizard-auth/src/main/java/io/dropwizard/auth/oauth/OAuthCredentialAuthFilter.java | OAuthCredentialAuthFilter.getCredentials | @Nullable
private String getCredentials(String header) {
if (header == null) {
return null;
}
final int space = header.indexOf(' ');
if (space <= 0) {
return null;
}
final String method = header.substring(0, space);
if (!prefix.equals... | java | @Nullable
private String getCredentials(String header) {
if (header == null) {
return null;
}
final int space = header.indexOf(' ');
if (space <= 0) {
return null;
}
final String method = header.substring(0, space);
if (!prefix.equals... | [
"@",
"Nullable",
"private",
"String",
"getCredentials",
"(",
"String",
"header",
")",
"{",
"if",
"(",
"header",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"int",
"space",
"=",
"header",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",... | Parses a value of the `Authorization` header in the form of `Bearer a892bf3e284da9bb40648ab10`.
@param header the value of the `Authorization` header
@return a token | [
"Parses",
"a",
"value",
"of",
"the",
"Authorization",
"header",
"in",
"the",
"form",
"of",
"Bearer",
"a892bf3e284da9bb40648ab10",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-auth/src/main/java/io/dropwizard/auth/oauth/OAuthCredentialAuthFilter.java#L49-L66 |
29,950 | dropwizard/dropwizard | dropwizard-util/src/main/java/io/dropwizard/util/Generics.java | Generics.getTypeParameter | public static <T> Class<T> getTypeParameter(Class<?> klass, Class<? super T> bound) {
Type t = requireNonNull(klass);
while (t instanceof Class<?>) {
t = ((Class<?>) t).getGenericSuperclass();
}
/* This is not guaranteed to work for all cases with convoluted piping
*... | java | public static <T> Class<T> getTypeParameter(Class<?> klass, Class<? super T> bound) {
Type t = requireNonNull(klass);
while (t instanceof Class<?>) {
t = ((Class<?>) t).getGenericSuperclass();
}
/* This is not guaranteed to work for all cases with convoluted piping
*... | [
"public",
"static",
"<",
"T",
">",
"Class",
"<",
"T",
">",
"getTypeParameter",
"(",
"Class",
"<",
"?",
">",
"klass",
",",
"Class",
"<",
"?",
"super",
"T",
">",
"bound",
")",
"{",
"Type",
"t",
"=",
"requireNonNull",
"(",
"klass",
")",
";",
"while",
... | Finds the type parameter for the given class which is assignable to the bound class.
@param klass a parameterized class
@param bound the type bound
@param <T> the type bound
@return the class's type parameter | [
"Finds",
"the",
"type",
"parameter",
"for",
"the",
"given",
"class",
"which",
"is",
"assignable",
"to",
"the",
"bound",
"class",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-util/src/main/java/io/dropwizard/util/Generics.java#L35-L74 |
29,951 | dropwizard/dropwizard | dropwizard-logging/src/main/java/io/dropwizard/logging/DefaultLoggingFactory.java | DefaultLoggingFactory.clear | void clear() {
// This is volatile, read once for performance.
final String name = loggerName;
if (name != null) {
CHANGE_LOGGER_CONTEXT_LOCK.lock();
try {
loggerContext.stop();
final Logger logger = loggerContext.getLogger(org.slf4j.Logg... | java | void clear() {
// This is volatile, read once for performance.
final String name = loggerName;
if (name != null) {
CHANGE_LOGGER_CONTEXT_LOCK.lock();
try {
loggerContext.stop();
final Logger logger = loggerContext.getLogger(org.slf4j.Logg... | [
"void",
"clear",
"(",
")",
"{",
"// This is volatile, read once for performance.",
"final",
"String",
"name",
"=",
"loggerName",
";",
"if",
"(",
"name",
"!=",
"null",
")",
"{",
"CHANGE_LOGGER_CONTEXT_LOCK",
".",
"lock",
"(",
")",
";",
"try",
"{",
"loggerContext"... | This method is designed to be used by unit tests only. | [
"This",
"method",
"is",
"designed",
"to",
"be",
"used",
"by",
"unit",
"tests",
"only",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-logging/src/main/java/io/dropwizard/logging/DefaultLoggingFactory.java#L99-L119 |
29,952 | dropwizard/dropwizard | dropwizard-servlets/src/main/java/io/dropwizard/servlets/tasks/LogConfigurationTask.java | LogConfigurationTask.getTimer | @Nonnull
private Timer getTimer() {
return timerReference.updateAndGet(timer -> timer == null ? new Timer(LogConfigurationTask.class.getSimpleName(), true) : timer);
} | java | @Nonnull
private Timer getTimer() {
return timerReference.updateAndGet(timer -> timer == null ? new Timer(LogConfigurationTask.class.getSimpleName(), true) : timer);
} | [
"@",
"Nonnull",
"private",
"Timer",
"getTimer",
"(",
")",
"{",
"return",
"timerReference",
".",
"updateAndGet",
"(",
"timer",
"->",
"timer",
"==",
"null",
"?",
"new",
"Timer",
"(",
"LogConfigurationTask",
".",
"class",
".",
"getSimpleName",
"(",
")",
",",
... | Lazy create the timer to avoid unnecessary thread creation unless an expirable log configuration task is submitted | [
"Lazy",
"create",
"the",
"timer",
"to",
"avoid",
"unnecessary",
"thread",
"creation",
"unless",
"an",
"expirable",
"log",
"configuration",
"task",
"is",
"submitted"
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-servlets/src/main/java/io/dropwizard/servlets/tasks/LogConfigurationTask.java#L117-L120 |
29,953 | dropwizard/dropwizard | dropwizard-client/src/main/java/io/dropwizard/client/HttpClientBuilder.java | HttpClientBuilder.createUserAgent | protected String createUserAgent(String name) {
final String defaultUserAgent = environmentName == null ? name : String.format("%s (%s)", environmentName, name);
return configuration.getUserAgent().orElse(defaultUserAgent);
} | java | protected String createUserAgent(String name) {
final String defaultUserAgent = environmentName == null ? name : String.format("%s (%s)", environmentName, name);
return configuration.getUserAgent().orElse(defaultUserAgent);
} | [
"protected",
"String",
"createUserAgent",
"(",
"String",
"name",
")",
"{",
"final",
"String",
"defaultUserAgent",
"=",
"environmentName",
"==",
"null",
"?",
"name",
":",
"String",
".",
"format",
"(",
"\"%s (%s)\"",
",",
"environmentName",
",",
"name",
")",
";"... | Create a user agent string using the configured user agent if defined, otherwise
using a combination of the environment name and this client name
@param name the name of this client
@return the user agent string to be used by this client | [
"Create",
"a",
"user",
"agent",
"string",
"using",
"the",
"configured",
"user",
"agent",
"if",
"defined",
"otherwise",
"using",
"a",
"combination",
"of",
"the",
"environment",
"name",
"and",
"this",
"client",
"name"
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-client/src/main/java/io/dropwizard/client/HttpClientBuilder.java#L441-L444 |
29,954 | dropwizard/dropwizard | dropwizard-client/src/main/java/io/dropwizard/client/HttpClientBuilder.java | HttpClientBuilder.createConnectionManager | protected InstrumentedHttpClientConnectionManager createConnectionManager(Registry<ConnectionSocketFactory> registry,
String name) {
final Duration ttl = configuration.getTimeToLive();
final InstrumentedHttpClientConnectionMan... | java | protected InstrumentedHttpClientConnectionManager createConnectionManager(Registry<ConnectionSocketFactory> registry,
String name) {
final Duration ttl = configuration.getTimeToLive();
final InstrumentedHttpClientConnectionMan... | [
"protected",
"InstrumentedHttpClientConnectionManager",
"createConnectionManager",
"(",
"Registry",
"<",
"ConnectionSocketFactory",
">",
"registry",
",",
"String",
"name",
")",
"{",
"final",
"Duration",
"ttl",
"=",
"configuration",
".",
"getTimeToLive",
"(",
")",
";",
... | Create a InstrumentedHttpClientConnectionManager based on the
HttpClientConfiguration. It sets the maximum connections per route and
the maximum total connections that the connection manager can create
@param registry
@param name
@return a InstrumentedHttpClientConnectionManger instance | [
"Create",
"a",
"InstrumentedHttpClientConnectionManager",
"based",
"on",
"the",
"HttpClientConfiguration",
".",
"It",
"sets",
"the",
"maximum",
"connections",
"per",
"route",
"and",
"the",
"maximum",
"total",
"connections",
"that",
"the",
"connection",
"manager",
"can... | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-client/src/main/java/io/dropwizard/client/HttpClientBuilder.java#L456-L468 |
29,955 | dropwizard/dropwizard | dropwizard-client/src/main/java/io/dropwizard/client/HttpClientBuilder.java | HttpClientBuilder.configureCredentials | protected Credentials configureCredentials(AuthConfiguration auth) {
if (null != auth.getCredentialType() && auth.getCredentialType().equalsIgnoreCase(AuthConfiguration.NT_CREDS)) {
return new NTCredentials(auth.getUsername(), auth.getPassword(), auth.getHostname(), auth.getDomain());
} els... | java | protected Credentials configureCredentials(AuthConfiguration auth) {
if (null != auth.getCredentialType() && auth.getCredentialType().equalsIgnoreCase(AuthConfiguration.NT_CREDS)) {
return new NTCredentials(auth.getUsername(), auth.getPassword(), auth.getHostname(), auth.getDomain());
} els... | [
"protected",
"Credentials",
"configureCredentials",
"(",
"AuthConfiguration",
"auth",
")",
"{",
"if",
"(",
"null",
"!=",
"auth",
".",
"getCredentialType",
"(",
")",
"&&",
"auth",
".",
"getCredentialType",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"AuthConfiguration"... | determine the Credentials implementation to use
@param auth
@return a {@code Credentials} instance, either {{@link UsernamePasswordCredentials} or {@link NTCredentials}} | [
"determine",
"the",
"Credentials",
"implementation",
"to",
"use"
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-client/src/main/java/io/dropwizard/client/HttpClientBuilder.java#L508-L516 |
29,956 | dropwizard/dropwizard | dropwizard-hibernate/src/main/java/io/dropwizard/hibernate/AbstractDAO.java | AbstractDAO.uniqueResult | protected E uniqueResult(CriteriaQuery<E> criteriaQuery) throws HibernateException {
return AbstractProducedQuery.uniqueElement(
currentSession()
.createQuery(requireNonNull(criteriaQuery))
.getResultList()
);
} | java | protected E uniqueResult(CriteriaQuery<E> criteriaQuery) throws HibernateException {
return AbstractProducedQuery.uniqueElement(
currentSession()
.createQuery(requireNonNull(criteriaQuery))
.getResultList()
);
} | [
"protected",
"E",
"uniqueResult",
"(",
"CriteriaQuery",
"<",
"E",
">",
"criteriaQuery",
")",
"throws",
"HibernateException",
"{",
"return",
"AbstractProducedQuery",
".",
"uniqueElement",
"(",
"currentSession",
"(",
")",
".",
"createQuery",
"(",
"requireNonNull",
"("... | Convenience method to return a single instance that matches the criteria query,
or null if the criteria returns no results.
@param criteriaQuery the {@link CriteriaQuery} query to run
@return the single result or {@code null}
@throws HibernateException if there is more than one matching result | [
"Convenience",
"method",
"to",
"return",
"a",
"single",
"instance",
"that",
"matches",
"the",
"criteria",
"query",
"or",
"null",
"if",
"the",
"criteria",
"returns",
"no",
"results",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-hibernate/src/main/java/io/dropwizard/hibernate/AbstractDAO.java#L107-L113 |
29,957 | dropwizard/dropwizard | dropwizard-hibernate/src/main/java/io/dropwizard/hibernate/AbstractDAO.java | AbstractDAO.uniqueResult | @SuppressWarnings("unchecked")
protected E uniqueResult(Criteria criteria) throws HibernateException {
return (E) requireNonNull(criteria).uniqueResult();
} | java | @SuppressWarnings("unchecked")
protected E uniqueResult(Criteria criteria) throws HibernateException {
return (E) requireNonNull(criteria).uniqueResult();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"E",
"uniqueResult",
"(",
"Criteria",
"criteria",
")",
"throws",
"HibernateException",
"{",
"return",
"(",
"E",
")",
"requireNonNull",
"(",
"criteria",
")",
".",
"uniqueResult",
"(",
")",
";",
"}... | Convenience method to return a single instance that matches the criteria, or null if the
criteria returns no results.
@param criteria the {@link Criteria} query to run
@return the single result or {@code null}
@throws HibernateException if there is more than one matching result
@see Criteria#uniqueResult() | [
"Convenience",
"method",
"to",
"return",
"a",
"single",
"instance",
"that",
"matches",
"the",
"criteria",
"or",
"null",
"if",
"the",
"criteria",
"returns",
"no",
"results",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-hibernate/src/main/java/io/dropwizard/hibernate/AbstractDAO.java#L124-L127 |
29,958 | dropwizard/dropwizard | dropwizard-hibernate/src/main/java/io/dropwizard/hibernate/AbstractDAO.java | AbstractDAO.list | protected List<E> list(Query<E> query) throws HibernateException {
return requireNonNull(query).list();
} | java | protected List<E> list(Query<E> query) throws HibernateException {
return requireNonNull(query).list();
} | [
"protected",
"List",
"<",
"E",
">",
"list",
"(",
"Query",
"<",
"E",
">",
"query",
")",
"throws",
"HibernateException",
"{",
"return",
"requireNonNull",
"(",
"query",
")",
".",
"list",
"(",
")",
";",
"}"
] | Get the results of a query.
@param query the query to run
@return the list of matched query results
@see Query#list() | [
"Get",
"the",
"results",
"of",
"a",
"query",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-hibernate/src/main/java/io/dropwizard/hibernate/AbstractDAO.java#L171-L173 |
29,959 | dropwizard/dropwizard | dropwizard-jersey/src/main/java/io/dropwizard/jersey/setup/JerseyEnvironment.java | JerseyEnvironment.getProperty | @SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
@Nullable
public <T> T getProperty(String name) {
return (T) config.getProperties().get(name);
} | java | @SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
@Nullable
public <T> T getProperty(String name) {
return (T) config.getProperties().get(name);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"TypeParameterUnusedInFormals\"",
"}",
")",
"@",
"Nullable",
"public",
"<",
"T",
">",
"T",
"getProperty",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"T",
")",
"config",
".",
"getProperties",
"("... | Gets the given Jersey property.
@param name the name of the Jersey property
@see org.glassfish.jersey.server.ResourceConfig | [
"Gets",
"the",
"given",
"Jersey",
"property",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jersey/src/main/java/io/dropwizard/jersey/setup/JerseyEnvironment.java#L96-L100 |
29,960 | dropwizard/dropwizard | dropwizard-servlets/src/main/java/io/dropwizard/servlets/Servlets.java | Servlets.getFullUrl | public static String getFullUrl(HttpServletRequest request) {
if (request.getQueryString() == null) {
return request.getRequestURI();
}
return request.getRequestURI() + "?" + request.getQueryString();
} | java | public static String getFullUrl(HttpServletRequest request) {
if (request.getQueryString() == null) {
return request.getRequestURI();
}
return request.getRequestURI() + "?" + request.getQueryString();
} | [
"public",
"static",
"String",
"getFullUrl",
"(",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"request",
".",
"getQueryString",
"(",
")",
"==",
"null",
")",
"{",
"return",
"request",
".",
"getRequestURI",
"(",
")",
";",
"}",
"return",
"request",
"... | Returns the full URL of the given request.
@param request an HTTP servlet request
@return the full URL, including the query string | [
"Returns",
"the",
"full",
"URL",
"of",
"the",
"given",
"request",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-servlets/src/main/java/io/dropwizard/servlets/Servlets.java#L17-L24 |
29,961 | dropwizard/dropwizard | dropwizard-core/src/main/java/io/dropwizard/cli/Cli.java | Cli.run | public boolean run(String... arguments) throws Exception {
try {
if (isFlag(HELP, arguments)) {
parser.printHelp(stdOut);
} else if (isFlag(VERSION, arguments)) {
parser.printVersion(stdOut);
} else {
final Namespace namespace =... | java | public boolean run(String... arguments) throws Exception {
try {
if (isFlag(HELP, arguments)) {
parser.printHelp(stdOut);
} else if (isFlag(VERSION, arguments)) {
parser.printVersion(stdOut);
} else {
final Namespace namespace =... | [
"public",
"boolean",
"run",
"(",
"String",
"...",
"arguments",
")",
"throws",
"Exception",
"{",
"try",
"{",
"if",
"(",
"isFlag",
"(",
"HELP",
",",
"arguments",
")",
")",
"{",
"parser",
".",
"printHelp",
"(",
"stdOut",
")",
";",
"}",
"else",
"if",
"("... | Runs the command line interface given some arguments.
@param arguments the command line arguments
@return whether or not the command successfully executed
@throws Exception if something goes wrong | [
"Runs",
"the",
"command",
"line",
"interface",
"given",
"some",
"arguments",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-core/src/main/java/io/dropwizard/cli/Cli.java#L67-L96 |
29,962 | dropwizard/dropwizard | dropwizard-core/src/main/java/io/dropwizard/setup/Bootstrap.java | Bootstrap.registerMetrics | public void registerMetrics() {
if (metricsAreRegistered) {
return;
}
getMetricRegistry().register("jvm.attribute", new JvmAttributeGaugeSet());
getMetricRegistry().register("jvm.buffers", new BufferPoolMetricSet(ManagementFactory
... | java | public void registerMetrics() {
if (metricsAreRegistered) {
return;
}
getMetricRegistry().register("jvm.attribute", new JvmAttributeGaugeSet());
getMetricRegistry().register("jvm.buffers", new BufferPoolMetricSet(ManagementFactory
... | [
"public",
"void",
"registerMetrics",
"(",
")",
"{",
"if",
"(",
"metricsAreRegistered",
")",
"{",
"return",
";",
"}",
"getMetricRegistry",
"(",
")",
".",
"register",
"(",
"\"jvm.attribute\"",
",",
"new",
"JvmAttributeGaugeSet",
"(",
")",
")",
";",
"getMetricReg... | Registers the JVM metrics to the metric registry and start to report
the registry metrics via JMX. | [
"Registers",
"the",
"JVM",
"metrics",
"to",
"the",
"metric",
"registry",
"and",
"start",
"to",
"report",
"the",
"registry",
"metrics",
"via",
"JMX",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-core/src/main/java/io/dropwizard/setup/Bootstrap.java#L76-L91 |
29,963 | dropwizard/dropwizard | dropwizard-core/src/main/java/io/dropwizard/setup/Bootstrap.java | Bootstrap.run | public void run(T configuration, Environment environment) throws Exception {
for (ConfiguredBundle<? super T> bundle : configuredBundles) {
bundle.run(configuration, environment);
}
} | java | public void run(T configuration, Environment environment) throws Exception {
for (ConfiguredBundle<? super T> bundle : configuredBundles) {
bundle.run(configuration, environment);
}
} | [
"public",
"void",
"run",
"(",
"T",
"configuration",
",",
"Environment",
"environment",
")",
"throws",
"Exception",
"{",
"for",
"(",
"ConfiguredBundle",
"<",
"?",
"super",
"T",
">",
"bundle",
":",
"configuredBundles",
")",
"{",
"bundle",
".",
"run",
"(",
"c... | Runs the bootstrap's bundles with the given configuration and environment.
@param configuration the parsed configuration
@param environment the application environment
@throws Exception if a bundle throws an exception | [
"Runs",
"the",
"bootstrap",
"s",
"bundles",
"with",
"the",
"given",
"configuration",
"and",
"environment",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-core/src/main/java/io/dropwizard/setup/Bootstrap.java#L181-L185 |
29,964 | dropwizard/dropwizard | dropwizard-auth/src/main/java/io/dropwizard/auth/basic/BasicCredentialAuthFilter.java | BasicCredentialAuthFilter.getCredentials | @Nullable
private BasicCredentials getCredentials(String header) {
if (header == null) {
return null;
}
final int space = header.indexOf(' ');
if (space <= 0) {
return null;
}
final String method = header.substring(0, space);
if (!pre... | java | @Nullable
private BasicCredentials getCredentials(String header) {
if (header == null) {
return null;
}
final int space = header.indexOf(' ');
if (space <= 0) {
return null;
}
final String method = header.substring(0, space);
if (!pre... | [
"@",
"Nullable",
"private",
"BasicCredentials",
"getCredentials",
"(",
"String",
"header",
")",
"{",
"if",
"(",
"header",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"int",
"space",
"=",
"header",
".",
"indexOf",
"(",
"'",
"'",
")",
";... | Parses a Base64-encoded value of the `Authorization` header
in the form of `Basic dXNlcm5hbWU6cGFzc3dvcmQ=`.
@param header the value of the `Authorization` header
@return a username and a password as {@link BasicCredentials} | [
"Parses",
"a",
"Base64",
"-",
"encoded",
"value",
"of",
"the",
"Authorization",
"header",
"in",
"the",
"form",
"of",
"Basic",
"dXNlcm5hbWU6cGFzc3dvcmQ",
"=",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-auth/src/main/java/io/dropwizard/auth/basic/BasicCredentialAuthFilter.java#L40-L73 |
29,965 | dropwizard/dropwizard | dropwizard-util/src/main/java/io/dropwizard/util/Resources.java | Resources.toByteArray | public static byte[] toByteArray(URL url) throws IOException {
try (InputStream inputStream = url.openStream()) {
return ByteStreams.toByteArray(inputStream);
}
} | java | public static byte[] toByteArray(URL url) throws IOException {
try (InputStream inputStream = url.openStream()) {
return ByteStreams.toByteArray(inputStream);
}
} | [
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"URL",
"url",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputStream",
"inputStream",
"=",
"url",
".",
"openStream",
"(",
")",
")",
"{",
"return",
"ByteStreams",
".",
"toByteArray",
"(",
"input... | Reads all bytes from a URL into a byte array.
@param url the URL to read from
@return a byte array containing all the bytes from the URL
@throws IOException if an I/O error occurs | [
"Reads",
"all",
"bytes",
"from",
"a",
"URL",
"into",
"a",
"byte",
"array",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-util/src/main/java/io/dropwizard/util/Resources.java#L43-L47 |
29,966 | dropwizard/dropwizard | dropwizard-util/src/main/java/io/dropwizard/util/Resources.java | Resources.copy | public static void copy(URL from, OutputStream to) throws IOException {
try (InputStream inputStream = from.openStream()) {
ByteStreams.copy(inputStream, to);
}
} | java | public static void copy(URL from, OutputStream to) throws IOException {
try (InputStream inputStream = from.openStream()) {
ByteStreams.copy(inputStream, to);
}
} | [
"public",
"static",
"void",
"copy",
"(",
"URL",
"from",
",",
"OutputStream",
"to",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputStream",
"inputStream",
"=",
"from",
".",
"openStream",
"(",
")",
")",
"{",
"ByteStreams",
".",
"copy",
"(",
"inputStrea... | Copies all bytes from a URL to an output stream.
@param from the URL to read from
@param to the output stream
@throws IOException if an I/O error occurs | [
"Copies",
"all",
"bytes",
"from",
"a",
"URL",
"to",
"an",
"output",
"stream",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-util/src/main/java/io/dropwizard/util/Resources.java#L71-L75 |
29,967 | dropwizard/dropwizard | dropwizard-jersey/src/main/java/io/dropwizard/jersey/filter/RequestIdFilter.java | RequestIdFilter.generateRandomUuid | private static UUID generateRandomUuid() {
final Random rnd = ThreadLocalRandom.current();
long mostSig = rnd.nextLong();
long leastSig = rnd.nextLong();
// Identify this as a version 4 UUID, that is one based on a random value.
mostSig &= 0xffffffffffff0fffL;
mostSig |... | java | private static UUID generateRandomUuid() {
final Random rnd = ThreadLocalRandom.current();
long mostSig = rnd.nextLong();
long leastSig = rnd.nextLong();
// Identify this as a version 4 UUID, that is one based on a random value.
mostSig &= 0xffffffffffff0fffL;
mostSig |... | [
"private",
"static",
"UUID",
"generateRandomUuid",
"(",
")",
"{",
"final",
"Random",
"rnd",
"=",
"ThreadLocalRandom",
".",
"current",
"(",
")",
";",
"long",
"mostSig",
"=",
"rnd",
".",
"nextLong",
"(",
")",
";",
"long",
"leastSig",
"=",
"rnd",
".",
"next... | Generate a random UUID v4 that will perform reasonably when used by
multiple threads under load.
@see <a href="https://github.com/Netflix/netflix-commons/blob/v0.3.0/netflix-commons-util/src/main/java/com/netflix/util/concurrent/ConcurrentUUIDFactory.java">ConcurrentUUIDFactory</a>
@return random UUID | [
"Generate",
"a",
"random",
"UUID",
"v4",
"that",
"will",
"perform",
"reasonably",
"when",
"used",
"by",
"multiple",
"threads",
"under",
"load",
"."
] | 7ee09a410476b9681e8072ab684788bb440877bd | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jersey/src/main/java/io/dropwizard/jersey/filter/RequestIdFilter.java#L59-L74 |
29,968 | jOOQ/jOOR | jOOR/src/main/java/org/joor/Reflect.java | Reflect.isSimilarSignature | private boolean isSimilarSignature(Method possiblyMatchingMethod, String desiredMethodName, Class<?>[] desiredParamTypes) {
return possiblyMatchingMethod.getName().equals(desiredMethodName) && match(possiblyMatchingMethod.getParameterTypes(), desiredParamTypes);
} | java | private boolean isSimilarSignature(Method possiblyMatchingMethod, String desiredMethodName, Class<?>[] desiredParamTypes) {
return possiblyMatchingMethod.getName().equals(desiredMethodName) && match(possiblyMatchingMethod.getParameterTypes(), desiredParamTypes);
} | [
"private",
"boolean",
"isSimilarSignature",
"(",
"Method",
"possiblyMatchingMethod",
",",
"String",
"desiredMethodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"desiredParamTypes",
")",
"{",
"return",
"possiblyMatchingMethod",
".",
"getName",
"(",
")",
".",
"equal... | Determines if a method has a "similar" signature, especially if wrapping
primitive argument types would result in an exactly matching signature. | [
"Determines",
"if",
"a",
"method",
"has",
"a",
"similar",
"signature",
"especially",
"if",
"wrapping",
"primitive",
"argument",
"types",
"would",
"result",
"in",
"an",
"exactly",
"matching",
"signature",
"."
] | 40b42be12ecc9939560ff86921bbc57c99a21b85 | https://github.com/jOOQ/jOOR/blob/40b42be12ecc9939560ff86921bbc57c99a21b85/jOOR/src/main/java/org/joor/Reflect.java#L647-L649 |
29,969 | jOOQ/jOOR | jOOR/src/main/java/org/joor/Reflect.java | Reflect.match | private boolean match(Class<?>[] declaredTypes, Class<?>[] actualTypes) {
if (declaredTypes.length == actualTypes.length) {
for (int i = 0; i < actualTypes.length; i++) {
if (actualTypes[i] == NULL.class)
continue;
if (wrapper(declaredTypes[i]).is... | java | private boolean match(Class<?>[] declaredTypes, Class<?>[] actualTypes) {
if (declaredTypes.length == actualTypes.length) {
for (int i = 0; i < actualTypes.length; i++) {
if (actualTypes[i] == NULL.class)
continue;
if (wrapper(declaredTypes[i]).is... | [
"private",
"boolean",
"match",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
"declaredTypes",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"actualTypes",
")",
"{",
"if",
"(",
"declaredTypes",
".",
"length",
"==",
"actualTypes",
".",
"length",
")",
"{",
"for",
"("... | Check whether two arrays of types match, converting primitive types to
their corresponding wrappers. | [
"Check",
"whether",
"two",
"arrays",
"of",
"types",
"match",
"converting",
"primitive",
"types",
"to",
"their",
"corresponding",
"wrappers",
"."
] | 40b42be12ecc9939560ff86921bbc57c99a21b85 | https://github.com/jOOQ/jOOR/blob/40b42be12ecc9939560ff86921bbc57c99a21b85/jOOR/src/main/java/org/joor/Reflect.java#L810-L827 |
29,970 | jOOQ/jOOR | jOOR/src/main/java/org/joor/Reflect.java | Reflect.on | private static Reflect on(Constructor<?> constructor, Object... args) throws ReflectException {
try {
return on(constructor.getDeclaringClass(), accessible(constructor).newInstance(args));
}
catch (Exception e) {
throw new ReflectException(e);
}
} | java | private static Reflect on(Constructor<?> constructor, Object... args) throws ReflectException {
try {
return on(constructor.getDeclaringClass(), accessible(constructor).newInstance(args));
}
catch (Exception e) {
throw new ReflectException(e);
}
} | [
"private",
"static",
"Reflect",
"on",
"(",
"Constructor",
"<",
"?",
">",
"constructor",
",",
"Object",
"...",
"args",
")",
"throws",
"ReflectException",
"{",
"try",
"{",
"return",
"on",
"(",
"constructor",
".",
"getDeclaringClass",
"(",
")",
",",
"accessible... | Wrap an object created from a constructor | [
"Wrap",
"an",
"object",
"created",
"from",
"a",
"constructor"
] | 40b42be12ecc9939560ff86921bbc57c99a21b85 | https://github.com/jOOQ/jOOR/blob/40b42be12ecc9939560ff86921bbc57c99a21b85/jOOR/src/main/java/org/joor/Reflect.java#L864-L871 |
29,971 | jOOQ/jOOR | jOOR/src/main/java/org/joor/Reflect.java | Reflect.on | private static Reflect on(Method method, Object object, Object... args) throws ReflectException {
try {
accessible(method);
if (method.getReturnType() == void.class) {
method.invoke(object, args);
return on(object);
}
else {
... | java | private static Reflect on(Method method, Object object, Object... args) throws ReflectException {
try {
accessible(method);
if (method.getReturnType() == void.class) {
method.invoke(object, args);
return on(object);
}
else {
... | [
"private",
"static",
"Reflect",
"on",
"(",
"Method",
"method",
",",
"Object",
"object",
",",
"Object",
"...",
"args",
")",
"throws",
"ReflectException",
"{",
"try",
"{",
"accessible",
"(",
"method",
")",
";",
"if",
"(",
"method",
".",
"getReturnType",
"(",... | Wrap an object returned from a method | [
"Wrap",
"an",
"object",
"returned",
"from",
"a",
"method"
] | 40b42be12ecc9939560ff86921bbc57c99a21b85 | https://github.com/jOOQ/jOOR/blob/40b42be12ecc9939560ff86921bbc57c99a21b85/jOOR/src/main/java/org/joor/Reflect.java#L876-L891 |
29,972 | jOOQ/jOOR | jOOR/src/main/java/org/joor/Reflect.java | Reflect.unwrap | private static Object unwrap(Object object) {
if (object instanceof Reflect) {
return ((Reflect) object).get();
}
return object;
} | java | private static Object unwrap(Object object) {
if (object instanceof Reflect) {
return ((Reflect) object).get();
}
return object;
} | [
"private",
"static",
"Object",
"unwrap",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"instanceof",
"Reflect",
")",
"{",
"return",
"(",
"(",
"Reflect",
")",
"object",
")",
".",
"get",
"(",
")",
";",
"}",
"return",
"object",
";",
"}"
] | Unwrap an object | [
"Unwrap",
"an",
"object"
] | 40b42be12ecc9939560ff86921bbc57c99a21b85 | https://github.com/jOOQ/jOOR/blob/40b42be12ecc9939560ff86921bbc57c99a21b85/jOOR/src/main/java/org/joor/Reflect.java#L896-L902 |
29,973 | jOOQ/jOOR | jOOR/src/main/java/org/joor/Reflect.java | Reflect.wrapper | public static Class<?> wrapper(Class<?> type) {
if (type == null) {
return null;
}
else if (type.isPrimitive()) {
if (boolean.class == type) {
return Boolean.class;
}
else if (int.class == type) {
return Integer.clas... | java | public static Class<?> wrapper(Class<?> type) {
if (type == null) {
return null;
}
else if (type.isPrimitive()) {
if (boolean.class == type) {
return Boolean.class;
}
else if (int.class == type) {
return Integer.clas... | [
"public",
"static",
"Class",
"<",
"?",
">",
"wrapper",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"type",
".",
"isPrimitive",
"(",
")",
")",
"{",
"if"... | Get a wrapper type for a primitive type, or the argument type itself, if
it is not a primitive type. | [
"Get",
"a",
"wrapper",
"type",
"for",
"a",
"primitive",
"type",
"or",
"the",
"argument",
"type",
"itself",
"if",
"it",
"is",
"not",
"a",
"primitive",
"type",
"."
] | 40b42be12ecc9939560ff86921bbc57c99a21b85 | https://github.com/jOOQ/jOOR/blob/40b42be12ecc9939560ff86921bbc57c99a21b85/jOOR/src/main/java/org/joor/Reflect.java#L960-L995 |
29,974 | jOOQ/jOOR | jOOR-java-6/src/main/java/org/joor/Reflect.java | Reflect.as | @SuppressWarnings("unchecked")
public <P> P as(final Class<P> proxyType) {
final boolean isMap = (object instanceof Map);
final InvocationHandler handler = new InvocationHandler() {
@Override
@SuppressWarnings("null")
public Object invoke(Object proxy, Method meth... | java | @SuppressWarnings("unchecked")
public <P> P as(final Class<P> proxyType) {
final boolean isMap = (object instanceof Map);
final InvocationHandler handler = new InvocationHandler() {
@Override
@SuppressWarnings("null")
public Object invoke(Object proxy, Method meth... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"P",
">",
"P",
"as",
"(",
"final",
"Class",
"<",
"P",
">",
"proxyType",
")",
"{",
"final",
"boolean",
"isMap",
"=",
"(",
"object",
"instanceof",
"Map",
")",
";",
"final",
"InvocationHandl... | Create a proxy for the wrapped object allowing to typesafely invoke
methods on it using a custom interface
@param proxyType The interface type that is implemented by the proxy
@return A proxy for the wrapped object | [
"Create",
"a",
"proxy",
"for",
"the",
"wrapped",
"object",
"allowing",
"to",
"typesafely",
"invoke",
"methods",
"on",
"it",
"using",
"a",
"custom",
"interface"
] | 40b42be12ecc9939560ff86921bbc57c99a21b85 | https://github.com/jOOQ/jOOR/blob/40b42be12ecc9939560ff86921bbc57c99a21b85/jOOR-java-6/src/main/java/org/joor/Reflect.java#L721-L783 |
29,975 | opentable/otj-pg-embedded | src/main/java/com/opentable/db/postgres/embedded/PreparedDbProvider.java | PreparedDbProvider.createOrFindPreparer | private static synchronized PrepPipeline createOrFindPreparer(DatabasePreparer preparer, Iterable<Consumer<Builder>> customizers) throws IOException, SQLException
{
final ClusterKey key = new ClusterKey(preparer, customizers);
PrepPipeline result = CLUSTERS.get(key);
if (result != null) {
... | java | private static synchronized PrepPipeline createOrFindPreparer(DatabasePreparer preparer, Iterable<Consumer<Builder>> customizers) throws IOException, SQLException
{
final ClusterKey key = new ClusterKey(preparer, customizers);
PrepPipeline result = CLUSTERS.get(key);
if (result != null) {
... | [
"private",
"static",
"synchronized",
"PrepPipeline",
"createOrFindPreparer",
"(",
"DatabasePreparer",
"preparer",
",",
"Iterable",
"<",
"Consumer",
"<",
"Builder",
">",
">",
"customizers",
")",
"throws",
"IOException",
",",
"SQLException",
"{",
"final",
"ClusterKey",
... | Each schema set has its own database cluster. The template1 database has the schema preloaded so that
each test case need only create a new database and not re-invoke your preparer. | [
"Each",
"schema",
"set",
"has",
"its",
"own",
"database",
"cluster",
".",
"The",
"template1",
"database",
"has",
"the",
"schema",
"preloaded",
"so",
"that",
"each",
"test",
"case",
"need",
"only",
"create",
"a",
"new",
"database",
"and",
"not",
"re",
"-",
... | 0f94ce9677f004959c23a7a4a825a606267d4aa9 | https://github.com/opentable/otj-pg-embedded/blob/0f94ce9677f004959c23a7a4a825a606267d4aa9/src/main/java/com/opentable/db/postgres/embedded/PreparedDbProvider.java#L72-L88 |
29,976 | opentable/otj-pg-embedded | src/main/java/com/opentable/db/postgres/embedded/PreparedDbProvider.java | PreparedDbProvider.getConfigurationTweak | public Map<String, String> getConfigurationTweak(String dbModuleName) throws SQLException
{
final DbInfo db = dbPreparer.getNextDb();
final Map<String, String> result = new HashMap<>();
result.put("ot.db." + dbModuleName + ".uri", getJdbcUri(db));
result.put("ot.db." + dbModuleName +... | java | public Map<String, String> getConfigurationTweak(String dbModuleName) throws SQLException
{
final DbInfo db = dbPreparer.getNextDb();
final Map<String, String> result = new HashMap<>();
result.put("ot.db." + dbModuleName + ".uri", getJdbcUri(db));
result.put("ot.db." + dbModuleName +... | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getConfigurationTweak",
"(",
"String",
"dbModuleName",
")",
"throws",
"SQLException",
"{",
"final",
"DbInfo",
"db",
"=",
"dbPreparer",
".",
"getNextDb",
"(",
")",
";",
"final",
"Map",
"<",
"String",
",",
... | Return configuration tweaks in a format appropriate for otj-jdbc DatabaseModule. | [
"Return",
"configuration",
"tweaks",
"in",
"a",
"format",
"appropriate",
"for",
"otj",
"-",
"jdbc",
"DatabaseModule",
"."
] | 0f94ce9677f004959c23a7a4a825a606267d4aa9 | https://github.com/opentable/otj-pg-embedded/blob/0f94ce9677f004959c23a7a4a825a606267d4aa9/src/main/java/com/opentable/db/postgres/embedded/PreparedDbProvider.java#L147-L154 |
29,977 | opentable/otj-pg-embedded | src/main/java/com/opentable/db/postgres/embedded/EmbeddedPostgres.java | EmbeddedPostgres.getOS | private static String getOS()
{
if (SystemUtils.IS_OS_WINDOWS) {
return "Windows";
}
if (SystemUtils.IS_OS_MAC_OSX) {
return "Darwin";
}
if (SystemUtils.IS_OS_LINUX) {
return "Linux";
}
throw new UnsupportedOperationExceptio... | java | private static String getOS()
{
if (SystemUtils.IS_OS_WINDOWS) {
return "Windows";
}
if (SystemUtils.IS_OS_MAC_OSX) {
return "Darwin";
}
if (SystemUtils.IS_OS_LINUX) {
return "Linux";
}
throw new UnsupportedOperationExceptio... | [
"private",
"static",
"String",
"getOS",
"(",
")",
"{",
"if",
"(",
"SystemUtils",
".",
"IS_OS_WINDOWS",
")",
"{",
"return",
"\"Windows\"",
";",
"}",
"if",
"(",
"SystemUtils",
".",
"IS_OS_MAC_OSX",
")",
"{",
"return",
"\"Darwin\"",
";",
"}",
"if",
"(",
"Sy... | Get current operating system string. The string is used in the appropriate postgres binary name.
@return Current operating system string. | [
"Get",
"current",
"operating",
"system",
"string",
".",
"The",
"string",
"is",
"used",
"in",
"the",
"appropriate",
"postgres",
"binary",
"name",
"."
] | 0f94ce9677f004959c23a7a4a825a606267d4aa9 | https://github.com/opentable/otj-pg-embedded/blob/0f94ce9677f004959c23a7a4a825a606267d4aa9/src/main/java/com/opentable/db/postgres/embedded/EmbeddedPostgres.java#L650-L662 |
29,978 | uber/NullAway | jar-infer/jar-infer-lib/src/main/java/com/uber/nullaway/jarinfer/DefinitelyDerefedParams.java | DefinitelyDerefedParams.analyzeReturnType | public NullnessHint analyzeReturnType() {
if (method.getReturnType().isPrimitiveType()) {
LOG(DEBUG, "DEBUG", "Skipping method with primitive return type: " + method.getSignature());
return NullnessHint.UNKNOWN;
}
LOG(DEBUG, "DEBUG", "@ Return type analysis for: " + method.getSignature());
/... | java | public NullnessHint analyzeReturnType() {
if (method.getReturnType().isPrimitiveType()) {
LOG(DEBUG, "DEBUG", "Skipping method with primitive return type: " + method.getSignature());
return NullnessHint.UNKNOWN;
}
LOG(DEBUG, "DEBUG", "@ Return type analysis for: " + method.getSignature());
/... | [
"public",
"NullnessHint",
"analyzeReturnType",
"(",
")",
"{",
"if",
"(",
"method",
".",
"getReturnType",
"(",
")",
".",
"isPrimitiveType",
"(",
")",
")",
"{",
"LOG",
"(",
"DEBUG",
",",
"\"DEBUG\"",
",",
"\"Skipping method with primitive return type: \"",
"+",
"m... | This is the nullability analysis for the method return value.
@return NullnessHint The inferred nullness type for the method return value. | [
"This",
"is",
"the",
"nullability",
"analysis",
"for",
"the",
"method",
"return",
"value",
"."
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/jar-infer/jar-infer-lib/src/main/java/com/uber/nullaway/jarinfer/DefinitelyDerefedParams.java#L191-L221 |
29,979 | uber/NullAway | nullaway/src/main/java/com/uber/nullaway/dataflow/EnclosingEnvironmentNullness.java | EnclosingEnvironmentNullness.isValidTreeType | private boolean isValidTreeType(Tree t) {
if (t instanceof LambdaExpressionTree) {
return true;
}
if (t instanceof ClassTree) {
NestingKind nestingKind = ASTHelpers.getSymbol((ClassTree) t).getNestingKind();
return nestingKind.equals(NestingKind.ANONYMOUS) || nestingKind.equals(NestingKind... | java | private boolean isValidTreeType(Tree t) {
if (t instanceof LambdaExpressionTree) {
return true;
}
if (t instanceof ClassTree) {
NestingKind nestingKind = ASTHelpers.getSymbol((ClassTree) t).getNestingKind();
return nestingKind.equals(NestingKind.ANONYMOUS) || nestingKind.equals(NestingKind... | [
"private",
"boolean",
"isValidTreeType",
"(",
"Tree",
"t",
")",
"{",
"if",
"(",
"t",
"instanceof",
"LambdaExpressionTree",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"t",
"instanceof",
"ClassTree",
")",
"{",
"NestingKind",
"nestingKind",
"=",
"ASTHelpe... | Is t an anonymous inner class or a lambda? | [
"Is",
"t",
"an",
"anonymous",
"inner",
"class",
"or",
"a",
"lambda?"
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/dataflow/EnclosingEnvironmentNullness.java#L51-L60 |
29,980 | uber/NullAway | nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java | NullabilityUtil.getFunctionalInterfaceMethod | public static Symbol.MethodSymbol getFunctionalInterfaceMethod(ExpressionTree tree, Types types) {
Preconditions.checkArgument(
(tree instanceof LambdaExpressionTree) || (tree instanceof MemberReferenceTree));
Type funcInterfaceType = ((JCTree.JCFunctionalExpression) tree).type;
return (Symbol.Metho... | java | public static Symbol.MethodSymbol getFunctionalInterfaceMethod(ExpressionTree tree, Types types) {
Preconditions.checkArgument(
(tree instanceof LambdaExpressionTree) || (tree instanceof MemberReferenceTree));
Type funcInterfaceType = ((JCTree.JCFunctionalExpression) tree).type;
return (Symbol.Metho... | [
"public",
"static",
"Symbol",
".",
"MethodSymbol",
"getFunctionalInterfaceMethod",
"(",
"ExpressionTree",
"tree",
",",
"Types",
"types",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"(",
"tree",
"instanceof",
"LambdaExpressionTree",
")",
"||",
"(",
"tree",
... | finds the corresponding functional interface method for a lambda expression or method reference
@param tree the lambda expression or method reference
@return the functional interface method | [
"finds",
"the",
"corresponding",
"functional",
"interface",
"method",
"for",
"a",
"lambda",
"expression",
"or",
"method",
"reference"
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java#L57-L62 |
29,981 | uber/NullAway | nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java | NullabilityUtil.lambdaParamIsImplicitlyTyped | public static boolean lambdaParamIsImplicitlyTyped(VariableTree lambdaParameter) {
// kind of a hack; the "preferred position" seems to be the position
// of the variable name. if this differs from the start position, it
// means there is an explicit type declaration
JCDiagnostic.DiagnosticPosition dia... | java | public static boolean lambdaParamIsImplicitlyTyped(VariableTree lambdaParameter) {
// kind of a hack; the "preferred position" seems to be the position
// of the variable name. if this differs from the start position, it
// means there is an explicit type declaration
JCDiagnostic.DiagnosticPosition dia... | [
"public",
"static",
"boolean",
"lambdaParamIsImplicitlyTyped",
"(",
"VariableTree",
"lambdaParameter",
")",
"{",
"// kind of a hack; the \"preferred position\" seems to be the position",
"// of the variable name. if this differs from the start position, it",
"// means there is an explicit typ... | determines whether a lambda parameter is missing an explicit type declaration
@param lambdaParameter the parameter
@return true if there is no type declaration, false otherwise | [
"determines",
"whether",
"a",
"lambda",
"parameter",
"is",
"missing",
"an",
"explicit",
"type",
"declaration"
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java#L70-L77 |
29,982 | uber/NullAway | nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java | NullabilityUtil.getOutermostClassSymbol | public static Symbol.ClassSymbol getOutermostClassSymbol(Symbol symbol) {
// get the symbol for the outermost enclosing class. this handles
// the case of anonymous classes
Symbol.ClassSymbol outermostClassSymbol = ASTHelpers.enclosingClass(symbol);
while (outermostClassSymbol.getNestingKind().isNested... | java | public static Symbol.ClassSymbol getOutermostClassSymbol(Symbol symbol) {
// get the symbol for the outermost enclosing class. this handles
// the case of anonymous classes
Symbol.ClassSymbol outermostClassSymbol = ASTHelpers.enclosingClass(symbol);
while (outermostClassSymbol.getNestingKind().isNested... | [
"public",
"static",
"Symbol",
".",
"ClassSymbol",
"getOutermostClassSymbol",
"(",
"Symbol",
"symbol",
")",
"{",
"// get the symbol for the outermost enclosing class. this handles",
"// the case of anonymous classes",
"Symbol",
".",
"ClassSymbol",
"outermostClassSymbol",
"=",
"AS... | finds the symbol for the top-level class containing the given symbol
@param symbol the given symbol
@return symbol for the non-nested enclosing class | [
"finds",
"the",
"symbol",
"for",
"the",
"top",
"-",
"level",
"class",
"containing",
"the",
"given",
"symbol"
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java#L85-L99 |
29,983 | uber/NullAway | nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java | NullabilityUtil.findEnclosingMethodOrLambdaOrInitializer | @Nullable
public static TreePath findEnclosingMethodOrLambdaOrInitializer(TreePath path) {
TreePath curPath = path.getParentPath();
while (curPath != null) {
if (curPath.getLeaf() instanceof MethodTree
|| curPath.getLeaf() instanceof LambdaExpressionTree) {
return curPath;
}
... | java | @Nullable
public static TreePath findEnclosingMethodOrLambdaOrInitializer(TreePath path) {
TreePath curPath = path.getParentPath();
while (curPath != null) {
if (curPath.getLeaf() instanceof MethodTree
|| curPath.getLeaf() instanceof LambdaExpressionTree) {
return curPath;
}
... | [
"@",
"Nullable",
"public",
"static",
"TreePath",
"findEnclosingMethodOrLambdaOrInitializer",
"(",
"TreePath",
"path",
")",
"{",
"TreePath",
"curPath",
"=",
"path",
".",
"getParentPath",
"(",
")",
";",
"while",
"(",
"curPath",
"!=",
"null",
")",
"{",
"if",
"(",... | find the enclosing method, lambda expression or initializer block for the leaf of some tree
path
@param path the tree path
@return the closest enclosing method / lambda | [
"find",
"the",
"enclosing",
"method",
"lambda",
"expression",
"or",
"initializer",
"block",
"for",
"the",
"leaf",
"of",
"some",
"tree",
"path"
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java#L108-L131 |
29,984 | uber/NullAway | nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java | NullabilityUtil.getAllAnnotationsForParameter | public static Stream<? extends AnnotationMirror> getAllAnnotationsForParameter(
Symbol.MethodSymbol symbol, int paramInd) {
Symbol.VarSymbol varSymbol = symbol.getParameters().get(paramInd);
return Stream.concat(
varSymbol.getAnnotationMirrors().stream(),
symbol
.getRawTypeAttr... | java | public static Stream<? extends AnnotationMirror> getAllAnnotationsForParameter(
Symbol.MethodSymbol symbol, int paramInd) {
Symbol.VarSymbol varSymbol = symbol.getParameters().get(paramInd);
return Stream.concat(
varSymbol.getAnnotationMirrors().stream(),
symbol
.getRawTypeAttr... | [
"public",
"static",
"Stream",
"<",
"?",
"extends",
"AnnotationMirror",
">",
"getAllAnnotationsForParameter",
"(",
"Symbol",
".",
"MethodSymbol",
"symbol",
",",
"int",
"paramInd",
")",
"{",
"Symbol",
".",
"VarSymbol",
"varSymbol",
"=",
"symbol",
".",
"getParameters... | Works for method parameters defined either in source or in class files
@param symbol the method symbol
@param paramInd index of the parameter
@return all declaration and type-use annotations for the parameter | [
"Works",
"for",
"method",
"parameters",
"defined",
"either",
"in",
"source",
"or",
"in",
"class",
"files"
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java#L153-L165 |
29,985 | uber/NullAway | jar-infer/jar-infer-cli/src/main/java/com/uber/nullaway/jarinfer/JarInfer.java | JarInfer.main | public static void main(String[] args) throws Exception {
Options options = new Options();
HelpFormatter hf = new HelpFormatter();
hf.setWidth(100);
options.addOption(
Option.builder("i")
.argName("in_path")
.longOpt("input-file")
.hasArg()
.requir... | java | public static void main(String[] args) throws Exception {
Options options = new Options();
HelpFormatter hf = new HelpFormatter();
hf.setWidth(100);
options.addOption(
Option.builder("i")
.argName("in_path")
.longOpt("input-file")
.hasArg()
.requir... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"Options",
"options",
"=",
"new",
"Options",
"(",
")",
";",
"HelpFormatter",
"hf",
"=",
"new",
"HelpFormatter",
"(",
")",
";",
"hf",
".",
"setWidth",
... | This is the main method of the cli tool. It parses the arguments, invokes the analysis driver
and checks that the output file is written.
@param args Command line arguments. | [
"This",
"is",
"the",
"main",
"method",
"of",
"the",
"cli",
"tool",
".",
"It",
"parses",
"the",
"arguments",
"invokes",
"the",
"analysis",
"driver",
"and",
"checks",
"that",
"the",
"output",
"file",
"is",
"written",
"."
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/jar-infer/jar-infer-cli/src/main/java/com/uber/nullaway/jarinfer/JarInfer.java#L36-L98 |
29,986 | uber/NullAway | nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPathNullnessPropagation.java | AccessPathNullnessPropagation.setNonnullIfAnalyzeable | private void setNonnullIfAnalyzeable(Updates updates, Node node) {
AccessPath ap = AccessPath.getAccessPathForNodeWithMapGet(node, types);
if (ap != null) {
updates.set(ap, NONNULL);
}
} | java | private void setNonnullIfAnalyzeable(Updates updates, Node node) {
AccessPath ap = AccessPath.getAccessPathForNodeWithMapGet(node, types);
if (ap != null) {
updates.set(ap, NONNULL);
}
} | [
"private",
"void",
"setNonnullIfAnalyzeable",
"(",
"Updates",
"updates",
",",
"Node",
"node",
")",
"{",
"AccessPath",
"ap",
"=",
"AccessPath",
".",
"getAccessPathForNodeWithMapGet",
"(",
"node",
",",
"types",
")",
";",
"if",
"(",
"ap",
"!=",
"null",
")",
"{"... | If node represents a local, field access, or method call we can track, set it to be non-null in
the updates | [
"If",
"node",
"represents",
"a",
"local",
"field",
"access",
"or",
"method",
"call",
"we",
"can",
"track",
"set",
"it",
"to",
"be",
"non",
"-",
"null",
"in",
"the",
"updates"
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPathNullnessPropagation.java#L635-L640 |
29,987 | uber/NullAway | nullaway/src/main/java/com/uber/nullaway/handlers/Handlers.java | Handlers.buildDefault | public static Handler buildDefault(Config config) {
ImmutableList.Builder<Handler> handlerListBuilder = ImmutableList.builder();
if (config.acknowledgeRestrictiveAnnotations()) {
// This runs before LibraryModelsHandler, so that library models can override third-party
// bytecode annotations
h... | java | public static Handler buildDefault(Config config) {
ImmutableList.Builder<Handler> handlerListBuilder = ImmutableList.builder();
if (config.acknowledgeRestrictiveAnnotations()) {
// This runs before LibraryModelsHandler, so that library models can override third-party
// bytecode annotations
h... | [
"public",
"static",
"Handler",
"buildDefault",
"(",
"Config",
"config",
")",
"{",
"ImmutableList",
".",
"Builder",
"<",
"Handler",
">",
"handlerListBuilder",
"=",
"ImmutableList",
".",
"builder",
"(",
")",
";",
"if",
"(",
"config",
".",
"acknowledgeRestrictiveAn... | Builds the default handler for the checker.
@param config NullAway config
@return A {@code CompositeHandler} including the standard handlers for the nullness checker. | [
"Builds",
"the",
"default",
"handler",
"for",
"the",
"checker",
"."
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/handlers/Handlers.java#L39-L60 |
29,988 | uber/NullAway | compile-bench/src/main/java/com/uber/nullaway/benchmark/NullAwayBenchmarkHarness.java | NullAwayBenchmarkHarness.justRun | private static void justRun(String[] args) {
List<String> javacArgs = new ArrayList<>(Arrays.asList(args));
String nullawayJar = getJarFileForClass(NullAway.class).getFile();
// add NullAway jar to existing processor path if found
boolean foundProcessorPath = false;
for (int i = 0; i < javacArgs.si... | java | private static void justRun(String[] args) {
List<String> javacArgs = new ArrayList<>(Arrays.asList(args));
String nullawayJar = getJarFileForClass(NullAway.class).getFile();
// add NullAway jar to existing processor path if found
boolean foundProcessorPath = false;
for (int i = 0; i < javacArgs.si... | [
"private",
"static",
"void",
"justRun",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"List",
"<",
"String",
">",
"javacArgs",
"=",
"new",
"ArrayList",
"<>",
"(",
"Arrays",
".",
"asList",
"(",
"args",
")",
")",
";",
"String",
"nullawayJar",
"=",
"getJarFi... | Some recommendations for this mode.
<ul>
<li>Disable all other checks but NullAway by passing {@code -XepDisableAllChecks
-Xep:NullAway:WARN} after other EP options
<li>If you want to just benchmark the baseline without NullAway, only pass {@code
-XepDisableAllChecks} (you'll have to do this in a different run)
</ul> | [
"Some",
"recommendations",
"for",
"this",
"mode",
"."
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/compile-bench/src/main/java/com/uber/nullaway/benchmark/NullAwayBenchmarkHarness.java#L38-L59 |
29,989 | uber/NullAway | compile-bench/src/main/java/com/uber/nullaway/benchmark/NullAwayBenchmarkHarness.java | NullAwayBenchmarkHarness.addNullAwayArgsAndRun | private static void addNullAwayArgsAndRun(String[] args) {
String nullawayJar = getJarFileForClass(NullAway.class).getFile();
String annotPackages = args[0];
String[] javacArgs = Arrays.copyOfRange(args, 1, args.length);
// run NullAway first
List<String> nullawayArgs =
Arrays.asList(
... | java | private static void addNullAwayArgsAndRun(String[] args) {
String nullawayJar = getJarFileForClass(NullAway.class).getFile();
String annotPackages = args[0];
String[] javacArgs = Arrays.copyOfRange(args, 1, args.length);
// run NullAway first
List<String> nullawayArgs =
Arrays.asList(
... | [
"private",
"static",
"void",
"addNullAwayArgsAndRun",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"String",
"nullawayJar",
"=",
"getJarFileForClass",
"(",
"NullAway",
".",
"class",
")",
".",
"getFile",
"(",
")",
";",
"String",
"annotPackages",
"=",
"args",
"[... | Here we assume that the javac command has no existing processorpath and no other error prone
flags are being passed. In this case, we assume the annotated packages are passed as the first
argument and the remaining javac args as the rest. We run two configs, one with NullAway added
in a warning-only mode and one with n... | [
"Here",
"we",
"assume",
"that",
"the",
"javac",
"command",
"has",
"no",
"existing",
"processorpath",
"and",
"no",
"other",
"error",
"prone",
"flags",
"are",
"being",
"passed",
".",
"In",
"this",
"case",
"we",
"assume",
"the",
"annotated",
"packages",
"are",
... | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/compile-bench/src/main/java/com/uber/nullaway/benchmark/NullAwayBenchmarkHarness.java#L69-L94 |
29,990 | uber/NullAway | nullaway/src/main/java/com/uber/nullaway/NullAway.java | NullAway.matchMemberReference | @Override
public Description matchMemberReference(MemberReferenceTree tree, VisitorState state) {
if (!matchWithinClass) {
return Description.NO_MATCH;
}
Symbol.MethodSymbol referencedMethod = ASTHelpers.getSymbol(tree);
Symbol.MethodSymbol funcInterfaceSymbol =
NullabilityUtil.getFuncti... | java | @Override
public Description matchMemberReference(MemberReferenceTree tree, VisitorState state) {
if (!matchWithinClass) {
return Description.NO_MATCH;
}
Symbol.MethodSymbol referencedMethod = ASTHelpers.getSymbol(tree);
Symbol.MethodSymbol funcInterfaceSymbol =
NullabilityUtil.getFuncti... | [
"@",
"Override",
"public",
"Description",
"matchMemberReference",
"(",
"MemberReferenceTree",
"tree",
",",
"VisitorState",
"state",
")",
"{",
"if",
"(",
"!",
"matchWithinClass",
")",
"{",
"return",
"Description",
".",
"NO_MATCH",
";",
"}",
"Symbol",
".",
"Method... | for method references, we check that the referenced method correctly overrides the
corresponding functional interface method | [
"for",
"method",
"references",
"we",
"check",
"that",
"the",
"referenced",
"method",
"correctly",
"overrides",
"the",
"corresponding",
"functional",
"interface",
"method"
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/NullAway.java#L692-L702 |
29,991 | uber/NullAway | nullaway/src/main/java/com/uber/nullaway/NullAway.java | NullAway.doUnboxingCheck | private Description doUnboxingCheck(VisitorState state, ExpressionTree... expressions) {
for (ExpressionTree tree : expressions) {
Type type = ASTHelpers.getType(tree);
if (type == null) {
throw new RuntimeException("was not expecting null type");
}
if (!type.isPrimitive()) {
... | java | private Description doUnboxingCheck(VisitorState state, ExpressionTree... expressions) {
for (ExpressionTree tree : expressions) {
Type type = ASTHelpers.getType(tree);
if (type == null) {
throw new RuntimeException("was not expecting null type");
}
if (!type.isPrimitive()) {
... | [
"private",
"Description",
"doUnboxingCheck",
"(",
"VisitorState",
"state",
",",
"ExpressionTree",
"...",
"expressions",
")",
"{",
"for",
"(",
"ExpressionTree",
"tree",
":",
"expressions",
")",
"{",
"Type",
"type",
"=",
"ASTHelpers",
".",
"getType",
"(",
"tree",
... | if any expression has non-primitive type, we should check that it can't be null as it is
getting unboxed
@param expressions expressions to check
@return error Description if an error is found, otherwise NO_MATCH | [
"if",
"any",
"expression",
"has",
"non",
"-",
"primitive",
"type",
"we",
"should",
"check",
"that",
"it",
"can",
"t",
"be",
"null",
"as",
"it",
"is",
"getting",
"unboxed"
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/NullAway.java#L1247-L1263 |
29,992 | uber/NullAway | nullaway/src/main/java/com/uber/nullaway/NullAway.java | NullAway.handleInvocation | private Description handleInvocation(
Tree tree,
VisitorState state,
Symbol.MethodSymbol methodSymbol,
List<? extends ExpressionTree> actualParams) {
ImmutableSet<Integer> nonNullPositions = null;
if (NullabilityUtil.isUnannotated(methodSymbol, config)) {
nonNullPositions =
... | java | private Description handleInvocation(
Tree tree,
VisitorState state,
Symbol.MethodSymbol methodSymbol,
List<? extends ExpressionTree> actualParams) {
ImmutableSet<Integer> nonNullPositions = null;
if (NullabilityUtil.isUnannotated(methodSymbol, config)) {
nonNullPositions =
... | [
"private",
"Description",
"handleInvocation",
"(",
"Tree",
"tree",
",",
"VisitorState",
"state",
",",
"Symbol",
".",
"MethodSymbol",
"methodSymbol",
",",
"List",
"<",
"?",
"extends",
"ExpressionTree",
">",
"actualParams",
")",
"{",
"ImmutableSet",
"<",
"Integer",
... | handle either a method invocation or a 'new' invocation
@param tree the corresponding MethodInvocationTree or NewClassTree
@param state visitor state
@param methodSymbol symbol for invoked method
@param actualParams parameters passed at call
@return description of error or NO_MATCH if no error | [
"handle",
"either",
"a",
"method",
"invocation",
"or",
"a",
"new",
"invocation"
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/NullAway.java#L1274-L1346 |
29,993 | uber/NullAway | nullaway/src/main/java/com/uber/nullaway/NullAway.java | NullAway.stripParensAndCasts | private static ExpressionTree stripParensAndCasts(ExpressionTree expr) {
boolean someChange = true;
while (someChange) {
someChange = false;
if (expr.getKind().equals(PARENTHESIZED)) {
expr = ((ParenthesizedTree) expr).getExpression();
someChange = true;
}
if (expr.getKin... | java | private static ExpressionTree stripParensAndCasts(ExpressionTree expr) {
boolean someChange = true;
while (someChange) {
someChange = false;
if (expr.getKind().equals(PARENTHESIZED)) {
expr = ((ParenthesizedTree) expr).getExpression();
someChange = true;
}
if (expr.getKin... | [
"private",
"static",
"ExpressionTree",
"stripParensAndCasts",
"(",
"ExpressionTree",
"expr",
")",
"{",
"boolean",
"someChange",
"=",
"true",
";",
"while",
"(",
"someChange",
")",
"{",
"someChange",
"=",
"false",
";",
"if",
"(",
"expr",
".",
"getKind",
"(",
"... | strip out enclosing parentheses and type casts.
@param expr
@return | [
"strip",
"out",
"enclosing",
"parentheses",
"and",
"type",
"casts",
"."
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/NullAway.java#L2062-L2076 |
29,994 | uber/NullAway | nullaway/src/main/java/com/uber/nullaway/NullAway.java | NullAway.getClosestOverriddenMethod | @Nullable
private Symbol.MethodSymbol getClosestOverriddenMethod(Symbol.MethodSymbol method, Types types) {
// taken from Error Prone MethodOverrides check
Symbol.ClassSymbol owner = method.enclClass();
for (Type s : types.closure(owner.type)) {
if (types.isSameType(s, owner.type)) {
continu... | java | @Nullable
private Symbol.MethodSymbol getClosestOverriddenMethod(Symbol.MethodSymbol method, Types types) {
// taken from Error Prone MethodOverrides check
Symbol.ClassSymbol owner = method.enclClass();
for (Type s : types.closure(owner.type)) {
if (types.isSameType(s, owner.type)) {
continu... | [
"@",
"Nullable",
"private",
"Symbol",
".",
"MethodSymbol",
"getClosestOverriddenMethod",
"(",
"Symbol",
".",
"MethodSymbol",
"method",
",",
"Types",
"types",
")",
"{",
"// taken from Error Prone MethodOverrides check",
"Symbol",
".",
"ClassSymbol",
"owner",
"=",
"method... | find the closest ancestor method in a superclass or superinterface that method overrides
@param method the subclass method
@param types the types data structure from javac
@return closest overridden ancestor method, or <code>null</code> if method does not override
anything | [
"find",
"the",
"closest",
"ancestor",
"method",
"in",
"a",
"superclass",
"or",
"superinterface",
"that",
"method",
"overrides"
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/NullAway.java#L2099-L2121 |
29,995 | uber/NullAway | nullaway/src/main/java/com/uber/nullaway/NullAway.java | NullAway.getComputedNullness | public Nullness getComputedNullness(ExpressionTree e) {
if (computedNullnessMap.containsKey(e)) {
return computedNullnessMap.get(e);
} else {
return Nullness.NULLABLE;
}
} | java | public Nullness getComputedNullness(ExpressionTree e) {
if (computedNullnessMap.containsKey(e)) {
return computedNullnessMap.get(e);
} else {
return Nullness.NULLABLE;
}
} | [
"public",
"Nullness",
"getComputedNullness",
"(",
"ExpressionTree",
"e",
")",
"{",
"if",
"(",
"computedNullnessMap",
".",
"containsKey",
"(",
"e",
")",
")",
"{",
"return",
"computedNullnessMap",
".",
"get",
"(",
"e",
")",
";",
"}",
"else",
"{",
"return",
"... | Returns the computed nullness information from an expression. If none is available, it returns
Nullable.
<p>Computed information can be added by handlers or by the core, and should supersede that
comming from annotations.
<p>The default value of an expression without additional computed nullness information is
always... | [
"Returns",
"the",
"computed",
"nullness",
"information",
"from",
"an",
"expression",
".",
"If",
"none",
"is",
"available",
"it",
"returns",
"Nullable",
"."
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/NullAway.java#L2137-L2143 |
29,996 | uber/NullAway | jar-infer/jar-infer-lib/src/main/java/com/uber/nullaway/jarinfer/DefinitelyDerefedParamsDriver.java | DefinitelyDerefedParamsDriver.accountCodeBytes | private static void accountCodeBytes(IMethod mtd) {
// Get method bytecode size
if (mtd instanceof ShrikeCTMethod) {
analyzedBytes += ((ShrikeCTMethod) mtd).getBytecodes().length;
}
} | java | private static void accountCodeBytes(IMethod mtd) {
// Get method bytecode size
if (mtd instanceof ShrikeCTMethod) {
analyzedBytes += ((ShrikeCTMethod) mtd).getBytecodes().length;
}
} | [
"private",
"static",
"void",
"accountCodeBytes",
"(",
"IMethod",
"mtd",
")",
"{",
"// Get method bytecode size",
"if",
"(",
"mtd",
"instanceof",
"ShrikeCTMethod",
")",
"{",
"analyzedBytes",
"+=",
"(",
"(",
"ShrikeCTMethod",
")",
"mtd",
")",
".",
"getBytecodes",
... | Accounts the bytecode size of analyzed method for statistics.
@param mtd Analyzed method. | [
"Accounts",
"the",
"bytecode",
"size",
"of",
"analyzed",
"method",
"for",
"statistics",
"."
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/jar-infer/jar-infer-lib/src/main/java/com/uber/nullaway/jarinfer/DefinitelyDerefedParamsDriver.java#L101-L106 |
29,997 | uber/NullAway | jar-infer/jar-infer-lib/src/main/java/com/uber/nullaway/jarinfer/DefinitelyDerefedParamsDriver.java | DefinitelyDerefedParamsDriver.isAllPrimitiveTypes | private static boolean isAllPrimitiveTypes(IMethod mtd) {
if (!mtd.getReturnType().isPrimitiveType()) return false;
for (int i = (mtd.isStatic() ? 0 : 1); i < mtd.getNumberOfParameters(); i++) {
if (!mtd.getParameterType(i).isPrimitiveType()) return false;
}
return true;
} | java | private static boolean isAllPrimitiveTypes(IMethod mtd) {
if (!mtd.getReturnType().isPrimitiveType()) return false;
for (int i = (mtd.isStatic() ? 0 : 1); i < mtd.getNumberOfParameters(); i++) {
if (!mtd.getParameterType(i).isPrimitiveType()) return false;
}
return true;
} | [
"private",
"static",
"boolean",
"isAllPrimitiveTypes",
"(",
"IMethod",
"mtd",
")",
"{",
"if",
"(",
"!",
"mtd",
".",
"getReturnType",
"(",
")",
".",
"isPrimitiveType",
"(",
")",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"(",
"mtd",
".",
... | Checks if all parameters and return value of a method have primitive types.
@param mtd Method.
@return boolean True if all parameters and return value are of primitive type, otherwise false. | [
"Checks",
"if",
"all",
"parameters",
"and",
"return",
"value",
"of",
"a",
"method",
"have",
"primitive",
"types",
"."
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/jar-infer/jar-infer-lib/src/main/java/com/uber/nullaway/jarinfer/DefinitelyDerefedParamsDriver.java#L272-L278 |
29,998 | uber/NullAway | jar-infer/jar-infer-lib/src/main/java/com/uber/nullaway/jarinfer/DefinitelyDerefedParamsDriver.java | DefinitelyDerefedParamsDriver.getInputStream | private static InputStream getInputStream(String libPath) throws IOException {
Preconditions.checkArgument(
(libPath.endsWith(".jar") || libPath.endsWith(".aar")) && Files.exists(Paths.get(libPath)),
"invalid library path! " + libPath);
LOG(VERBOSE, "Info", "opening library: " + libPath + "...")... | java | private static InputStream getInputStream(String libPath) throws IOException {
Preconditions.checkArgument(
(libPath.endsWith(".jar") || libPath.endsWith(".aar")) && Files.exists(Paths.get(libPath)),
"invalid library path! " + libPath);
LOG(VERBOSE, "Info", "opening library: " + libPath + "...")... | [
"private",
"static",
"InputStream",
"getInputStream",
"(",
"String",
"libPath",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"(",
"libPath",
".",
"endsWith",
"(",
"\".jar\"",
")",
"||",
"libPath",
".",
"endsWith",
"(",
"\".aar\"... | Get InputStream of the jar of class files to be analyzed.
@param libPath Path to input jar / aar file to be analyzed.
@return InputStream InputStream for the jar. | [
"Get",
"InputStream",
"of",
"the",
"jar",
"of",
"class",
"files",
"to",
"be",
"analyzed",
"."
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/jar-infer/jar-infer-lib/src/main/java/com/uber/nullaway/jarinfer/DefinitelyDerefedParamsDriver.java#L286-L300 |
29,999 | uber/NullAway | jar-infer/jar-infer-lib/src/main/java/com/uber/nullaway/jarinfer/DefinitelyDerefedParamsDriver.java | DefinitelyDerefedParamsDriver.writeModelJAR | private static void writeModelJAR(String outPath) throws IOException {
Preconditions.checkArgument(
outPath.endsWith(MODEL_JAR_SUFFIX), "invalid model file path! " + outPath);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(outPath));
if (!map_result.isEmpty()) {
ZipEntry entry ... | java | private static void writeModelJAR(String outPath) throws IOException {
Preconditions.checkArgument(
outPath.endsWith(MODEL_JAR_SUFFIX), "invalid model file path! " + outPath);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(outPath));
if (!map_result.isEmpty()) {
ZipEntry entry ... | [
"private",
"static",
"void",
"writeModelJAR",
"(",
"String",
"outPath",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"outPath",
".",
"endsWith",
"(",
"MODEL_JAR_SUFFIX",
")",
",",
"\"invalid model file path! \"",
"+",
"outPath",
")"... | Write model jar file with nullability model at DEFAULT_ASTUBX_LOCATION
@param outPath Path of output model jar file. | [
"Write",
"model",
"jar",
"file",
"with",
"nullability",
"model",
"at",
"DEFAULT_ASTUBX_LOCATION"
] | c3979b4241f80411dbba6aac3ff653acbb88d00b | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/jar-infer/jar-infer-lib/src/main/java/com/uber/nullaway/jarinfer/DefinitelyDerefedParamsDriver.java#L307-L323 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.