Examples of PropertyAccessor


Examples of ognl.PropertyAccessor

     * {@link TilesContextPropertyAccessorDelegateFactory#getPropertyAccessor(String, Request)}
     * .
     */
    @Test
    public void testGetPropertyAccessorRequestScopeDefault() {
        PropertyAccessor objectPropertyAccessor = createMock(PropertyAccessor.class);
        PropertyAccessor applicationContextPropertyAccessor = createMock(PropertyAccessor.class);
        PropertyAccessor requestScopePropertyAccessor = createMock(PropertyAccessor.class);
        PropertyAccessor sessionScopePropertyAccessor = createMock(PropertyAccessor.class);
        PropertyAccessor applicationScopePropertyAccessor = createMock(PropertyAccessor.class);
        Request request = createMock(Request.class);
        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("anotherAttribute", 1);

View Full Code Here

Examples of ognl.PropertyAccessor

     */
    @SuppressWarnings("unchecked")
    @Test
    public void testGetProperty() throws OgnlException {
        PropertyAccessorDelegateFactory<Integer> factory = createMock(PropertyAccessorDelegateFactory.class);
        PropertyAccessor mockAccessor = createMock(PropertyAccessor.class);
        Map<String, Object> context = createMock(Map.class);
        expect(factory.getPropertyAccessor("property", 1)).andReturn(mockAccessor);
        expect(mockAccessor.getProperty(context, 1, "property")).andReturn("value");

        replay(factory, mockAccessor, context);
        PropertyAccessor accessor = new DelegatePropertyAccessor<Integer>(factory);
        assertEquals("value", accessor.getProperty(context, 1, "property"));
        verify(factory, mockAccessor, context);
    }
View Full Code Here

Examples of ognl.PropertyAccessor

     */
    @SuppressWarnings("unchecked")
    @Test
    public void testSetProperty() throws OgnlException {
        PropertyAccessorDelegateFactory<Integer> factory = createMock(PropertyAccessorDelegateFactory.class);
        PropertyAccessor mockAccessor = createMock(PropertyAccessor.class);
        Map<String, Object> context = createMock(Map.class);
        expect(factory.getPropertyAccessor("property", 1)).andReturn(mockAccessor);
        mockAccessor.setProperty(context, 1, "property", "value");

        replay(factory, mockAccessor, context);
        PropertyAccessor accessor = new DelegatePropertyAccessor<Integer>(factory);
        accessor.setProperty(context, 1, "property", "value");
        verify(factory, mockAccessor, context);
    }
View Full Code Here

Examples of ognl.PropertyAccessor

     */
    @SuppressWarnings("unchecked")
    @Test
    public void testGetSourceAccessor() {
        PropertyAccessorDelegateFactory<Integer> factory = createMock(PropertyAccessorDelegateFactory.class);
        PropertyAccessor mockAccessor = createMock(PropertyAccessor.class);
        OgnlContext context = createMock(OgnlContext.class);
        expect(factory.getPropertyAccessor("property", 1)).andReturn(mockAccessor);
        expect(mockAccessor.getSourceAccessor(context, 1, "property")).andReturn("method");

        replay(factory, mockAccessor, context);
        PropertyAccessor accessor = new DelegatePropertyAccessor<Integer>(factory);
        assertEquals("method", accessor.getSourceAccessor(context, 1, "property"));
        verify(factory, mockAccessor, context);
    }
View Full Code Here

Examples of ognl.PropertyAccessor

     */
    @SuppressWarnings("unchecked")
    @Test
    public void testGetSourceSetter() {
        PropertyAccessorDelegateFactory<Integer> factory = createMock(PropertyAccessorDelegateFactory.class);
        PropertyAccessor mockAccessor = createMock(PropertyAccessor.class);
        OgnlContext context = createMock(OgnlContext.class);
        expect(factory.getPropertyAccessor("property", 1)).andReturn(mockAccessor);
        expect(mockAccessor.getSourceSetter(context, 1, "property")).andReturn("method");

        replay(factory, mockAccessor, context);
        PropertyAccessor accessor = new DelegatePropertyAccessor<Integer>(factory);
        assertEquals("method", accessor.getSourceSetter(context, 1, "property"));
        verify(factory, mockAccessor, context);
    }
View Full Code Here

Examples of org.apache.cayenne.property.PropertyAccessor

        Iterator it = entity.getDeclaredAttributes().iterator();
        while (it.hasNext()) {
            ObjAttribute attribute = (ObjAttribute) it.next();

            Class propertyType = attribute.getJavaClass();
            PropertyAccessor accessor = makeAccessor(attribute.getName(), propertyType);
            allDescriptors.put(attribute.getName(), persistent
                    ? new SimplePersistentProperty(this, accessor)
                    : new SimpleProperty(this, accessor));
        }
    }
View Full Code Here

Examples of org.apache.cayenne.property.PropertyAccessor

            String reverseName = relationship.getReverseRelationshipName();

            Property property;
            if (relationship.isToMany()) {

                PropertyAccessor accessor = makeAccessor(
                        relationship.getName(),
                        List.class);

                if (dataObject) {
                    property = new ToManyListProperty(
                            this,
                            targetDescriptor,
                            accessor,
                            reverseName);
                }
                else {
                    property = new ListProperty(
                            this,
                            targetDescriptor,
                            accessor,
                            reverseName);
                }
            }
            else {

                if (dataObject) {
                    ObjEntity targetEntity = (ObjEntity) relationship.getTargetEntity();
                    PropertyAccessor accessor = makeAccessor(
                            relationship.getName(),
                            targetEntity.getJavaClass());
                    property = new PersistentObjectProperty(
                            this,
                            targetDescriptor,
                            accessor,
                            reverseName);
                }
                else {
                    PropertyAccessor accessor = makeAccessor(
                            relationship.getName(),
                            ValueHolder.class);
                    property = new ValueHolderProperty(
                            this,
                            targetDescriptor,
View Full Code Here

Examples of org.geotools.filter.expression.PropertyAccessor

    */
    @SuppressWarnings("unchecked")
    public <T> T evaluate(Object obj, Class<T> target) {
        // NC- new method

        PropertyAccessor accessor = getLastPropertyAccessor();
        AtomicReference<Object> value = new AtomicReference<Object>();
        AtomicReference<Exception> e = new AtomicReference<Exception>();

        if (accessor == null || !accessor.canHandle(obj, attPath, target)
                || !tryAccessor(accessor, obj, target, value, e)) {
            boolean success = false;
            if( namespaceSupport != null && hints == null ){
                hints = new Hints(PropertyAccessorFactory.NAMESPACE_CONTEXT, namespaceSupport);
            }
View Full Code Here

Examples of org.hibernate.property.PropertyAccessor

  private static Getter getGetter(Property mappingProperty) {
    if ( mappingProperty == null || !mappingProperty.getPersistentClass().hasPojoRepresentation() ) {
      return null;
    }

    PropertyAccessor pa = PropertyAccessorFactory.getPropertyAccessor( mappingProperty, EntityMode.POJO );
    return pa.getGetter( mappingProperty.getPersistentClass().getMappedClass(), mappingProperty.getName() );
  }
View Full Code Here

Examples of org.hibernate.property.PropertyAccessor

  private static Getter getGetter(Property mappingProperty) {
    if ( mappingProperty == null || !mappingProperty.getPersistentClass().hasPojoRepresentation() ) {
      return null;
    }

    PropertyAccessor pa = PropertyAccessorFactory.getPropertyAccessor( mappingProperty, EntityMode.POJO );
    return pa.getGetter( mappingProperty.getPersistentClass().getMappedClass(), mappingProperty.getName() );
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.