Interface EntityOps

All Known Implementing Classes:
EntityModel

public interface EntityOps
  • Method Details

    • getAssociatedClass

      Class<?> getAssociatedClass()
    • getOps

      <T> T getOps(Class<T> opsClass)
      Operations may be associated with an entity. For example, an entity may support map operations (put, get, etc...) While such an entity may e.g. have a (read-only) size property, the get / put operations would be part of separate operations class associate with this entityOps instance.
    • findAnnotation

      <A> A findAnnotation(Class<A> annotationClass)
    • isInstantiable

      boolean isInstantiable()
    • newInstance

      Object newInstance()
    • getProperties

      Collection<? extends PropertyOps> getProperties()
    • isClonable

      boolean isClonable()
    • clone

      Object clone(Object Entity)
    • isPrimitive

      boolean isPrimitive()
    • getEditableProperties

      default Collection<? extends PropertyOps> getEditableProperties()
      Convenience method for getting read- and writable properties
      Returns:
    • getProperty

      PropertyOps getProperty(String name)
    • getPropertyNames

      default Set<String> getPropertyNames()
    • deepCopy

      static Object deepCopy(Object entity, Function<Class<?>,EntityOps> classToOps)
    • isCollection

      boolean isCollection()
      Entities may be container for items One issue is the identity of the items: E.g. a map is a collection of entry objects, but the getEntries method may create a copy of the entry objects. So if we cloned a collection, we would also have to clone the entry objects - even thought they are only temporary.
    • getItems

      Iterator<?> getItems(Object entity)
    • setItems

      void setItems(Object entity, Iterator<?> items)
    • deepCopy

      static Object deepCopy(Object entity, Function<Class<?>,EntityOps> classToOps, Set<Object> managedEntities)
      Deep copy, with any entity in managedEntities does NOT cause the creation of a clone For all entities not in the set a clone will be created and added to the set
      Parameters:
      entity -
      classToOps -
      managedEntities -
      Returns:
    • deepCopy

      static Object deepCopy(Object entity, Function<Class<?>,EntityOps> classToOps, Function<Object,Object> getEntityToClone, BiConsumer<Object,Object> putEntityToClone)
    • deepCopy

      static Object deepCopy(Object entity, Function<Class<?>,EntityOps> classToOps, Function<Object,Object> getEntityToClone, BiConsumer<Object,Object> putEntityToClone, Predicate<Object> getIsCopied, Consumer<Object> setIsCopied)
    • copy

      static void copy(EntityOps sourceOps, EntityOps targetOps, Object fromEntity, Object toEntity)