Examples of DynaProperty


Examples of org.apache.commons.beanutils.DynaProperty

    }
   
    public DynaClass getDynaClass() {
        return new DynaClass() {
            public DynaProperty[] getDynaProperties() {
                DynaProperty[] properties = {new DynaProperty("DynaProp", String.class)};
                return properties;
            }
           
            public String getName() {
                return "DynaWithDotBetwixtClass";
            }
           
            public DynaBean newInstance() {
                return new DynaWithDotBetwixt();
            }
           
            public DynaProperty getDynaProperty(String name) {
                if ("DynaProp".equals(name)) {
                    return new DynaProperty("DynaProp", String.class);
                }
                return null;
            }  
        };
    }
View Full Code Here

Examples of org.apache.commons.beanutils.DynaProperty

   
    private DynaClass createDynasaurClass() throws Exception {
        DynaClass dynaClass = new BasicDynaClass
                ("Dynasaur", null,
                        new DynaProperty[]{
                            new DynaProperty("Species", String.class),
                            new DynaProperty("isRaptor", Boolean.TYPE),
                            new DynaProperty("Period", String.class),
                        });
        return (dynaClass);
    }
View Full Code Here

Examples of org.apache.commons.beanutils.DynaProperty

        Class type = null;               // Java type of target property

        if (target instanceof DynaBean) {
            DynaClass dynaClass = ((DynaBean) target).getDynaClass();
            DynaProperty dynaProperty = dynaClass.getDynaProperty(propName);
            if (dynaProperty == null) {
                return null; // Skip this property setter
            }
            type = dynaProperty.getType();
        }
        else {
            PropertyDescriptor descriptor = null;
            try {
                descriptor =
View Full Code Here

Examples of org.apache.commons.beanutils.DynaProperty

     * Corner cases on getDynaProperty invalid arguments.
     */
    @Test(expected = IllegalArgumentException.class)
    public void testGetDescriptorArguments()
    {
        DynaProperty descriptor = bean.getDynaClass().getDynaProperty("unknown");
        assertNull("Unknown property descriptor should be null", descriptor);
        bean.getDynaClass().getDynaProperty(null);
    }
View Full Code Here

Examples of org.apache.commons.beanutils.DynaProperty

     * listed in <code>properties</code> should be returned exactly once.
     */
    @Test
    public void testGetDescriptors()
    {
        DynaProperty pd[] = bean.getDynaClass().getDynaProperties();
        assertNotNull("Got descriptors", pd);
        int count[] = new int[properties.length];
        for (DynaProperty element : pd) {
            String name = element.getName();
            for (int j = 0; j < properties.length; j++)
View Full Code Here

Examples of org.apache.commons.beanutils.DynaProperty

     * @param name Name of the property to be retrieved
     * @param type Expected class type of this property
     */
    protected void testGetDescriptorBase(String name, Class<?> type)
    {
        DynaProperty descriptor = bean.getDynaClass().getDynaProperty(name);

        assertNotNull("Failed to get descriptor", descriptor);
        assertEquals("Got incorrect type", type, descriptor.getType());
    }
View Full Code Here

Examples of org.apache.commons.beanutils.DynaProperty

            else if (type == Short.class)
            {
                type = Short.TYPE;
            }

            return new DynaProperty(name, type);
        }
    }
View Full Code Here

Examples of org.apache.commons.beanutils.DynaProperty

        Iterator<String> keys = configuration.getKeys();
        List<DynaProperty> properties = new ArrayList<DynaProperty>();
        while (keys.hasNext())
        {
            String key = keys.next();
            DynaProperty property = getDynaProperty(key);
            properties.add(property);
        }

        DynaProperty[] propertyArray = new DynaProperty[properties.size()];
        properties.toArray(propertyArray);
View Full Code Here

Examples of org.apache.commons.beanutils.DynaProperty

     * Learn whether the property referenced is an indexed property.
     * @return boolean
     */
    protected boolean isIndexedProperty() {
        DynaClass dynaClass = dynaBean.getDynaClass();
        DynaProperty property = dynaClass.getDynaProperty(name);
        return property.isIndexed();
    }
View Full Code Here

Examples of org.apache.commons.beanutils.DynaProperty

     * @param element whether this should be a collection element.
     * @return conversion result
     */
    private Object convert(Object value, boolean element) {
        DynaClass dynaClass = (DynaClass) dynaBean.getDynaClass();
        DynaProperty property = dynaClass.getDynaProperty(getPropertyName());
        Class type = property.getType();
        if (element) {
            if (type.isArray()) {
                type = type.getComponentType();
            }
            else {
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.