Example usage for java.lang CharSequence toString

List of usage examples for java.lang CharSequence toString

Introduction

In this page you can find the example usage for java.lang CharSequence toString.

Prototype

public String toString();

Source Link

Document

Returns a string containing the characters in this sequence in the same order as this sequence.

Usage

From source file:org.yamj.core.database.dao.MetadataDao.java

@SuppressWarnings("unchecked")
public List<QueueDTO> getMetadataQueue(final CharSequence sql, final int maxResults) {
    SQLQuery query = getSession().createSQLQuery(sql.toString());
    query.setReadOnly(true);/*from  w ww.  j  av  a  2  s .  com*/
    query.setCacheable(true);
    if (maxResults > 0) {
        query.setMaxResults(maxResults);
    }

    List<QueueDTO> queueElements = new ArrayList<QueueDTO>();
    List<Object[]> objects = query.list();
    for (Object[] object : objects) {
        QueueDTO queueElement = new QueueDTO();
        queueElement.setId(convertRowElementToLong(object[0]));
        queueElement.setMetadataType(convertRowElementToString(object[1]));
        queueElement.setDate(convertRowElementToDate(object[3]));
        if (queueElement.getDate() == null) {
            queueElement.setDate(convertRowElementToDate(object[2]));
        }
        queueElements.add(queueElement);
    }

    Collections.sort(queueElements, new QueueDTOComparator());
    return queueElements;
}

From source file:com.actionbarsherlock.internal.widget.CapitalizingButton.java

public void setTextCompat(CharSequence text) {
    if (SANS_ICE_CREAM && mAllCaps && text != null) {
        if (IS_GINGERBREAD) {
            setText(text.toString().toUpperCase(Locale.ROOT));
        } else {/*from   w w w .  j  a va2 s.  co m*/
            setText(text.toString().toUpperCase());
        }
    } else {
        setText(text);
    }
}

From source file:modula.executor.core.reporter.SimpleErrorReporter.java

/**
 * ?{@link #onError(String, String, Object)} onError}.
 * ?warning/*www .j  a v a 2s  .com*/
 */
protected void handleErrorMessage(final String errorCode, final String errDetail, final Object errCtx,
        final CharSequence errorMessage) {

    if (log.isWarnEnabled()) {
        log.warn(errorMessage.toString());
    }
}

From source file:ch.unibe.cde.geonet.kernel.security.Md5PasswordEncoder.java

@Override
public String encode(CharSequence cs) {
    try {/*  w ww. jav a 2  s.  c om*/
        MessageDigest md = MessageDigest.getInstance("MD5");
        md.reset();
        md.update(cs.toString().getBytes("UTF-8"));
        return "md5:" + Md5PasswordEncoder.byteToHex(md.digest());
    } catch (UnsupportedEncodingException | NoSuchAlgorithmException ex) {
        Log.error(Log.JEEVES, ex);
    }
    return null;
}

From source file:de.ckatzorke.spring.security.password.encoder.Argon2PasswordEncoder.java

public String encode(final CharSequence rawPassword) {
    //hash returns already the encoded String
    final String hash = ARGON2.hash(ITERATIONS, MEMORY, PARALLELISM, rawPassword.toString());
    return hash;//from   w  w  w.  j a  v a 2  s  . c o  m
}

From source file:org.envirocar.app.json.TrackDecoder.java

public Track fromJson(CharSequence contents) throws JSONException, java.text.ParseException {
    return fromJson(new JSONObject(contents.toString()));
}

From source file:org.apache.drill.exec.ref.rse.JSONDataWriter.java

private String s(CharSequence seq) {
    String s = (seq instanceof String) ? (String) seq : seq.toString();
    return s;/*from www.ja va2 s  .c  o m*/
}

From source file:edu.cens.loci.ui.PlaceViewActivity.java

static String buildActionString(DataKind kind, ContentValues values, boolean lowerCase, Context context) {
    if (kind.actionHeader == null) {
        return null;
    }//  w  w w  . j  a v a2 s.co  m
    CharSequence actionHeader = kind.actionHeader.inflateUsing(context, values);
    if (actionHeader == null) {
        return null;
    }
    return lowerCase ? actionHeader.toString().toLowerCase() : actionHeader.toString();
}

From source file:com.sawyer.advadapters.app.adapters.jsonadapter.MovieJSONAdapter.java

@SuppressWarnings("UnusedDeclaration") //Reflexively called, hence the suppressed warning
private boolean isFilteredOut(JSONObject item, CharSequence constraint) {
    String title = item.optString(MovieItem.JSON_TITLE).toLowerCase(Locale.US);
    return !title.contains(constraint.toString().toLowerCase(Locale.US));
}

From source file:com.frostwire.android.gui.views.SuggestionsAdapter.java

@Override
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
    try {/* ww  w .  j av a 2s .c om*/
        String url = String.format(SUGGESTIONS_URL, URLEncoder.encode(constraint.toString(), "UTF-8"));

        String json = client.get(url, HTTP_QUERY_TIMEOUT);

        if (!discardLastResult) {
            return new SuggestionsCursor(new JSONArray(json).getJSONArray(1));
        }
    } catch (Throwable e) {
        // ignore
    } finally {
        discardLastResult = false;
    }

    return null;
}