Package noaa.coastwatch.util
Class MetadataServices
java.lang.Object
noaa.coastwatch.util.MetadataServices
The
MetadataServices
class defines various static
methods relating to metadata manipulation.- Since:
- 3.1.8
- Author:
- Peter Hollemans
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
Appends a new value to the end of an attribute.static String
Appends a new value to the end of an attribute.static Object
Creates a collapsed version of an attribute value.static String
Creates a collapsed version of an attribute value.static String
Creates a formatted version of an attribute value.static String
getCommandLine
(String prog, String[] argv) Creates a command line string from program name and arguments.static double
similarity
(String s1, String s2) Calculates the similarity between strings.static Object
Converts a wrapped Java primitive to a primitive array.static String
Converts an attribute value to a string.
-
Field Details
-
SPLIT_STRING
The composite attribute value splitting string.- See Also:
-
DATE_FMT
Default date format.- See Also:
-
TIME_FMT
Default time format.- See Also:
-
DATE_TIME_FMT
Default date/time format.- See Also:
-
-
Method Details
-
collapse
Creates a collapsed version of an attribute value. The collapsed version of the attribute has no repeated composite values. For example, the string "GOES-10\nGOES-10\nGOES-12" will be collapsed to simply "GOES-10\nGOES-12".- Parameters:
attValue
- the attribute value to collapse.- Returns:
- the collapsed attribute value.
-
collapse
Creates a collapsed version of an attribute value. The collapsed version of the attribute has no repeated composite values.- Parameters:
attValue
- the attribute value to collapse.- Returns:
- the collapsed attribute value.
- See Also:
-
format
Creates a formatted version of an attribute value. The formatted version is collapsed and the splitting string replaced with a user-specified string.- Parameters:
attValue
- the attribute value to format.split
- the string to use for splitting composite values.- Returns:
- the formatted attribute value.
-
append
Appends a new value to the end of an attribute.- Parameters:
attValue
- the existing attribute value, may be null.appendValue
- the attribute value to append.- Returns:
- the new composite attribute value.
-
toArray
Converts a wrapped Java primitive to a primitive array.- Parameters:
value
- the object value to convert.- Returns:
- a Java primitive array of length 1.
- Throws:
ClassNotFoundException
- if the value class is unknown.
-
append
Appends a new value to the end of an attribute.- Parameters:
attValue
- the existing attribute value, may be null.appendValue
- the attribute value to append.- Returns:
- the new composite attribute value.
-
getCommandLine
Creates a command line string from program name and arguments.- Parameters:
prog
- the program name.argv
- the array of arguments.- Returns:
- the assembled command line string.
-
toString
Converts an attribute value to a string.- Parameters:
attValue
- the attribute value to convert.- Returns:
- the attribute value as a string or "null" if the attribute value is null.
-
similarity
Calculates the similarity between strings.- Parameters:
s1
- the first string to compare.s2
- the second srting to compare.- Returns:
- the similarity between strings as a number in the range [0..1] where 0.0 is not similar at all and 1.0 is exactly the same.
- Since:
- 3.8.0
- See Also:
-