DateTime parse(String aDateTime) {
    if(aDateTime == null){
      throw new NullPointerException("DateTime string is null");
    }
    String dateTime = aDateTime.trim();
    Parts parts = splitIntoDateAndTime(dateTime);
    if (parts.hasTwoParts()) {
      parseDate(parts.datePart);
      parseTime(parts.timePart);
    }
    else if (parts.hasDateOnly()){
      parseDate(parts.datePart);
    }
    else if (parts.hasTimeOnly()){
      parseTime(parts.timePart);
    }
    DateTime result = new DateTime(fYear, fMonth, fDay, fHour, fMinute, fSecond, fNanosecond);
    return result;
  }