Package com.aerisweather.aeris.util
Class WeatherUtil
- java.lang.Object
-
- com.aerisweather.aeris.util.WeatherUtil
-
public class WeatherUtil extends Object
Helper methods for helping display some weather information from numbers to strings.
-
-
Constructor Summary
Constructors Constructor Description WeatherUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
appendDegree(Number temp)
Appends the degree sign to the string degree.static String
appendDegree(String temp)
Appends the degree sign to the string degree.static String
capitalize(String temp)
Simplifier version of the helper classWordsCapitalizer.capitalizeEveryWord(String, List, Locale)
.static String
getDayFromISO(String iso)
Takes the ISO 8601 time string and returns the day i.e.static String
getDayNumFromISO(String iso)
Takes the ISO 8601 time string and returns the day number (1-31) of the monthstatic String
getFormatFromISO(String iso, String pattern)
Takes the ISO 8601 time string and returns time in desired UTS #35 format.static String
getFormatFromISO_CorrectTimezone(String iso, String pattern)
Takes the ISO 8601 time string and returns time in desired UTS #35static String
getFormatFromTimeZone(Profile profile, String format)
Gets the format from the profile with desired UTS 35static String
getFormattedPrecipText(Number number)
static String
getFormattedPrecipText(Number number, boolean isSnow)
static String
getPlaceFormat(Place place)
static String
getTimeFromISO(String iso)
Takes the ISO 8601 time string and returns time in HH:mm AM/PM (h:mm aa in Unicode UTS #35)static String
getTimeFromISO(String iso, boolean showMinutes)
Takes the ISO 8601 time string and returns time in HH:mm AM/PM (h:mm aa Unicode UTS #35) if showMinutes is true, or HH AM/PM(h aa Unicode UTS #35) if not.static String
getTimeFromTimezone(Profile profile)
Gets the time from the timezone object in hh:mm a format.static String
getWeatherFromAtTime(Observation ob, Place place)
static String
getWindSpeedDirDesc(String dir, Number speed)
-
-
-
Method Detail
-
appendDegree
public static String appendDegree(String temp)
Appends the degree sign to the string degree.- Parameters:
temp
- temperature in degree to add the sign to.- Returns:
- String with degree sign appended.
-
appendDegree
public static String appendDegree(Number temp)
Appends the degree sign to the string degree.- Parameters:
temp
- temperature in degree to add the sign to.- Returns:
- String with degree sign appended.
-
getWeatherFromAtTime
public static String getWeatherFromAtTime(Observation ob, Place place)
-
getFormatFromTimeZone
public static String getFormatFromTimeZone(Profile profile, String format)
Gets the format from the profile with desired UTS 35- Parameters:
profile
- profile to get format fromformat
- format to parse to- Returns:
- time in hh:mm a format.
-
getTimeFromTimezone
public static String getTimeFromTimezone(Profile profile)
Gets the time from the timezone object in hh:mm a format.- Parameters:
profile
- profile to get time from- Returns:
- time in hh:mm a format.
-
getDayNumFromISO
public static String getDayNumFromISO(String iso)
Takes the ISO 8601 time string and returns the day number (1-31) of the month- Parameters:
iso
- ISO 8601 string to parse- Returns:
- Day number of the month
-
getDayFromISO
public static String getDayFromISO(String iso)
Takes the ISO 8601 time string and returns the day i.e. Mon in three character code.- Parameters:
iso
- ISO 8601 string to parse- Returns:
- Day of the week in EEE
-
getTimeFromISO
public static String getTimeFromISO(String iso)
Takes the ISO 8601 time string and returns time in HH:mm AM/PM (h:mm aa in Unicode UTS #35)- Parameters:
iso
- ISO 8601 string to parse- Returns:
- Time formatted.
-
getFormatFromISO
public static String getFormatFromISO(String iso, String pattern)
Takes the ISO 8601 time string and returns time in desired UTS #35 format.- Parameters:
iso
- ISO 8601 string to parsepattern
- pattern to parse too.- Returns:
- Time formatted.
-
getFormatFromISO_CorrectTimezone
public static String getFormatFromISO_CorrectTimezone(String iso, String pattern)
Takes the ISO 8601 time string and returns time in desired UTS #35- Parameters:
iso
- ISO 8601 string to parsepattern
- Pattern for the time/date format- Returns:
- String - formatted date and time
-
getTimeFromISO
public static String getTimeFromISO(String iso, boolean showMinutes)
Takes the ISO 8601 time string and returns time in HH:mm AM/PM (h:mm aa Unicode UTS #35) if showMinutes is true, or HH AM/PM(h aa Unicode UTS #35) if not.- Parameters:
iso
- ISO 8601 string to parseshowMinutes
- whether to show the minutes or not- Returns:
- Time formatted.
-
capitalize
public static String capitalize(String temp)
Simplifier version of the helper classWordsCapitalizer.capitalizeEveryWord(String, List, Locale)
.- Parameters:
temp
- String- Returns:
- return value
-
-