JniDateParameterMapper.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-04-09
  6. * Changed: 2023-04-10
  7. *
  8. * */
  9. #include <ls-std/core/jni/JniClass.hpp>
  10. #include <ls-std/time/common/DateParameter.hpp>
  11. #include <ls-std/time/common/jni/JniDateParameterMapper.hpp>
  12. using ls::std::core::experimental::JniClass;
  13. using ls::std::time::DateParameter;
  14. using ls::std::time::experimental::JniDateParameterMapper;
  15. JniDateParameterMapper::JniDateParameterMapper() = default;
  16. JniDateParameterMapper::~JniDateParameterMapper() = default;
  17. DateParameter JniDateParameterMapper::toDateParameter(const JniClass &_javaClass)
  18. {
  19. JniClass javaClass = _javaClass;
  20. DateParameter dateParameter{};
  21. dateParameter.setYear(javaClass.callMethod("getYear").getIntegerValue());
  22. dateParameter.setMonth(javaClass.callMethod("getMonth").getByteValue());
  23. dateParameter.setDay(javaClass.callMethod("getDay").getByteValue());
  24. dateParameter.setHour(javaClass.callMethod("getHour").getByteValue());
  25. dateParameter.setMinute(javaClass.callMethod("getMinute").getByteValue());
  26. dateParameter.setSecond(javaClass.callMethod("getSecond").getByteValue());
  27. return dateParameter;
  28. }