public abstract class HaleIO extends Object
Constructor and Description |
---|
HaleIO() |
Modifier and Type | Method and Description |
---|---|
static <P extends IOProvider> |
createIOProvider(Class<P> providerType,
org.eclipse.core.runtime.content.IContentType contentType,
String providerId)
Creates an I/O provider instance
|
static List<IOProviderDescriptor> |
filterFactories(Collection<IOProviderDescriptor> factories,
org.eclipse.core.runtime.content.IContentType contentType)
Filter I/O provider factories by content type
|
static <P extends IOProvider> |
findContentType(Class<P> providerType,
com.google.common.io.InputSupplier<? extends InputStream> in,
String filename)
Find the content type for the given input
|
static List<org.eclipse.core.runtime.content.IContentType> |
findContentTypesFor(Collection<org.eclipse.core.runtime.content.IContentType> types,
com.google.common.io.InputSupplier<? extends InputStream> in,
String filename)
Find the content types that match the given file name and/or input.
|
static <T extends ImportProvider> |
findImportProvider(Class<T> type,
InputStream in)
Automatically find an import provider to load a resource that is
available through an input stream that can only be read once.
|
static <P extends IOProvider> |
findIOProvider(Class<P> providerType,
com.google.common.io.InputSupplier<? extends InputStream> in,
String filename)
Find an I/O provider instance for the given input
|
static <T extends IOProvider> |
findIOProviderAndId(Class<T> providerType,
com.google.common.io.InputSupplier<? extends InputStream> in,
String filename)
Find an I/O provider instance for the given input
|
static <P extends IOProvider> |
findIOProviderFactory(Class<P> providerType,
org.eclipse.core.runtime.content.IContentType contentType,
String providerId)
Find an I/O provider factory
|
static Element |
getComplexElement(Object value)
Get the representation of a complex value as a DOM element.
|
static <T> T |
getComplexValue(Element element,
Class<T> expectedType,
Object context)
Get the value of a complex property represented as a DOM element.
|
static Object |
getComplexValue(Element element,
Object context)
Get the value of a complex property represented as a DOM element.
|
static <P extends IOProvider> |
getProviderFactories(Class<P> providerType)
Get the I/O provider factories of a certain type
|
static boolean |
isCompatibleContentType(org.eclipse.core.runtime.content.IContentType parentType,
org.eclipse.core.runtime.content.IContentType valueType)
Test if the given value content type is compatible with the given parent
content type
|
public static List<IOProviderDescriptor> filterFactories(Collection<IOProviderDescriptor> factories, org.eclipse.core.runtime.content.IContentType contentType)
factories
- the I/O provider factoriescontentType
- the content type factories must supportpublic static List<org.eclipse.core.runtime.content.IContentType> findContentTypesFor(Collection<org.eclipse.core.runtime.content.IContentType> types, com.google.common.io.InputSupplier<? extends InputStream> in, String filename)
types
- the types to matchin
- the input supplier to use for testing, may be null
if the file name is not null
filename
- the file name, may be null
if the input
supplier is not null
public static <P extends IOProvider> Collection<IOProviderDescriptor> getProviderFactories(Class<P> providerType)
providerType
- the provider type, usually an interfacepublic static <P extends IOProvider> IOProviderDescriptor findIOProviderFactory(Class<P> providerType, org.eclipse.core.runtime.content.IContentType contentType, String providerId)
P
- the provider interface typeproviderType
- the provider type, usually an interfacecontentType
- the content type the provider must match, may be
null
if providerId is setproviderId
- the id of the provider to use, may be null
if contentType is setnull
if no matching I/O
provider factory is foundpublic static <P extends IOProvider> P createIOProvider(Class<P> providerType, org.eclipse.core.runtime.content.IContentType contentType, String providerId)
P
- the provider interface typeproviderType
- the provider type, usually an interfacecontentType
- the content type the provider must match, may be
null
if providerId is setproviderId
- the id of the provider to use, may be null
if contentType is setnull
if no matching I/O provider is foundpublic static <P extends IOProvider> org.eclipse.core.runtime.content.IContentType findContentType(Class<P> providerType, com.google.common.io.InputSupplier<? extends InputStream> in, String filename)
P
- the provider interface typeproviderType
- the provider type, usually an interfacein
- the input supplier to use for testing, may be null
if the file name is not null
filename
- the file name, may be null
if the input
supplier is not null
null
if no matching content type
is foundpublic static <P extends IOProvider> P findIOProvider(Class<P> providerType, com.google.common.io.InputSupplier<? extends InputStream> in, String filename)
P
- the provider interface typeproviderType
- the provider type, usually an interfacein
- the input supplier to use for testing, may be null
if the file name is not null
filename
- the file name, may be null
if the input
supplier is not null
null
if no matching I/O provider
is foundpublic static <T extends IOProvider> Pair<T,String> findIOProviderAndId(Class<T> providerType, com.google.common.io.InputSupplier<? extends InputStream> in, String filename)
T
- the provider interface typeproviderType
- the provider type, usually an interfacein
- the input supplier to use for testing, may be null
if the file name is not null
filename
- the file name, may be null
if the input
supplier is not null
null
if no matching I/O provider was foundpublic static <T extends ImportProvider> T findImportProvider(Class<T> type, InputStream in)
type
- the import provider typein
- the input streamnull
if none was foundpublic static boolean isCompatibleContentType(org.eclipse.core.runtime.content.IContentType parentType, org.eclipse.core.runtime.content.IContentType valueType)
parentType
- the parent content typevalueType
- the value content typepublic static Object getComplexValue(Element element, Object context)
element
- the DOM elementcontext
- the context object, may be null
ComplexValueExtension
, or the original elementpublic static <T> T getComplexValue(Element element, Class<T> expectedType, Object context)
element
- the DOM elementexpectedType
- the expected parameter type, this must be either
String
, DOM Element
or a complex value type
defined in the ComplexValueExtension
context
- the context object, may be null
null
if it could not be created
from the elementpublic static Element getComplexElement(Object value)
ComplexValueExtension
.value
- the complex valueIllegalStateException
- if the value is neither a DOM element nor
can be converted to one using the
ComplexValueExtension
Build 2013-10-07_11-27-38
Revision 99b27713a799a59a21b0b166eaaea8aaefbf125a