Package com.impetus.kundera.property.accessor

Examples of com.impetus.kundera.property.accessor.StringAccessor


        {
            byte[] id = PropertyAccessorHelper.get(person, person.getClass().getDeclaredField("personId"));
            byte[] fn = PropertyAccessorHelper.get(person, person.getClass().getDeclaredField("firstName"));
            byte[] ln = PropertyAccessorHelper.get(person, person.getClass().getDeclaredField("lastName"));
           
            Assert.assertEquals("1", new StringAccessor().fromBytes(String.class, id));
            Assert.assertEquals("Amresh", new StringAccessor().fromBytes(String.class, fn));
            Assert.assertEquals("Singh", new StringAccessor().fromBytes(String.class, ln));
        }
        catch (SecurityException e)
        {           
            Assert.fail(e.getMessage());
        }
View Full Code Here


    {
        PersonnelDTO person = new PersonnelDTO("1", "Amresh", "Singh");       
        try
        {
            byte[] b = PropertyAccessorHelper.toBytes("1" , person.getClass().getDeclaredField("personId"));          
            Assert.assertEquals("1", new StringAccessor().fromBytes(String.class, b));           
        }
        catch (SecurityException e)
        {           
            Assert.fail(e.getMessage());
        }    
View Full Code Here

    public void testToBytesObjectClass()
    {               
        try
        {
            byte[] b = PropertyAccessorHelper.toBytes("1" , String.class);          
            Assert.assertEquals("1", new StringAccessor().fromBytes(String.class, b));           
        }
        catch (SecurityException e)
        {           
            Assert.fail(e.getMessage());
        }      
View Full Code Here

            List<ColumnDef> columnMetadataList = columnFamilyDefToUpdate.getColumn_metadata();
            List<String> indexList = new ArrayList<String>();

            if (columnMetadataList != null) {
                for (ColumnDef columnDef : columnMetadataList) {
                    indexList.add(new StringAccessor().fromBytes(String.class, columnDef.getName()));
                }
                // need to set them to null else it is giving problem on update
                // column family and trying to add again existing indexes.
                // columnFamilyDefToUpdate.column_metadata = null;
            }

            // Iterate over all columns for creating secondary index on them
            for (Column column : columns) {

                ColumnDef columnDef = new ColumnDef();

                columnDef.setName(column.getName());
                columnDef.setValidation_class(CassandraValidationClassMapper.getValidationClass(columnType, false));
                columnDef.setIndex_type(IndexType.KEYS);

                // Add secondary index only if it's not already created
                // (if already created, it would be there in column family
                // definition)
                if (!indexList.contains(new StringAccessor().fromBytes(String.class, column.getName()))) {
                    isUpdatable = true;
                    columnFamilyDefToUpdate.addToColumn_metadata(columnDef);
                }
            }
View Full Code Here

TOP

Related Classes of com.impetus.kundera.property.accessor.StringAccessor

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.