Package com.tobedevoured.modelcitizen.annotation

Examples of com.tobedevoured.modelcitizen.annotation.MappedList


                logger.trace("  Setting mapped for {} to {}", mappedField.getName(), mappedField.getTarget());
            }

            // Process @MappedList
            MappedList mappedCollection = field.getAnnotation(MappedList.class);
            if (mappedCollection != null) {
                MappedListField listField = new MappedListField();
                listField.setName(field.getName());
                listField.setFieldClass(field.getType());
                listField.setSize(mappedCollection.size());
                listField.setIgnoreEmpty(mappedCollection.ignoreEmpty());
                listField.setForce(mappedCollection.force());

                // If @MappedList(target) not set, use Field's class
                if (NotSet.class.equals(mappedCollection.target())) {
                    listField.setTarget(field.getType());

                    // Use @MappedList(target) for MappedListField#target
                } else {
                    listField.setTarget(mappedCollection.target());
                }

                // If @MappedList(targetList) not set, use ArrayList
                if (NotSet.class.equals(mappedCollection.targetList())) {
                    listField.setTargetList(ArrayList.class);
                } else {

                    // Ensure that the targetList implements List
                    boolean implementsList = false;
                    for (Class interf : mappedCollection.targetList().getInterfaces()) {
                        if (List.class.equals(interf)) {
                            implementsList = true;
                            break;
                        }
                    }

                    if (!implementsList) {
                        throw new RegisterBlueprintException("@MappedList targetList must implement List for field " + field.getName());
                    }

                    listField.setTargetList(mappedCollection.targetList());
                }

                modelFields.add(listField);

                logger.trace("  Setting mapped list for {} to {} as <{}> and forced {}", new Object[]{listField.getName(), listField.getFieldClass(), listField.getTarget(), listField.isForce()});
View Full Code Here

TOP

Related Classes of com.tobedevoured.modelcitizen.annotation.MappedList

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.