Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _invoke_filter_list_method_by_name(j_filter_factory, name, filters):
filter_factory_class = j_filter_factory.getClass()
list_class = reflection_util.classForName("java.util.List")
class_array = java_gateway.new_array(java_pkg.java.lang.Class, 1)
class_array[0] = list_class
method = filter_factory_class.getMethod(name, class_array)
filter_list = java_pkg.java.util.ArrayList()
for filter in filters:
filter_list.append(filter)
objects_array = java_gateway.new_array(java_pkg.java.lang.Object, 1)
objects_array[0] = filter_list
return method.invoke(j_filter_factory, objects_array)
Args:
value (any): The literal value to use.
Returns:
An Expression with the given literal value.
"""
if isinstance(value, datetime):
# Convert the date to a string
value = value.strftime("%Y-%m-%dT%H:%M:%S")
if isinstance(value, str):
# Prevent Py4J from assuming the string matches up with the char variant method
filter_factory_class = self._java_ref.getClass()
object_class = reflection_util.classForName("java.lang.Object")
class_array = java_gateway.new_array(java_pkg.java.lang.Class, 1)
class_array[0] = object_class
method = filter_factory_class.getMethod("literal", class_array)
objects_array = java_gateway.new_array(java_pkg.java.lang.Object, 1)
objects_array[0] = value
return method.invoke(self._java_ref, objects_array)
if isinstance(value, BaseGeometry):
return self._java_ref.literal(GeometryType().to_java(value))
return self._java_ref.literal(value)
def _invoke_filter_list_method_by_name(j_filter_factory, name, filters):
filter_factory_class = j_filter_factory.getClass()
list_class = reflection_util.classForName("java.util.List")
class_array = java_gateway.new_array(java_pkg.java.lang.Class, 1)
class_array[0] = list_class
method = filter_factory_class.getMethod(name, class_array)
filter_list = java_pkg.java.util.ArrayList()
for filter in filters:
filter_list.append(filter)
objects_array = java_gateway.new_array(java_pkg.java.lang.Object, 1)
objects_array[0] = filter_list
return method.invoke(j_filter_factory, objects_array)
def _invoke_filter_method_by_name(j_filter_factory, name, filter):
filter_factory_class = j_filter_factory.getClass()
filter_class = reflection_util.classForName("org.opengis.filter.Filter")
class_array = java_gateway.new_array(java_pkg.java.lang.Class, 1)
class_array[0] = filter_class
method = filter_factory_class.getMethod(name, class_array)
objects_array = java_gateway.new_array(java_pkg.java.lang.Object, 1)
objects_array[0] = filter
return method.invoke(j_filter_factory, objects_array)