Examples of TypeDescriptor


Examples of org.apache.derby.catalog.TypeDescriptor

    if (routineInfo != null)
    {
      if (methodParms != null)
        optimizeDomainValueConversion();
     
      TypeDescriptor returnType = routineInfo.getReturnType();

            // create type dependency if return type is an ANSI UDT
            if ( returnType != null ) { createTypeDependency( DataTypeDescriptor.getType( returnType ) ); }

      if ( returnType != null && !returnType.isRowMultiSet() && !returnType.isUserDefinedType() )
      {
        TypeId returnTypeId = TypeId.getBuiltInTypeId(returnType.getJDBCTypeId());

        if (returnTypeId.variableLength()) {
          // Cast the return using a cast node, but have to go
          // into the SQL domain, and back to the Java domain.

          DataTypeDescriptor returnValueDtd = new DataTypeDescriptor(
                returnTypeId,
                returnType.getPrecision(),
                returnType.getScale(),
                returnType.isNullable(),
                returnType.getMaximumWidth()
              );
             

          ValueNode returnValueToSQL = (ValueNode) getNodeFactory().getNode(
                C_NodeTypes.JAVA_TO_SQL_VALUE_NODE,
                this,
                getContextManager());

          ValueNode returnValueCastNode = (ValueNode) getNodeFactory().getNode(
                  C_NodeTypes.CAST_NODE,
                  returnValueToSQL,
                  returnValueDtd,
                  getContextManager());
                   
                    // DERBY-2972  Match the collation of the RoutineAliasInfo
                    returnValueCastNode.setCollationInfo(
                            returnType.getCollationType(),
                            StringDataValue.COLLATION_DERIVATION_IMPLICIT);


          JavaValueNode returnValueToJava = (JavaValueNode) getNodeFactory().getNode(
                    C_NodeTypes.SQL_TO_JAVA_VALUE_NODE,
                    returnValueCastNode,
                    getContextManager());
          returnValueToJava.setCollationType(returnType.getCollationType());
          return returnValueToJava.bindExpression(fromList, subqueryList, aggregateVector);
        }

      }
    }
View Full Code Here

