/** * Returns the String value. If the value is <code>null</code>, the {@link * #DEFAULT_STRING} is returned. * * @param value the value * @return the value */ public static String getString(String value) { return getString(value, DEFAULT_STRING); }
private Object _getTypedValue(String value) { if (this == Type.BOOLEAN) { return GetterUtil.getBoolean(value); } else if (this == Type.BYTE) { Byte byteValue = Byte.valueOf(value); return byteValue.byteValue(); } else if (this == Type.CHARACTER) { return value.charAt(0); } else if (this == Type.DOUBLE) { return GetterUtil.getDouble(value); } else if (this == Type.FLOAT) { return GetterUtil.getFloat(value); } else if (this == Type.INTEGER) { return GetterUtil.getInteger(value); } else if (this == Type.LONG) { return GetterUtil.getLong(value); } else if (this == Type.SHORT) { return GetterUtil.getShort(value); } return value; }
/** * Returns the String array values as a long array. If the values array is * <code>null</code>, the {@link #DEFAULT_LONG_VALUES} array is returned. In * the returned array, each value element not convertible to a long is * replaced by the {@link #DEFAULT_LONG}. * * @param values the values to convert * @return the values as a long array */ public static long[] getLongValues(String[] values) { return getLongValues(values, DEFAULT_LONG_VALUES); }
private boolean _isOverwrite(HttpServletRequest request) { String value = GetterUtil.getString(request.getHeader("Overwrite")); if (StringUtil.equalsIgnoreCase(value, "F") || !GetterUtil.getBoolean(value)) { return false; } return true; }
return GetterUtil.getBoolean(attribute[0]); return GetterUtil.getBooleanValues(attribute); return GetterUtil.getDouble(attribute[0]); return GetterUtil.getDoubleValues(attribute); return GetterUtil.getFloat(attribute[0]); return GetterUtil.getFloatValues(attribute); return GetterUtil.getInteger(attribute[0]); return GetterUtil.getIntegerValues(attribute); return GetterUtil.getLong(attribute[0]); return GetterUtil.getLongValues(attribute); return GetterUtil.getNumber(attribute[0]); return GetterUtil.getNumberValues(attribute); return GetterUtil.getShort(attribute[0]); return GetterUtil.getShortValues(attribute);
/** * Returns the String value as a boolean. If the value is <code>null</code>, * the {@link #DEFAULT_BOOLEAN} is returned. If the value does not match a * {@link #BOOLEANS} value, <code>false</code> is returned. * * @param value the value to convert * @return the value as a boolean */ public static boolean getBoolean(String value) { return getBoolean(value, DEFAULT_BOOLEAN); }
public static long decodeUserId(String portletId) { int x = portletId.indexOf(_USER_SEPARATOR); if (x == -1) { return 0; } int y = portletId.indexOf(_INSTANCE_SEPARATOR); if (y != -1) { return GetterUtil.getLong( portletId.substring(x + _USER_SEPARATOR.length(), y)); } return GetterUtil.getLong( portletId.substring(x + _USER_SEPARATOR.length())); }
/** * Returns the Object value as an integer. If the value is <code>null</code> * or not convertible to an integer, the {@link #DEFAULT_INTEGER} is * returned. * * @param value the value to convert * @return the value as an integer */ public static int getInteger(Object value) { return getInteger(value, DEFAULT_INTEGER); }
protected long[] getGroupIdsFromSearchContext(SearchContext searchContext) { String groupIdAttribute = GetterUtil.getString( searchContext.getAttribute("groupId")); if (Validator.isNull(groupIdAttribute)) { return null; } long groupId = GetterUtil.getLong(groupIdAttribute); if (groupId == 0) { return _GROUP_IDS_FROM_SEARCH_CONTEXT_DEFAULT; } return addScopeGroup(groupId); }
/** * Returns the Object value as a double. If the value is <code>null</code> * or not convertible to a double, the {@link #DEFAULT_DOUBLE} is returned. * * @param value the value to convert * @return the value as a double */ public static double getDouble(Object value) { return getDouble(value, DEFAULT_DOUBLE); }
/** * Returns the Object value as a float. If the value is <code>null</code> or * not convertible to a float, the {@link #DEFAULT_FLOAT} is returned. * * @param value the value to convert * @return the value as a float */ public static float getFloat(Object value) { return getFloat(value, DEFAULT_FLOAT); }
/** * Returns the Object value as a boolean. If the value is <code>null</code>, * the {@link #DEFAULT_BOOLEAN} is returned. If the value does not match a * {@link #BOOLEANS} value, <code>false</code> is returned. * * @param value the value to convert * @return the value as a boolean */ public static boolean getBoolean(Object value) { return getBoolean(value, DEFAULT_BOOLEAN); }
protected long getLayoutGroupId() { String data = (String)get("data"); int pos = data.lastIndexOf(CharPool.AT); if (pos != -1) { data = data.substring(pos + 1); } return GetterUtil.getLong(data); }
public int getHighlightFragmentSize() { return GetterUtil.getInteger( _attributes.get(PropsKeys.INDEX_SEARCH_HIGHLIGHT_FRAGMENT_SIZE), _INDEX_SEARCH_HIGHLIGHT_FRAGMENT_SIZE); }
/** * Returns the String value as a double. If the value is <code>null</code> * or not convertible to a double, the {@link #DEFAULT_DOUBLE} is returned. * * @param value the value to convert * @return the value as a double */ public static double getDouble(String value) { return getDouble(value, DEFAULT_DOUBLE); }
/** * Returns the String value as a float. If the value is <code>null</code> or * not convertible to a float, the {@link #DEFAULT_FLOAT} is returned. * * @param value the value to convert * @return the value as a float */ public static float getFloat(String value) { return getFloat(value, DEFAULT_FLOAT); }
/** * Returns the Object value as a String. If the value is <code>null</code>, * the {@link #DEFAULT_STRING} is returned. * * @param value the value to convert * @return the value as a String */ public static String getString(Object value) { return getString(value, DEFAULT_STRING); }
public boolean isCollatedSpellCheckResultEnabled() { return GetterUtil.getBoolean( _attributes.get( PropsKeys.INDEX_SEARCH_COLLATED_SPELL_CHECK_RESULT_ENABLED), _INDEX_SEARCH_COLLATED_SPELL_CHECK_RESULT_ENABLED); }
public static Date getLastPublishDate( PortletPreferences jxPortletPreferences) { long lastPublishDate = GetterUtil.getLong( jxPortletPreferences.getValue( _LAST_PUBLISH_DATE, StringPool.BLANK)); if (lastPublishDate == 0) { return null; } return new Date(lastPublishDate); }
public int getHighlightSnippetSize() { return GetterUtil.getInteger( _attributes.get(PropsKeys.INDEX_SEARCH_HIGHLIGHT_SNIPPET_SIZE), _INDEX_SEARCH_HIGHLIGHT_SNIPPET_SIZE); }