Example usage for java.text ChoiceFormat getFormats

List of usage examples for java.text ChoiceFormat getFormats

Introduction

In this page you can find the example usage for java.text ChoiceFormat getFormats.

Prototype

public Object[] getFormats() 

Source Link

Document

Get the formats passed in the constructor.

Usage

From source file:net.gtaun.wl.lang.BeanMessageFormat.java

/**
 * Do something TODO. //from w  ww.  j a va 2  s.  c  o m
 * <p> 
 * Details of the function. 
 * </p> 
 */
private void applyFormats(MessageFormat subFormat) {

    for (Format format : subFormat.getFormats()) {
        if (!(format instanceof ChoiceFormat)) {
            continue;
        }

        ChoiceFormat choice = (ChoiceFormat) format;
        String[] choiceFormats = (String[]) choice.getFormats();
        for (int i = 0; i < choiceFormats.length; i++) {
            String innerFormat = choiceFormats[i];
            if (innerFormat.contains("{")) {
                BeanMessageFormat recursive = new BeanMessageFormat(innerFormat, root);
                choiceFormats[i] = recursive.inner.toPattern();
            }
        }

        choice.setChoices(choice.getLimits(), choiceFormats);
    }
}

From source file:org.mypsycho.text.BeanMessageFormat.java

/**
 * Do something TODO./*from w  ww .  j  a  v a  2  s  .  c  o m*/
 * <p>
 * Details of the function.
 * </p>
 */
private void applyFormats(java.text.MessageFormat subFormat) {

    for (Format format : subFormat.getFormats()) {
        if (!(format instanceof ChoiceFormat)) {
            continue;
        }

        ChoiceFormat choice = (ChoiceFormat) format;
        String[] choiceFormats = (String[]) choice.getFormats();
        for (int i = 0; i < choiceFormats.length; i++) {
            String innerFormat = choiceFormats[i];
            if (innerFormat.contains("{")) {
                BeanMessageFormat recursive = new BeanMessageFormat(innerFormat, root);
                choiceFormats[i] = recursive.inner.toPattern();
            }
        }

        choice.setChoices(choice.getLimits(), choiceFormats);
    }
}