Examples of org.apache.derby.catalog.TypeDescriptor

      signature = new JSQLType[sigParameterCount];
      for (int p = 0; p < parameterCount; p++) {

        // find the declared type.

        TypeDescriptor td = parameterTypes[p];

        TypeId typeId = TypeId.getTypeId(td);

        TypeId parameterTypeId = typeId;


        // if it's an OUT or INOUT parameter we need an array.
        int parameterMode = routineInfo.getParameterModes()[p];

        if (parameterMode != JDBC30Translation.PARAMETER_MODE_IN) {

          String arrayType;
          switch (typeId.getJDBCTypeId()) {
            case java.sql.Types.SMALLINT:
            case java.sql.Types.INTEGER:
            case java.sql.Types.BIGINT:
            case java.sql.Types.REAL:
            case java.sql.Types.DOUBLE:
              arrayType = getTypeCompiler(typeId).getCorrespondingPrimitiveTypeName().concat("[]");
              break;
            default:
              arrayType = typeId.getCorrespondingJavaTypeName().concat("[]");
              break;
          }

          typeId = TypeId.getUserDefinedTypeId(arrayType, false);
        }

        // this is the type descriptor of the require method parameter
        DataTypeDescriptor methoddtd = new DataTypeDescriptor(
            typeId,
            td.getPrecision(),
            td.getScale(),
            td.isNullable(),
            td.getMaximumWidth()
          );

        signature[p] = new JSQLType(methoddtd);

        // check parameter is a ? node for INOUT and OUT parameters.

        ValueNode sqlParamNode = null;

        if (methodParms[p] instanceof SQLToJavaValueNode) {
          SQLToJavaValueNode sql2j = (SQLToJavaValueNode) methodParms[p];
          sqlParamNode = sql2j.getSQLValueNode();
        }
        else
        {
        }

        boolean isParameterMarker = true;
        if ((sqlParamNode == null) || !sqlParamNode.requiresTypeFromContext())
        {
          if (parameterMode != JDBC30Translation.PARAMETER_MODE_IN) {
          
            throw StandardException.newException(SQLState.LANG_DB2_PARAMETER_NEEDS_MARKER,
              RoutineAliasInfo.parameterMode(parameterMode),
              routineInfo.getParameterNames()[p]);
          }
          isParameterMarker = false;
        }
        else
        {
          if (applicationParameterNumbers == null)
            applicationParameterNumbers = new int[parameterCount];
            if (sqlParamNode instanceof UnaryOperatorNode) {
              ParameterNode pn = ((UnaryOperatorNode)sqlParamNode).getParameterOperand();
              applicationParameterNumbers[p] = pn.getParameterNumber();
            } else
            applicationParameterNumbers[p] = ((ParameterNode) sqlParamNode).getParameterNumber();
        }

        // this is the SQL type of the procedure parameter.
        DataTypeDescriptor paramdtd = new DataTypeDescriptor(
          parameterTypeId,
          td.getPrecision(),
          td.getScale(),
          td.isNullable(),
          td.getMaximumWidth()
        );

        boolean needCast = false;
        if (!isParameterMarker)
        {
View Full Code Here

Examples of org.apache.derby.catalog.TypeDescriptor

     */
    public DataTypeDescriptor getDataType() throws StandardException
    {
        if ( routineInfo != null )
        {
            TypeDescriptor td = routineInfo.getReturnType();

            if ( td != null ) { return DataTypeDescriptor.getType( td ); }
        }

        return super.getDataType();
View Full Code Here

Examples of org.mvel2.ast.TypeDescriptor

      }

      return ((CharSequence) ctx).charAt((Integer) idx);
    }
    else {
      TypeDescriptor tDescr = new TypeDescriptor(expr, this.start, length, 0);
      if (tDescr.isArray()) {
        Class cls = getClassReference((Class) ctx, tDescr, variableFactory, pCtx);
        rootNode = new StaticReferenceAccessor(cls);
        return cls;
      }
View Full Code Here

Examples of org.quorum.symbols.TypeDescriptor

    public Object getRoot() {
        return QUORUM_ROOT;
    }

    private void addArrayChildren(ArrayList<Object> kids, RuntimeObject object) {
        TypeDescriptor type = object.getClazz().getType();
        if(!type.isArrayClass()) { //only mess with arrays if this is an array
            return;
        }
        Plugin arrayPlugin = this.plugins.get(ArrayPlugin.KEY);
        ArrayPluginInterface ap = (ArrayPluginInterface) arrayPlugin;
        org.quorum.plugins.ArrayInterface array = ap.getArray(object.getHashKey());
View Full Code Here

Examples of org.springframework.core.convert.TypeDescriptor

        }

        String[] parameterValue = rawParameters.get(parameterName);
        Object value = parameterValue == null ? null : parameterValue.length == 1 ? parameterValue[0] : parameterValue;

        result[i] = conversionService.convert(value, TypeDescriptor.forObject(value), new TypeDescriptor(param));
      }
    }

    return result;
  }
View Full Code Here

Examples of org.springframework.core.convert.TypeDescriptor

      Method method = invocation.getMethod();

      // Looking up the TypeDescriptor for the return type - yes, this way o.O
      MethodParameter parameter = new MethodParameter(method, -1);
      TypeDescriptor methodReturnTypeDescriptor = TypeDescriptor.nested(parameter, 0);

      Class<?> expectedReturnType = method.getReturnType();

      if (result != null && expectedReturnType.isInstance(result)) {
        return result;
View Full Code Here

Examples of org.springframework.core.convert.TypeDescriptor

    }

    @Override
    public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
        try {
            TypeDescriptor generic = getGenericType(getResolvableType(targetType));
            return this.conversionService.canConvert(sourceType, generic);
        } catch (Exception e) {
            e.printStackTrace()//TODO: implement catch
        }
        return false;
View Full Code Here

Examples of org.springframework.core.convert.TypeDescriptor

        if (source == null) {
            return null;
        }
        try {
            ResolvableType tgtResolvableType = getResolvableType(targetType);
            TypeDescriptor typeDescriptor = getGenericType(tgtResolvableType);
            //TODO: discover propName
            String propName = "hello.defaultMessage";
            //TODO: discover defaultValue
            Object defaultValue = conversionService.convert(source, sourceType, typeDescriptor);
            return new DynamicProp(propName, defaultValue);
View Full Code Here

Examples of org.springsource.loaded.TypeDescriptor

  @Test
  public void rewrite() throws Exception {
    TypeRegistry typeRegistry = getTypeRegistry("catchers.B");
    loadClass("catchers.A");
    TypeDescriptor typeDescriptor = typeRegistry.getExtractor().extract(loadBytesForClass("catchers.B"), true);
    checkDoesNotContain(typeDescriptor, "privateMethod");
    checkDoesContain(typeDescriptor, "0x1 publicMethod");
    checkDoesContain(typeDescriptor, "0x1 protectedMethod");
    checkDoesContain(typeDescriptor, "0x1 defaultMethod");
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.