com.levigo.jadice.annotation.profiles
Class AnnotationProfile

java.lang.Object
  extended by com.levigo.jadice.annotation.profiles.AnnotationProfile
All Implemented Interfaces:
PropertiesProvider

public class AnnotationProfile
extends Object
implements PropertiesProvider


Constructor Summary
AnnotationProfile()
           
 
Method Summary
 boolean contains(AnnotationType type)
          Return whether this profile or a parent profile contain the given annotation type.
 boolean equals(Object obj)
           
static AnnotationProfile get(Document document)
          Return the applicable AnnotationProfile for the given Document.
static AnnotationProfile get(Page page)
          Return the applicable AnnotationProfile for the given Document and Page within.
static AnnotationProfile getDefaultProfile()
           
 TypeSet getDefaultTypeSet()
           
 AnnotationFactory getFactory(String name)
          Return the annotation factory for the given name.
 String getName()
           
 AnnotationProfile getParentProfile()
           
 String getParentProfileSpec()
          Deprecated. XML mapping use only
 PropertiesDescriptor getPropDesc()
          Deprecated. XML mapping use only
 Map<String,Object> getProperties()
          Return a map of user properties.
 AnnotationTemplate getTemplate(String name)
          Return the template with the given name or null if there is no such template.
 List<AnnotationTemplate> getTemplates()
           
 AnnotationType getType(String name)
          Return the type profile with the given name or null if there is no such profile.
 List<AnnotationType> getTypes()
           
 TypeSet getTypeSet(String name)
           
 List<TypeSet> getTypeSets()
           
 int hashCode()
           
static AnnotationProfile load(URL profileURL)
          Load an annotation profile from the given URL.
static AnnotationProfile locateByName(String name)
          Locate the an annotation profile by its name.
static void main(String[] args)
           
static void registerAnnotationProfileLocator(AnnotationProfileLocator apl)
          Registers an additional AnnotationProfileLocator.
static void set(Document document, AnnotationProfile ap)
          Set the applicable AnnotationProfile for the given document.
static void setDefaultProfile(AnnotationProfile defaultProfile)
           
 void setName(String name)
           
 void setParentProfile(AnnotationProfile parentProfile)
           
 void setParentProfileSpec(String parentProfileSpec)
          Deprecated. XML mapping use only
 void setPropDesc(PropertiesDescriptor propDesc)
          Deprecated. XML mapping use only
 void setTypeSets(List<TypeSet> allTypeSets)
           
 String toString()
           
static void unRegisterAnnotationProfileLocator(AnnotationProfileLocator apl)
          Unregisters given AnnotationProfileLocator.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnnotationProfile

public AnnotationProfile()
Method Detail

setDefaultProfile

public static void setDefaultProfile(AnnotationProfile defaultProfile)
Parameters:
defaultProfile - the defaultProfile to set

getDefaultProfile

public static AnnotationProfile getDefaultProfile()
Returns:
the defaultProfile

load

public static AnnotationProfile load(URL profileURL)
Load an annotation profile from the given URL.

Parameters:
profileURL -
Returns:
Annotation profile

main

public static void main(String[] args)
                 throws JAXBException,
                        IOException
Throws:
JAXBException
IOException

registerAnnotationProfileLocator

public static void registerAnnotationProfileLocator(AnnotationProfileLocator apl)
Registers an additional AnnotationProfileLocator. Additional AnnotationProfileLocator will be preferably used to locate AnnotationProfiles by name. With this method it is possible to add as many additional AnnotationProfileLocator as necessary.

Parameters:
apl - AnnotationProfileLocator to be registered
See Also:
locateByName(String), unRegisterAnnotationProfileLocator(AnnotationProfileLocator)

unRegisterAnnotationProfileLocator

public static void unRegisterAnnotationProfileLocator(AnnotationProfileLocator apl)
Unregisters given AnnotationProfileLocator.

Parameters:
apl - AnnotationProfileLocator to be unregistered
See Also:
locateByName(String), registerAnnotationProfileLocator(AnnotationProfileLocator)

locateByName

public static AnnotationProfile locateByName(String name)
Locate the an annotation profile by its name. The actual work is split into two steps. At first each additional AnnotationProfileLocator is used to locate AnnotationProfiles by name. The locators are applied in the order in which they are registered. The first locator, which successfully locate the demanded profile wins and the found profile returns. If no registered AnnotationProfileLocator is able to find a matching profile the lookup is delegated to AnnotationProfileLocators which are found via META-INF/services lookup.

Parameters:
name -
Returns:
the loaded annotation profile or null, if no locator was able to find it.
See Also:
registerAnnotationProfileLocator(AnnotationProfileLocator), unRegisterAnnotationProfileLocator(AnnotationProfileLocator)

get

public static AnnotationProfile get(Document document)
Return the applicable AnnotationProfile for the given Document. Returns null, if the document doesn't have one.

Parameters:
document -
Returns:
the applicable AnnotationProfile

get

public static AnnotationProfile get(Page page)
Return the applicable AnnotationProfile for the given Document and Page within. null, if the document doesn't have one.

Caveat: this method only uses the first annotation page segment found on the given page using the ordering of Page.getPageSegments(). However, the latter is problematic as the default implementation does not return the segments in any predictable order but in order of the hash map they are maintained in. Future implementations will exhibit a clarified but different behavior.

Parameters:
page - The Page for which to retrieve its AnnotationProfile.
Returns:
the applicable AnnotationProfile

set

public static void set(Document document,
                       AnnotationProfile ap)
Set the applicable AnnotationProfile for the given document.

Parameters:
document -
ap -

setName

public void setName(String name)
Parameters:
name - the name to set

getName

public String getName()
Returns:
the name

getTypes

public List<AnnotationType> getTypes()
Returns:
the typeProfiles

getTemplates

public List<AnnotationTemplate> getTemplates()
Returns:
the templates

getTemplate

public AnnotationTemplate getTemplate(String name)
Return the template with the given name or null if there is no such template.

Parameters:
name -
Returns:
the template or null

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getType

public AnnotationType getType(String name)
Return the type profile with the given name or null if there is no such profile.

Parameters:
name -
Returns:
the type profile or null

getFactory

public AnnotationFactory getFactory(String name)
Return the annotation factory for the given name.

Parameters:
name -
Returns:
the type profile or null

setTypeSets

public void setTypeSets(List<TypeSet> allTypeSets)

getTypeSets

public List<TypeSet> getTypeSets()

getTypeSet

public TypeSet getTypeSet(String name)

getDefaultTypeSet

public TypeSet getDefaultTypeSet()

toString

public String toString()
Overrides:
toString in class Object

setParentProfileSpec

@Deprecated
public void setParentProfileSpec(String parentProfileSpec)
                          throws JAXBException
Deprecated. XML mapping use only

Parameters:
parentProfileSpec - the parentProfileSpec to set
Throws:
JAXBException

getParentProfileSpec

@Deprecated
public String getParentProfileSpec()
Deprecated. XML mapping use only

Returns:
the parentProfileSpec

setParentProfile

public void setParentProfile(AnnotationProfile parentProfile)
Parameters:
parentProfile - the parentProfile to set

getParentProfile

public AnnotationProfile getParentProfile()
Returns:
the parentProfile

contains

public boolean contains(AnnotationType type)
Return whether this profile or a parent profile contain the given annotation type.

Parameters:
type -
Returns:

getProperties

public Map<String,Object> getProperties()
Description copied from interface: PropertiesProvider
Return a map of user properties. What to store and which keys to use is largely up to the user of classes implementing this interface, since those classes will generally be oblivious to the map's contents. There are no guarantees regarding the thread-safety of the returned map, unless otherwise specified by implementors.

Specified by:
getProperties in interface PropertiesProvider
Returns:
the map of user properties

getPropDesc

@Deprecated
public PropertiesDescriptor getPropDesc()
Deprecated. XML mapping use only


setPropDesc

@Deprecated
public void setPropDesc(PropertiesDescriptor propDesc)
Deprecated. XML mapping use only

Parameters:
propDesc -


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.