Skip to content

Commit 7e6797e

Browse files
committed
unit type from name method
1 parent 5014975 commit 7e6797e

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/main/java/mil/nga/crs/common/Units.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,23 @@ public static Units fromUnit(Unit unit) {
286286
return fromName(unit.getName());
287287
}
288288

289+
/**
290+
* Get the unit type from the name
291+
*
292+
* @param name
293+
* unit name
294+
* @return units type
295+
* @since 1.1.0
296+
*/
297+
public static UnitType getUnitType(String name) {
298+
UnitType type = null;
299+
Units unit = fromName(name);
300+
if (unit != null) {
301+
type = unit.getType();
302+
}
303+
return type;
304+
}
305+
289306
/**
290307
* Get the default unit for the unit type
291308
*

0 commit comments

Comments
 (0)