private SoyMsgPart compactPlaceholder(SoyMsgPlaceholderPart part) { return new SoyMsgPlaceholderPart( intern(part.getPlaceholderName()), /* placeholderExample=*/ null); }
private SoyMsgPart compactPlaceholder(SoyMsgPlaceholderPart part) { return new SoyMsgPlaceholderPart( intern(part.getPlaceholderName()), /* placeholderExample=*/ null); }
/** * Compacts a single message part. * * <p>If the part is a plural/select part, it might be expanded into multiple parts. */ private SoyMsgPart compactPart(SoyMsgPart part) { if (part instanceof SoyMsgPluralPart) { part = compactPlural((SoyMsgPluralPart) part); } else if (part instanceof SoyMsgSelectPart) { part = compactSelect((SoyMsgSelectPart) part); } else if (part instanceof SoyMsgPlaceholderPart) { part = compactPlaceholder((SoyMsgPlaceholderPart) part); } // Now intern the message part. return intern(part); }
private SoyMsgPart compactSelect(SoyMsgSelectPart select) { // TODO: Turn into a non-select message if there's only one unique case. // Select variable names tend to be repeated across many templates, like "gender". return new SoyMsgSelectPart( intern(select.getSelectVarName()), compactCases(select.getCases(), DEFAULT_SELECT_CASE_SPEC)); }
/** * Compacts a single message part. * * <p>If the part is a plural/select part, it might be expanded into multiple parts. */ private SoyMsgPart compactPart(SoyMsgPart part) { if (part instanceof SoyMsgPluralPart) { part = compactPlural((SoyMsgPluralPart) part); } else if (part instanceof SoyMsgSelectPart) { part = compactSelect((SoyMsgSelectPart) part); } else if (part instanceof SoyMsgPlaceholderPart) { part = compactPlaceholder((SoyMsgPlaceholderPart) part); } // Now intern the message part. return intern(part); }
private SoyMsgPart compactSelect(SoyMsgSelectPart select) { // TODO: Turn into a non-select message if there's only one unique case. // Select variable names tend to be repeated across many templates, like "gender". return new SoyMsgSelectPart( intern(select.getSelectVarName()), compactCases(select.getCases(), DEFAULT_SELECT_CASE_SPEC)); }
private SoyMsgPart compactPlural(SoyMsgPluralPart plural) { // Plural variable names tend to be repeated across templates, such as "count". return new SoyMsgPluralPart( intern(plural.getPluralVarName()), plural.getOffset(), compactCases(plural.getCases(), DEFAULT_PLURAL_CASE_SPEC)); }
private SoyMsgPart compactPlural(SoyMsgPluralPart plural) { // Plural variable names tend to be repeated across templates, such as "count". return new SoyMsgPluralPart( intern(plural.getPluralVarName()), plural.getOffset(), compactCases(plural.getCases(), DEFAULT_PLURAL_CASE_SPEC)); }
caseAndValue.spec() != null ? intern(caseAndValue.spec()) : null, compactParts(caseAndValue.parts())));
caseAndValue.spec() != null ? intern(caseAndValue.spec()) : null, compactParts(caseAndValue.parts())));