Package org.intermine.api.profile
Class TagMapper
- java.lang.Object
-
- org.intermine.api.profile.TagMapper
-
- All Implemented Interfaces:
org.apache.commons.collections.Transformer
public final class TagMapper extends java.lang.Object implements org.apache.commons.collections.Transformer
A class that handles transforming a list of tags into a list of strings of different types.- Author:
- Alex Kalderimis
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TagMapper.Field
The valid fields that can be read from a tag
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TagMapper
getMapper(TagMapper.Field field)
Get a tag mapper.java.util.List<java.lang.String>
map(java.util.List<Tag> tags)
Safely transform a list of tags into a list of string, preserving type information.java.lang.String
transform(java.lang.Object obj)
java.lang.String
transform(Tag tag)
Transform a tag into a string of some kind.
-
-
-
Method Detail
-
getMapper
public static TagMapper getMapper(TagMapper.Field field)
Get a tag mapper.- Parameters:
field
- The kind of field this mapper reads.- Returns:
- The mapper.
-
transform
public java.lang.String transform(java.lang.Object obj)
- Specified by:
transform
in interfaceorg.apache.commons.collections.Transformer
-
transform
public java.lang.String transform(Tag tag)
Transform a tag into a string of some kind.- Parameters:
tag
- The input tag. Must not be null.- Returns:
- The output string. Might be null.
-
map
public java.util.List<java.lang.String> map(java.util.List<Tag> tags)
Safely transform a list of tags into a list of string, preserving type information. The lists produced by this method are intended to be read only. If you intend on modifying the list in any way, you must construct a new collection from the result.- Parameters:
tags
- The input list of tags. Must not be null.- Returns:
- The list of strings, never null.
-
-