Examples of TypeRef


Examples of org.apache.etch.compiler.ast.TypeRef

  }

  public String getValidator(Service service, Named<?> named) {
    if (named instanceof Parameter) {
      Parameter param = (Parameter) named;
      TypeRef type = param.type();

      if (type.isBuiltin())
        return String.format("(etch_object*)etchvtor_%s_get( %d )", getValidatorStringForParam(param),
            type.dim());

      Named<?> n = type.getNamed(type.intf());

      if (n.isBuiltin()) {
        Builtin b = (Builtin) n;
        String cn = b.className();

        int i = cn.indexOf('<');
        if (i >= 0)
          cn = cn.substring(0, i);
       
        String classid = getClassIDBuiltin(b);
        String messagetype = getMessageTypeBuiltin(b);
        return String.format(
            "(etch_object*)etchvtor_custom_get(%s, CLASSID_%s, builtins._mt_%s,%d)",
              getEtchTypeForBuiltin(b),classid, messagetype, getDimensionForBuiltin(b));
      }


      if (n.isStruct() || n.isExcept() || n.isEnumx())
        return String.format(
            "(etch_object*)etchvtor_custom_get(ETCHTYPEB_USER, get_dynamic_classid_unique(&CLASSID_%s), %s_valufact_get_static()->_mt_%s, %d)",
                 n.efqname(this).toUpperCase(), getDefiningServiceNameOf(type), n.efqname(this), type.dim());

      if (n.isExtern())
      {
        Assertion.check(false,"extern type not supported for " + n );
      }
View Full Code Here

Examples of org.apache.etch.compiler.ast.TypeRef

    addBuiltin( service, newName( "Set" ), "etch_set", true );
    addBuiltin(service, newName("Datetime"), "etch_date", false);
  }

  public String getValidatorStringForParam(Parameter param) {
    TypeRef type = param.type();
    return getValidatorStringForParam(type);
  }
View Full Code Here

Examples of org.apache.etch.compiler.ast.TypeRef

  public String getValidator( Named<?> named )
  {
    if (named instanceof Parameter)
    {
      Parameter param = (Parameter) named;
      TypeRef type = param.type();

      if (type.isBuiltin())
        return String.format( "Validator_%s.get( %d )",
          type.type(), type.dim() );

      Named<?> n = type.getNamed( type.intf() );

      if (n.isBuiltin())
      {
        Builtin b = (Builtin) n;
        String cn = b.className();
       
        int i = cn.indexOf( '<' );
        if (i >= 0)
          cn = cn.substring( 0, i );
       
        return String.format( "Validator_custom.get( %s.class, %d, %s )",
          cn, type.dim(), b.allowSubclass() );
      }

      // Allow subclassing for etch defined structs and externs.

      if (n.isStruct() || n.isExcept())
        return String.format( "Validator_custom.get( %s.class, %d, true )",
          n.efqname( this ), type.dim() );

      // Don't allow subclassing for externs or etch defined enums.

      if (!(n.isExtern() || n.isEnumx()))
        Assertion.check( n.isExtern() || n.isEnumx(),
          "n.isExtern() || n.isEnumx(): "+n );

      return String.format( "Validator_custom.get( %s.class, %d, false )",
        n.efqname( this ), type.dim() );
    }

    if (named instanceof Thrown)
    {
      Thrown thrown = (Thrown) named;
View Full Code Here

Examples of org.apache.etch.compiler.ast.TypeRef

  public String getValidator( Named<?> named )
  {
    if (named instanceof Parameter)
    {
      Parameter param = (Parameter) named;
      TypeRef type = param.type();

      if (type.isBuiltin())
        return String.format( "Validator_%s.get( %d )",
          type.type(), type.dim() );

      Named<?> n = type.getNamed( type.intf() );

      if (n.isBuiltin())
      {
        Builtin b = (Builtin) n;
        String cn = b.className();
       
        int i = cn.indexOf( '<' );
        if (i >= 0)
          cn = cn.substring( 0, i );
       
        return String.format( "Validator_custom.get( %s.class, %d, %s )",
          cn, type.dim(), b.allowSubclass() );
      }

      // Allow subclassing for etch defined structs and externs.

      if (n.isStruct() || n.isExcept())
        return String.format( "Validator_custom.get( %s.class, %d, true )",
          n.efqname( this ), type.dim() );

      // Don't allow subclassing for externs or etch defined enums.

      if (!(n.isExtern() || n.isEnumx()))
        Assertion.check( n.isExtern() || n.isEnumx(),
          "n.isExtern() || n.isEnumx(): "+n );

      return String.format( "Validator_custom.get( %s.class, %d, false )",
        n.efqname( this ), type.dim() );
    }

    if (named instanceof Thrown)
    {
      Thrown thrown = (Thrown) named;
View Full Code Here

Examples of org.jvnet.sorcerer.Tag.TypeRef

                        switch (e.getKind()) {
                        case ANNOTATION_TYPE:
                        case CLASS:
                        case ENUM:
                        case INTERFACE:
                            gen.add(new TypeRef(cu,srcPos,id,(TypeElement)e));
                            break;
                        case FIELD: // such as objects imported by static import.
                        case ENUM_CONSTANT:
                            gen.add(new FieldRef(cu,srcPos,id,(VariableElement)e));
                            break;
                        case PARAMETER:
                        case EXCEPTION_PARAMETER:
                        case LOCAL_VARIABLE:
                            gen.add(new LocalVarRef(cu,srcPos,id,(VariableElement)e));
                            break;
                        }
                    }
                }

                return super.visitIdentifier(id,_);
            }

            /**
             * "exp.token"
             */
            public Void visitMemberSelect(MemberSelectTree mst, Void _) {
                // avoid marking 'Foo.class' as static reference
                if(!mst.getIdentifier().equals(CLASS)) {
                    // just select the 'token' portion
                    long ep = srcPos.getEndPosition(cu,mst);
                    long sp = ep-mst.getIdentifier().length();

                    // marker for the selected identifier
                    Element e = TreeUtil.getElement(mst);
                    if(e!=null) {
                        switch(e.getKind()) {
                        case FIELD:
                        case ENUM_CONSTANT:
                            gen.add(new FieldRef(sp, ep, PositionUtils.getLineNumber(lineMap, sp), PositionUtils.getColNumber(lineMap, sp), (VariableElement)e));
                            break;

                        // these show up in the import statement
                        case ANNOTATION_TYPE:
                        case CLASS:
                        case ENUM:
                        case INTERFACE:
                            gen.add(new TypeRef(sp, ep, PositionUtils.getLineNumber(lineMap, sp), PositionUtils.getLineNumber(lineMap, sp), (TypeElement)e));
                            break;
                        }
                    }
                }

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.