spring-geode/src/main/java/org/springframework/geode/data/json/converter/support/JSONFormatterPdxToJsonConverter.java
/**
	 * WARNING!!!
	 *
	 * First, this method might be less than optimal and could lead to PDX type explosion!
	 *
	 * Second, this {@code pdxInstance.createWriter().setField(AT_TYPE_METADATA_PROPERTY_NAME, className);} ...
	 *
	 * Throws:
	 *  org.apache.geode.pdx.PdxFieldDoesNotExistException: A field named @type does not exist on ...
	 *  PdxType[dsid=0,typenum=7232261,name=example.app.crm.model.Customer,fields=[id:long:identity:0:idx0(relativeOffset)=0:idx1(vlfOffsetIndex)=0, name:String:1:idx0(relativeOffset)=8:idx1(vlfOffsetIndex)=-1,]]
	 *    at org.apache.geode.pdx.internal.WritablePdxInstanceImpl.setField(WritablePdxInstanceImpl.java:119)
	 *    ...
	 *
	 * This code needs to create a {@literal new} {@link PdxInstance} from an existing {@link PdxInstance}
	 * or add the new (PDX) field to the PDX type metadata using {@code PdxType.addField(:PdxField)} before
	 * setting the new field on the {@link PdxInstance} using the {@link WritablePdxInstance}. Unfortunately,
	 * {@code PdxType} is part of the internal API and updating and ditributing a {@code PdxType} is complicated,
	 * requiring a Distributed Lock, among other responsibilities.
	 */
WARNING
First, this method might be less than optimal and could lead to PDX type explosion!





This code needs to create a  new  PdxInstance from an existing  PdxInstance
or add the new (PDX) field to the PDX type metadata using  PdxType.addField(:PdxField) before
setting the new field on the  PdxInstance using the  WritablePdxInstance. Unfortunately,
PdxType is part of the internal API and updating and ditributing a  PdxType is complicated,
requiring a Distributed Lock, among other responsibilities.
WARNING First this method might be less than optimal and could lead to PDX type explosion! This code needs to create a new PdxInstance from an existing PdxInstance or add the new ( PDX ) field to the PDX type metadata using PdxType . addField ( : PdxField ) before setting the new field on the PdxInstance using the WritablePdxInstance . Unfortunately PdxType is part of the internal API and updating and ditributing a PdxType is complicated requiring a Distributed Lock among other responsibilities .
@SuppressWarnings("unused")
	protected @NonNull PdxInstance decorate(@NonNull PdxInstance pdxInstance) {
		if (isMissingObjectTypeMetadata(pdxInstance)) {
			String pdxInstanceClassName = pdxInstance.getClassName();
			Assert.isTrue(hasValidClassName(pdxInstance), () ->
				String.format("Class name [%s] is required and cannot be equal to [%s]",
					pdxInstanceClassName, JSONFormatter.JSON_CLASSNAME));
			pdxInstance = newPdxInstanceBuilder()
				.copy(pdxInstance)
				.writeString(AT_TYPE_METADATA_PROPERTY_NAME, pdxInstanceClassName)
				.create();
		}
		return pdxInstance;
	}
@ SuppressWarnings ( "unused" ) protected @ NonNull PdxInstance decorate ( @ NonNull PdxInstance pdxInstance ) { if ( isMissingObjectTypeMetadata ( pdxInstance ) ) { String pdxInstanceClassName = pdxInstance . getClassName ( ) ; Assert . isTrue ( hasValidClassName ( pdxInstance ) , ( ) -> String . format ( "Class name [%s] is required and cannot be equal to [%s]" , pdxInstanceClassName , JSONFormatter . JSON_CLASSNAME ) ) ; pdxInstance = newPdxInstanceBuilder ( ) . copy ( pdxInstance ) . writeString ( AT_TYPE_METADATA_PROPERTY_NAME , pdxInstanceClassName ) . create ( ) ; } return pdxInstance ; }
WARNING!!!
WARNING!!!