_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q169400 | Content.getCount | validation | public static int getCount(Context context, Uri uri) {
String[] proj = {"COUNT(*)"};
return Cursors.firstInt(context.getContentResolver().query(uri, proj, null, null, null));
} | java | {
"resource": ""
} |
q169401 | Addresses.concatAddressLines | validation | public static String concatAddressLines(Address address, String delimiter) {
StringBuilder s = new StringBuilder(256);
for (int i = 0, max = address.getMaxAddressLineIndex(); i <= max; i++) {
if (i > 0) {
s.append(delimiter);
}
s.append(address.getAddressLine(i));
}
return s.toString();
} | java | {
"resource": ""
} |
q169402 | GoogleApiClients.connect | validation | public static GoogleApiClient connect(GoogleApiClient client, ConnectedListener connected,
OnConnectionFailedListener failed) {
client.registerConnectionCallbacks(new ConnectionListener(connected));
client.registerConnectionFailedListener(failed);
client.connect();
return client;
} | java | {
"resource": ""
} |
q169403 | Fragments.transit | validation | @SuppressLint("CommitTransaction")
private static FragmentTransaction transit(FragmentManager fm, int transit) {
return fm != null ? fm.beginTransaction().setTransition(transit) : null;
} | java | {
"resource": ""
} |
q169404 | MutableForegroundColorSpan.getForegroundColor | validation | @Override
public int getForegroundColor() {
return Color.argb(mAlpha, Color.red(mColor), Color.green(mColor), Color.blue(mColor));
} | java | {
"resource": ""
} |
q169405 | Views.setOnClickListeners | validation | public static void setOnClickListeners(OnClickListener listener, View... views) {
for (View view : views) {
view.setOnClickListener(listener);
}
} | java | {
"resource": ""
} |
q169406 | Log.getLevelName | validation | public static String getLevelName(int level) {
switch (level) {
case VERBOSE:
return "VERBOSE";
case DEBUG:
return "DEBUG";
case INFO:
return "INFO";
case WARN:
return "WARN";
case ERROR:
return "ERROR";
case ASSERT:
return "ASSERT";
default:
return "?";
}
} | java | {
"resource": ""
} |
q169407 | MoreActivityOptions.makeScaleUpAnimation | validation | public static ActivityOptions makeScaleUpAnimation(View source) {
return ActivityOptions.makeScaleUpAnimation(
source, 0, 0, source.getWidth(), source.getHeight());
} | java | {
"resource": ""
} |
q169408 | InputMethods.show | validation | public static void show(View view) {
view.postDelayed(() -> Managers.inputMethod(view.getContext()).showSoftInput(view, 0),
300L); // give InputMethodManager some time to recognise that the View is focused
} | java | {
"resource": ""
} |
q169409 | InputMethods.hide | validation | public static void hide(View view) {
Managers.inputMethod(view.getContext()).hideSoftInputFromWindow(view.getWindowToken(), 0);
} | java | {
"resource": ""
} |
q169410 | Cursors.hasPosition | validation | public static boolean hasPosition(Cursor cursor, int position) {
return !cursor.isClosed() && position >= 0 && position < cursor.getCount();
} | java | {
"resource": ""
} |
q169411 | Cursors.count | validation | public static int count(Cursor cursor, boolean close) {
int count = cursor.getCount();
close(cursor, close);
return count;
} | java | {
"resource": ""
} |
q169412 | Cursors.firstInt | validation | public static int firstInt(Cursor cursor, boolean close) {
int i = cursor.moveToFirst() ? cursor.getInt(0) : Integer.MIN_VALUE;
close(cursor, close);
return i;
} | java | {
"resource": ""
} |
q169413 | Cursors.firstLong | validation | public static long firstLong(Cursor cursor, boolean close) {
long l = cursor.moveToFirst() ? cursor.getLong(0) : Long.MIN_VALUE;
close(cursor, close);
return l;
} | java | {
"resource": ""
} |
q169414 | Cursors.firstString | validation | @Nullable
public static String firstString(Cursor cursor, boolean close) {
String s = cursor.moveToFirst() ? cursor.getString(0) : null;
close(cursor, close);
return s;
} | java | {
"resource": ""
} |
q169415 | Cursors.allInts | validation | public static int[] allInts(Cursor cursor, boolean close) {
int[] i = EMPTY_INT_ARRAY;
if (cursor.moveToFirst()) {
i = new int[cursor.getCount()];
do {
i[cursor.getPosition()] = cursor.getInt(0);
} while (cursor.moveToNext());
}
close(cursor, close);
return i;
} | java | {
"resource": ""
} |
q169416 | Cursors.allLongs | validation | public static long[] allLongs(Cursor cursor, boolean close) {
long[] l = EMPTY_LONG_ARRAY;
if (cursor.moveToFirst()) {
l = new long[cursor.getCount()];
do {
l[cursor.getPosition()] = cursor.getLong(0);
} while (cursor.moveToNext());
}
close(cursor, close);
return l;
} | java | {
"resource": ""
} |
q169417 | Cursors.allStrings | validation | public static String[] allStrings(Cursor cursor, boolean close) {
String[] s = EMPTY_STRING_ARRAY;
if (cursor.moveToFirst()) {
s = new String[cursor.getCount()];
do {
s[cursor.getPosition()] = cursor.getString(0);
} while (cursor.moveToNext());
}
close(cursor, close);
return s;
} | java | {
"resource": ""
} |
q169418 | BindingAdapters.load | validation | @BindingAdapter(value = {"sprockets_placeholder", "sprockets_load", "sprockets_resize",
"sprockets_transform"}, requireAll = false)
public static void load(ImageView view, Drawable placeholder, Uri load, boolean resize,
String transform) {
RequestCreator req = Picasso.with(view.getContext()).load(load).placeholder(placeholder);
if (resize) {
req.fit().centerCrop(); // view width/height isn't available yet
}
if (TextUtils.equals(transform, "circle")) {
req.transform(Transformations.circle());
}
req.into(view);
} | java | {
"resource": ""
} |
q169419 | LayoutManagers.getOrientation | validation | public static int getOrientation(RecyclerView view) {
LayoutManager layout = view.getLayoutManager();
if (layout instanceof LinearLayoutManager) {
return ((LinearLayoutManager) layout).getOrientation();
} else if (layout instanceof StaggeredGridLayoutManager) {
return ((StaggeredGridLayoutManager) layout).getOrientation();
}
return -1;
} | java | {
"resource": ""
} |
q169420 | LayoutManagers.getSpanCount | validation | public static int getSpanCount(RecyclerView view) {
LayoutManager layout = view.getLayoutManager();
if (layout != null) {
if (layout instanceof GridLayoutManager) {
return ((GridLayoutManager) layout).getSpanCount();
} else if (layout instanceof StaggeredGridLayoutManager) {
return ((StaggeredGridLayoutManager) layout).getSpanCount();
}
return 1; // assuming LinearLayoutManager
}
return 0;
} | java | {
"resource": ""
} |
q169421 | Layouts.addRule | validation | public static RelativeLayout.LayoutParams addRule(View view, int verb, int anchor) {
RelativeLayout.LayoutParams params = getParams(view);
params.addRule(verb, anchor);
view.requestLayout();
return params;
} | java | {
"resource": ""
} |
q169422 | ReadCursor.wasRead | validation | public boolean wasRead() {
int pos = getPosition();
if (pos < 0 || pos >= mRead.length) {
return false;
}
boolean read = mRead[pos];
if (!read) {
mRead[pos] = true;
}
return read;
} | java | {
"resource": ""
} |
q169423 | Loopers.mineOrMain | validation | public static Looper mineOrMain() {
Looper looper = Looper.myLooper();
return looper != null ? looper : Looper.getMainLooper();
} | java | {
"resource": ""
} |
q169424 | SparseArrays.values | validation | @SuppressWarnings("unchecked")
public static <E> List<E> values(SparseArray<E> array) {
return (List<E>) values(array, null, null, null, null);
} | java | {
"resource": ""
} |
q169425 | SparseArrays.values | validation | @SuppressWarnings("unchecked")
public static <E> List<E> values(LongSparseArray<E> array) {
return (List<E>) values(null, null, null, null, array);
} | java | {
"resource": ""
} |
q169426 | TranslateImagePageChangeListener.checkAdapter | validation | private void checkAdapter() {
PagerAdapter adapter = mPager.getAdapter();
if (mAdapter != adapter) {
if (mAdapter != null) {
mAdapter.unregisterDataSetObserver(mObserver);
}
mAdapter = adapter;
if (mAdapter != null) {
mAdapter.registerDataSetObserver(mObserver);
}
reset();
}
} | java | {
"resource": ""
} |
q169427 | TranslateImagePageChangeListener.checkDrawable | validation | private void checkDrawable() {
Drawable drawable = mView.getDrawable();
if (mDrawable != drawable) {
/* get the latest View size and ensure that it's been measured */
mViewWidth = mView.getWidth();
mViewHeight = mView.getHeight();
if (mViewWidth > 0 && mViewHeight > 0) {
mDrawable = drawable; // don't save until now so above is repeated until measured
if (mDrawable != null) {
mDrawableWidth = mDrawable.getIntrinsicWidth();
mDrawableHeight = mDrawable.getIntrinsicHeight();
if (mDrawableWidth > 0 && mDrawableHeight > 0) { // e.g. colors don't have size
float widthRatio = (float) mViewWidth / mDrawableWidth;
float heightRatio = (float) mViewHeight / mDrawableHeight;
mScale = widthRatio > heightRatio ? widthRatio : heightRatio;
} else { // nothing to scale, ensure matrix is skipped
mScale = 0.0f;
}
}
} else { // don't update matrix until View is measured
mScale = 0.0f;
}
reset();
}
} | java | {
"resource": ""
} |
q169428 | TranslateImagePageChangeListener.updateMatrix | validation | private void updateMatrix(int position, float offset) {
if (mDrawable != null && mScale > 0.0f) {
if (mPageCount == -1 && mAdapter != null) { // cache page count and translation values
mPageCount = mAdapter.getCount();
if (mPageCount > 1) {
mPageX = (mDrawableWidth * mScale - mViewWidth) / (mPageCount - 1);
mPageY = (mDrawableHeight * mScale - mViewHeight) / (mPageCount - 1);
}
}
mMatrix.setTranslate(-mPageX * position - mPageX * offset,
-mPageY * position - mPageY * offset);
mMatrix.preScale(mScale, mScale);
mView.setScaleType(MATRIX);
mView.setImageMatrix(mMatrix);
}
} | java | {
"resource": ""
} |
q169429 | SQLiteContentProvider.updDel | validation | private int updDel(int op, Uri uri, ContentValues vals, String sel, String[] args) {
/* get the IDs of records that will be affected */
Sql sql = elements(op, uri, new String[]{"rowid"}, sel, args, null);
long[] ids = Cursors.allLongs(sql.mResult);
/* update or delete the records and then notify about any changes */
SQLiteDatabase db = mHelper.getWritableDatabase();
int rows = op == UPDATE ? db.update(sql.table(), vals, sql.sel(), sql.args())
: db.delete(sql.table(), !TextUtils.isEmpty(sql.sel()) ? sql.sel() : "1",
sql.args());
if (rows > 0) {
for (long id : ids) {
notifyChange(ContentUris.withAppendedId(sql.notifyUri(), id), uri);
}
}
return rows;
} | java | {
"resource": ""
} |
q169430 | SQLiteContentProvider.elements | validation | private Sql elements(int op, Uri uri, String[] proj, String sel, String[] args, String order) {
MutableSql sql = translate(uri);
if (sql == null) {
sql = Sql.create();
}
if (sql.table() == null) {
sql.table(uri.getPathSegments().get(0));
}
if (sql.notifyUri() == null && op != SELECT) {
sql.notifyUri(uri.buildUpon().path(sql.table()).clearQuery().fragment(null).build());
}
if (op != INSERT) { // run the query and return the cursor
String from = sql.join() != null ? sql.table() + ' ' + sql.join() : sql.table();
if ((sql.sel() == null || sql.args() == null) && uri.getPathSegments().size() == 2) {
try { // filter on ID if URI in /table/id format
long id = ContentUris.parseId(uri);
if (id > 0) {
if (sql.sel() == null) {
sql.sel("rowid = ?");
}
if (sql.args() == null) {
sql.args(String.valueOf(id));
}
}
} catch (NumberFormatException e) { // last segment not a number
}
}
if (sel != null) { // append caller values
sql.sel(DatabaseUtils.concatenateWhere(sql.sel(), sel));
}
if (args != null) {
sql.args(DatabaseUtils.appendSelectionArgs(sql.args(), args));
}
String groupBy = uri.getQueryParameter(GROUP_BY);
if (groupBy != null) { // prefer caller's value
sql.groupBy(groupBy);
}
String having = uri.getQueryParameter(HAVING);
if (having != null) {
sql.having(having);
}
if (order != null) {
sql.orderBy(order);
}
String limit = uri.getQueryParameter(LIMIT);
if (limit != null) {
sql.limit(limit);
}
sql.mResult = mHelper.getReadableDatabase()
.query(from, proj, sql.sel(), sql.args(), sql.groupBy(), sql.having(),
sql.orderBy(), sql.limit());
}
return sql;
} | java | {
"resource": ""
} |
q169431 | Bitmaps.getByteCount | validation | public static int getByteCount(int width, int height, Config config) {
int bytes = 0;
switch (config) {
case ALPHA_8:
bytes = 1;
break;
case RGB_565:
bytes = 2;
break;
case ARGB_4444:
bytes = 2;
break;
case ARGB_8888:
bytes = 4;
break;
}
return width * height * bytes;
} | java | {
"resource": ""
} |
q169432 | Bitmaps.mutable | validation | @Nullable
public static Bitmap mutable(Bitmap source) {
if (source.isMutable()) {
return source;
}
Config config = source.getConfig();
Bitmap bm = source.copy(config != null ? config : ARGB_8888, true);
if (bm != null) {
source.recycle();
}
return bm;
} | java | {
"resource": ""
} |
q169433 | Intents.hasActivity | validation | public static boolean hasActivity(Context context, Intent intent) {
return context.getPackageManager().resolveActivity(intent, MATCH_DEFAULT_ONLY) != null;
} | java | {
"resource": ""
} |
q169434 | Intents.mailto | validation | public static Intent mailto(List<String> to, List<String> cc, List<String> bcc, String subject,
String body) {
return new Intent(ACTION_SENDTO, Uris.mailto(to, cc, bcc, subject, body));
} | java | {
"resource": ""
} |
q169435 | PanesActivity.setDefaultContentView | validation | public void setDefaultContentView() {
setContentView(R.layout.sprockets_panes, R.id.panes, R.id.pane1, R.id.pane2);
} | java | {
"resource": ""
} |
q169436 | PanesActivity.findFragmentByPane | validation | @Nullable
@SuppressWarnings("unchecked")
public <T extends Fragment> T findFragmentByPane(@IntRange(from = 1, to = 2) int pane) {
String tag = Elements.get(sPanes, pane - 1);
return tag != null ? (T) getFragmentManager().findFragmentByTag(tag) : null;
} | java | {
"resource": ""
} |
q169437 | Bundles.of | validation | public static Bundle of(String key1, int value1, String key2, int value2) {
Bundle b = new Bundle(2);
b.putInt(key1, value1);
b.putInt(key2, value2);
return b;
} | java | {
"resource": ""
} |
q169438 | ContentService.newIntent | validation | public static Intent newIntent(Context context, String action, Uri data, ContentValues values) {
return newIntent(context, action, data, values, null, null);
} | java | {
"resource": ""
} |
q169439 | ContentService.newUpdateIntent | validation | public static Intent newUpdateIntent(Context context, Uri data, ContentValues values,
String selection, String[] selectionArgs) {
return newIntent(context, ACTION_EDIT, data, values, selection, selectionArgs);
} | java | {
"resource": ""
} |
q169440 | ContentService.newDeleteIntent | validation | public static Intent newDeleteIntent(Context context, Uri data) {
return newIntent(context, ACTION_DELETE, data, null, null, null);
} | java | {
"resource": ""
} |
q169441 | ContentService.newDeleteIntent | validation | public static Intent newDeleteIntent(Context context, Uri data, String selection,
String[] selectionArgs) {
return newIntent(context, ACTION_DELETE, data, null, selection, selectionArgs);
} | java | {
"resource": ""
} |
q169442 | Themes.getActionBarSize | validation | public static int getActionBarSize(Context context) {
TypedArray a = context.obtainStyledAttributes(sActionBarSize);
int size = a.getDimensionPixelSize(0, 0);
a.recycle();
return size;
} | java | {
"resource": ""
} |
q169443 | Themes.getActionBarBackground | validation | @Nullable
public static Drawable getActionBarBackground(Context context) {
int[] attrs = {android.R.attr.actionBarStyle};
TypedArray a = context.obtainStyledAttributes(attrs);
int id = a.getResourceId(0, 0);
a.recycle();
if (id > 0) {
attrs[0] = android.R.attr.background;
a = context.obtainStyledAttributes(id, attrs);
Drawable background = a.getDrawable(0);
a.recycle();
return background;
}
return null;
} | java | {
"resource": ""
} |
q169444 | Network.isConnected | validation | public static boolean isConnected(Context context) {
NetworkInfo info = Managers.connectivity(context).getActiveNetworkInfo();
return info != null && info.isConnected();
} | java | {
"resource": ""
} |
q169445 | DiffMatchPatch.diff_cleanupEfficiency | validation | public void diff_cleanupEfficiency(LinkedList<Diff> diffs) {
if (diffs.isEmpty()) {
return;
}
boolean changes = false;
Stack<Diff> equalities = new Stack<Diff>(); // Stack of equalities.
String lastequality = null; // Always equal to equalities.lastElement().text
ListIterator<Diff> pointer = diffs.listIterator();
// Is there an insertion operation before the last equality.
boolean pre_ins = false;
// Is there a deletion operation before the last equality.
boolean pre_del = false;
// Is there an insertion operation after the last equality.
boolean post_ins = false;
// Is there a deletion operation after the last equality.
boolean post_del = false;
Diff thisDiff = pointer.next();
Diff safeDiff = thisDiff; // The last Diff that is known to be unsplitable.
while (thisDiff != null) {
if (thisDiff.operation == Operation.EQUAL) {
// Equality found.
if (thisDiff.text.length() < Diff_EditCost && (post_ins || post_del)) {
// Candidate found.
equalities.push(thisDiff);
pre_ins = post_ins;
pre_del = post_del;
lastequality = thisDiff.text;
} else {
// Not a candidate, and can never become one.
equalities.clear();
lastequality = null;
safeDiff = thisDiff;
}
post_ins = post_del = false;
} else {
// An insertion or deletion.
if (thisDiff.operation == Operation.DELETE) {
post_del = true;
} else {
post_ins = true;
}
/*
* Five types to be split:
* <ins>A</ins><del>B</del>XY<ins>C</ins><del>D</del>
* <ins>A</ins>X<ins>C</ins><del>D</del>
* <ins>A</ins><del>B</del>X<ins>C</ins>
* <ins>A</del>X<ins>C</ins><del>D</del>
* <ins>A</ins><del>B</del>X<del>C</del>
*/
if (lastequality != null
&& ((pre_ins && pre_del && post_ins && post_del)
|| ((lastequality.length() < Diff_EditCost / 2)
&& ((pre_ins ? 1 : 0) + (pre_del ? 1 : 0)
+ (post_ins ? 1 : 0) + (post_del ? 1 : 0)) == 3))) {
//System.out.println("Splitting: '" + lastequality + "'");
// Walk back to offending equality.
while (thisDiff != equalities.lastElement()) {
thisDiff = pointer.previous();
}
pointer.next();
// Replace equality with a delete.
pointer.set(new Diff(Operation.DELETE, lastequality));
// Insert a corresponding an insert.
pointer.add(thisDiff = new Diff(Operation.INSERT, lastequality));
equalities.pop(); // Throw away the equality we just deleted.
lastequality = null;
if (pre_ins && pre_del) {
// No changes made which could affect previous entry, keep going.
post_ins = post_del = true;
equalities.clear();
safeDiff = thisDiff;
} else {
if (!equalities.empty()) {
// Throw away the previous equality (it needs to be reevaluated).
equalities.pop();
}
if (equalities.empty()) {
// There are no previous questionable equalities,
// walk back to the last known safe diff.
thisDiff = safeDiff;
} else {
// There is an equality we can fall back to.
thisDiff = equalities.lastElement();
}
while (thisDiff != pointer.previous()) {
// Intentionally empty loop.
}
post_ins = post_del = false;
}
changes = true;
}
}
thisDiff = pointer.hasNext() ? pointer.next() : null;
}
if (changes) {
diff_cleanupMerge(diffs);
}
} | java | {
"resource": ""
} |
q169446 | DiffMatchPatch.patch_make | validation | public LinkedList<Patch> patch_make(String text1, LinkedList<Diff> diffs) {
if (text1 == null || diffs == null) {
throw new IllegalArgumentException("Null inputs. (patch_make)");
}
LinkedList<Patch> patches = new LinkedList<Patch>();
if (diffs.isEmpty()) {
return patches; // Get rid of the null case.
}
Patch patch = new Patch();
int char_count1 = 0; // Number of characters into the text1 string.
int char_count2 = 0; // Number of characters into the text2 string.
// Start with text1 (prepatch_text) and apply the diffs until we arrive at
// text2 (postpatch_text). We recreate the patches one by one to determine
// context info.
String prepatch_text = text1;
String postpatch_text = text1;
for (Diff aDiff : diffs) {
if (patch.diffs.isEmpty() && aDiff.operation != Operation.EQUAL) {
// A new patch starts here.
patch.start1 = char_count1;
patch.start2 = char_count2;
}
switch (aDiff.operation) {
case INSERT:
patch.diffs.add(aDiff);
patch.length2 += aDiff.text.length();
postpatch_text = postpatch_text.substring(0, char_count2)
+ aDiff.text + postpatch_text.substring(char_count2);
break;
case DELETE:
patch.length1 += aDiff.text.length();
patch.diffs.add(aDiff);
postpatch_text = postpatch_text.substring(0, char_count2)
+ postpatch_text.substring(char_count2 + aDiff.text.length());
break;
case EQUAL:
if (aDiff.text.length() <= 2 * Patch_Margin
&& !patch.diffs.isEmpty() && aDiff != diffs.getLast()) {
// Small equality inside a patch.
patch.diffs.add(aDiff);
patch.length1 += aDiff.text.length();
patch.length2 += aDiff.text.length();
}
if (aDiff.text.length() >= 2 * Patch_Margin) {
// Time for a new patch.
if (!patch.diffs.isEmpty()) {
patch_addContext(patch, prepatch_text);
patches.add(patch);
patch = new Patch();
// Unlike Unidiff, our patch lists have a rolling context.
// http://code.google.com/p/google-diff-match-patch/wiki/Unidiff
// Update prepatch text & pos to reflect the application of the
// just completed patch.
prepatch_text = postpatch_text;
char_count1 = char_count2;
}
}
break;
}
// Update the current character count.
if (aDiff.operation != Operation.INSERT) {
char_count1 += aDiff.text.length();
}
if (aDiff.operation != Operation.DELETE) {
char_count2 += aDiff.text.length();
}
}
// Pick up the leftover patch if not empty.
if (!patch.diffs.isEmpty()) {
patch_addContext(patch, prepatch_text);
patches.add(patch);
}
return patches;
} | java | {
"resource": ""
} |
q169447 | Some.flatMap | validation | @Override
public <R> Option<R> flatMap(ThrowableFunction1<T, Option<R>> function) {
try {
return function.apply(value);
}
catch (Throwable ex) {
throw new BrokenFunctionException("Caught exception while applying function", ex);
}
} | java | {
"resource": ""
} |
q169448 | AbstractTraceeErrorLoggingHandler.convertSoapMessageAsString | validation | String convertSoapMessageAsString(SOAPMessage soapMessage) {
if (soapMessage == null) {
return "null";
}
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
soapMessage.writeTo(os);
return new String(os.toByteArray(), determineMessageEncoding(soapMessage));
} catch (Exception e) {
logger.error("Couldn't create string representation of soapMessage: " + soapMessage.toString());
return "ERROR";
}
} | java | {
"resource": ""
} |
q169449 | TraceeContextLoggerAbstractProcessor.getOrCreateProfileProperties | validation | protected static synchronized FileObjectWrapper getOrCreateProfileProperties(final Filer filer, String fileName) throws IOException {
FileObjectWrapper fileObject = traceeProfileProperties.get(fileName);
if (fileObject == null) {
fileObject = new FileObjectWrapper(filer.createResource(StandardLocation.SOURCE_OUTPUT, "", fileName, null));
traceeProfileProperties.put(fileName, fileObject);
}
return fileObject;
} | java | {
"resource": ""
} |
q169450 | TraceeContextLoggerAbstractMethodAnnotationProcessor.isValidMethod | validation | protected boolean isValidMethod(Element element) {
// must be of type class
if (element.getKind() != ElementKind.METHOD) {
error(element, "Element %s annotated with annotation %s must be a method", element.getSimpleName(),
TraceeContextProviderMethod.class.getSimpleName());
return false;
}
// must be public
if (!element.getModifiers().contains(Modifier.PUBLIC)) {
error(element, "Method %s annotated with annotation %s must be public", element.getSimpleName(),
TraceeContextProviderMethod.class.getSimpleName());
return false;
}
// must not abstract
if (element.getModifiers().contains(Modifier.ABSTRACT)) {
error(element, "Method %s annotated with annotation %s must not be abstract", element.getSimpleName(),
TraceeContextProviderMethod.class.getSimpleName());
return false;
}
// must not be static
if (element.getModifiers().contains(Modifier.STATIC)) {
error(element, "Method %s annotated with annotation %s must not be static", element.getSimpleName(),
TraceeContextProviderMethod.class.getSimpleName());
return false;
}
return true;
} | java | {
"resource": ""
} |
q169451 | TraceeContextLoggerAbstractMethodAnnotationProcessor.isGetterMethod | validation | protected boolean isGetterMethod(ExecutableElement executableElement) {
// must have a return value
TypeMirror returnTypeMirror = executableElement.getReturnType();
if (returnTypeMirror.getKind().equals(TypeKind.VOID)) {
error(executableElement, "method %s must have a non void return type", executableElement.getSimpleName().toString());
return false;
}
// check if method takes no parameters
List parameters = executableElement.getParameters();
if (parameters != null && parameters.size() > 0) {
error(executableElement, "method %s must have no parameters ", executableElement.getSimpleName().toString());
return false;
}
return true;
} | java | {
"resource": ""
} |
q169452 | ProfileSettings.getPropertyValue | validation | public Boolean getPropertyValue(final String propertyKey) {
if (propertyKey == null) {
return null;
}
// check system property override
if (toTraceeContextStringRepresentationBuilder != null && toTraceeContextStringRepresentationBuilder.getManualContextOverrides() != null) {
Boolean manualOverrideCheck = toTraceeContextStringRepresentationBuilder.getManualContextOverrides().get(propertyKey);
if (manualOverrideCheck != null) {
return manualOverrideCheck;
}
}
// check profile properties
if (profileProperties != null) {
String value = profileProperties.getProperty(propertyKey);
if (value != null) {
return Boolean.valueOf(value);
}
}
return null;
} | java | {
"resource": ""
} |
q169453 | TraceeContextLoggerAbstractTypeAnnotationProcessor.checkIfClassHasNoargsConstructor | validation | protected boolean checkIfClassHasNoargsConstructor(TypeElement typeElement) {
// check if annotated class has noargs constructor
boolean foundConstructor = false;
boolean foundNoargsConstructor = false;
for (Element child : typeElement.getEnclosedElements()) {
if (ElementKind.CONSTRUCTOR.equals(child.getKind())) {
foundConstructor = true;
ExecutableElement constructor = (ExecutableElement) child;
if (constructor.getParameters().size() == 0) {
foundNoargsConstructor = true;
break;
}
}
}
return !(foundConstructor && !foundNoargsConstructor);
} | java | {
"resource": ""
} |
q169454 | TraceeContextLogAnnotationUtilities.getAnnotationFromType | validation | public static <T extends Annotation> T getAnnotationFromType(final Object instance, Class<T> annotation) {
if (instance == null || annotation == null) {
return null;
}
return instance.getClass().getAnnotation(annotation);
} | java | {
"resource": ""
} |
q169455 | TraceeContextLogAnnotationUtilities.checkMethodHasNonVoidReturnType | validation | public static boolean checkMethodHasNonVoidReturnType(final Method method) {
if (method == null) {
return false;
}
try {
return !(Void.TYPE == method.getReturnType());
} catch (Exception e) {
return false;
}
} | java | {
"resource": ""
} |
q169456 | TypeProviderFunction.apply | validation | public boolean apply(final StringBuilder stringBuilder, final OutputStyle outputStyle, final OutputElement outputElement) {
boolean result = false;
if (outputElement != null) {
if (OutputElementType.COLLECTION.equals(outputElement.getOutputElementType())) {
result = handleCollectionType(stringBuilder, outputStyle, outputElement);
} else if (OutputElementType.COMPLEX.equals(outputElement.getOutputElementType())) {
if (TraceeContextLogAnnotationUtilities.getAnnotationFromType(outputElement.getEncapsulatedInstance()) != null) {
result = handleTraceeContextprovider(stringBuilder, outputStyle, outputElement);
} else {
result = handleComplexType(stringBuilder, outputStyle, outputElement);
}
}
}
return result;
} | java | {
"resource": ""
} |
q169457 | TypeToWrapper.findWrapperClasses | validation | public static Set<Class> findWrapperClasses() {
final List<TypeToWrapper> localTypeToWrapperList = getTypeToWrapper();
Set<Class> resultList = new HashSet<Class>();
if (localTypeToWrapperList != null) {
for (TypeToWrapper typeToWrapper : localTypeToWrapperList) {
resultList.add(typeToWrapper.getWrapperType());
}
}
return resultList;
} | java | {
"resource": ""
} |
q169458 | TypeToWrapper.getImplicitContextDataProviders | validation | public static Set<ImplicitContextData> getImplicitContextDataProviders() {
final Set<ImplicitContextData> result = new HashSet<ImplicitContextData>();
for (Class clazz : ContextProviderServiceLoader.getServiceLocator().getImplicitContextProvider()) {
try {
if (ImplicitContextData.class.isAssignableFrom(clazz)) {
ImplicitContextData instance = (ImplicitContextData)(clazz.newInstance());
result.add(instance);
}
}
catch (Throwable e) {
// to be ignored
}
}
return result;
} | java | {
"resource": ""
} |
q169459 | TypeToWrapper.getAvailableWrappers | validation | public static List<TypeToWrapper> getAvailableWrappers() {
final List<TypeToWrapper> result = new ArrayList<TypeToWrapper>();
for (Class clazz : ContextProviderServiceLoader.getServiceLocator().getContextProvider()) {
try {
if (WrappedContextData.class.isAssignableFrom(clazz)) {
// try to create instance to get the wrapped type
final WrappedContextData instance = (WrappedContextData)clazz.newInstance();
result.add(new TypeToWrapper(instance.getWrappedType(), clazz));
}
}
catch (Throwable e) {
// to be ignored
}
}
return result;
} | java | {
"resource": ""
} |
q169460 | ConnectorFactory.initConnectors | validation | private void initConnectors() {
// first get all connector configuration Names
Set<String> connectorConfigurationNames = this.getConnectorConfigurationNames();
for (String connectorConfigurationName : connectorConfigurationNames) {
Connector connector = this.createConnector(connectorConfigurationName);
if (connector != null) {
this.connectorMap.put(connectorConfigurationName, connector);
}
}
// Add mandatory logger
if (!isConnectorConfigured(LogConnector.class)) {
Connector logConnector = new LogConnector();
this.connectorMap.put("LOGGER", logConnector);
}
} | java | {
"resource": ""
} |
q169461 | ConnectorFactory.sendErrorReportToConnectors | validation | final void sendErrorReportToConnectors(ConnectorOutputProvider connectorOutputProvider) {
for (Connector connector : this.connectorMap.values()) {
connector.sendErrorReport(connectorOutputProvider);
}
} | java | {
"resource": ""
} |
q169462 | ConnectorFactory.getConnectorConfigurationNames | validation | final Set<String> getConnectorConfigurationNames() {
Set<String> connectorNames = new HashSet<String>();
Enumeration<Object> keyEnumeration = getSystemProperties().keys();
while (keyEnumeration.hasMoreElements()) {
String key = keyEnumeration.nextElement().toString();
// check if property key has tracee connector format
Matcher matcher = KEY_MATCHER_PATTERN.matcher(key);
if (matcher.matches() && matcher.groupCount() > 0) {
connectorNames.add(matcher.group(1));
}
}
return connectorNames;
} | java | {
"resource": ""
} |
q169463 | ConnectorFactory.getPropertiesForConnectorConfigurationName | validation | final Map<String, String> getPropertiesForConnectorConfigurationName(final String connectorName) {
final Map<String, String> propertyMap = new HashMap<String, String>();
final String patternString = String.format(CONNECTOR_PROPERTY_GRABBER_PATTERN, connectorName);
final Pattern propertyGrabPattern = Pattern.compile(patternString);
final Set<Map.Entry<Object, Object>> entries = getSystemProperties().entrySet();
for (Map.Entry<Object, Object> entry : entries) {
final String key = entry.getKey().toString();
final Object value = entry.getValue();
// check if property key has tracee connector format
final Matcher matcher = propertyGrabPattern.matcher(key);
if (value != null && matcher.matches() && matcher.groupCount() > 0) {
final String propertyName = matcher.group(1);
propertyMap.put(propertyName, value.toString());
}
}
return propertyMap;
} | java | {
"resource": ""
} |
q169464 | ConnectorFactory.createConnector | validation | final Connector createConnector(final String connectorConfigurationName) {
Map<String, String> propertyMap = this.getPropertiesForConnectorConfigurationName(connectorConfigurationName);
String type = propertyMap.get(TraceeContextLoggerConstants.SYSTEM_PROPERTY_CONTEXT_LOGGER_CONNECTOR_TYPE);
// get canonical class name for well known connectors
if (WELL_KNOW_CONNECTOR_MAPPINGS.containsKey(type)) {
type = WELL_KNOW_CONNECTOR_MAPPINGS.get(type);
}
try {
// try to create connector instance
Connector connector = (Connector)Class.forName(type).newInstance();
// now try to call init method
connector.init(propertyMap);
return connector;
}
catch (Exception e) {
LOGGER.error("An error occurred while creating connector with name '" + connectorConfigurationName + "' of type '" + type + "'", e);
}
return null;
} | java | {
"resource": ""
} |
q169465 | ConnectorFactory.isConnectorConfigured | validation | private boolean isConnectorConfigured(Class connectorClass) {
for (Connector connector : this.connectorMap.values()) {
if (connectorClass.isInstance(connector)) {
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q169466 | IsGetterMethodPredicate.hasGetterPrefixInMethodName | validation | boolean hasGetterPrefixInMethodName(Method method) {
String methodName = method.getName();
if (methodName != null) {
for (String prefix : GETTER_PREFIXES) {
if (methodName.startsWith(prefix)) {
return true;
}
}
}
return false;
} | java | {
"resource": ""
} |
q169467 | IsGetterMethodPredicate.isPublicNonStaticMethod | validation | boolean isPublicNonStaticMethod(final Method method) {
int modifiers = method.getModifiers();
return !Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers);
} | java | {
"resource": ""
} |
q169468 | IsGetterMethodPredicate.hasCompatibleReturnTypes | validation | boolean hasCompatibleReturnTypes(Class type, Method method) {
Field correspondingField = getCorrespondingField(type, method);
return correspondingField != null && method.getReturnType().isAssignableFrom(correspondingField.getType());
} | java | {
"resource": ""
} |
q169469 | IsGetterMethodPredicate.getCorrespondingField | validation | Field getCorrespondingField(Class type, Method method) {
try {
return type.getDeclaredField(GetterUtilities.getFieldName(method));
}
catch (NoSuchFieldException e) {
return null;
}
} | java | {
"resource": ""
} |
q169470 | GetterUtilities.isGetterMethod | validation | public static boolean isGetterMethod(final String methodName) {
if (methodName != null) {
for (String prefix : GETTER_PREFIXES) {
if (methodName.startsWith(prefix)) {
return true;
}
}
}
return false;
} | java | {
"resource": ""
} |
q169471 | GetterUtilities.capitalizeFirstCharOfString | validation | static String capitalizeFirstCharOfString(final String input) {
if (input == null || input.length() == 0) {
return "";
}
else if (input.length() == 1) {
return input.toUpperCase();
}
else {
return input.substring(0, 1).toUpperCase() + input.substring(1);
}
} | java | {
"resource": ""
} |
q169472 | GetterUtilities.decapitalizeFirstCharOfString | validation | static String decapitalizeFirstCharOfString(final String input) {
if (input == null || input.length() == 0) {
return "";
}
else if (input.length() == 1) {
return input.toLowerCase();
}
else {
return input.substring(0, 1).toLowerCase() + input.substring(1);
}
} | java | {
"resource": ""
} |
q169473 | GetterUtilities.stripGetterPrefix | validation | static String stripGetterPrefix(final String input) {
if (input != null) {
for (String prefix : GETTER_PREFIXES) {
if (input.startsWith(prefix)) {
return input.substring(prefix.length());
}
}
}
return input;
} | java | {
"resource": ""
} |
q169474 | WatchdogAspect.sendErrorReportToConnectors | validation | void sendErrorReportToConnectors(ProceedingJoinPoint proceedingJoinPoint, String annotatedId, Throwable e) {
// try to get error message annotation
ErrorMessage errorMessage = WatchdogUtils.getErrorMessageAnnotation(proceedingJoinPoint);
if (errorMessage == null) {
TraceeContextLogger
.create()
.enforceOrder()
.apply()
.logWithPrefixedMessage(MessagePrefixProvider.provideLogMessagePrefix(MessageLogLevel.ERROR, Watchdog.class), CoreImplicitContextProviders.COMMON,
CoreImplicitContextProviders.TRACEE, WatchdogDataWrapper.wrap(annotatedId, proceedingJoinPoint), e);
} else {
TraceeContextLogger
.create()
.enforceOrder()
.apply()
.logWithPrefixedMessage(MessagePrefixProvider.provideLogMessagePrefix(MessageLogLevel.ERROR, Watchdog.class),
TraceeMessage.wrap(errorMessage.value()), CoreImplicitContextProviders.COMMON, CoreImplicitContextProviders.TRACEE,
WatchdogDataWrapper.wrap(annotatedId, proceedingJoinPoint), e);
}
} | java | {
"resource": ""
} |
q169475 | TraceeContextProviderWrapperFunction.apply | validation | public Object apply(ContextLoggerConfiguration contextLoggerConfiguration, Object instanceToWrap) {
// check for implicit context
if (IsImplicitContextEnumValuePredicate.getInstance().apply(instanceToWrap)) {
return createInstance((Class) contextLoggerConfiguration.getImplicitContextProviderClass((ImplicitContext) instanceToWrap));
}
// now try to find instance type in known wrapper types map
Class matchingWrapperType = contextLoggerConfiguration.getContextProviderClass(instanceToWrap.getClass());
if (matchingWrapperType == null) {
// now try to find instance type in TypeToWrapper List
for (TypeToWrapper wrapper : contextLoggerConfiguration.getWrapperList()) {
if (wrapper.getWrappedInstanceType().isAssignableFrom(instanceToWrap.getClass())) {
matchingWrapperType = wrapper.getWrapperType();
break;
}
}
}
if (matchingWrapperType != null) {
// now create wrapper instance
try {
WrappedContextData wrapperInstance = (WrappedContextData) createInstance(matchingWrapperType);
wrapperInstance.setContextData(instanceToWrap);
return wrapperInstance;
} catch (Exception e) {
// continue
}
}
return instanceToWrap;
} | java | {
"resource": ""
} |
q169476 | TraceeContextProviderWrapperFunction.createInstance | validation | protected Object createInstance(final Class type) {
if (type != null) {
try {
return type.newInstance();
} catch (Exception e) {
// should not occur
}
}
return null;
} | java | {
"resource": ""
} |
q169477 | ProfileLookup.getCurrentProfile | validation | public static Profile getCurrentProfile() {
// First get profile from system properties
Profile profile = getProfileFromSystemProperties();
// check if profile has been found otherwise try getting profile from file in classpath
if (profile == null) {
profile = getProfileFromFileInClasspath(ProfilePropertyNames.PROFILE_SET_BY_FILE_IN_CLASSPATH_FILENAME);
}
// use DEFAULT profile, if profile has not been found
if (profile == null) {
profile = ProfilePropertyNames.DEFAULT_PROFILE;
}
return profile;
} | java | {
"resource": ""
} |
q169478 | ProfileLookup.openProperties | validation | public static Properties openProperties(final String propertyFileName) throws IOException {
if (propertyFileName == null) {
return null;
}
InputStream inputStream = null;
try {
inputStream = Profile.class.getResourceAsStream(propertyFileName);
if (inputStream != null) {
// file could be opened
Properties properties = new Properties();
properties.load(inputStream);
return properties;
} else {
// file doesn't exist
return null;
}
} finally {
if (inputStream != null) {
inputStream.close();
}
}
} | java | {
"resource": ""
} |
q169479 | ConfigBuilderImpl.fillManualContextOverrideMap | validation | private void fillManualContextOverrideMap(final String[] contexts, final boolean value) {
if (contexts != null) {
for (String context : contexts) {
if (!context.isEmpty()) {
this.manualContextOverrides.put(context, value);
}
}
}
} | java | {
"resource": ""
} |
q169480 | ConfigBuilderImpl.createContextStringRepresentationLogBuilder | validation | private TraceeContextStringRepresentationBuilderImpl createContextStringRepresentationLogBuilder() {
TraceeContextStringRepresentationBuilderImpl traceeContextStringRepresentationBuilderImpl = new TraceeContextStringRepresentationBuilderImpl();
traceeContextStringRepresentationBuilderImpl.setManualContextOverrides(this.getManualContextOverrides());
traceeContextStringRepresentationBuilderImpl.setProfile(this.getProfile());
traceeContextStringRepresentationBuilderImpl.setEnforceOrder(this.getEnforceOrder());
traceeContextStringRepresentationBuilderImpl.setOutputWriterConfiguration(this.getOutputWriterConfiguration());
return traceeContextStringRepresentationBuilderImpl;
} | java | {
"resource": ""
} |
q169481 | WatchdogUtils.checkIfMethodThrowsContainsPassedException | validation | public static boolean checkIfMethodThrowsContainsPassedException(final ProceedingJoinPoint proceedingJoinPoint, Throwable thrownException) {
if (proceedingJoinPoint == null || thrownException == null) {
return false;
}
Class[] throwsClassesFromMethodSignature = getDefinedThrowsFromMethodSignature(proceedingJoinPoint);
return checkClassIsDefinedInThrowsException(throwsClassesFromMethodSignature, thrownException);
} | java | {
"resource": ""
} |
q169482 | WatchdogUtils.checkClassIsDefinedInThrowsException | validation | public static boolean checkClassIsDefinedInThrowsException(Class[] classes, Throwable thrownException) {
// return false if either passed classes array or thrownException are null.
if (classes == null || thrownException == null) {
return false;
}
// loop through classes array to check for matching type
for (Class clazz : classes) {
if (clazz.isInstance(thrownException)) {
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q169483 | WatchdogUtils.getDefinedThrowsFromMethodSignature | validation | public static Class[] getDefinedThrowsFromMethodSignature(final ProceedingJoinPoint proceedingJoinPoint) {
if (proceedingJoinPoint == null) {
return new Class[0];
}
// get watchdog annotation from method
MethodSignature methodSignature = (MethodSignature)proceedingJoinPoint.getSignature();
return methodSignature.getMethod().getExceptionTypes();
} | java | {
"resource": ""
} |
q169484 | WatchdogUtils.checkProcessWatchdog | validation | public static boolean checkProcessWatchdog(final Watchdog watchdogAnnotation, final ProceedingJoinPoint proceedingJoinPoint, final Throwable throwable) {
// check if watchdog aspect processing is deactivated by annotation
if (watchdogAnnotation != null && watchdogAnnotation.isActive()) {
// checks if throws annotations must be suppressed
boolean throwableIsPartOfThrowsDeclaration = WatchdogUtils.checkIfMethodThrowsContainsPassedException(proceedingJoinPoint, throwable);
if (!watchdogAnnotation.suppressThrowsExceptions() || (watchdogAnnotation.suppressThrowsExceptions() && !throwableIsPartOfThrowsDeclaration)) {
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q169485 | GroupAssert.hasSize | validation | public final @NotNull S hasSize(int expected) {
isNotNull();
int size = actualGroupSize();
if (size == expected) {
return myself();
}
failIfCustomMessageIsSet();
throw failure(format("expected size:<%s> but was:<%s> for <%s>", expected, size, actual));
} | java | {
"resource": ""
} |
q169486 | ItemGroupAssert.assertDoesNotHaveDuplicates | validation | protected final void assertDoesNotHaveDuplicates() {
isNotNull();
Collection<?> duplicates = duplicatesFrom(actualAsList());
if (duplicates.isEmpty()) {
return;
}
failIfCustomMessageIsSet();
throw failure(format("<%s> contains duplicate(s):<%s>", actual, duplicates));
} | java | {
"resource": ""
} |
q169487 | ViewHoldingListAdapter.getDropDownView | validation | public View getDropDownView(int index, View convertView, ViewGroup parent) {
return dropDownViewFactory.getView(convertView, itemList.get(index));
} | java | {
"resource": ""
} |
q169488 | AbstractImmutableVocabulary.reserveTermName | validation | protected final int reserveTermName(String name) {
checkStatus(Status.INITIALIZING);
checkInitializationPrecondition(TermUtils.isValidTermName(name), "Object '%s' is not a valid term name",name);
checkInitializationPrecondition(!this.nameOrdinal.containsKey(name),"Term '%s' has been already reserved",name);
this.nameOrdinal.put(name, ++this.ordinal);
return this.ordinal;
} | java | {
"resource": ""
} |
q169489 | AbstractImmutableVocabulary.registerTerm | validation | protected final <S extends ImmutableTerm> void registerTerm(S term) {
checkStatus(Status.INITIALIZING);
checkInitializationPrecondition(this.nameOrdinal.containsKey(term.name()),"Term '%s' has not been reserved",term.name());
checkInitializationPrecondition(term.ordinal()>=0 && term.ordinal()<=this.ordinal,"Invalid ordinal '%d' for reserved name '%s'",term.ordinal(),term.name());
this.terms.put(term.ordinal(),this.termClass.cast(term));
} | java | {
"resource": ""
} |
q169490 | AbstractImmutableVocabulary.initialize | validation | protected final void initialize() {
checkStatus(Status.INITIALIZING);
if(this.terms.size()!=this.nameOrdinal.size()) {
throw new IllegalStateException(
String.format(
"Vocabulary '%s' (%s) initialization failure: not all reserved names have been registered",
this.namespace,
getClass().getName()));
}
this.status=Status.INITIALIZED;
} | java | {
"resource": ""
} |
q169491 | BadDataResourceHandler.getRepresentation | validation | public DataSet getRepresentation() {
return
DataDSL.
dataSet().
individual(newReference().toLocalIndividual().named("anonymous")).
hasLink(KNOWS).
referringTo(newReference().toManagedIndividual("unknownTemplate1").named("r1")).
individual(newReference().toLocalIndividual().named("anonymous")).
hasProperty(CREATED_ON).
withValue(new Date()).
hasLink(KNOWS).
referringTo(newReference().toManagedIndividual("unknownTemplate2").named("r1")).
individual(newReference().toManagedIndividual("unknownTemplate2").named("r1")).
hasProperty(CREATION_DATE).
withValue(new Date()).
hasProperty(AGE).
withValue(34).
hasLink(HAS_FATHER).
toIndividual(newReference().toLocalIndividual().named("Michel")).
hasLink(HAS_WIFE).
referringTo(newReference().toLocalIndividual().named("Consuelo")).
build();
} | java | {
"resource": ""
} |
q169492 | URIUtils.relativeResolution | validation | private static URIRef relativeResolution(URI target, URI base) {
URIRef Base=URIRef.create(base); // NOSONAR
URIRef R=URIRef.create(target); // NOSONAR
URIRef T=URIRef.create(); // NOSONAR
if(defined(R.scheme)) {
T.scheme = R.scheme;
T.authority = R.authority;
T.path = removeDotSegments(R.path);
T.query = R.query;
} else {
if(defined(R.authority)) {
T.authority = R.authority;
T.path = removeDotSegments(R.path);
T.query = R.query;
} else {
resolvePathOnlyTarget(Base, R, T);
}
T.scheme = Base.scheme;
}
T.fragment = R.fragment;
return T;
} | java | {
"resource": ""
} |
q169493 | URIUtils.merge | validation | private static String merge(String path, String relativePath, boolean hasAuthority) {
String parent=path;
if(hasAuthority && parent.isEmpty()) {
parent=SLASH;
}
return parent.substring(0,parent.lastIndexOf('/')+1).concat(relativePath);
} | java | {
"resource": ""
} |
q169494 | URIUtils.removeDotSegments | validation | private static String removeDotSegments(String path) {
Deque<String> outputBuffer=new LinkedList<String>();
String input=path==null?EMPTY:path;
while(!input.isEmpty()) {
input=processInput(outputBuffer, input);
}
return assembleInOrder(outputBuffer);
} | java | {
"resource": ""
} |
q169495 | NamingScheme.name | validation | public Name<String> name(String name, String... names) {
return createName(assemble(name, names));
} | java | {
"resource": ""
} |
q169496 | NamingScheme.name | validation | public Name<String> name(Class<?> clazz, String... names) {
return name(clazz.getCanonicalName(), names);
} | java | {
"resource": ""
} |
q169497 | MediaTypes.wildcard | validation | public static MediaType wildcard(String type) {
requireNonNull(type,TYPE_CANNOT_BE_NULL);
return new ImmutableMediaType(MediaTypes.preferredSyntax(),type,WILDCARD_TYPE,null,null);
} | java | {
"resource": ""
} |
q169498 | MediaTypes.wildcard | validation | public static MediaType wildcard(String type, String suffix) {
requireNonNull(type,TYPE_CANNOT_BE_NULL);
requireNonNull(suffix,"Suffix cannot be null");
return new ImmutableMediaType(MediaTypes.preferredSyntax(),type,WILDCARD_TYPE,suffix,null);
} | java | {
"resource": ""
} |
q169499 | MediaTypes.of | validation | public static MediaType of(String type, String subtype) {
requireNonNull(type,TYPE_CANNOT_BE_NULL);
requireNonNull(subtype,"Subtype cannot be null");
return fromString(type+"/"+subtype);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.