k-joseph

Untitled

Sep 3rd, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. /**
  2. * The contents of this file are subject to the OpenMRS Public License
  3. * Version 1.0 (the "License"); you may not use this file except in
  4. * compliance with the License. You may obtain a copy of the License at
  5. * http://license.openmrs.org
  6. *
  7. * Software distributed under the License is distributed on an "AS IS"
  8. * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  9. * License for the specific language governing rights and limitations
  10. * under the License.
  11. *
  12. * Copyright (C) OpenMRS, LLC. All Rights Reserved.
  13. */
  14. package org.openmrs;
  15.  
  16. import org.apache.commons.lang.StringUtils;
  17. import org.openmrs.customdatatype.SerializingCustomDatatype;
  18.  
  19. public abstract class BaseMetadataDatatype<T extends OpenmrsMetadata> extends SerializingCustomDatatype<T> {
  20. public String serialize(T typedValue) {
  21. if (typedValue == null)
  22. return null;
  23. return typedValue.toString();
  24. }
  25.  
  26. public T deserialize(String serializedValue, T tv) {
  27. if (StringUtils.isEmpty(serializedValue))
  28. return null;
  29. //return T.valueOf(serializedValue);
  30. return tv;
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment