public void addMapping()

in infinispan-remote/src/main/java/org/hibernate/ogm/datastore/infinispanremote/impl/protobuf/ProtofieldAccessorSet.java [65:176]


	public void addMapping(String ormMappedName, GridType gridType, Type ormType, boolean nullable) {
		final String name = SanitationUtils.convertNameSafely( ormMappedName );
		uniqueTagAssigningCounter++;
		gridType = extractGridTypeOnRecursiveTypes( gridType, ormType );
		if ( gridType instanceof StringType ) {
			add( new StringProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof IntegerType ) {
			add( new IntegerProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof LongType ) {
			add( new LongProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof DoubleType ) {
			add( new DoubleProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof UUIDType ) {
			add( new StringProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof CalendarDateType ) {
			add( new CalendarDateProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof CalendarType ) {
			//TODO same as CalendarDateType ?
			add( new CalendarDateProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof DateType  ) {
			add( new DateProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof TimestampType ) {
			add( new TimestampProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof TimeType ) {
			//TODO same as DateType?
			add( new DateProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof PrimitiveByteArrayType  ) {
			add( new PrimitiveBytearrayProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof SerializableAsByteArrayType ) {
			//TODO same as PrimitiveByteArrayType?
			add( new PrimitiveBytearrayProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof CharacterType ) {
			add( new CharacterProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof ByteType ) {
			add( new ByteProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof BooleanType ) {
			add( new BooleanProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof TrueFalseType ) {
			add( new CharacterProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof YesNoType ) {
			add( new CharacterProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof NumericBooleanType ) {
			add( new IntegerProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof BigDecimalType ) {
			add( new StringProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof UrlType ) {
			add( new StringProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof ShortType ) {
			add( new ShortProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof BigIntegerType ) {
			add( new StringProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof FloatType ) {
			add( new FloatProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof LocalDateType ) {
			add( new LocalDateProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof LocalDateTimeType ) {
			add( new LocalDateTimeProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof LocalTimeType ) {
			add( new TimeProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
		}
		else if ( gridType instanceof EnumType ) {
			EnumType etype = (EnumType) gridType;
			if ( etype.isOrdinal() ) {
				add( new IntegerProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
			}
			else {
				add( new StringProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, ormMappedName ) );
				/* FIXME Alternative: Support of native Enum mapping in protobuf:
				if ( ormType instanceof CustomType ) {
					CustomType customOrmType = (CustomType) ormType;
					UserType userType = customOrmType.getUserType();
					org.hibernate.type.EnumType enumtype = (org.hibernate.type.EnumType) userType;
					Class returnedClass = enumtype.returnedClass();
					add( new EnumProtofieldAccessor( uniqueTagAssigningCounter, name, nullable, returnedClass, ormMappedName ) );
				}
				else {
					throw new AssertionFailure( "Type not implemented yet! " );
				} */
			}
		}
		else if ( gridType instanceof EntityType ) {
			throw new AssertionFailure( "EntityType not implemented yet! " + gridType.getName()  );
		}
		else {
			throw new AssertionFailure( "Type not implemented yet! " + gridType.getName()  );
		}
	}