Package org.jboss.metatype.api.values

Examples of org.jboss.metatype.api.values.SimpleValue


      if (expected.isInstance(field))
         return expected.cast(field);
     
      if (field instanceof SimpleValue)
      {
         SimpleValue value = (SimpleValue) field;
         Object result = value.getValue();
         if (result == null)
            return null;
         return expected.cast(result);
      }
     
View Full Code Here


      }

      @Override
      public File unwrapMetaValue(MetaValue metaValue)
      {
         SimpleValue svalue = (SimpleValue) metaValue;
         File f = null;
         if (svalue != null)
         {
            f = new File(svalue.getValue().toString());
         }
         return f;
      }
View Full Code Here

      assertNotNull(byteType);
      assertEquals(SimpleMetaType.BYTE_PRIMITIVE, byteType);
      assertTrue(byteType.isPrimitive());
      Serializable one = (byte) 1;
      log.debug("one.class: "+one.getClass());
      SimpleValue byte1p = SimpleValueSupport.wrap((byte)1);
      SimpleValue byte1p2 = SimpleValueSupport.wrap((byte)1);
      assertEquals(SimpleMetaType.BYTE_PRIMITIVE, byte1p.getMetaType());
      SimpleValue byte1 = SimpleValueSupport.wrap(one);
      assertEquals(SimpleMetaType.BYTE, byte1.getMetaType());
      assertEquals(byte1, byte1p);
      assertEquals(byte1p, byte1p2);
  
      SimpleValue byte2p = SimpleValueSupport.wrap((byte)2);
      assertFalse(byte1p.equals(byte2p));
   }
View Full Code Here

      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());
      SimpleValue short1 = SimpleValueSupport.wrap(one);
      assertEquals(SimpleMetaType.SHORT, short1.getMetaType());
      assertEquals(short1, short1p);
      assertEquals(short1p, short1p2);
  
      SimpleValue short2p = SimpleValueSupport.wrap((short)2);
      assertFalse(short1p.equals(short2p));
   }
View Full Code Here

      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());
      SimpleValue int1 = SimpleValueSupport.wrap(one);
      assertEquals(SimpleMetaType.INTEGER, int1.getMetaType());
      assertEquals(int1, int1p);
      assertEquals(int1p, int1p2);
  
      SimpleValue int2p = SimpleValueSupport.wrap((int)2);
      assertFalse(int1p.equals(int2p));
   }
View Full Code Here

      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());
      SimpleValue long1 = SimpleValueSupport.wrap(one);
      assertEquals(SimpleMetaType.LONG, long1.getMetaType());
      assertEquals(long1, long1p);
      assertEquals(long1p, long1p2);

      SimpleValue long2p = SimpleValueSupport.wrap((long)2);
      assertFalse(long1p.equals(long2p));
   }
View Full Code Here

      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());
      SimpleValue float1 = SimpleValueSupport.wrap(pi);
      assertEquals(SimpleMetaType.FLOAT, float1.getMetaType());
      assertEquals(float1, float1p);
      assertEquals(float1p, float1p2);
  
      SimpleValue float2p = SimpleValueSupport.wrap(3.24f);
      assertFalse(float1p.equals(float2p));
   }
View Full Code Here

      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());
      SimpleValue double1 = SimpleValueSupport.wrap(pi);
      assertEquals(SimpleMetaType.DOUBLE, double1.getMetaType());
      assertEquals(double1, double1p);
      assertEquals(double1p, double1p2);
  
      SimpleValue double2p = SimpleValueSupport.wrap(3.24);
      assertFalse(double1p.equals(double2p));
   }
View Full Code Here

      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());
      SimpleValue boolean1 = SimpleValueSupport.wrap(b);
      assertEquals(SimpleMetaType.BOOLEAN, boolean1.getMetaType());
      assertEquals(boolean1, boolean1p);
      assertEquals(boolean1p, boolean1p2);
  
      SimpleValue boolean2p = SimpleValueSupport.wrap(false);
      assertFalse(boolean1p.equals(boolean2p));
   }
View Full Code Here

   public TestMetaMapped unwrapMetaValue(MetaValue metaValue)
   {
      if (SimpleMetaType.STRING.equals(metaValue.getMetaType()) == false)
         throw new IllegalArgumentException("Not a string: " + metaValue);
     
      SimpleValue simple = (SimpleValue) metaValue;
      String value = (String) simple.getValue();
      return new TestMetaMapped(value);
   }
View Full Code Here

TOP

Related Classes of org.jboss.metatype.api.values.SimpleValue

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.