/* * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2017, Open Source Geospatial Foundation (OSGeo) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ package org.geotools.data.mongodb.complex; import org.geotools.filter.FunctionExpressionImpl; import org.geotools.filter.capability.FunctionNameImpl; import org.opengis.filter.capability.FunctionName; import java.util.UUID; import static org.geotools.filter.capability.FunctionNameImpl.parameter; /** * Function that returns a random ID for a collection. */ public final class CollectionIdFunction extends FunctionExpressionImpl { private static final FunctionName DEFINITION = new FunctionNameImpl( "collectionId", parameter("value", Object.class), parameter("path", String.class)); public CollectionIdFunction() { super(DEFINITION); } public Object evaluate(Object object) { return UUID.randomUUID().toString(); } }