Package org.mongodb.morphia.annotations

Examples of org.mongodb.morphia.annotations.Reference


*/
public class LazyReferenceMissingDependencies extends FieldConstraint {

  @Override
  protected void check(final MappedClass mc, final MappedField mf, final Set<ConstraintViolation> ve) {
    final Reference ref = mf.getAnnotation(Reference.class);
    if (ref != null) {
      if (ref.lazy()) {
        if (!LazyFeatureDependencies.testDependencyFullFilled()) {
          ve.add(new ConstraintViolation(Level.SEVERE, mc, mf, getClass(),
            "Lazy references need CGLib and Proxytoys in the classpath."));
        }
      }
View Full Code Here


*/
public class LazyReferenceOnArray extends FieldConstraint {

  @Override
  protected void check(final MappedClass mc, final MappedField mf, final Set<ConstraintViolation> ve) {
    final Reference ref = mf.getAnnotation(Reference.class);
    if (ref != null && ref.lazy()) {
      final Class type = mf.getType();
      if (type.isArray()) {
        ve.add(new ConstraintViolation(Level.FATAL, mc, mf, getClass(),
          "The lazy attribute cannot be used for an Array. If you need a lazy array please use ArrayList instead."));
      }
View Full Code Here

        if (fieldValue == null && !mapper.getOptions().isStoreNulls()) {
            return;
        }

        final Reference refAnn = mf.getAnnotation(Reference.class);
        if (mf.isMap()) {
            writeMap(mf, dbObject, name, fieldValue, refAnn, mapper);
        } else if (mf.isMultipleValues()) {
            writeCollection(mf, dbObject, name, fieldValue, refAnn, mapper);
        } else {
View Full Code Here

    public void fromDBObject(final DBObject dbObject, final MappedField mf, final Object entity, final EntityCache cache,
                             final Mapper mapper) {
        final Class fieldType = mf.getType();

        final Reference refAnn = mf.getAnnotation(Reference.class);
        if (mf.isMap()) {
            readMap(dbObject, mf, entity, refAnn, cache, mapper);
        } else if (mf.isMultipleValues()) {
            readCollection(dbObject, mf, entity, refAnn, cache, mapper);
        } else {
View Full Code Here

            final Property mv = (Property) foundAnnotations.get(Property.class);
            if (!mv.value().equals(Mapper.IGNORED_FIELDNAME)) {
                return mv.value();
            }
        } else if (hasAnnotation(Reference.class)) {
            final Reference mr = (Reference) foundAnnotations.get(Reference.class);
            if (!mr.value().equals(Mapper.IGNORED_FIELDNAME)) {
                return mr.value();
            }
        } else if (hasAnnotation(Embedded.class)) {
            final Embedded me = (Embedded) foundAnnotations.get(Embedded.class);
            if (!me.value().equals(Mapper.IGNORED_FIELDNAME)) {
                return me.value();
View Full Code Here

TOP

Related Classes of org.mongodb.morphia.annotations.Reference

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.