/*
(non-Javadoc)

@see
com.impetus.kundera.property.PropertyAccessor#fromString(java.lang.String
)
962280
@Override
    public Object fromString(Class targetClass, String s)
    {
        try
        {
            if (s == null)
            {
                return null;
            }
            Object o = (Object) s;
            return o;
        }
        catch (NumberFormatException e)
        {
            log.error("Number format exception, Caused by {}.", e);
            throw new PropertyAccessException(e);
        }
    }
1344736
public final IJSONSerializable<?> fromString(final String string) throws Exception, ValidationException
    {
        final ValidationContext ctx = new ValidationContext();

        ctx.setValidate(true);

        ctx.setStopOnError(true);

        final IJSONSerializable<?> result = fromString(string, ctx);

        if (ctx.getErrorCount() > 0)
        {
            throw new ValidationException(ctx);
        }
        if (null == result)
        {
            throw new Exception("Unknown reason for NULL result in JSONParser");
        }
        return result;
    }
1277379
@Override
    public <A> A fromXML(String xml, Class<A> clazz) {
        try {
            return xmlMapper().readValue(xml, clazz);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
1073664
protected <T> T fromJsonString(String json, Class<T> clazz) {
		return _gsonParser.fromJson(json, clazz);
	}
1189334
@Override
  public final T fromString(final Map<String, Object> pAddParam,
    final String pStrVal) throws Exception {
    if (pStrVal == null || "".equals(pStrVal)) {
      return null;
    }
    T object = this.objectClass.newInstance();
    for (String fldValStr : pStrVal.split(",")) {
      int eqIdx = fldValStr.indexOf("=");
      String fldName = fldValStr.substring(0, eqIdx);
      String cnvrtName = this.fieldConverterNamesHolder.getFor(this.objectClass,
        fldName);
      if (cnvrtName != null) { // e.g. transient field
        IConverterToFromString cnvrt = this.fieldsConvertersFatory
          .lazyGet(null, cnvrtName);
        Method fldSetter = this.settersRapiHolder
          .getFor(this.objectClass, fldName);
        String strVal = fldValStr.substring(eqIdx + 1);
        Object fldVal = cnvrt.fromString(pAddParam, strVal);
        fldSetter.invoke(object, fldVal);
      }
    }
    return object;
  }
778513
public static Call create(final String to, final String from) throws Exception {
    	return create(to, from, "none", null);
    }
1231968
public final static void copyProperties(Object from, Object to) {

        Set<Field> fromSet = getAllFiled(from.getClass());
        Set<Field> toSet = getAllFiled(to.getClass());

        Map<String, Field> toMap = new HashMap<String, Field>();
        for (Field f : toSet) {
            toMap.put(f.getName(), f);
        }

        for (Field f : fromSet) {
            if (Modifier.isStatic(f.getModifiers())) {
                continue;
            }
            String name = f.getName();
            Field toField = toMap.get(name);
            if (toField == null) {
                continue;
            }

            toField.setAccessible(true);
            f.setAccessible(true);
            try {
                toField.set(to, f.get(from));
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }

    }
1222644
@Override
    public Timestamp fromBytes(Class targetClass, byte[] b)
    {

        // String s;
        // try
        // {
        // if(b == null)
        // {
        // return null;
        // }
        // s = new String(b, Constants.ENCODING);
        // }
        // catch (UnsupportedEncodingException e)
        // {
        // throw new PropertyAccessException(e);
        // }
        // return fromString(targetClass, s);
        try
        {
            if (b == null)
            {
                return null;
            }

            // In case date.getTime() is stored in DB.
            LongAccessor longAccessor = new LongAccessor();

            return new Timestamp(longAccessor.fromBytes(targetClass, b));
        }
        catch (Exception e)
        {
            log.error("Error occured, Caused by {}.", e);
            throw new PropertyAccessException(e);
        }
    }
521651
@Deprecated
    @JsonProperty("from")
    public void setFrom(String from) throws IllegalArgumentException {
        if (messagingServiceSID != null) {
            throw new IllegalArgumentException("You must specify either `from` or `messagingServiceSID`, but not both");
        }
        this.from = from;
    }
956554
protected static Properties stringToProperties(String propertiesString)
    {
        Properties properties = new Properties();

        if (propertiesString != null) {
            try {
                properties.load(new StringReader(propertiesString));
            }
            catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return properties;
    }
310068
@Override
    public void setNString(String parameterName, String value) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
76226
public <T> T fromJson(@Nullable String jsonString, Class<T> clazz) {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}

		try {
			return mapper.readValue(jsonString, clazz);
		} catch (IOException e) {
			logger.warn("parse json string error:" + jsonString, e);
			return null;
		}
	}
1163076
@Override
    public Float fromString(Class targetClass, String s)
    {
        try
        {
            if (s == null)
            {
                return null;
            }
            Float f = new Float(s);
            return f;
        }
        catch (NumberFormatException e)
        {
            log.error("Number format exception, Caused by {}.", e);
            throw new PropertyAccessException(e);
        }
    }
1308605
@Override
    public Double fromString(Class targetClass, String s)
    {
        try
        {
            if (s == null)
            {
                return null;
            }
            Double d = new Double(s);
            return d;
        }
        catch (NumberFormatException e)
        {
            log.error("Number format exception, Caused by {}.", e);
            throw new PropertyAccessException(e);
        }
    }
1120311
@Override
    public void setString(int parameterIndex, String x) throws SQLException {
        internalStmt.setString(parameterIndex, x);
    }
510804
@Override
  public final E fromString(final Map<String, Object> pAddParam,
    final String pStrVal) throws Exception {
    if (pStrVal == null || "".equals(pStrVal)) {
      return null;
    }
    return Enum.valueOf(this.enumClass, pStrVal);
  }
761568
@Override
    public Boolean fromString(String value) {
        return value != null && TRUE.contains(value.toLowerCase());
    }