Examples of PluralCount


Examples of com.google.gwt.i18n.client.Messages.PluralCount

    int numParams = params.length;
    boolean[] seenFlags = new boolean[numParams];

    // See if any parameter is tagged as a PluralCount parameter.
    for (int i = 0; i < numParams; ++i) {
      PluralCount pluralCount = params[i].getAnnotation(PluralCount.class);
      if (pluralCount != null) {
        if (pluralParamIndex >= 0) {
          throw error(logger, m.getName()
              + ": there can only be one PluralCount parameter");
        }
        JPrimitiveType primType = params[i].getType().isPrimitive();
        if (primType != JPrimitiveType.INT && primType != JPrimitiveType.SHORT) {
          throw error(logger, m.getName()
              + ": PluralCount parameter must be int or short");
        }
        pluralParamIndex = i;
        ruleClass = pluralCount.value();
      }
    }

    StringBuffer generated = new StringBuffer();
    if (ruleClass == null) {
View Full Code Here

Examples of com.google.gwt.i18n.client.Messages.PluralCount

      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < annotations.length; i++) {
         Annotation[] childArray = annotations[i];
         for (int j = 0; j < childArray.length; j++) {
            if (PluralCount.class.isAssignableFrom(childArray[j].getClass())) {
               PluralCount pluralCount = (PluralCount) childArray[j];
               Class<? extends PluralRule> pluralRuleClass = pluralCount.value();
               int count = (Integer) args[i];

               String pluralRuleClassName = pluralRuleClass != PluralRule.class
                        ? pluralRuleClass.getName() : DefaultRule.class.getName();
               pluralRuleClassName += "_" + locale.getLanguage();
View Full Code Here

Examples of com.google.gwt.i18n.client.Messages.PluralCount

   
    public PluralFormSelector(TreeLogger logger, JMethod method, int argNumber,
        JParameter[] params, GwtLocale locale)
        throws UnableToCompleteException {
      super(logger, argNumber, params);
      PluralCount pluralCount = params[argNumber].getAnnotation(
          PluralCount.class);
      Class<? extends PluralRule> ruleClass = pluralCount.value();
      if (ruleClass == PluralRule.class) {
        ruleClass = DefaultRule.class;
      }
      pluralRule = createLocalizedPluralRule(logger,
          method.getEnclosingType().getOracle(), ruleClass, locale);
View Full Code Here

Examples of com.google.gwt.i18n.client.Messages.PluralCount

        ArgumentInfo argInfo = entry.addArgument(param.getName());
        Optional optional = param.getAnnotation(Optional.class);
        if (optional != null) {
          argInfo.optional = true;
        }
        PluralCount pluralCount = param.getAnnotation(PluralCount.class);
        if (pluralCount != null) {
          argInfo.isPluralCount = true;
        }
        Example example = param.getAnnotation(Example.class);
        if (example != null) {
View Full Code Here

Examples of com.google.gwt.i18n.client.Messages.PluralCount

    int numParams = params.length;
    List<AlternateFormSelector> selectors = new ArrayList<AlternateFormSelector>();
    // See if any parameter is tagged as a PluralCount or Select parameter.
    for (int i = 0; i < numParams; ++i) {
      PluralCount pluralCount = params[i].getAnnotation(PluralCount.class);
      Select select = params[i].getAnnotation(Select.class);
      if (pluralCount != null && select != null) {
        throw error(logger, params[i].getName() + " cannot be both @PluralCount"
            + " and @Select");
      }
View Full Code Here

Examples of com.google.gwt.i18n.client.Messages.PluralCount

  public boolean isAnnotationPresent(Class<? extends Annotation> annotClass) {
    return getAnnotation(annotClass) != null;
  }

  private AlternateMessageSelector computeAlternateMessageSelector() {
    PluralCount pluralAnnot = getAnnotation(PluralCount.class);
    if (pluralAnnot != null) {
      Class<? extends PluralRule> pluralClass = pluralAnnot.value();
      // TODO(jat): this seems redundant with other processing
      DefaultLocale defLocaleAnnot = getAnnotation(
          DefaultLocale.class);
      String defaultLocale = null;
      if (defLocaleAnnot != null) {
View Full Code Here

Examples of com.google.gwt.i18n.client.Messages.PluralCount

        ArgumentInfo argInfo = entry.addArgument(param.getName());
        Optional optional = param.getAnnotation(Optional.class);
        if (optional != null) {
          argInfo.optional = true;
        }
        PluralCount pluralCount = param.getAnnotation(PluralCount.class);
        if (pluralCount != null) {
          argInfo.isPluralCount = true;
        }
        Example example = param.getAnnotation(Example.class);
        if (example != null) {
View Full Code Here

Examples of com.google.gwt.i18n.client.Messages.PluralCount

    int numParams = params.length;
    boolean[] seenFlags = new boolean[numParams];

    // See if any parameter is tagged as a PluralCount parameter.
    for (int i = 0; i < numParams; ++i) {
      PluralCount pluralCount = params[i].getAnnotation(PluralCount.class);
      if (pluralCount != null) {
        if (pluralParamIndex >= 0) {
          throw error(logger, m.getName()
              + ": there can only be one PluralCount parameter");
        }
        JPrimitiveType primType = params[i].getType().isPrimitive();
        if (primType != JPrimitiveType.INT && primType != JPrimitiveType.SHORT) {
          throw error(logger, m.getName()
              + ": PluralCount parameter must be int or short");
        }
        pluralParamIndex = i;
        ruleClass = pluralCount.value();
      }
    }

    StringBuffer generated = new StringBuffer();
    if (ruleClass == null) {
View Full Code Here

Examples of com.google.gwt.i18n.client.Messages.PluralCount

                                || short.class.isAssignableFrom(type)
                                || Short.class.isAssignableFrom(type))) {
                    Number num = (Number) args[i];
                    Plural plural;
                    // Check for a custom plural rule.
                    PluralCount pc = (PluralCount) annotation;
                    Class<? extends PluralRule> pluralRuleClass = pc.value();
                    if(!pluralRuleClass.isInterface() && PluralRule.class.isAssignableFrom(pluralRuleClass)) {
                        PluralRule customRule = this.instantiateCustomPluralRuleClass(pluralRuleClass);
                        plural = CustomPlural.fromNumber(customRule, num.intValue());
                    } else {
                        plural = GwtPlural.fromNumber(this.pluralRules, num.doubleValue());
View Full Code Here

Examples of com.google.gwt.i18n.client.Messages.PluralCount

        ArgumentInfo argInfo = entry.addArgument(param.getName());
        Optional optional = param.getAnnotation(Optional.class);
        if (optional != null) {
          argInfo.optional = true;
        }
        PluralCount pluralCount = param.getAnnotation(PluralCount.class);
        if (pluralCount != null) {
          argInfo.isPluralCount = true;
        }
        Example example = param.getAnnotation(Example.class);
        if (example != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.