Package nexj.core.meta

Examples of nexj.core.meta.Primitive


      }
      else if (type.isPrimitive())
      {
         ConversionMapper mapper = null;
         UnaryDescriptor descriptor = null;
         Primitive resultType = null;

         if (m_source != null)
         {
            mapper = m_source.getAdapter().getConversionMapper();
            descriptor = mapper.getUnaryDescriptor(this);
View Full Code Here


         for (int i = 0; m_markArray[i] > -1; i += MARKER_META_SIZE)
         {
            int nParamID = m_markArray[i + MARKER_ID];
            int nMarkerOffset = m_markArray[i + MARKER_OFFSET];
            int nArgOffset = nParamID * PARAM_META_SIZE;
            Primitive type;

            if (m_paramArray.length < nArgOffset + PARAM_META_SIZE ||
                (type = (Primitive)m_paramArray[nArgOffset + PARAM_TYPE]) == null)
            {
               throw new SQLException("Parameter " + (nParamID + 1) + " not set.");
View Full Code Here

       * @see java.sql.PreparedStatement#setObject(int, java.lang.Object)
       */
      public void setObject(int nParameterIndex, Object obj) throws SQLException
      {
         int nOffset = initParam(nParameterIndex);
         Primitive type = Primitive.primitiveOf(obj);

         // hopefully type doesn't matter for null
         m_paramArray[nOffset + PARAM_TYPE] = (type == null) ? Primitive.ANY : type;
         m_paramArray[nOffset + PARAM_VALUE] = obj;
      }
View Full Code Here

            {
               throw new TypeMismatchException(getSymbol());
            }
         }

         Primitive rightPrimitive = (Primitive)rightType;

         if (mapper.getType(rightPrimitive) != mapper.getType(descriptor.getRightType()))
         {
            setRight(new TypeConversionOperator(descriptor.getRightType(), m_right));
            m_right = m_right.normalize(nFlags | NORMALIZE_NORECUR);
         }

         Primitive leftPrimitive = (Primitive)leftType;

         if (mapper.getType(leftPrimitive) != mapper.getType(descriptor.getLeftType()))
         {
            if (m_right.isConstant() && Primitive.isOrderPreserved(leftPrimitive, descriptor.getLeftType()))
            {
View Full Code Here

            if (!fromType.isPrimitive())
            {
               throw new TypeMismatchException(getSymbol());
            }

            Primitive toType = m_argTypeArray[i];

            if (toType != fromType)
            {
               if (toType.findStrictConverter((Primitive)fromType) == null)
               {
                  throw new TypeMismatchException(getSymbol());
               }

               op = new TypeConversionOperator(toType, op);
View Full Code Here

         {
            setSource(findCommonSource(m_left, m_right), nFlags);

            ConversionMapper mapper = null;
            BinaryDescriptor descriptor = null;
            Primitive resultType = null;

            if (m_source != null)
            {
               mapper = m_source.getAdapter().getConversionMapper();
               descriptor = mapper.getBinaryDescriptor(this);
View Full Code Here

         {
            foldObjectIn(first);
            return this;
         }

         Primitive firstType = (Primitive)type;
         boolean bNull = false;

         for (int i = 1; i < m_nOperandCount; ++i)
         {
            Operator op = m_operandArray[i];

            if (!op.isConstant() || op.getType() != null && !op.getType().isPrimitive())
            {
               throw new InvalidQueryException("err.persistence.variableInList");
            }

            Primitive opType = (Primitive)op.getType();

            if (firstType.findEQFunction(opType) == null)
            {
               throw new TypeMismatchException(getSymbol());
            }
View Full Code Here

      Object firstValue = first.getValue();
      Type type = first.getType();

      if (type.isPrimitive())
      {
         Primitive primitiveType = (Primitive)type;
         BinaryFunction f = primitiveType.getEQFunction(primitiveType);

         for (int i = 1; i < m_nOperandCount; ++i)
         {
            if (((Boolean)f.invoke(firstValue, m_operandArray[i].getValue())).booleanValue())
            {
View Full Code Here

                     Object oldValue = instance.getNewValueDirect(lockingAttribute.getOrdinal());

                     if (oldValue != Undefined.VALUE)
                     {
                        // Check the old lock value
                        Primitive primitive = (Primitive)lockingAttribute.getType();
                        Object value = getValue(lockingField);

                        if (((Boolean)primitive.findNEFunction(primitive).invoke(oldValue, value)).booleanValue())
                        {
                           // The lock values do not match
                           // If the instance is dirty/deleted or share-locked, throw an exception
                           if (!bOverwrite || ref.isLocked())
                           {
View Full Code Here

         while ((zipEntry = zipStream.getNextEntry()) != null)
         {
            String sKeySize = null;
            long lValueSize = 0;
            String sKeyContents = null;
            Primitive sizeType = null;
            TransferObject entry = new TransferObject();

            entryList.add(entry);

            // Iterate the parts, assigning data from the Zip entry
            for (int i = 0; i < entriesPart.getPartCount(); i++)
            {
               PrimitiveMessagePart part = (PrimitiveMessagePart)entriesPart.getPart(i);
               ZipMessagePartMapping mapping = (ZipMessagePartMapping)part.getMapping();
               Object datum = null;
               Primitive partType = part.getType();

               switch (mapping.getValue())
               {
                  case ZipMessagePartMapping.VALUE_CONTENTS:
                     Binary contents = new PagedBinary(zipStream);

                     zipStream.closeEntry();

                     if (s_logger.isDebugEnabled())
                     {
                        s_logger.debug("Extracted contents of \"" + zipEntry.getName() + "\" size=" + contents.getSize());
                     }

                     if (contents.getSize() > 0)
                     {
                        datum = partType.getConverter(Primitive.BINARY).invoke(contents);
                     }

                     sKeyContents = part.getName();
                     break;

                  case ZipMessagePartMapping.VALUE_COMMENT:
                     datum = partType.getConverter(Primitive.STRING).invoke(zipEntry.getComment());
                     break;

                  case ZipMessagePartMapping.VALUE_DIRECTORY:
                     datum = partType.getConverter(Primitive.BOOLEAN).invoke(Boolean.valueOf(zipEntry.isDirectory()));
                     break;

                  case ZipMessagePartMapping.VALUE_EXTRA:
                     if (zipEntry.getExtra() != null)
                     {
                        datum = partType.getConverter(Primitive.BINARY).invoke(new Binary(zipEntry.getExtra()));
                     }

                     break;

                  case ZipMessagePartMapping.VALUE_NAME:
                     datum = partType.getConverter(Primitive.STRING).invoke(convertZipSeparatorToPlatformSeparator(zipEntry.getName()));
                     break;

                  case ZipMessagePartMapping.VALUE_SIZE:
                     datum = partType.getConverter(Primitive.LONG).invoke(Primitive.createLong(zipEntry.getSize()));
                     sKeySize = part.getName();
                     lValueSize = zipEntry.getSize();
                     sizeType = partType;
                     break;

                  case ZipMessagePartMapping.VALUE_TIME:
                     datum = partType.getConverter(Primitive.LONG).invoke(Primitive.createLong(zipEntry.getTime()));
                     break;

                  default:
                     throw new IllegalStateException("Unknown value: " + mapping.getValue());
               }
View Full Code Here

TOP

Related Classes of nexj.core.meta.Primitive

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.