If not already created, a new <code>entity</code> element will be created and returned.
Otherwise, the first existing <code>entity</code> element will be returned.
@return the instance defined for the element <code>entity</code>
761909
public Entity<EntityMappings<T>> getOrCreateEntity()
   {
      List<Node> nodeList = childNode.get("entity");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new EntityImpl<EntityMappings<T>>(this, "entity", childNode, nodeList.get(0));
      }
      return createEntity();
   }
195367
protected D createModelWithId(Object id, T entity) {
		return createModelWithId(id, entity, new Object[0]);
	}
1029524
public EntityInstanceWrapper getSelected() throws PMException {
        final EntityContainer container = getEntityContainer(true);
        if (container == null) {
            return null;
        }
        return container.getSelected();
    }
1313797
protected T getObject() {
		final T object;
		if (reusedObject != null) {
			// REUSE THE SAME RECORD AFTER HAVING RESETTED IT
			object = reusedObject;
			object.reset();
		} else
			// CREATE A NEW ONE
			object = (T) database.newInstance(className);
		return object;
	}
595790
public String getOrGenerateDocumentId(Object entity) {
        Reference<String> idHolder = new Reference<>();
        tryGetIdFromInstance(entity, idHolder);
        String id = idHolder.value;
        if (id == null) {
            // Generate the key up front
            id = _generateId.apply(entity);
        }

        if (id != null && id.startsWith("/")) {
            throw new IllegalStateException("Cannot use value '" + id + "' as a document id because it begins with a '/'");
        }
        return id;
    }
569943
public Rule Entity() {
        return NodeSequence(
                Sequence('&', FirstOf(HexEntity(), DecEntity(), CharEntity()), ';'),
                push(new TextNode(match()))
        );
    }
1176027
@Transactional()
    public E add(E entity)
    {
        getSqlSession().insert(getMapId(ADD_MAP_ID), entity);
        return entity;
    }
277350
private Object instantiateEntity(Class entityClass, Object entity)
    {
        try
        {
            if (entity == null)
            {
                return entityClass.newInstance();
            }
            return entity;
        }
        catch (InstantiationException e)
        {
            log.error("Error while instantiating " + entityClass + ", Caused by: ", e);
        }
        catch (IllegalAccessException e)
        {
            log.error("Error while instantiating " + entityClass + ", Caused by: ", e);
        }
        return null;
    }
1018783
public Object nextElement()
    {
        try
        {
            if (!hasCalledCheck)
            {    
                hasMoreElements();
            }    
            hasCalledCheck = false;
            if (hasNext)
            {
                Identity oid = getIdentityFromResultSet();
                Identity[] args = {oid};
                return this.constructor.newInstance(args);
            }
            else
                throw new NoSuchElementException();
        }
        catch (Exception ex)
        {
            LoggerFactory.getDefaultLogger().error(ex);
            throw new NoSuchElementException();
        }
    }
260590
protected Entity getEntity() throws ConverterException {
        final String _entity = getConfig("entity");
        if (_entity == null) {
            throw new ConverterException("collection.converter.entity.cannot.be.null");
        }
        final Entity entity = PresentationManager.getPm().getEntity(_entity);
        if (entity == null) {
            throw new ConverterException("collection.converter.entity.cannot.be.null");
        }
        return entity;
    }
59050
public TableGenerator<EntityMappings<T>> getOrCreateTableGenerator()
   {
      List<Node> nodeList = childNode.get("table-generator");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new TableGeneratorImpl<EntityMappings<T>>(this, "table-generator", childNode, nodeList.get(0));
      }
      return createTableGenerator();
   }
1158769
function createEntityObject(e) {
		var obj = {id: e.id, className: e.constructor.name, children: []};
		if (e.children && e.children.length > 0) {
			e.children.forEach(function(c) {
				obj.children.push(createEntityObject(c));
			});
		}
		return obj;
	}
705013
function () {
                var sel, e, elements = [], c, match;

                // depreciated, will be removed soon
                if ($('(')) {
                    sel = $(this.entity);
                    expect(')');
                    return new(tree.Selector)([new(tree.Element)('', sel, i)]);
                }

                while (e = $(this.element)) {
                    c = input.charAt(i);
                    elements.push(e)
                    if (c === '{' || c === '}' || c === ';' || c === ',') { break }
                }

                if (elements.length > 0) { return new(tree.Selector)(elements) }
            }
1168306
public static <T extends Entity<ID>, ID extends Serializable> T newInstance(Class<T> clazz, ID id) {
    return meta.newInstance(clazz, id);
  }
1080813
public <T extends Entity<ID>, ID extends Serializable> T newInstance(final Class<T> clazz, final ID id) {
    EntityType type = getEntityType(clazz);
    @SuppressWarnings("unchecked")
    T entity = (T) type.newInstance();
    try {
      PropertyUtils.setProperty(entity, type.getIdName(), id);
    } catch (Exception e) {
      logger.error("initialize {} with id {} error", clazz, id);
    }
    return entity;
  }
1147976
public SecondaryTable<Entity<T>> getOrCreateSecondaryTable()
   {
      List<Node> nodeList = childNode.get("secondary-table");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new SecondaryTableImpl<Entity<T>>(this, "secondary-table", childNode, nodeList.get(0));
      }
      return createSecondaryTable();
   }
267379
public Attributes<Entity<T>> getOrCreateAttributes()
   {
      Node node = childNode.getOrCreate("attributes");
      Attributes<Entity<T>> attributes = new AttributesImpl<Entity<T>>(this, "attributes", childNode, node);
      return attributes;
   }