org.pm4j.core.pm.api
Class PmFactoryApi

java.lang.Object
  extended by org.pm4j.core.pm.api.PmFactoryApi

public class PmFactoryApi
extends java.lang.Object


Constructor Summary
PmFactoryApi()
           
 
Method Summary
static
<T extends PmBean<?>>
T
findPmForBean(PmObject pmCtxt, java.lang.Object bean)
          Searches an existing presentation model for the given bean.
static
<T,T_PM extends PmBean<T>>
T_PM
getPmForBean(PmObject pmCtxt, T bean)
          Searches an existing presentation model for the given bean.
static
<T> java.util.List<? extends PmBean<T>>
getPmListForBeans(PmObject pmParent, java.util.Collection<T> beanList, boolean excludeInvisible)
          Convenience method that calls #getPmForBean(Object) for each item within the given list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PmFactoryApi

public PmFactoryApi()
Method Detail

getPmForBean

public static <T,T_PM extends PmBean<T>> T_PM getPmForBean(PmObject pmCtxt,
                                                           T bean)
Searches an existing presentation model for the given bean. Will create a new model when no one exists yet.

The method call will return null when the given bean is null.

Parameters:
bean - The bean to get the presentation model for.
Returns:
The presentation model for the given bean.

findPmForBean

public static <T extends PmBean<?>> T findPmForBean(PmObject pmCtxt,
                                                    java.lang.Object bean)
Searches an existing presentation model for the given bean. Will not create a new model when none found.

Parameters:
bean - The bean to get the presentation model for.
Returns:
The presentation model for the given bean or null.

getPmListForBeans

public static <T> java.util.List<? extends PmBean<T>> getPmListForBeans(PmObject pmParent,
                                                                        java.util.Collection<T> beanList,
                                                                        boolean excludeInvisible)
Convenience method that calls #getPmForBean(Object) for each item within the given list.

Parameters:
pmParent - The PM context for the PMs to create.
beanList - The objects to get PMs for. Can be null or empty.
excludeInvisible - true adds only visible PmBeans to the list.
Returns:
The matching list of PMs, sorted in the same order as the given collection.
Is never null.
In case of an empty set it provides an unmodifiable list.