MCPcopy Create free account
hub / github.com/MenoData/Time4J / getUnit

Method getUnit

base/src/main/java/net/time4j/Duration.java:4882–4936  ·  view source on GitHub ↗
(char symbol)

Source from the content-addressed store, hash-verified

4880 }
4881
4882 @SuppressWarnings("unchecked")
4883 @Override
4884 protected U getUnit(char symbol) {
4885
4886 IsoUnit unit;
4887
4888 switch (symbol) {
4889 case 'I':
4890 unit = MILLENNIA;
4891 break;
4892 case 'C':
4893 unit = CENTURIES;
4894 break;
4895 case 'E':
4896 unit = DECADES;
4897 break;
4898 case 'Y':
4899 unit = YEARS;
4900 break;
4901 case 'Q':
4902 unit = QUARTERS;
4903 break;
4904 case 'M':
4905 unit = MONTHS;
4906 break;
4907 case 'W':
4908 unit = WEEKS;
4909 break;
4910 case 'D':
4911 unit = DAYS;
4912 break;
4913 case 'h':
4914 unit = HOURS;
4915 break;
4916 case 'm':
4917 unit = MINUTES;
4918 break;
4919 case 's':
4920 unit = SECONDS;
4921 break;
4922 case 'f':
4923 unit = NANOS;
4924 break;
4925 default:
4926 throw new IllegalArgumentException(
4927 "Unsupported pattern symbol: " + symbol);
4928 }
4929
4930 try {
4931 return (U) unit;
4932 } catch (ClassCastException cce) {
4933 throw new IllegalArgumentException(cce.getMessage(), cce);
4934 }
4935
4936 }
4937
4938 }
4939

Callers 15

printRelativeOrDateMethod · 0.45
printRelativeTimeMethod · 0.45
pushDurationMethod · 0.45
JSR310DurationAdapterMethod · 0.45
getUnitsMethod · 0.45
convertMethod · 0.45
writeDurationMethod · 0.45
compareMethod · 0.45
normalizeMethod · 0.45
normalizeMethod · 0.45
containsMethod · 0.45
getPartialAmountMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected