net.sourceforge.jfacets.annotations
Class AnnotatedFacetDescriptorManager

java.lang.Object
  extended by net.sourceforge.jfacets.annotations.AnnotatedFacetDescriptorManager
All Implemented Interfaces:
IFacetDescriptorManager

public class AnnotatedFacetDescriptorManager
extends java.lang.Object
implements IFacetDescriptorManager

The AnnotatedFacetDescriptorManager : loads and manages descriptors for facets using the @FacetKey annotation.
This manager scans the classpath in order to find classes that implement the IFacet interface and are marked with a @FacetKey annotation. If found, a descriptor is crated and added for this facet, based on the information supplied in the annotation's attributes.
IMPORTANT : You HAVE to provide at least one base package when creating this objects.

Author:
Remi VANKEISBELCK - remi@rvkb.com

Constructor Summary
AnnotatedFacetDescriptorManager(java.util.List<java.lang.String> basePackages)
          Create the manager and set base packages that will be scanned for annotated facets.
 
Method Summary
 FacetDescriptor getDescriptor(java.lang.String name, java.lang.String profileId, java.lang.Class targetObjectType)
          Return the descriptor sctrictly associated to passed params if any, null of not found.
 FacetDescriptor[] getDescriptors()
          Return all descriptors in an array.
 DuplicatedKeyPolicyType getDuplicatedKeyPolicy()
           
 AnnotatedFacetDescriptorManager initialize()
          Loads all available Facet Descriptors by scanning the CLASSPATH with specified base packages.
 AnnotatedFacetDescriptorManager setDuplicatedKeyPolicy(DuplicatedKeyPolicyType policyType)
          Set the duplicated key policy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotatedFacetDescriptorManager

public AnnotatedFacetDescriptorManager(java.util.List<java.lang.String> basePackages)
Create the manager and set base packages that will be scanned for annotated facets.

Parameters:
basePackages - the packages as a list of Strings
Method Detail

setDuplicatedKeyPolicy

public AnnotatedFacetDescriptorManager setDuplicatedKeyPolicy(DuplicatedKeyPolicyType policyType)
Set the duplicated key policy. This allows to enable duplicated keys, or to throw an exception when dups are found.

Parameters:
policyType - the policy to use
Returns:
this for chained calls

getDuplicatedKeyPolicy

public DuplicatedKeyPolicyType getDuplicatedKeyPolicy()

initialize

public AnnotatedFacetDescriptorManager initialize()
Loads all available Facet Descriptors by scanning the CLASSPATH with specified base packages.

Returns:
this for chained calls

getDescriptor

public FacetDescriptor getDescriptor(java.lang.String name,
                                     java.lang.String profileId,
                                     java.lang.Class targetObjectType)
Return the descriptor sctrictly associated to passed params if any, null of not found.

Specified by:
getDescriptor in interface IFacetDescriptorManager

getDescriptors

public FacetDescriptor[] getDescriptors()
Return all descriptors in an array.

Specified by:
getDescriptors in interface IFacetDescriptorManager


Copyright © 2011. All Rights Reserved.