Package com.google.gwt.i18n.client.Messages

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


    }
    Annotation[][] paramsAnnotations = method.getParameterAnnotations();
    Class<?>[] paramTypes = method.getParameterTypes();
    for (int i = 0; i < paramTypes.length; i++) {
      Class<?> paramType = paramTypes[i];
      PluralCount pc = getAnnotation(paramsAnnotations[i], PluralCount.class);
      if (pc == null) {
        continue;
      } else if (pc.value() != PluralRule.class) {
        //user plural rule is not supported
      } else {
        // manage plural text
        int n = -1;
        if (isA(paramType, Number.class)
View Full Code Here

    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

    int numParams = params.length;
    int lastPluralArgNumber = -1;
    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

    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

  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

        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

        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

    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

    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

TOP

Related Classes of com.google.gwt.i18n.client.Messages.PluralCount

Copyright © 2018 www.massapicom. 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.