org.apache.flink.api.java.typeutils.TypeExtractionUtils Java Examples

The following examples show how to use org.apache.flink.api.java.typeutils.TypeExtractionUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Serializers.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private static void recursivelyRegisterGenericType(Type fieldType, ExecutionConfig config, Set<Class<?>> alreadySeen) {
	if (fieldType instanceof ParameterizedType) {
		// field has generics
		ParameterizedType parameterizedFieldType = (ParameterizedType) fieldType;
		
		for (Type t: parameterizedFieldType.getActualTypeArguments()) {
			if (TypeExtractionUtils.isClassType(t) ) {
				recursivelyRegisterType(TypeExtractionUtils.typeToClass(t), config, alreadySeen);
			}
		}

		recursivelyRegisterGenericType(parameterizedFieldType.getRawType(), config, alreadySeen);
	}
	else if (fieldType instanceof GenericArrayType) {
		GenericArrayType genericArrayType = (GenericArrayType) fieldType;
		recursivelyRegisterGenericType(genericArrayType.getGenericComponentType(), config, alreadySeen);
	}
	else if (fieldType instanceof Class) {
		Class<?> clazz = (Class<?>) fieldType;
		recursivelyRegisterType(clazz, config, alreadySeen);
	}
}
 
Example #2
Source File: Serializers.java    From flink with Apache License 2.0 6 votes vote down vote up
private static void recursivelyRegisterGenericType(Type fieldType, ExecutionConfig config, Set<Class<?>> alreadySeen) {
	if (fieldType instanceof ParameterizedType) {
		// field has generics
		ParameterizedType parameterizedFieldType = (ParameterizedType) fieldType;
		
		for (Type t: parameterizedFieldType.getActualTypeArguments()) {
			if (TypeExtractionUtils.isClassType(t) ) {
				recursivelyRegisterType(TypeExtractionUtils.typeToClass(t), config, alreadySeen);
			}
		}

		recursivelyRegisterGenericType(parameterizedFieldType.getRawType(), config, alreadySeen);
	}
	else if (fieldType instanceof GenericArrayType) {
		GenericArrayType genericArrayType = (GenericArrayType) fieldType;
		recursivelyRegisterGenericType(genericArrayType.getGenericComponentType(), config, alreadySeen);
	}
	else if (fieldType instanceof Class) {
		Class<?> clazz = (Class<?>) fieldType;
		recursivelyRegisterType(clazz, config, alreadySeen);
	}
}
 
Example #3
Source File: Serializers.java    From flink with Apache License 2.0 6 votes vote down vote up
private static void recursivelyRegisterGenericType(Type fieldType, ExecutionConfig config, Set<Class<?>> alreadySeen) {
	if (fieldType instanceof ParameterizedType) {
		// field has generics
		ParameterizedType parameterizedFieldType = (ParameterizedType) fieldType;
		
		for (Type t: parameterizedFieldType.getActualTypeArguments()) {
			if (TypeExtractionUtils.isClassType(t) ) {
				recursivelyRegisterType(TypeExtractionUtils.typeToClass(t), config, alreadySeen);
			}
		}

		recursivelyRegisterGenericType(parameterizedFieldType.getRawType(), config, alreadySeen);
	}
	else if (fieldType instanceof GenericArrayType) {
		GenericArrayType genericArrayType = (GenericArrayType) fieldType;
		recursivelyRegisterGenericType(genericArrayType.getGenericComponentType(), config, alreadySeen);
	}
	else if (fieldType instanceof Class) {
		Class<?> clazz = (Class<?>) fieldType;
		recursivelyRegisterType(clazz, config, alreadySeen);
	}
}