Package uk.ac.starlink.vo

# Class UnitStatus

java.lang.Object
uk.ac.starlink.vo.UnitStatus

public class UnitStatus extends Object
Categorises VOUnit validity. The `getStatus(java.lang.String)` method tests a unit string to determine whether it conforms to the VOUnits standard.

Norman Gray's Unity library is used for VOUnits parsing.

Since:
  9 Jul 2021
Author:
  Mark Taylor
See Also:
  - VOUnits

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`UnitStatus.Code`
Characterises VOUnits standard conformance.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`UnitStatus(UnitStatus.Code code, String message)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`UnitStatus.Code`
`getCode()`
Returns a status element indicating conformance.
`String`
`getMessage()`
Returns a human-readable message supplying additional information.
`static UnitStatus`
`getStatus(String unit)`
Returns the status for a given unit string.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### UnitStatus

protected UnitStatus(UnitStatus.Code code, String message)
Constructor.

Parameters:
  `code` - status code
  `message` - human-readable message supplying additional information

## Method Details

### getCode

public UnitStatus.Code getCode()
Returns a status element indicating conformance.

Returns:
  code

### getMessage

public String getMessage()
Returns a human-readable message supplying additional information. The returned text does not in general report the original unit string.

Returns:
  message, or null if nothing to say

### getStatus

public static UnitStatus getStatus(String unit)
Returns the status for a given unit string.

Parameters:
  `unit` - unit text
Returns:
  status, or null for blank input