Set value by known type

@param postcard postcard
@param typeDef  type
@param key      key
@param value    value
180091
private static void setValue(Postcard postcard, Integer typeDef, String key, String value) {
        if (TextUtils.isEmpty(key) || TextUtils.isEmpty(value)) {
            return;
        }

        try {
            if (null != typeDef) {
                if (typeDef == TypeKind.BOOLEAN.ordinal()) {
                    postcard.withBoolean(key, Boolean.parseBoolean(value));
                } else if (typeDef == TypeKind.BYTE.ordinal()) {
                    postcard.withByte(key, Byte.valueOf(value));
                } else if (typeDef == TypeKind.SHORT.ordinal()) {
                    postcard.withShort(key, Short.valueOf(value));
                } else if (typeDef == TypeKind.INT.ordinal()) {
                    postcard.withInt(key, Integer.valueOf(value));
                } else if (typeDef == TypeKind.LONG.ordinal()) {
                    postcard.withLong(key, Long.valueOf(value));
                } else if (typeDef == TypeKind.FLOAT.ordinal()) {
                    postcard.withFloat(key, Float.valueOf(value));
                } else if (typeDef == TypeKind.DOUBLE.ordinal()) {
                    postcard.withDouble(key, Double.valueOf(value));
                } else if (typeDef == TypeKind.STRING.ordinal()) {
                    postcard.withString(key, value);
                } else if (typeDef == TypeKind.PARCELABLE.ordinal()) {
                    // TODO : How to description parcelable value with string?
                } else if (typeDef == TypeKind.OBJECT.ordinal()) {
                    postcard.withString(key, value);
                } else {    // Compatible compiler sdk 1.0.3, in that version, the string type = 18
                    postcard.withString(key, value);
                }
            } else {
                postcard.withString(key, value);
            }
        } catch (Throwable ex) {
            logger.warning(Consts.TAG, "LogisticsCenter setValue failed! " + ex.getMessage());
        }
    }
292241
public static void setLatkeProperty(final String key, final String value) {
        if (null == key) {
            LOGGER.log(Level.WARN, "latke.props can not set null key");

            return;
        }
        if (null == value) {
            LOGGER.log(Level.WARN, "latke.props can not set null value");

            return;
        }

        latkeProps.setProperty(key, value);
    }
752644
public function setValue($value)
    {
        if (!is_string($value) && !is_array($value) && !is_object($value) &&!is_bool($value) &&!is_int($value)) {
            throw new TypeException('$value must be of type string, array or object.');
        }
        $this->value = $value;
    }
106582
@SuppressWarnings("unchecked")
    public void setFormValue(Object value) {

        if (value instanceof List<?>) {
            List<String> keys = (List<String>)value;
            Set<String> keySet = new HashSet<String>(keys);
            int i = 0;
            for (Map.Entry<String, String> entry : m_items.entrySet()) {
                String key = entry.getKey();
                CmsCheckBox checkbox = m_checkboxes.get(i);
                checkbox.setChecked(keySet.contains(key));
                i += 1;
            }
        }
    }
463729
public QueryParameters set(String key, Object value, Integer type) {
        return this.set(key, value, type, Direction.IN);
    }
862357
public void put(final ValueType value, final KeyType... keys) {

        if (ArrayUtils.isEmpty(keys)) {
            return;
        }
        int keysLength = keys.length;
        if (keysLength == 1) {
            put(value, keys[0]);
        } else {
            StorageComponent<KeyType, ValueType> childStorageComponent = getStorageComponent(keys[0]);
            int lastKeyIndex = keysLength - 1;
            for (int i = 1; i < lastKeyIndex; i++) {
                childStorageComponent = childStorageComponent.getStorageComponent(keys[i]);
            }
            childStorageComponent.put(value, keys[lastKeyIndex]);
        }
    }
114597
public Postcard withChar(@Nullable String key, char value) {
        mBundle.putChar(key, value);
        return this;
    }
618520
public function post($key, $type = 'string', $default = null)
    {
        $value = $default;
        if (isset($this->post[$key])) {
            $value = $this->post[$key];
        }
        settype($value, $type);
        return $value;
    }
362540
public Postcard withString(@Nullable String key, @Nullable String value) {
        mBundle.putString(key, value);
        return this;
    }
230730
public Postcard withCharSequence(@Nullable String key, @Nullable CharSequence value) {
        mBundle.putCharSequence(key, value);
        return this;
    }
225373
public <T> void put(@NonNull String key, @NonNull T value) {
    Preconditions.checkNotNull(value, VALUE_IS_NULL);
    put(key, value, TypeToken.fromValue(value));
  }
501763
public void registerCard(String type, Class<? extends Card> cardClz) {
        mDefaultCardResolver.register(type, cardClz);
    }
469415
public Postcard withLong(@Nullable String key, long value) {
        mBundle.putLong(key, value);
        return this;
    }
838956
public Postcard withCharArray(@Nullable String key, @Nullable char[] value) {
        mBundle.putCharArray(key, value);
        return this;
    }
511873
public void setValue(String key, String value) {
        KeyValue kv = getKV(key);
        if (kv != null) {
            kv.setValue(value);
        } else if (key != null) {
            map.add(new KeyValue(key,value));
        }
    }
661128
public function set(string $key, $value, int $type = PDO::PARAM_STR)
    {
        $this->params[$key] = $value;
        $this->param_types[$key] = $type;
        return $this;
    }
1132719
public Postcard withIntegerArrayList(@Nullable String key, @Nullable ArrayList<Integer> value) {
        mBundle.putIntegerArrayList(key, value);
        return this;
    }