Package com.google.gxp.compiler.base

Examples of com.google.gxp.compiler.base.Parameter


        Set<String> allowedAttributes) {

      Set<String> foundAttributes = Sets.newHashSet();

      for (String attrBundle : attributeBundles) {
        Parameter parameter = template.getParameterByPrimary(attrBundle);
        if (parameter == null || !(parameter.getType() instanceof BundleType)) {
          alertSink.add(new InvalidAttrBundleError(node, attrBundle));
          continue;
        }

        for (Map.Entry<String, AttributeValidator> attr :
                 ((BundleType) parameter.getType()).getAttrMap().entrySet()) {

          AttributeValidator validator = validatorMap.get(attr.getKey());
          if (validator == null) {
            // no validator match, so we either already have seen this
            // attribute or this attribute isn't allowed at all
            if (allowedAttributes.contains(attr.getKey())) {
              alertSink.add(new DuplicateAttributeError(node, attrBundle,
                                                        attr.getKey()));
            } else {
              alertSink.add(new UnknownAttributeError(node, attr.getKey()));
            }
          } else if (!validator.equals(attr.getValue())) {
            alertSink.add(new MismatchedAttributeValidatorsError(
                              node, attr.getKey(), parameter.getPrimaryName()));
          } else {
            foundAttributes.add(attr.getKey());
          }
        }
      }
View Full Code Here


        Iterator<FormalParameter> interfaceParams = implementable.getParameters().iterator();
        Iterator<Parameter> templateParams = template.getParameters().iterator();
        while (interfaceParams.hasNext()) {
          FormalParameter interfaceParam = interfaceParams.next();
          if (!Implementable.INSTANCE_PARAM_NAME.equals(interfaceParam.getPrimaryName())) {
            Parameter templateParam = templateParams.next();

            if (!interfaceParam.getPrimaryName().equals(templateParam.getPrimaryName())) {
              alertSink.add(new ParamNameMismatchError(bid, interfaceParam, templateParam));
              continue;
            }

            if (!interfaceParam.getType().matches(templateParam.getType())) {
              alertSink.add(new ParamTypeMismatchError(bid, interfaceParam, templateParam));
              continue;
            }

            if (interfaceParam.hasDefault() && templateParam.getDefaultValue() == null) {
              alertSink.add(new ParamDefaultMismatchError(templateParam));
            }

            if (interfaceParam.hasConstructor() && templateParam.getConstructor() == null) {
              alertSink.add(new ParamConstructorMismatchError(templateParam));
            }
          }
        }
      }
View Full Code Here

                         List<ThrowsDeclaration> throwsDeclarations,
                         List<Parameter> parameters,
                         List<FormalTypeParameter> formalTypeParameters) {
    TemplateName name = fqTemplateName(dottedName);
    List<Parameter> params = Lists.newArrayList(parameters);
    params.add(new Parameter(new FormalParameter(pos,
                                                 Implementable.INSTANCE_PARAM_NAME,
                                                 Implementable.INSTANCE_PARAM_NAME,
                                                 new TemplateType(pos, name.toString(), name))));

    return new Interface(pos, "<gxp:interface>", fqTemplateName(dottedName),
View Full Code Here

                         Expression defaultValue) {
    Type type = nativeType(pos(), typeStr);
    FormalParameter formal = new FormalParameter(pos(), "<gxp:param>", name, false, type,
                                                 defaultValue, false, null, null, false,
                                                 SpaceOperatorSet.NULL);
    return new Parameter(formal, Collections.<JavaAnnotation>emptyList(),
                         defaultValue, false, null, false, str(""));
  }
View Full Code Here

      FormalParameter formal = new FormalParameter(node.getSourcePosition(),
                                                   Implementable.INSTANCE_PARAM_NAME,
                                                   Implementable.INSTANCE_PARAM_NAME,
                                                   new TemplateType(node.getSourcePosition(),
                                                                    name.toString(), name));
      parameters.add(new Parameter(formal));

      List<JavaAnnotation> javaAnnotations =
          getJavaAnnotations(node, JavaAnnotation.Element.INTERFACE);
      List<Import> imports = nodeParts.getImports();
      List<ThrowsDeclaration> throwsDeclarations = nodeParts.getThrowsDeclarations();
View Full Code Here

      if (name != null) {
        FormalParameter formal = new FormalParameter(node, name, consumesContent, type,
                                                     defaultValue, hasDefaultFlag, regex,
                                                     constructor, hasConstructorFlag,
                                                     spaceOperators);
        output.accumulate(new Parameter(formal, javaAnnotations, defaultValue, hasDefaultFlag,
                                        constructor, hasConstructorFlag, comment));
      }
      return null;
    }
View Full Code Here

    Import node = injectImport("com.google.Foo");
    expectedAlerts.add(new BadNodePlacementError(node, FROM_NODE));
  }

  private Parameter injectParameter() {
    Parameter node = param("hello", "world", null);
    parts.accumulate(node);
    return node;
  }
View Full Code Here

    parts.accumulate(node);
    return node;
  }

  public void testWithParameters() {
    Parameter node = injectParameter();
    assertContentsInOrder(parts.getParameters(), node);
  }
View Full Code Here

    Parameter node = injectParameter();
    assertContentsInOrder(parts.getParameters(), node);
  }

  public void testUnusedParameters() {
    Parameter node = injectParameter();
    expectedAlerts.add(new BadNodePlacementError(node, FROM_NODE));
  }
View Full Code Here

      FormalParameter formal = new FormalParameter(node.getSourcePosition(),
                                                   Implementable.INSTANCE_PARAM_NAME,
                                                   Implementable.INSTANCE_PARAM_NAME,
                                                   new TemplateType(node.getSourcePosition(),
                                                                    name.toString(), name));
      parameters.add(new Parameter(formal));

      List<JavaAnnotation> javaAnnotations =
          getJavaAnnotations(node, JavaAnnotation.Element.INTERFACE);
      List<Import> imports = nodeParts.getImports();
      List<ThrowsDeclaration> throwsDeclarations = nodeParts.getThrowsDeclarations();
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.base.Parameter

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.