Package org.jboss.metatype.api.types

Examples of org.jboss.metatype.api.types.SimpleMetaType


   }
   public void testShortPrimitives()
      throws Exception
   {
      assertEquals(SimpleMetaType.SHORT_PRIMITIVE, SimpleMetaType.isSimpleType(short.class.getName()));
      SimpleMetaType shortType = SimpleMetaType.resolve("short");
      assertNotNull(shortType);
      assertEquals(SimpleMetaType.SHORT_PRIMITIVE, shortType);
      assertTrue(shortType.isPrimitive());
      Serializable one = (short) 1;
      log.debug("one.class: "+one.getClass());
      SimpleValue short1p = SimpleValueSupport.wrap((short)1);
      SimpleValue short1p2 = SimpleValueSupport.wrap((short)1);
      assertEquals(SimpleMetaType.SHORT_PRIMITIVE, short1p.getMetaType());
View Full Code Here


   }
   public void testIntPrimitives()
      throws Exception
   {
      assertEquals(SimpleMetaType.INTEGER_PRIMITIVE, SimpleMetaType.isSimpleType(int.class.getName()));
      SimpleMetaType intType = SimpleMetaType.resolve("int");
      assertNotNull(intType);
      assertEquals(SimpleMetaType.INTEGER_PRIMITIVE, intType);
      assertTrue(intType.isPrimitive());
      Serializable one = (int) 1;
      log.debug("one.class: "+one.getClass());
      SimpleValue int1p = SimpleValueSupport.wrap((int)1);
      SimpleValue int1p2 = SimpleValueSupport.wrap((int)1);
      assertEquals(SimpleMetaType.INTEGER_PRIMITIVE, int1p.getMetaType());
View Full Code Here

   }
   public void testLongPrimitives()
      throws Exception
   {
      assertEquals(SimpleMetaType.LONG_PRIMITIVE, SimpleMetaType.isSimpleType(long.class.getName()));
      SimpleMetaType longType = SimpleMetaType.resolve("long");
      assertNotNull(longType);
      assertEquals(SimpleMetaType.LONG_PRIMITIVE, longType);
      assertTrue(longType.isPrimitive());
      Serializable one = (long) 1;
      log.debug("one.class: "+one.getClass());
      SimpleValue long1p = SimpleValueSupport.wrap((long)1);
      SimpleValue long1p2 = SimpleValueSupport.wrap((long)1);
      assertEquals(SimpleMetaType.LONG_PRIMITIVE, long1p.getMetaType());
View Full Code Here

   }
   public void testFloatPrimitives()
      throws Exception
   {
      assertEquals(SimpleMetaType.FLOAT_PRIMITIVE, SimpleMetaType.isSimpleType(float.class.getName()));
      SimpleMetaType floatType = SimpleMetaType.resolve("float");
      assertNotNull(floatType);
      assertTrue(SimpleMetaType.FLOAT_PRIMITIVE == floatType);
      assertEquals(SimpleMetaType.FLOAT_PRIMITIVE, floatType);
      assertTrue(floatType.isPrimitive());
      Serializable pi = 3.14f;
      log.debug("pi.class: "+pi.getClass());
      SimpleValue float1p = SimpleValueSupport.wrap(3.14f);
      SimpleValue float1p2 = SimpleValueSupport.wrap(3.14f);
      assertEquals(SimpleMetaType.FLOAT_PRIMITIVE, float1p.getMetaType());
View Full Code Here

   }
   public void testDoublePrimitives()
      throws Exception
   {
      assertEquals(SimpleMetaType.DOUBLE_PRIMITIVE, SimpleMetaType.isSimpleType(double.class.getName()));
      SimpleMetaType doubleType = SimpleMetaType.resolve("double");
      assertNotNull(doubleType);
      assertEquals(SimpleMetaType.DOUBLE_PRIMITIVE, doubleType);
      assertTrue(doubleType.isPrimitive());
      Serializable pi = 3.14;
      log.debug("pi.class: "+pi.getClass());
      SimpleValue double1p = SimpleValueSupport.wrap(3.14);
      SimpleValue double1p2 = SimpleValueSupport.wrap(3.14);
      assertEquals(SimpleMetaType.DOUBLE_PRIMITIVE, double1p.getMetaType());
View Full Code Here

   }
   public void testBooleanPrimitives()
      throws Exception
   {
      assertEquals(SimpleMetaType.BOOLEAN_PRIMITIVE, SimpleMetaType.isSimpleType(boolean.class.getName()));
      SimpleMetaType booleanType = SimpleMetaType.resolve("boolean");
      assertNotNull(booleanType);
      assertEquals(SimpleMetaType.BOOLEAN_PRIMITIVE, booleanType);
      assertTrue(booleanType.isPrimitive());
      Serializable b = true;;
      log.debug("b.class: "+b.getClass());
      SimpleValue boolean1p = SimpleValueSupport.wrap(true);
      SimpleValue boolean1p2 = SimpleValueSupport.wrap(true);
      assertEquals(SimpleMetaType.BOOLEAN_PRIMITIVE, boolean1p.getMetaType());
View Full Code Here

    *
    * @throws Exception for any problem
    */
   public void testIsValueSimpleValue() throws Exception
   {
      SimpleMetaType simpleType = SimpleMetaType.STRING;
      MockSimpleValue sv = new MockSimpleValue(simpleType);
      MockSimpleValue[][] compData1 = new MockSimpleValue[][]
      {
         { sv, null }, { sv, sv }
      };
           
      ArrayMetaType compArrayType1 = new ArrayMetaType(2, SimpleMetaType.STRING);
      assertTrue("compData1 should be a value of array type", compArrayType1.isValue(compData1));

      ArrayMetaType compArrayType2 = new ArrayMetaType(1, SimpleMetaType.STRING);
      assertFalse("compData1 should not be a value of array type, wrong dimension", compArrayType2.isValue(compData1));

      SimpleMetaType simpleType2 = SimpleMetaType.INTEGER;
      ArrayMetaType compArrayType3 = new ArrayMetaType(2, simpleType2);
      assertFalse("compData1 should not be a value of array type, wrong element type", compArrayType3.isValue(compData1));
   }
View Full Code Here

*/
public class SimpleValueComparator implements Comparator<SimpleValue>
{
   public int compare(SimpleValue o1, SimpleValue o2)
   {
      SimpleMetaType smt1 = o1.getMetaType();
      SimpleMetaType smt2 = o2.getMetaType();

      return (smt1 == smt2) ? smt1.compare(o1.getValue(), o2.getValue()) : -1;
   }
View Full Code Here

      String className = object.getClass().getName();
      return wrap(object, className);
   }
   private static SimpleValue wrap(Serializable object, String className)
   {
      SimpleMetaType metaType = SimpleMetaType.resolve(className);
      return new SimpleValueSupport(metaType, object);
   }
View Full Code Here

   public static SimpleValue wrap(Serializable object)
   {
      if (object == null)
         return null;
      String className = object.getClass().getName();
      SimpleMetaType metaType = SimpleMetaType.resolve(className);
      return new SimpleValueSupport(metaType, object);
   }
View Full Code Here

TOP

Related Classes of org.jboss.metatype.api.types.SimpleMetaType

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.