public class TypeSystemUtil extends Object
Constructor and Description |
---|
TypeSystemUtil() |
Modifier and Type | Method and Description |
---|---|
static FeatureDescription |
feature2FeatureDescription(Feature aFeature)
Convert a
Feature to an equivalent FeatureDescription . |
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 a
Type to an equivalent TypeDescription . |
static TypeSystemDescription |
typeSystem2TypeSystemDescription(TypeSystem aTypeSystem)
Convert a
TypeSystem to an equivalent TypeSystemDescription . |
public static List<TypeSystemDescription> loadTypeSystemDescriptionsFromClasspath(Class<?> aContext, String... typeSystemDescriptionLocations)
TypeSystemDescriptionProvider
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"); } }
aContext
- a context class. If the locations are not absolute, then they are looked up relative
to this context class as per Class.getResource(String)
.typeSystemDescriptionLocations
- type system description locations to load.public static TypeSystemDescription typeSystem2TypeSystemDescription(TypeSystem aTypeSystem)
TypeSystem
to an equivalent TypeSystemDescription
.aTypeSystem
- type system object to convertaTypeSystem
public static TypeDescription type2TypeDescription(Type aType, TypeSystem aTypeSystem)
Type
to an equivalent TypeDescription
.aType
- type object to convertaTypeSystem
- the TypeSystem that contains aType
aType
public static FeatureDescription feature2FeatureDescription(Feature aFeature)
Feature
to an equivalent FeatureDescription
.aFeature
- feature object to convertaFeature
public static String[] getAllowedValuesForType(Type aType, TypeSystem aTypeSystem)
aType
- the type, which must be a subtype of uima.cas.StringaTypeSystem
- the type system to useaType
TODO - this should be a method on Type.Copyright © 2006–2022 The Apache Software Foundation. All rights reserved.