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:eu.cloudteams.authentication.jwt.SHAPasswordEncoder.java

@Override
public String encode(CharSequence cs) {
    return cs.toString();
}

From source file:com.stephengream.simplecms.authentication.SimpleCmsPasswordEncoder.java

@Override
public String encode(CharSequence cs) {
    String pt = cs.toString();
    try {//from   ww w.  ja v  a2 s .  com
        return PasswordHash.createHash(pt);
    } catch (NoSuchAlgorithmException | InvalidKeySpecException ex) {
        Logger.getLogger(SimpleCmsPasswordEncoder.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}

From source file:com.beto.test.securityinterceptor.security.PasswordEncoder.java

@Override
public boolean matches(CharSequence rawPassword, String encodedPassword) {
    logger.debug(rawPassword.toString() + "==" + encodedPassword);
    return (encodedPassword == null ? encodedPassword == null : encodedPassword.equals(encode(rawPassword)));
}

From source file:eu.cloudteams.authentication.jwt.SHAPasswordEncoder.java

/**
 *
 * @param cs//  w w w . j  av  a  2  s.c o  m
 * @param string
 * @return True if the password is matched otherwise false
 */
@Override
public boolean matches(CharSequence cs, String string) {
    return Util.createAlgorithm(cs.toString(), Util.ALGORITHM.SHA.toString()).equals(string);
}

From source file:HSqlPrimerDesign.java

@SuppressWarnings("Duplicates")
//uses a library compiled from primer3 source code
public static double complementarity(CharSequence primer1, CharSequence primer2, DpalLoad.Dpal INSTANCE) {
    DpalLoad.Dpal.dpal_args args1 = new DpalLoad.Dpal.dpal_args();
    DpalLoad.Dpal.dpal_results out1 = new DpalLoad.Dpal.dpal_results();
    INSTANCE.set_dpal_args(args1);//from   w ww. jav  a 2s. c  o  m
    INSTANCE.dpal(primer1.toString().getBytes(), primer2.toString().getBytes(), args1, out1);
    double o1 = out1.score / 100;
    DpalLoad.Dpal.dpal_args args2 = new DpalLoad.Dpal.dpal_args();
    DpalLoad.Dpal.dpal_results out2 = new DpalLoad.Dpal.dpal_results();
    INSTANCE.set_dpal_args(args2);
    INSTANCE.dpal(primer1.toString().getBytes(),
            new StringBuilder(makeComplement(primer2.toString())).reverse().toString().getBytes(), args2, out2);
    double o2 = out2.score / 100;
    return Math.max(o1, o2);
}

From source file:com.feilong.core.lang.StringUtil.java

/**
 * [?]:? <code>lastString</code>.
 * //from   w ww  . j ava2 s  .c  o m
 * <h3>:</h3>
 * 
 * <blockquote>
 * 
 * <pre class="code">
 * StringUtil.substringWithoutLast(null, "222")                     = ""
 * StringUtil.substringWithoutLast("jinxin.feilong", "ng")          = "jinxin.feilo"
 * StringUtil.substringWithoutLast("jinxin.feilong     ", "     ")  = "jinxin.feilong"
 * </pre>
 * 
 * </blockquote>
 *
 * @param text
 *            the text
 * @param lastString
 *            the last string
 * @return  <code>text</code> null, {@link StringUtils#EMPTY}<br>
 *          <code>lastString</code> null, <code>text.toString()</code><br>
 * @since 1.4.0
 */
public static String substringWithoutLast(final CharSequence text, final String lastString) {
    if (null == text) {
        return EMPTY;
    }
    String textString = text.toString();
    if (null == lastString) {
        return textString;
    }
    return textString.endsWith(lastString) ? substringWithoutLast(textString, lastString.length()) : textString;
}

From source file:com.px100systems.data.browser.controller.Encoder.java

/**
 * MD5 encoding//from   ww  w. j a v a  2s.c  o  m
 * @param rawPassword password
 * @return encoded password
 */
@Override
public String encode(CharSequence rawPassword) {
    return passwordEncoder.encodePassword(rawPassword.toString(), null);
}

From source file:org.cleverbus.common.Strings.java

private static int search(final CharSequence s, String searchString, int pos) {
    if (s == null) {
        return -1;
    }//from   ww w .jav a2 s .  com

    int matchIndex = -1;
    if (s instanceof String) {
        matchIndex = ((String) s).indexOf(searchString, pos);
    } else if (s instanceof StringBuffer) {
        matchIndex = ((StringBuffer) s).indexOf(searchString, pos);
    } else if (s instanceof StringBuilder) {
        matchIndex = ((StringBuilder) s).indexOf(searchString, pos);
    } else {
        matchIndex = s.toString().indexOf(searchString, pos);
    }

    return matchIndex;
}

From source file:com.beto.test.securityinterceptor.security.PasswordEncoder.java

@Override
public String encode(CharSequence rawPassword) {
    logger.debug("RAW PASS :" + rawPassword.length());
    return rawPassword.toString();
}

From source file:com.heliosapm.opentsdb.client.jvmjmx.custom.aggregation.AggregateFunction.java

/**
 * Returns the AggregateFunction for the passed name. Applies trim and toUpper to the name first.
 * @param name The name of the function//from w w w.j a v  a 2  s.  c  o  m
 * @return the named AggregateFunction 
 */
public static AggregateFunction forName(CharSequence name) {
    if (name == null)
        throw new IllegalArgumentException("The passed AggregateFunction name was null", new Throwable());
    try {
        return AggregateFunction.valueOf(name.toString().trim().toUpperCase());
    } catch (Exception e) {
        throw new IllegalArgumentException(
                "The passed AggregateFunction name [" + name + "] is not a valid function name",
                new Throwable());
    }
}