spring-geode/src/main/java/org/springframework/geode/core/util/ObjectUtils.java
/**
	 * Tries to cast the given source {@link Object} into an instance of the given {@link Class} type.
	 *
	 * This method is cable of handling Apache Geode {@link PdxInstance} types.
	 *
	 * @param <T> desired {@link Class type} of the source {@link Object}.
	 * @param source {@link Object} to evaluate.
	 * @param type desired target {@link Class} type; must not be {@literal null}.
	 * @return the source {@link Object} cast to an instance of the given {@link Class} type.
	 * @throws IllegalArgumentException if the source {@link Object} is not an instance of
	 * the given {@link Class} type or the {@link Class} type is {@literal null}.
	 * @see org.apache.geode.pdx.PdxInstance
	 * @see java.lang.Class
	 * @see java.lang.Object
	 */
Tries to cast the given source  Object into an instance of the given  Class type.
This method is cable of handling Apache Geode  PdxInstance types.

@param  desired  Class type of the source  Object.
@param source  Object to evaluate.
@param type desired target  Class type; must not be  null.
@return the source  Object cast to an instance of the given  Class type.
@throws IllegalArgumentException if the source  Object is not an instance of
the given  Class type or the  Class type is  null.
Tries to cast the given source Object into an instance of the given Class type . This method is cable of handling Apache Geode PdxInstance types . @param desired Class type of the source Object . @param source Object to evaluate . @param type desired target Class type ; must not be null . @return the source Object cast to an instance of the given Class type . @throws IllegalArgumentException if the source Object is not an instance of the given Class type or the Class type is null .
public static @Nullable <T> T asType(@Nullable Object source, @NonNull Class<T> type) {
		Assert.notNull(type, "Class type must not be null");
		Object target = source instanceof PdxInstance
			? ((PdxInstance) source).getObject()
			: source;
		return target == null ? null
			: Optional.of(target)
				.filter(type::isInstance)
				.map(type::cast)
				.orElseThrow(() -> newIllegalArgumentException("Object [%s] is not an instance of type [%s]",
					nullSafeClassName(target), type.getName()));
	}
public static @ Nullable < T > T asType ( @ Nullable Object source , @ NonNull Class < T > type ) { Assert . notNull ( type , "Class type must not be null" ) ; Object target = source instanceof PdxInstance ? ( ( PdxInstance ) source ) . getObject ( ) : source ; return target == null ? null : Optional . of ( target ) . filter ( type :: isInstance ) . map ( type :: cast ) . orElseThrow ( ( ) -> newIllegalArgumentException ( "Object [%s] is not an instance of type [%s]" , nullSafeClassName ( target ) , type . getName ( ) ) ) ; }
Tries to cast the given source {@link Object} into an instance of the given {@link Class} type.
Tries to cast the given source { @link Object } into an instance of the given { @link Class } type .