Class MorphiaReference<T>

  • java.lang.Object
    • dev.morphia.mapping.experimental.MorphiaReference<T>
  • Type Parameters:
    T -
    Direct Known Subclasses:
    CollectionReference, MapReference, SingleReference

    public abstract class MorphiaReference<T>
    extends java.lang.Object
    Wrapper type for references to entities in other collections
    Since:
    1.5
    • Method Detail

      • get

        public abstract T get()
        Returns:
        returns the referenced entity if it exists. May return null.
      • isResolved

        public abstract boolean isResolved()
        Returns:
        true if this reference has already been resolved
        Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • encode

        public abstract java.lang.Object encode​(Mapper mapper,
                                                java.lang.Object value,
                                                MappedField optionalExtraInfo)
        Parameters:
        mapper - the mapper
        value - the value
        optionalExtraInfo - the MappedField
        Returns:
        the encoded vale
        Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • wrap

        public static <V> MorphiaReference<V> wrap​(V value)
        Wraps an value in a MorphiaReference to storing on an entity
        Type Parameters:
        V - the type of the value
        Parameters:
        value - the value wrap
        Returns:
        the MorphiaReference wrapper