Example usage for java.lang Object toString

List of usage examples for java.lang Object toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.jivesoftware.sdk.utils.JiveSDKUtils.java

/**
 * Check if all the items are presented and not empty
 *
 * @param items : Checked items//  w  w  w.  j  a va 2s. com
 * @return :
 * true -> if all the items are presented.
 * false -> if at least one is absent or empty.
 */
public static boolean isAllExist(@Nullable Object... items) {
    if (items == null) {
        return false;
    }

    for (Object item : items) {
        if (item == null || item.toString().isEmpty()) {
            return false;
        }
    }

    return true;
}

From source file:com.jsmartframework.web.manager.AuthEncrypter.java

static String decrypt(HttpServletRequest request, String key, Object value) {
    if (key != null && value != null) {
        try {/*from w ww .  j  av  a 2  s .c o m*/
            byte[] decoded = Base64.decodeBase64(value.toString());
            return new String(getDecryptCipher(request, key).doFinal(decoded), "UTF8");
        } catch (Exception ex) {
            LOGGER.log(Level.INFO, "Failed to decrypt value [" + value + "]: " + ex.getMessage());
        }
        return value.toString();
    }
    return null;
}

From source file:com.cisco.dbds.utils.configfilehandler.ConfigFileHandler.java

/**
 * Sets the systemvariable.//from   www  . j a v  a2 s.  c om
 *
 * @param input the new systemvariable
 */
public static void setSystemvariable(InputStream input) {
    Properties tmp1 = new Properties();
    try {
        tmp1.load(input);

        for (Object element : tmp1.keySet()) {
            System.setProperty(element.toString().trim(), tmp1.getProperty(element.toString().trim()).trim());
        }
    } catch (IOException e) {
        System.out.println("setSystemvariable method failure");
    }
}

From source file:com.mycompany.client.bank.utils.CryptMessage.java

public static List fromInternal(String SuperSecret, Object... criptStrings) {
    paramLst = new ArrayList<>();
    byte[] syperSecretBytes = null;
    try {//  www  .j a va  2 s. c  om
        syperSecretBytes = SuperSecret.getBytes("utf-8");
    } catch (UnsupportedEncodingException ex) {
        Logger.getLogger(CryptMessage.class.getName()).log(Level.SEVERE, null, ex);
    }
    int colvo = 0;
    for (Object str : criptStrings) {
        try {
            if (str != null) {
                byte[] mybyte = str.toString().getBytes("utf-8");
                int i = 0;
                ByteTransform(syperSecretBytes, mybyte, i);
                paramLst.add(colvo++, new String(mybyte, "utf-8"));
            } else {
                paramLst.add(colvo++, null);
            }
        } catch (UnsupportedEncodingException ex) {
            Logger.getLogger(CryptMessage.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    return paramLst;
}

From source file:Main.java

private static BigDecimal getBigDecimal(Object number) {
    BigDecimal num = null;//from  w  w w.j a  va 2 s  .c  o  m
    if (number instanceof BigDecimal) {
        num = (BigDecimal) number;
    } else {
        num = new BigDecimal(number.toString());
    }
    return num;
}

From source file:com.jim.im.login.rpc.LoginRpcServiceImpl.java

/**
 * ?//from  www. ja  va 2  s. com
 * @param params
 * @throws ImParamException
 */
private static void checkParamNull(Object... params) throws ImParamException {
    if (params == null)
        return;

    for (Object param : params) {
        if (param == null || StringUtils.isEmpty(param.toString().trim())) {
            throw new ImParamException("??null");
        }
    }
}

From source file:com.chadekin.jadys.syntax.groupby.impl.GroupByBuilderImpl.java

private static boolean isValidExpression(String param, JadysSqlOperation equality, Object value) {
    return StringUtils.isNotBlank(param) && equality != null && value != null
            && StringUtils.isNotBlank(value.toString());
}

From source file:Main.java

public static Integer asInteger(Object value, int def) {
    if (value instanceof Number) {
        return Integer.valueOf(((Number) value).intValue());
    } else {/*from   w  ww.  ja v a2s. c  o m*/
        try {
            return Integer.valueOf(value.toString());
        } catch (NumberFormatException ex) {
            return Integer.valueOf(def);
        }
    }
}

From source file:com.objy.se.utils.TargetList.java

private static long hash(List<Object> values) {
    String value = "";
    for (Object obj : values) {
        value += obj.toString();
    }//from   w ww.j  a v a2 s  .  c  o  m
    return value.hashCode();
}

From source file:Main.java

/**
 * Convenience method for retrieving the UIDefault for a single property of
 * a particular class./*from w  w  w  .j  ava2  s.c  o m*/
 *
 * @param clazz the class of interest
 * @param property the property to query
 * @return the UIDefault property, or null if not found
 */
public static Object getUIDefaultOfClass(Class clazz, String property) {
    Object retVal = null;
    UIDefaults defaults = getUIDefaultsOfClass(clazz);
    List<Object> listKeys = Collections.list(defaults.keys());
    for (Object key : listKeys) {
        if (key.equals(property)) {
            return defaults.get(key);
        }
        if (key.toString().equalsIgnoreCase(property)) {
            retVal = defaults.get(key);
        }
    }
    return retVal;
}