Convertor¶
-
public final class
Convertor
¶ A Convertor is mainly responsible for data format conversion.
Author: Hugo Y. K. Lam
Methods¶
convertObject¶
-
public static Object
convertObject
(Object source, Class target)¶ Converts the given source Object to an instance of the specified target class. The constructor of the target class which has an argument of the source object type will be looked up first. It it succeeds, the source Object will be passed in as the argument. Otherwise, the constructor which has a String argument will be looked up and the source object will be passed in as a String by calling its toString method. Null will be returned if the conversion cannot be performed.
Parameters: - source – the source Object.
- target – the target class.
Returns: an instance of the target class representing the given source Object.
deepCopy¶
-
public static Object
deepCopy
(Serializable obj)¶ Performs a deep copy of the given serializable Object.
Parameters: - obj – the serializable Object to be copied.
Returns: a copy of the given Object.
toFile¶
toSQLDate¶
toTimestamp¶
toVector¶
-
public static Vector
toVector
(Object obj)¶ Converts the given Object to a Vector. If the given Object is already a Vector, the Object will be directly returned. Otherwise, the Oobject will be added to a new Vector and the Vector will be returned.
Parameters: - obj – The Object to be converted.
Returns: The Vector converted by the given Object.
translateProperties¶
-
public static void
translateProperties
(javax.servlet.http.HttpServletRequest request, Object bean)¶ Translates the request parameters in the given HttpServletRequest to the properties in the given bean Object.
Parameters: - request – the HttpServletRequest which contains the request parameters to be translated.
- bean – the bean Object into which the request parameters to be translated.