code: @Override
      public long get(TemporalUnit unit) {
          if (unit instanceof ChronoUnit) {
              switch ((ChronoUnit) unit) {
                  case YEARS:
                      return period.getYears();
                  case MONTHS:
                      return period.getMonths();
                  case DAYS:
                      return period.getDays();
                  case SECONDS:
                      return duration.getSeconds();
                  case NANOS:
                      return duration.getNano();
                  default:
                      break;
              }
          }
          throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
      }
docs: Gets the value of the requested unit.
  <p>
  This returns a value for the supported units - {@link ChronoUnit#YEARS},
  {@link ChronoUnit#MONTHS}, {@link ChronoUnit#DAYS}, {@link ChronoUnit#SECONDS}
  and {@link ChronoUnit#NANOS}.
  All other units throw an exception.
  Note that hours and minutes throw an exception.
  
  @param unit  the {@code TemporalUnit} for which to return the value
  @return the long value of the unit
  @throws UnsupportedTemporalTypeException if the unit is not supported