com.endeca.b2creference.utils
Class ContentUtils

java.lang.Object
  extended by com.endeca.b2creference.utils.ContentUtils

public class ContentUtils
extends java.lang.Object


Constructor Summary
ContentUtils()
           
 
Method Summary
static com.endeca.content.ContentItem getContentItem(javax.servlet.http.HttpServletRequest request)
          Returns the content item property with the given name, throwing an exception if the property doesn't exist or its value is null, or if the property value is not of the required type clazz
static
<T> T
getOptionalProperty(com.endeca.content.ContentItem contentItem, java.lang.String propName, java.lang.Class<T> clazz)
          Returns the content item property with the given name, or null if that property doesn't exist or its value is null.
static
<T> T
getOptionalProperty(com.endeca.content.ContentItem contentItem, java.lang.String propName, java.lang.Class<T> clazz, T defaultVal)
          Returns the content item property with the given name, or defaultValue if that property doesn't exist or its value is null.
static boolean getRequiredBooleanProperty(com.endeca.content.ContentItem contentItem, java.lang.String propName)
           
static java.util.List<com.endeca.content.ContentItem> getRequiredContentItemListProperty(com.endeca.content.ContentItem contentItem, java.lang.String propName)
           
static com.endeca.content.ContentItem getRequiredContentItemProperty(com.endeca.content.ContentItem contentItem, java.lang.String propName)
           
static int getRequiredIntegerProperty(com.endeca.content.ContentItem contentItem, java.lang.String propName)
           
static
<T> T
getRequiredProperty(com.endeca.content.ContentItem contentItem, java.lang.String propName, java.lang.Class<T> clazz)
          Returns the content item property with the given name, throwing an exception if the property doesn't exist or its value is null, or if the property value is not of the required type clazz
static java.lang.String getRequiredStringProperty(com.endeca.content.ContentItem contentItem, java.lang.String propName)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentUtils

public ContentUtils()
Method Detail

getContentItem

public static com.endeca.content.ContentItem getContentItem(javax.servlet.http.HttpServletRequest request)
Returns the content item property with the given name, throwing an exception if the property doesn't exist or its value is null, or if the property value is not of the required type clazz

Type Parameters:
T -
Parameters:
contentItem -
propName -
clazz - The type of the returned object
Returns:
Throws:
com.endeca.content.ContentException

getRequiredProperty

public static <T> T getRequiredProperty(com.endeca.content.ContentItem contentItem,
                                        java.lang.String propName,
                                        java.lang.Class<T> clazz)
                             throws com.endeca.content.ContentException
Returns the content item property with the given name, throwing an exception if the property doesn't exist or its value is null, or if the property value is not of the required type clazz

Type Parameters:
T -
Parameters:
contentItem -
propName -
clazz - The type of the returned object
Returns:
Throws:
com.endeca.content.ContentException

getOptionalProperty

public static <T> T getOptionalProperty(com.endeca.content.ContentItem contentItem,
                                        java.lang.String propName,
                                        java.lang.Class<T> clazz)
                             throws com.endeca.content.ContentException
Returns the content item property with the given name, or null if that property doesn't exist or its value is null. Throws an exception if the property value is not of the required type clazz

Type Parameters:
T -
Parameters:
contentItem -
propName -
clazz - The type of the returned object
Returns:
Throws:
com.endeca.content.ContentException

getOptionalProperty

public static <T> T getOptionalProperty(com.endeca.content.ContentItem contentItem,
                                        java.lang.String propName,
                                        java.lang.Class<T> clazz,
                                        T defaultVal)
                             throws com.endeca.content.ContentException
Returns the content item property with the given name, or defaultValue if that property doesn't exist or its value is null. Throws an exception if the property value is not of the required type clazz

Type Parameters:
T -
Parameters:
contentItem -
propName -
clazz - The type of the returned object
defaultValue - The default value to return if the property or it's value is null
Returns:
Throws:
com.endeca.content.ContentException

getRequiredBooleanProperty

public static boolean getRequiredBooleanProperty(com.endeca.content.ContentItem contentItem,
                                                 java.lang.String propName)
                                          throws com.endeca.content.ContentException
Throws:
com.endeca.content.ContentException

getRequiredIntegerProperty

public static int getRequiredIntegerProperty(com.endeca.content.ContentItem contentItem,
                                             java.lang.String propName)
                                      throws com.endeca.content.ContentException
Throws:
com.endeca.content.ContentException

getRequiredStringProperty

public static java.lang.String getRequiredStringProperty(com.endeca.content.ContentItem contentItem,
                                                         java.lang.String propName)
                                                  throws com.endeca.content.ContentException
Throws:
com.endeca.content.ContentException

getRequiredContentItemProperty

public static com.endeca.content.ContentItem getRequiredContentItemProperty(com.endeca.content.ContentItem contentItem,
                                                                            java.lang.String propName)
                                                                     throws com.endeca.content.ContentException
Throws:
com.endeca.content.ContentException

getRequiredContentItemListProperty

public static java.util.List<com.endeca.content.ContentItem> getRequiredContentItemListProperty(com.endeca.content.ContentItem contentItem,
                                                                                                java.lang.String propName)
                                                                                         throws com.endeca.content.ContentException
Throws:
com.endeca.content.ContentException