private static SoyMsgPluralPart buildMsgPartForPlural ( MsgPluralNode msgPluralNode , MsgNode msgNode ) { // This is the list of the cases. ImmutableList . Builder < SoyMsgPart . Case < SoyMsgPluralCaseSpec >> pluralCases = ImmutableList . builder ( ) ; for ( CaseOrDefaultNode child : msgPluralNode . getChildren ( ) ) { ImmutableList < SoyMsgPart > caseMsgParts = buildMsgPartsForChildren ( ( MsgBlockNode ) child , msgNode ) ; SoyMsgPluralCaseSpec caseSpec ; if ( child instanceof MsgPluralCaseNode ) { caseSpec = new SoyMsgPluralCaseSpec ( ( ( MsgPluralCaseNode ) child ) . getCaseNumber ( ) ) ; } else if ( child instanceof MsgPluralDefaultNode ) { caseSpec = new SoyMsgPluralCaseSpec ( Type . OTHER ) ; } else { throw new AssertionError ( "Unidentified node under a plural node." ) ; } pluralCases . add ( SoyMsgPart . Case . create ( caseSpec , caseMsgParts ) ) ; } return new SoyMsgPluralPart ( msgNode . getPluralVarName ( msgPluralNode ) , msgPluralNode . getOffset ( ) , pluralCases . build ( ) ) ; }
Builds the list of SoyMsgParts for the given MsgPluralNode .