com.atlassian.confluence.api.model.reference
Class BuilderUtils

java.lang.Object
  extended by com.atlassian.confluence.api.model.reference.BuilderUtils

public class BuilderUtils
extends java.lang.Object

A wrapper around ImmutableList builder that produces immutable lists if elements are added to the builder or a collapsed list otherwise.


Constructor Summary
BuilderUtils()
           
 
Method Summary
static
<K,V> java.util.Map<K,V>
collapsedMap()
           
static
<K,V> java.util.Map<K,V>
collapsedMap(Navigation.Builder navBuilder)
           
static
<T> PageResponse<T>
collapsedPageResponse(Navigation.Builder navBuilder)
           
static
<T> java.util.List<T>
immutableListOrCollapsed(com.google.common.collect.ImmutableList.Builder<T> builder)
           
static
<K,V> java.util.Map<K,V>
modelMap(java.util.Map<K,V> map)
          All API Model maps must be Immutable and either: 1.
static
<K,V> java.util.Map<K,V>
modelMap(ModelMapBuilder<K,V> mapBuilder)
          All API Model maps must be Immutable and either: 1.
static
<T> com.google.common.collect.ImmutableList.Builder<T>
safelyAddAllToBuilder(com.google.common.collect.ImmutableList.Builder<T> listBuilder, java.lang.Iterable<T> toAdd)
           
static
<K,V> com.google.common.collect.ImmutableMap.Builder<K,V>
safelyPutAllToBuilder(com.google.common.collect.ImmutableMap.Builder<K,V> mapBuilder, java.util.Map<K,V> toAdd)
          Deprecated. since 5.5.1 Use a ModelMapBuilder.
static
<K,V> com.google.common.collect.ImmutableMap.Builder<K,V>
safelyPutToBuilder(com.google.common.collect.ImmutableMap.Builder<K,V> mapBuilder, K key, V value)
          Deprecated. since 5.5.1 Use a ModelMapBuilder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuilderUtils

public BuilderUtils()
Method Detail

immutableListOrCollapsed

public static <T> java.util.List<T> immutableListOrCollapsed(com.google.common.collect.ImmutableList.Builder<T> builder)

collapsedPageResponse

public static <T> PageResponse<T> collapsedPageResponse(Navigation.Builder navBuilder)

collapsedMap

public static <K,V> java.util.Map<K,V> collapsedMap()

collapsedMap

public static <K,V> java.util.Map<K,V> collapsedMap(Navigation.Builder navBuilder)

modelMap

public static <K,V> java.util.Map<K,V> modelMap(ModelMapBuilder<K,V> mapBuilder)
All API Model maps must be Immutable and either: 1. Collapsed if null, or 2. RestEnrichable This method *must* be called when assigning to a model map from a map builder. It is guaranteed to create a correct map from any input.

Returns:
an immutable, API model-friendly map

modelMap

public static <K,V> java.util.Map<K,V> modelMap(java.util.Map<K,V> map)
All API Model maps must be Immutable and either: 1. Collapsed if null, or 2. RestEnrichable This method *must* be called when assigning to a model map. It is guaranteed to create a correct map from any input.

Returns:
an immutable, API model-friendly map

safelyPutToBuilder

@Deprecated
public static <K,V> com.google.common.collect.ImmutableMap.Builder<K,V> safelyPutToBuilder(com.google.common.collect.ImmutableMap.Builder<K,V> mapBuilder,
                                                                                                      K key,
                                                                                                      V value)
Deprecated. since 5.5.1 Use a ModelMapBuilder.


safelyPutAllToBuilder

@Deprecated
public static <K,V> com.google.common.collect.ImmutableMap.Builder<K,V> safelyPutAllToBuilder(com.google.common.collect.ImmutableMap.Builder<K,V> mapBuilder,
                                                                                                         java.util.Map<K,V> toAdd)
Deprecated. since 5.5.1 Use a ModelMapBuilder.


safelyAddAllToBuilder

public static <T> com.google.common.collect.ImmutableList.Builder<T> safelyAddAllToBuilder(com.google.common.collect.ImmutableList.Builder<T> listBuilder,
                                                                                           java.lang.Iterable<T> toAdd)


Copyright © 2003-2014 Atlassian. All Rights Reserved.