Package org.apache.tapestry5

Examples of org.apache.tapestry5.PropertyConduit


  }
 
  public BeanModel getModel()
  {
    BeanModel<Object> model = beanModelSource.createDisplayModel(Object.class, messages);
    model.add("random", new PropertyConduit() {
     
      public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
      {
        return null;
      }
View Full Code Here


    }

    @Test
    public void literal_conduits_have_invariant_annotation()
    {
        PropertyConduit pc = source.create(CompositeBean.class, "12345");

        Invariant annotation = pc.getAnnotation(Invariant.class);

        assertNotNull(annotation);

        assertSame(annotation.annotationType(), Invariant.class);
    }
View Full Code Here

    }

    @Test
    public void range_variable_to()
    {
        PropertyConduit pc = source.create(IntegerHolder.class, "10..value");
        IntegerHolder h = new IntegerHolder();

        h.setValue(5);

        IntegerRange ir = (IntegerRange) pc.get(h);

        assertEquals(ir, new IntegerRange(10, 5));
    }
View Full Code Here

    }

    @Test
    public void range_variable_from()
    {
        PropertyConduit pc = source.create(IntegerHolder.class, "value..99");
        IntegerHolder h = new IntegerHolder();

        h.setValue(72);

        IntegerRange ir = (IntegerRange) pc.get(h);

        assertEquals(ir, new IntegerRange(72, 99));
    }
View Full Code Here

    }

    @Test
    public void literal_conduits_are_not_updateable()
    {
        PropertyConduit pc = source.create(CompositeBean.class, "12345");
        CompositeBean bean = new CompositeBean();

        try
        {
            pc.set(bean, 42);
            unreachable();
        } catch (RuntimeException ex)
        {
            assertEquals(ex.getMessage(), "Literal values are not updateable.");
        }
View Full Code Here

    }

    @Test
    public void this_literal_conduit_is_not_updateable()
    {
        PropertyConduit normal = source.create(CompositeBean.class, "this");
        CompositeBean bean = new CompositeBean();

        try
        {
            normal.set(bean, 42);
            unreachable();
        } catch (RuntimeException ex)
        {
            assertEquals(ex.getMessage(), "Literal values are not updateable.");
        }
View Full Code Here

        StringHolder stringHolder = new StringHolder();
        stringHolder.put(string);
        StringHolderBean bean = new StringHolderBean();
        bean.setValue(stringHolder);

        PropertyConduit conduit = source.create(StringHolderBean.class, "value.get()");

        assertSame(conduit.get(bean), string);

        assertSame(conduit.getPropertyType(), String.class);
    }
View Full Code Here

        simple.setLastName(last);
        simple.setAge(2);
        simple.setFirstName(first);
        bean.holder.put(simple);

        PropertyConduit conduit = source.create(WithGenericProperties.class, "holder.get().firstName");
        assertSame(conduit.get(bean), first);
    }
View Full Code Here

        bean.type1Field = holder;
        bean.type2Field = 5678L;
        bean.type2ArrayField = new Long[]
                {123L, 456L};

        PropertyConduit conduit = source.create(RealizedParameters.class, "type1property.get().firstName");
        assertSame(conduit.get(bean), first);
        conduit.set(bean, "Change");
        assertSame(conduit.get(bean), "Change");
        conduit.set(bean, first);

        conduit = source.create(RealizedParameters.class, "type1field.get().firstName");
        assertSame(conduit.get(bean), first);

        conduit = source.create(RealizedParameters.class, "type2field");
        assertEquals(conduit.get(bean), bean.type2Field);

        conduit = source.create(RealizedParameters.class, "type2property");
        assertEquals(conduit.get(bean), bean.getType2Property());

        conduit = source.create(RealizedParameters.class, "type2ArrayField");
        assertEquals(conduit.get(bean), bean.type2ArrayField);

    }
View Full Code Here

    {
        final WithRealizedGenericInterface bean = new WithRealizedGenericInterface();
        bean.a = "Hello";
        bean.b = 12345L;

        PropertyConduit conduit = source.create(WithRealizedGenericInterface.class, "genericA()");
        assertSame(conduit.get(bean), "Hello");
        conduit = source.create(WithRealizedGenericInterface.class, "genericB()");
        assertEquals(conduit.get(bean), 12345L);
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.PropertyConduit

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.