Package nexj.core.meta

Examples of nexj.core.meta.Primitive


      public final boolean invoke(int nArgCount, Machine machine)
      {
         verifyMinArgCount(nArgCount, 1);

         Object left = machine.getArg(0, nArgCount);
         Primitive leftType = Primitive.primitiveOf(left);
         Primitive rightType, coercedType = null;
         BinaryFunction fun;
         Object right;

         for (int i = 1; i < nArgCount; ++i)
         {
View Full Code Here


    * @param attribute The corresponding attribute.
    * @return The resulting primitive value.
    */
   protected static Object instantiatePrimitive(Object value, Attribute attribute)
   {
      Primitive type = (Primitive)attribute.getType();

      if (attribute.isCollection())
      {
         if (value == null)
         {
            return new ArrayList(0);
         }

         if (!(value instanceof List))
         {
            throw new RequestException("err.rpc.collectionType", new Object[]
            {
               attribute.getName(),
               attribute.getMetaclass().getName()
            });
         }

         List list = (List)value;
         int nCount = list.size();
         List convertedList = new ArrayList(nCount);

         for (int i = 0; i < nCount; ++i)
         {
            convertedList.add(type.convert(list.get(i)));
         }

         return convertedList;
      }

      return type.convert(value);
   }
View Full Code Here

    * @param part The primitive part to get the type.
    * @return The type.
    */
   protected static PrimitiveType getPrimitiveType(PrimitiveMessagePart part)
   {
      Primitive type = part.getType();
      XMLMessagePartMapping mapping;

      switch (type.getOrdinal())
      {
         case Primitive.TIMESTAMP_ORDINAL:
            mapping = (XMLMessagePartMapping)part.getMapping();

            switch (mapping.getSubtype())
View Full Code Here

      m_requiredXMLMetatypeMap = new HashTab/*<QName, XMLMetatype>*/();

      // define array types for all XSD types since that is how arrays might be marshalled
      for (int i = 0; i <= Primitive.MAX_COUNT; ++i)
      {
         Primitive type = Primitive.get(i);
         QName qType = XML.getQualifiedType(type);

         if (qType.getNamespaceURI() == XML.XSD_URI) // only consider XSD types, identity check
         {
            setRequiredType(type, true);
View Full Code Here

               writeTNSXSD();

               // add elements for all XSD types since that is how primitives will be marshalled
               for (int i = 0; i <= Primitive.MAX_COUNT; ++i)
               {
                  Primitive type = Primitive.get(i);
                  QName qType = getQualifiedTypeCached(type, false);

                  if (qType.getNamespaceURI() == XML.XSD_URI) // only consider XSD types
                  {
                     QName element = getElementTypeCached(type, false);
View Full Code Here

         // Add the primitive type symbols

         for (int i = 0; i < Primitive.MAX_COUNT; ++i)
         {
            Primitive type = Primitive.get(i);

            defineVariable("sys:" + type.getName(), type);
         }
      }
   }
View Full Code Here

            {
               buf.append("null");
            }
            else
            {
               Primitive type = (Primitive)op.getType();

               if (m_adapter.isLiteral() && m_adapter.isLiteral(type, value) ||
                  getBindCount() == m_adapter.getMaxBindCount())
               {
                  m_adapter.appendLiteral(buf, type, value);
View Full Code Here

   /**
    * @see nexj.core.persistence.sql.SQLSchemaManager#isImplicitConversion(nexj.core.meta.persistence.sql.Column, nexj.core.meta.persistence.sql.Column)
    */
   protected boolean isImplicitConversion(Column source, Column target)
   {
      Primitive srcType = source.getType();
      Primitive dstType = target.getType();

      if (srcType == dstType)
      {
         return true; // same type
      }
View Full Code Here

   protected final Converter getConverter(Primitive type, Column column)
   {
      if (column.getConverter() == null)
      {
         type = getConversionMapper().getType(type);
         Primitive colType = getConversionMapper().getType(column.getType());

         if (type != colType)
         {
            return getDefaultConverter(colType, type);
         }
View Full Code Here

    * @param value The constant value.
    * @return The converted constant.
    */
   public Object getInternal(Primitive type, Object value)
   {
      Primitive toType = getConversionMapper().getType(type);

      if (toType == type)
      {
         return value;
      }

      return toType.getConverter(type).invoke(value);
   }
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.