Converts a Projection to a DBObject for use by the Java driver.

@param projection the project to apply
@return the DBObject
423053
private DBObject toDBObject(final Projection projection) {
        String target;
        if (firstStage) {
            MappedField field = mapper.getMappedClass(source).getMappedField(projection.getTarget());
            target = field != null ? field.getNameToStore() : projection.getTarget();
        } else {
            target = projection.getTarget();
        }

        if (projection.getProjections() != null) {
            List<Projection> list = projection.getProjections();
            DBObject projections = new BasicDBObject();
            for (Projection subProjection : list) {
                projections.putAll(toDBObject(subProjection));
            }
            return new BasicDBObject(target, projections);
        } else if (projection.getSource() != null) {
            return new BasicDBObject(target, projection.getSource());
        } else if (projection.getArguments() != null) {
            DBObject args = toExpressionArgs(projection.getArguments());
            if (target == null) {
                // Unwrap for single-argument expressions
                if (args instanceof List<?> && ((List<?>) args).size() == 1) {
                    Object firstArg = ((List<?>) args).get(0);
                    if (firstArg instanceof DBObject) {
                        return (DBObject) firstArg;
                    }
                }
                return args;
            } else {
                // Unwrap for single-argument expressions
                if (args instanceof List<?> && ((List<?>) args).size() == 1) {
                    return new BasicDBObject(target, ((List<?>) args).get(0));
                }
                return new BasicDBObject(target, args);
            }
        } else {
            return new BasicDBObject(target, projection.isSuppressed() ? 0 : 1);
        }
    }
475797
@SuppressWarnings("PMD.LooseCoupling")
    public static Object convertToArray(final Object result, final Class entityType, final boolean projection) {
        final Collection res = result instanceof Collection
                // no projection because its applied later
                ? (Collection) result : convertToCollectionImpl(result, ArrayList.class, entityType, false);
        final Object array = Array.newInstance(entityType, res.size());
        int i = 0;
        for (Object obj : res) {
            Array.set(array, i++, projection ? applyProjection(obj, entityType) : obj);
        }
        return array;
    }
1310133
function(projection) {
        var p = projection, equals = false;
        if (p) {
            if (!(p instanceof OpenLayers.Projection)) {
                p = new OpenLayers.Projection(p);
            }
            if ((typeof Proj4js == "object") && this.proj.defData && p.proj.defData) {
                equals = this.proj.defData.replace(this.titleRegEx, "") ==
                    p.proj.defData.replace(this.titleRegEx, "");
            } else if (p.getCode) {
                var source = this.getCode(), target = p.getCode();
                equals = source == target ||
                    !!OpenLayers.Projection.transforms[source] &&
                    OpenLayers.Projection.transforms[source][target] ===
                        OpenLayers.Projection.nullTransform;
            }
        }
        return equals;   
    }
728916
private MappingProject toMappingProject(Entity mappingProjectEntity) {
    String identifier = mappingProjectEntity.getString(MappingProjectMetadata.IDENTIFIER);
    String name = mappingProjectEntity.getString(MappingProjectMetadata.NAME);
    int depth = Optional.ofNullable(mappingProjectEntity.getInt(DEPTH)).orElse(3);
    List<Entity> mappingTargetEntities =
        Lists.newArrayList(
            mappingProjectEntity.getEntities(MappingProjectMetadata.MAPPING_TARGETS));
    List<MappingTarget> mappingTargets = mappingTargetRepo.toMappingTargets(mappingTargetEntities);

    return new MappingProject(identifier, name, depth, mappingTargets);
  }
1176431
public Object sqlToJava(Object source)
    {
        if(source == null)
            return null;
        try
        {
            return SerializationUtils.deserialize((byte[]) source);
        }
        catch(Throwable t)
        {
            throw new ConversionException(t);
        }
    }
797164
public BoundingBox getBoundingBox(Projection projection) {
		BoundingBox boundingBox = getBoundingBox();
		if (projection != null) {
			ProjectionTransform transform = getProjection().getTransformation(
					projection);
			if (!transform.isSameProjection()) {
				boundingBox = boundingBox.transform(transform);
			}
		}
		return boundingBox;
	}
986863
public Object sqlToJava(Object source) throws ConversionException
    {

        if (source == null)
        {
            return null;
        }
        if (!(source instanceof String))
        {
            throw new ConversionException("Object is not a String it is a"
                    + source.getClass().getName());
        }
        if (source.toString().equals(NULLVALUE))
        {
            return null;
        }
        if (source.toString().equals(EMPTYCOLLEC))
        {
            return new ArrayList();
        }

        List v = new ArrayList();
        String input = source.toString();
        int pos = input.indexOf("#");

        while (pos >= 0)
        {
            if (pos == 0)
            {
                v.add("");
            }
            else
            {
                v.add(Integer.valueOf(input.substring(0, pos)));
            }

            if (pos + 1 > input.length())
            {
                //# at end causes outof bounds
                break;
            }

            input = input.substring(pos + 1, input.length());
            pos = input.indexOf("#");
        }
        return v;
    }
355878
public static <T> T withDb(String driver, String url, Properties properties, Supplier<T> supplier) {
        return new DB(DB.DEFAULT_NAME).withDb(driver, url, properties, supplier);
    }
18806
public static Object convertBlob(Connection conn, InputStream input) throws SQLException {
        return convertBlob(conn, toByteArray(input));
    }
100762
public static BigtableInstanceAdminClient create(@Nonnull String projectId) throws IOException {
    return create(BigtableInstanceAdminSettings.newBuilder().setProjectId(projectId).build());
  }
217284
public static EDBObject convertJPAObjectToEDBObject(JPAObject object) {
        EDBObject result = new EDBObject(object.getOID());
        for (JPAEntry kvp : object.getEntries()) {
            EDBObjectEntry entry = convertJPAEntryToEDBObjectEntry(kvp);
            result.put(entry.getKey(), entry);
        }
        result.setDeleted(object.isDeleted());
        if (object.getTimestamp() != null) {
            result.updateTimestamp(object.getTimestamp());
        }
        return result;
    }
765763
public static BindingResult bindObjectToInstance(Object object, Object source) {
        return bindObjectToInstance(object, source, getBindingIncludeList(object), Collections.emptyList(), null);
    }
823202
public I_CmsProjectDriver getProjectDriver(CmsDbContext dbc) {

        if ((dbc == null) || (dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) {
            return m_projectDriver;
        }
        I_CmsProjectDriver driver = dbc.getProjectDriver(dbc.getProjectId());
        return driver != null ? driver : m_projectDriver;
    }
972482
public <T> T withDb(Supplier<T> supplier) {
        return new DB(DB.DEFAULT_NAME).withDb(supplier);
    }
689487
public CoreSyncFindIterableImpl<DocumentT, ResultT> projection(
      @Nullable final Bson projection
  ) {
    findOptions.projection(projection);
    return this;
  }
326659
public static <T> T withDb(DataSource dataSource, Supplier<T> supplier) {
        return new DB(DB.DEFAULT_NAME).withDb(dataSource, supplier);
    }
632684
public CoreRemoteFindIterableImpl<DocumentT, ResultT> projection(
      @Nullable final Bson projection
  ) {
    findOptions.projection(projection);
    return this;
  }