public class MetadataSources extends Object
Constructor and Description |
---|
MetadataSources(ServiceRegistry serviceRegistry) |
MetadataSources(ServiceRegistry serviceRegistry,
EntityResolver entityResolver,
NamingStrategy namingStrategy) |
Modifier and Type | Method and Description |
---|---|
MetadataSources |
addAnnotatedClass(Class annotatedClass)
Read metadata from the annotations attached to the given class.
|
MetadataSources |
addCacheableFile(File file)
Add a cached mapping file.
|
MetadataSources |
addCacheableFile(String path)
See
addCacheableFile(java.io.File) for description |
MetadataSources |
addClass(Class entityClass)
Read a mapping as an application resource using the convention that a class named
foo.bar.Foo is
mapped by a file named foo/bar/Foo.hbm.xml which can be resolved as a classpath resource. |
MetadataSources |
addDirectory(File dir)
Read all mapping documents from a directory tree.
|
MetadataSources |
addDocument(Document document)
Read mappings from a DOM
Document |
MetadataSources |
addFile(File file)
Read mappings from a particular XML file
|
MetadataSources |
addFile(String path)
Read mappings from a particular XML file
|
MetadataSources |
addInputStream(InputStream xmlInputStream)
Read metadata from an
InputStream . |
MetadataSources |
addJar(File jar)
Read all mappings from a jar file.
|
MetadataSources |
addPackage(String packageName)
Read package-level metadata.
|
MetadataSources |
addResource(String name)
Read mappings as a application resourceName (i.e.
|
MetadataSources |
addURL(URL url)
Read mappings from a
URL |
Metadata |
buildMetadata() |
Iterable<Class<?>> |
getAnnotatedClasses() |
Iterable<String> |
getAnnotatedPackages() |
List<JaxbRoot> |
getJaxbRootList() |
MetadataBuilder |
getMetadataBuilder() |
NamingStrategy |
getNamingStrategy() |
ServiceRegistry |
getServiceRegistry() |
public MetadataSources(ServiceRegistry serviceRegistry)
public MetadataSources(ServiceRegistry serviceRegistry, EntityResolver entityResolver, NamingStrategy namingStrategy)
public ServiceRegistry getServiceRegistry()
public NamingStrategy getNamingStrategy()
public MetadataBuilder getMetadataBuilder()
public Metadata buildMetadata()
public MetadataSources addAnnotatedClass(Class annotatedClass)
annotatedClass
- The class containing annotationspublic MetadataSources addPackage(String packageName)
packageName
- java package name without trailing '.', cannot be null
public MetadataSources addResource(String name)
name
- The resource namepublic MetadataSources addClass(Class entityClass)
foo.bar.Foo
is
mapped by a file named foo/bar/Foo.hbm.xml
which can be resolved as a classpath resource.entityClass
- The mapped class. Cannot be null
null.public MetadataSources addFile(String path)
path
- The path to a file. Expected to be resolvable by File.File(String)
addFile(java.io.File)
public MetadataSources addFile(File file)
file
- The reference to the XML filepublic MetadataSources addCacheableFile(String path)
addCacheableFile(java.io.File)
for descriptionpath
- The path to a file. Expected to be resolvable by File.File(String)
addCacheableFile(java.io.File)
public MetadataSources addCacheableFile(File file)
{xmlFile}.bin
where {xmlFile}
is the name of the original mapping file.
If a cached {xmlFile}.bin
exists and is newer than {xmlFile}
, the {xmlFile}.bin
file will be read directly. Otherwise {xmlFile}
is read and then serialized to {xmlFile}.bin
for
use the next time.file
- The cacheable mapping file to be added, {xmlFile}
in above discussion.public MetadataSources addInputStream(InputStream xmlInputStream)
InputStream
.xmlInputStream
- The input stream containing a DOM.public MetadataSources addURL(URL url)
URL
url
- The url for the mapping document to be read.public MetadataSources addDocument(Document document)
Document
document
- The DOM documentpublic MetadataSources addJar(File jar)
jar
- a jar filepublic MetadataSources addDirectory(File dir)
dir
- The directoryMappingException
- Indicates problems reading the jar file or
processing the contained mapping documents.Copyright © 2018 JBoss by Red Hat. All rights reserved.