Class EntityCopier

java.lang.Object
org.dynamoframework.rest.crud.EntityCopier

@Component public class EntityCopier extends Object
A class used to create copies of an entity or list of entities

This is mainly used in order to "hide" attributes that are not relevant in a given situation (because "visibleInGrid" or "visibleInForm" is false for a particular attribute)

This is also used to get around infinite loops in the JSON structure, because this any references from detail objects back to their parents

  • Constructor Details

    • EntityCopier

      public EntityCopier()
  • Method Details

    • copyResults

      public <ID2, U extends AbstractEntity<ID2>> List<U> copyResults(List<U> input, EntityModel<U> model)
      Creates a copy of the provided list of entities, with all irrelevant fields omitted
      Parameters:
      input - the list of input entities
      model - the model
      Returns:
      the copies
    • copyResult

      public <ID2, U extends AbstractEntity<ID2>> U copyResult(U input, EntityModel<U> model)
      Creates a copy of the provided entity with all irrelevant fields omitted
      Type Parameters:
      ID2 - the type of the ID of the entity
      U - the type of the entity
      Parameters:
      input - the entity copy
      model - the entity model to use
      Returns:
      the copied entity
    • unproxy

      public static Object unproxy(Object proxy)