private Object _getTypedValue(String value) {
      if (this == Type.BOOLEAN) {
        return GetterUtil.getBoolean(value);
      } else if (this == Type.BYTE) {
        return new java.lang.Byte(value).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;
    }
  public static Serializable getAttributeFromStringArray(int type, String[] attribute) {

    if (ArrayUtil.isEmpty(attribute)) {
      return null;
    }

    if (type == ExpandoColumnConstants.BOOLEAN) {
      return GetterUtil.getBoolean(attribute[0]);
    } else if (type == ExpandoColumnConstants.BOOLEAN_ARRAY) {
      return GetterUtil.getBooleanValues(attribute);
    } else if (type == ExpandoColumnConstants.DATE) {
      return GetterUtil.getDate(attribute[0], _getDateFormat());
    } else if (type == ExpandoColumnConstants.DATE_ARRAY) {
      return GetterUtil.getDateValues(attribute, _getDateFormat());
    } else if (type == ExpandoColumnConstants.DOUBLE) {
      return GetterUtil.getDouble(attribute[0]);
    } else if (type == ExpandoColumnConstants.DOUBLE_ARRAY) {
      return GetterUtil.getDoubleValues(attribute);
    } else if (type == ExpandoColumnConstants.FLOAT) {
      return GetterUtil.getFloat(attribute[0]);
    } else if (type == ExpandoColumnConstants.FLOAT_ARRAY) {
      return GetterUtil.getFloatValues(attribute);
    } else if (type == ExpandoColumnConstants.INTEGER) {
      return GetterUtil.getInteger(attribute[0]);
    } else if (type == ExpandoColumnConstants.INTEGER_ARRAY) {
      return GetterUtil.getIntegerValues(attribute);
    } else if (type == ExpandoColumnConstants.LONG) {
      return GetterUtil.getLong(attribute[0]);
    } else if (type == ExpandoColumnConstants.LONG_ARRAY) {
      return GetterUtil.getLongValues(attribute);
    } else if (type == ExpandoColumnConstants.SHORT) {
      return GetterUtil.getShort(attribute[0]);
    } else if (type == ExpandoColumnConstants.SHORT_ARRAY) {
      return GetterUtil.getShortValues(attribute);
    } else if (type == ExpandoColumnConstants.STRING) {
      return attribute[0];
    } else {
      return attribute;
    }
  }
示例#3
0
 public short getShort(String key) {
   return GetterUtil.getShort(getString(key));
 }
 public static short getShort(ServiceContext serviceContext, String param) {
   return GetterUtil.getShort(serviceContext.getAttribute(param));
 }
 public static short getShort(PortletRequest portletRequest, String param) {
   return GetterUtil.getShort(portletRequest.getParameter(param));
 }
 public static short getShort(HttpServletRequest request, String param) {
   return GetterUtil.getShort(request.getParameter(param));
 }