Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

It's possible to provide custom project stage implementations.
Therefore, you have to provide an implementation of the ProjectStageHolder interface.
In this class you nest the custom project-stage implementations which have to be public static final class and it's required to extend ProjectStage.
It's required to provide a public static final instance even though, you won't use it directly.

Code Block
java
java
titleProjectStageHolder for custom project stage implementationsjava
public class CustomProjectStageHolder implements ProjectStageHolder
{
    public static final class CustomProjectStage extends ProjectStage
    {
        private static final long serialVersionUID = 1029094387976167179L;
    }

    public static final CustomProjectStage CustomProjectStage = new CustomProjectStage();
}

Configure your custom ProjectStageHolder in META-INF/services/org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStageHolder. The file has to provide the fully qualified class name of the custom implementation of the ProjectStageHolder interface.

Code Block
java
java
titleUsage of a custom project stagejava
ProjectStage customProjectStage;
customProjectStage = ProjectStage.valueOf("CustomProjectStage");
//or
customProjectStage = CustomProjectStageHolder.CustomProjectStage;
//or
@ProjectStageActivated(CustomProjectStageHolder.CustomProjectStage.class)

...

CDI provides the mechanism of @Alternative (as well as @Specializes) implementations. As soon as MyFaces CODI provides a default implementation as CDI bean, it's possible to provide a custom implementation via @Alternative (or @Specializes) (+ the corresponding std. CDI config). However, some CDI artifacts like CDI-Extensions (javax.enterprise.inject.spi.Extension) and Interceptors (javax.interceptor.Interceptor) don't support the mechanism for providing alternative implementations. Therefore, MyFaces CODI allows to create a custom implementation of the ClassDeactivator interface (or AbstractClassDeactivator).

Code Block
java
java
titleImplementing a custom Class-Deactivatorjava
public class CustomClassDeactivation extends AbstractClassDeactivator
{
    protected void deactivateClasses()
    {
        addDeactivatedClass(DefaultImpl.class);
        //...
    }
}

...