Package com.dyuproject.protostuff

Examples of com.dyuproject.protostuff.Tag


                    // preserve its field number for backward-forward compat
                    i++;
                    continue;
                }
               
                final Tag tag = f.getAnnotation(Tag.class);
                final int fieldMapping;
                final String name;
                if(tag == null)
                {
                    // Fields gets assigned mapping tags according to their definition order
                    if(annotated)
                    {
                        throw new RuntimeException("When using annotation-based mapping, " +
                                "all fields must be annotated with @" + Tag.class.getSimpleName());
                    }
                    fieldMapping = ++i;
                   
                    name = f.getName();
                }
                else
                {
                    // Fields gets assigned mapping tags according to their annotation
                    if(!annotated && !fields.isEmpty())
                    {
                        throw new RuntimeException("When using annotation-based mapping, " +
                                "all fields must be annotated with @" + Tag.class.getSimpleName());
                    }
                    annotated = true;
                    fieldMapping = tag.value();
                   
                    if(fieldMapping < 1)
                    {
                        throw new RuntimeException("Invalid field number: " +
                                fieldMapping + " on " + typeClass);
                    }
                   
                    name = tag.alias().isEmpty() ? f.getName() : tag.alias();
                }
               
                final Field<T> field = RuntimeFieldFactory.getFieldFactory(
                        f.getType(), strategy).create(fieldMapping, name, f, strategy);
                fields.add(field);
View Full Code Here


                    // preserve its field number for backward-forward compat
                    i++;
                    continue;
                }
               
                final Tag tag = f.getAnnotation(Tag.class);
                final int fieldMapping;
                final String name;
                if(tag == null)
                {
                    // Fields gets assigned mapping tags according to their definition order
                    if(annotated)
                    {
                        throw new RuntimeException("When using annotation-based mapping, " +
                                "all fields must be annotated with @" + Tag.class.getSimpleName());
                    }
                    fieldMapping = ++i;
                   
                    name = f.getName();
                }
                else
                {
                    // Fields gets assigned mapping tags according to their annotation
                    if(!annotated && !fields.isEmpty())
                    {
                        throw new RuntimeException("When using annotation-based mapping, " +
                                "all fields must be annotated with @" + Tag.class.getSimpleName());
                    }
                    annotated = true;
                    fieldMapping = tag.value();
                   
                    if(fieldMapping < 1)
                    {
                        throw new RuntimeException("Invalid field number: " +
                                fieldMapping + " on " + typeClass);
                    }
                   
                    name = tag.alias().isEmpty() ? f.getName() : tag.alias();
                }
               
                final Field<T> field = RuntimeFieldFactory.getFieldFactory(
                        f.getType(), strategy).create(fieldMapping, name, f, strategy);
                fields.add(field);
View Full Code Here

                    i++;
                    continue;
                }
               
                int fieldMapping;
                Tag tag = f.getAnnotation(Tag.class);
                if(tag == null)
                {
                    // Fields gets assigned mapping tags according to their definition order
                    if(annotated)
                    {
                        throw new RuntimeException("When using annotation-based mapping, " +
                                "all fields must be annotated with @" + Tag.class.getSimpleName());
                    }
                    fieldMapping = ++i;
                }
                else
                {
                    // Fields gets assigned mapping tags according to their annotation
                    if(!annotated && !fields.isEmpty())
                    {
                        throw new RuntimeException("When using annotation-based mapping, " +
                                "all fields must be annotated with @" + Tag.class.getSimpleName());
                    }
                    annotated = true;
                    fieldMapping = tag.value();
                }
               
                final Field<T> field = RuntimeFieldFactory.getFieldFactory(
                        f.getType(), strategy).create(fieldMapping, f.getName(), f, strategy);
                fields.add(field);
View Full Code Here

TOP

Related Classes of com.dyuproject.protostuff.Tag

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.