Package org.apache.imperius.spl.core

Examples of org.apache.imperius.spl.core.TypeInfo


   
    public boolean validate() throws SPLException
    {
        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");

        TypeInfo eType = _exp.getType();
       
        // dataType = TypeConstants.numericType;
        if (TypeResolver.isNumeric(eType) || TypeResolver.isString(eType))
        {
            _dataType.setType(TypeConstants.intType);
View Full Code Here


   
    public boolean validate() throws SPLException
    {
        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");

        TypeInfo eType = _exp.getType();
       
        // dataType = TypeConstants.numericType;
        if (TypeResolver.isNumeric(eType) || TypeResolver.isString(eType))
        {
            _dataType.setType(TypeConstants.byteType);
View Full Code Here

   
    public boolean validate() throws SPLException
    {
        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");

        TypeInfo eType = _exp.getType();
       
        // dataType = TypeConstants.numericType;
        if (TypeResolver.isNumeric(eType) || TypeResolver.isString(eType))
        {
           
View Full Code Here

   
    public boolean validate() throws SPLException
    {
        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");

        TypeInfo eType = _exp.getType();
       
        // dataType = TypeConstants.numericType;
        if (TypeResolver.isNumeric(eType) || TypeResolver.isString(eType))
        {
            _dataType.setType(TypeConstants.longType);
View Full Code Here

        // REMOVED BY NRJ
        //symTab.addCollectAnchor(this.targetClassName, qual, instanceInfoList, true);

        postCollectOperation.validate(this.targetClassName);
        TypeInfo tpe=null;
        // validate the expression
        if(postCollectOperation.isMethodOrParamExists())
        {
          tpe = postCollectOperation.getType(); // get the type
          returnClassName = targetClassName; // return type is same as the targetclass

          this._dataType.setIsArray(tpe.getIsArray());
          this._dataType.setType(tpe.getType());

        }
      }

View Full Code Here

    private void _validate() throws SPLException
    {
        boolean isArray = false;
        if (!_identTupleList.isEmpty())
        {
            TypeInfo returnType = new TypeInfoImpl(TypeConstants.referenceType,
                    _className, isArray);

            Iterator identTupleIt = _identTupleList.iterator();
            int i = 0;
            while (identTupleIt.hasNext())
            {
                if (returnType.getType() == TypeConstants.referenceType)
                {
                    String referenceTypeName = returnType
                            .getReferenceTypeName();
                    IdentPrimaryTuple ipt = (IdentPrimaryTuple) identTupleIt
                            .next();
                    if (i++ == 0)
                    {
View Full Code Here

       
      boolean typeNotEqual = false;
      for (int i = 0; i < argTypeList.size(); i++) {
        Expression exp = (Expression)pList.get(i);
        Argument arg = (Argument)argTypeList.get(i);
        TypeInfo expDataType = exp.getType();
        TypeInfo argDataType = arg.getType();
//        if (expDataType.getIsArray() != argDataType.getIsArray() ||
//            expDataType.getType() != argDataType.getType()) {
        if (expDataType.getType() != argDataType.getType()) {
          typeNotEqual = true;
          break;
        }
      }
     
View Full Code Here

            }
          boolean typeNotEqual = false;
          for (int i = 0; i < argTypeList.size(); i++) {
            Expression exp = (Expression)paramList.get(i);
            ArgumentImpl arg = (ArgumentImpl)argTypeList.get(i);
            TypeInfo expDataType = exp.getType();
            TypeInfo argDataType = arg.getType();
//            if (expDataType.getIsArray() != argDataType.getIsArray() ||
//                expDataType.getType() != argDataType.getType()) {
            if (expDataType.getType() != argDataType.getType()) {
              typeNotEqual = true;
              break;
            }
          }
          if (typeNotEqual) {
View Full Code Here

        return returnValue;
    }

  public TypeInfo validate(String classTypeOrVariableName) throws SPLException
  {
    TypeInfo typeInfo = new TypeInfoImpl();
    _classType = classTypeOrVariableName;
    // ensure symbol table is populated
    _populateSymbolTable(_classType);

    // xiping's addition to support Java overloading, 06/19/09
    // start
    Object obj = null;
   
    try {
      obj = _symbolTable.getSymbol(classTypeOrVariableName + "." + _identifier);
    } catch(SPLException splex) {
      try
      {
                obj = _symbolTable.getSymbol(classTypeOrVariableName + "." + getAccessorMethodName(_identifier, "get"));
            }
            catch(SPLException splex1)
            {
                try
                {
                    obj = _symbolTable.getSymbol(classTypeOrVariableName + "." + getAccessorMethodName(_identifier, "is"));
                }
                catch(SPLException splex2)
                {
                    throw new SPLException(
              Messages
                  .getString(
                      "SPL_SYMBOL_DOES_NOT_EXIST_EXCEPTION_MSG",
                      new Object[] { classTypeOrVariableName + "."
                          + _identifier }));
                }
            }
        }
   
    Symbol sym = null;
    if (obj instanceof Vector) { // MethodSymbol
      Collection c = (Collection) obj;
      for (Iterator it = c.iterator(); it.hasNext();) {
        sym = (Symbol) it.next();
        List aList = ((MethodSymbol)sym).getArgumentList();
     
        if (aList.size() != _paramList.size()) {
          continue;
        }
       
        boolean typeNotEqual = false;
        for (int i = 0; i < aList.size(); i++) {
          Expression exp = (Expression)_paramList.get(i);
          Argument arg = (Argument)aList.get(i);
          TypeInfo expDataType = exp.getType();
          TypeInfo argDataType = arg.getType();
//          if (expDataType.getIsArray() != argDataType.getIsArray() ||
//              expDataType.getType() != argDataType.getType()) {
          if (expDataType.getType() != argDataType.getType()) {
            typeNotEqual = true;
            break;
          }
        }
       
        if (typeNotEqual) {
          continue;
        }

        break;
      }
    } else { // PropertySymbol
      sym = (Symbol) obj;
    }

        if(_isMethod)
        {
            if(sym instanceof MethodSymbol)
            {
                typeInfo = _validateActualParameters(sym,classTypeOrVariableName);
               
            }
            else
            {
                throw new SPLException("Symbol " + _identifier + "is not a method");
            }
        }
        else
        {
            TypeInfo tp = sym.getType();
            boolean isArray = sym.isArray();
            if(_arrExp != null) // expression is like A.b[2] which means
            { // the result is not an array
                isArray = false;
            }
            String resultClass = null;
            if(TypeResolver.isReference(tp))
            {
                resultClass = sym.getReferenceTypeName();
                typeInfo.setReferenceTypeName(resultClass);
                typeInfo.setType(tp.getType());
                typeInfo.setIsArray(isArray);
            }
            else
            {
                typeInfo.setType(tp.getType());
                typeInfo.setIsArray(isArray);
            }
           
        }
   
View Full Code Here

    }

  private TypeInfo _validateActualParameters(Symbol sym,
      String classType) throws SPLException
  {
    TypeInfo returnTypeInfo = new TypeInfoImpl();
    String returnClassName = null;
    AnchorMethodInvokeAction.validateActualParameters(_symbolTable,
          classType, _identifier, _paramList);
    TypeInfo returnType = sym.getType();
    boolean isArray = sym.isArray();
    if(TypeResolver.isReference(returnType))
    {
      returnClassName = sym.getReferenceTypeName();
      returnTypeInfo.setIsArray(isArray);
      returnTypeInfo.setReferenceTypeName(returnClassName);
      returnTypeInfo.setType(returnType.getType());
     
    }
    else
    {
      returnTypeInfo.setIsArray(isArray);
      returnTypeInfo.setType(returnType.getType());
    }
    return returnTypeInfo;
   
     
   
View Full Code Here

TOP

Related Classes of org.apache.imperius.spl.core.TypeInfo

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.