Package com.tobedevoured.modelcitizen.annotation

Examples of com.tobedevoured.modelcitizen.annotation.MappedSet


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

            }

            // Process @MappedSet
            MappedSet mappedSet = field.getAnnotation(MappedSet.class);
            if (mappedSet != null) {
                MappedSetField setField = new MappedSetField();
                setField.setName(field.getName());
                setField.setFieldClass(field.getType());
                setField.setSize(mappedSet.size());
                setField.setIgnoreEmpty(mappedSet.ignoreEmpty());
                setField.setForce(mappedSet.force());

                // XXX: @MappedSet( target ) is required
                // If @MappedSet(target) not set
                if (NotSet.class.equals(mappedSet.target())) {

                    // XXX: incorrect, should use generic defined by Set, luckily annotation forces target to be set
                    setField.setTarget(field.getType());

                    // Use @MappedSet(target) for MappedSet#target
                } else {
                    setField.setTarget(mappedSet.target());
                }

                // If @MappedSet(targetSet) not set, use HashSet
                if (NotSet.class.equals(mappedSet.targetSet())) {
                    setField.setTargetSet(HashSet.class);
                } else {

                    // Ensure that the targetSet implements Set
                    boolean implementsSet = false;
                    for (Class interf : mappedSet.targetSet().getInterfaces()) {
                        if (Set.class.equals(interf)) {
                            implementsSet = true;
                            break;
                        }
                    }

                    if (!implementsSet) {
                        throw new RegisterBlueprintException("@MappedSet targetSet must implement Set for field " + field.getName());
                    }

                    setField.setTargetSet(mappedSet.targetSet());
                }

                modelFields.add(setField);

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

TOP

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

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.