org.netbeans.modules.j2ee.persistence.spi.support
Class PersistenceScopesHelper
java.lang.Object
org.netbeans.modules.j2ee.persistence.spi.support.PersistenceScopesHelper
public final class PersistenceScopesHelper
- extends Object
Helper class for implementing
PersistenceScopesProvider
.
It creates and maintains a PersistenceScopes
instance containing a single PersistenceScope
or an empty array of PersistenceScope
depending on whether the persistence.xml
file corresponding to that PersistenceScope
exists or not, firing property changes
as the persistence.xml file is created/deleted.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PersistenceScopesHelper
public PersistenceScopesHelper()
changePersistenceScope
public void changePersistenceScope(PersistenceScope newPersistenceScope,
File newPersistenceXml)
- Call this method in order to change the persistence scope returned by the
PersistenceScopes
instance returned by getPersistenceScopes()
or the corresponding persistence.xml file.
- Parameters:
newPersistenceScope
- the new persistence scope; can be null, but in this case
the newPersistenceXml
parameter must be null too.newPersistenceXml
- the new persistence.xml file; can be null.
- Throws:
IllegalArgumentException
- if newPersistenceScope
is null
and newPersistenceXml
is not.
getPersistenceScopes
public PersistenceScopes getPersistenceScopes()
- Returns the
PersistenceScopes
created by this helper. Usually
an implementor of PersistenceScopesProvider
will delegate
its getPersistenceScopes
method to this method.
- Returns:
- a
PersistenceScopes
instance; never null.