public final class Choice extends AbstractChoice
Modifier and Type | Field and Description |
---|---|
private List<List<PageElement>> |
alternatives |
Constructor and Description |
---|
Choice()
Creates an empty choice
|
Choice(List<List<PageElement>> alternatives)
Creates a choice between some alternatives.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(PageTemplateVisitor visitor)
Accepts a visitor to this structure
|
void |
add(List<PageElement> alternative)
Convenience shorthand for
if (alternative!=null) alternatives().add(alternative) |
List<List<PageElement>> |
alternatives()
Returns the alternatives of this as a live reference to the alternatives of this.
|
static Choice |
createSingleton(PageElement singletonAlternative)
Creates a choice having a single alternative having a single page element
|
private static List<PageElement> |
createSingletonList(PageElement member) |
static Choice |
createSingletons(List<PageElement> alternatives)
Creates a choice in which each alternative consists of a single element
|
void |
freeze() |
List<PageElement> |
get(int index)
Convenience shorthand of
return alternatives().get(index) |
boolean |
isChoiceBetween(Class pageTemplateModelElementClass)
Answers true if this is either a choice between the given class, or between Lists of the given class
|
boolean |
isEmpty()
Returns true only if there are no alternatives in this
|
String |
toString() |
getMethod, setMethod
clone, ensureNotFrozen, isFrozen
private List<List<PageElement>> alternatives
public Choice()
public Choice(List<List<PageElement>> alternatives)
public static Choice createSingleton(PageElement singletonAlternative)
public static Choice createSingletons(List<PageElement> alternatives)
private static List<PageElement> createSingletonList(PageElement member)
public List<List<PageElement>> alternatives()
public List<PageElement> get(int index)
return alternatives().get(index)
public void add(List<PageElement> alternative)
if (alternative!=null) alternatives().add(alternative)
public boolean isEmpty()
public boolean isChoiceBetween(Class pageTemplateModelElementClass)
isChoiceBetween
in class AbstractChoice
public void freeze()
freeze
in interface com.yahoo.component.provider.Freezable
freeze
in class com.yahoo.component.provider.FreezableClass
public void accept(PageTemplateVisitor visitor)
Copyright © 2018. All rights reserved.