Class MapChoice

  • All Implemented Interfaces:
    com.yahoo.component.provider.Freezable, PageElement

    public class MapChoice
    extends AbstractChoice
    A choice between different possible mapping functions of a set of values to a set of placeholder ids. A resolution of this choice consists of choosing a unique value for each placeholder id (hence a map choice is valid iff there are at least as many values as placeholder ids).

    Each unique set of mappings (pairs) from values to placeholder ids is a separate possible alternative of this choice. The alternatives are not listed explicitly but are generated as needed.

    Author:
    bratseth
    • Constructor Summary

      Constructors 
      Constructor Description
      MapChoice()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(PageTemplateVisitor visitor)
      Accepts a visitor to this structure
      void freeze()  
      boolean isChoiceBetween​(java.lang.Class pageTemplateModelElementClass)
      Returns true if this choice is (partially or completely) a choice between the given type
      java.util.List<java.lang.String> placeholderIds()
      Returns the placeholder ids (the "to" of the mapping) of this as a live reference which can be modified unless this is frozen.
      java.lang.String toString()  
      java.util.List<java.util.List<PageElement>> values()
      Returns the values (the "from" of the mapping) of this as a live reference which can be modified unless this is frozen.
      • Methods inherited from class com.yahoo.component.provider.FreezableClass

        clone, ensureNotFrozen, isFrozen
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface com.yahoo.component.provider.Freezable

        isFrozen
    • Constructor Detail

      • MapChoice

        public MapChoice()
    • Method Detail

      • isChoiceBetween

        public boolean isChoiceBetween​(java.lang.Class pageTemplateModelElementClass)
        Description copied from class: AbstractChoice
        Returns true if this choice is (partially or completely) a choice between the given type
        Specified by:
        isChoiceBetween in class AbstractChoice
      • placeholderIds

        public java.util.List<java.lang.String> placeholderIds()
        Returns the placeholder ids (the "to" of the mapping) of this as a live reference which can be modified unless this is frozen.
      • values

        public java.util.List<java.util.List<PageElement>> values()
        Returns the values (the "from" of the mapping) of this as a live reference which can be modified unless this is frozen. Note that each single choice of values within this is also a list of values. This is the inner list.
      • freeze

        public void freeze()
        Specified by:
        freeze in interface com.yahoo.component.provider.Freezable
        Overrides:
        freeze in class com.yahoo.component.provider.FreezableClass
      • accept

        public void accept​(PageTemplateVisitor visitor)
        Accepts a visitor to this structure
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object