Package org.apache.uima.util
Class TypeSystemUtil
java.lang.Object
org.apache.uima.util.TypeSystemUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic FeatureDescription
feature2FeatureDescription
(Feature aFeature) Convert aFeature
to an equivalentFeatureDescription
.static String[]
getAllowedValuesForType
(Type aType, TypeSystem aTypeSystem) Gets the allowed values for a string subtype.static List<TypeSystemDescription>
loadTypeSystemDescriptionsFromClasspath
(Class<?> aContext, String... typeSystemDescriptionLocations) Loads type system descriptions and resolves their imports.static TypeDescription
type2TypeDescription
(Type aType, TypeSystem aTypeSystem) Convert aType
to an equivalentTypeDescription
.static TypeSystemDescription
typeSystem2TypeSystemDescription
(TypeSystem aTypeSystem) Convert aTypeSystem
to an equivalentTypeSystemDescription
.
-
Constructor Details
-
TypeSystemUtil
public TypeSystemUtil()
-
-
Method Details
-
loadTypeSystemDescriptionsFromClasspath
public static List<TypeSystemDescription> loadTypeSystemDescriptionsFromClasspath(Class<?> aContext, String... typeSystemDescriptionLocations) Loads type system descriptions and resolves their imports. For example when you place aTypeSystemDescriptionProvider
implementation and place the type system descriptions it should provide in the same package, you can use this method to conveniently load them simply by name in the provider implementation.public class MyTypeSystemDescriptionProvider implements TypeSystemDescriptionProvider {
@Override
public List<TypeSystemDescription> listTypeSystemDescriptions()
{ return TypeSystemUtil.loadTypeSystemDescriptionsFromClasspath(getClass(), "TypeSystem1.xml", "TypeSystem2.xml"); } }- Parameters:
aContext
- a context class. If the locations are not absolute, then they are looked up relative to this context class as perClass.getResource(String)
.typeSystemDescriptionLocations
- type system description locations to load.- Returns:
- list of the loaded and resolved descriptions.
-
typeSystem2TypeSystemDescription
Convert aTypeSystem
to an equivalentTypeSystemDescription
.- Parameters:
aTypeSystem
- type system object to convert- Returns:
- a TypeSystemDescription that is equivalent to
aTypeSystem
-
type2TypeDescription
Convert aType
to an equivalentTypeDescription
.- Parameters:
aType
- type object to convertaTypeSystem
- the TypeSystem that containsaType
- Returns:
- a TypeDescription that is equivalent to
aType
-
feature2FeatureDescription
Convert aFeature
to an equivalentFeatureDescription
.- Parameters:
aFeature
- feature object to convert- Returns:
- a FeatureDescription that is equivalent to
aFeature
-
getAllowedValuesForType
Gets the allowed values for a string subtype.- Parameters:
aType
- the type, which must be a subtype of uima.cas.StringaTypeSystem
- the type system to use- Returns:
- array of allowed values for
aType
TODO - this should be a method on Type.
-