當前位置: 首頁>>代碼示例>>Java>>正文


Java BinaryObjectBuilder.removeField方法代碼示例

本文整理匯總了Java中org.apache.ignite.binary.BinaryObjectBuilder.removeField方法的典型用法代碼示例。如果您正苦於以下問題:Java BinaryObjectBuilder.removeField方法的具體用法?Java BinaryObjectBuilder.removeField怎麽用?Java BinaryObjectBuilder.removeField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.ignite.binary.BinaryObjectBuilder的用法示例。


在下文中一共展示了BinaryObjectBuilder.removeField方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: insertOrUpdateTuple

import org.apache.ignite.binary.BinaryObjectBuilder; //導入方法依賴的package包/類
@Override
public void insertOrUpdateTuple(EntityKey key, TuplePointer tuplePointer, TupleContext tupleContext) throws TupleAlreadyExistsException {
	IgniteCache<Object, BinaryObject> entityCache = provider.getEntityCache( key.getMetadata() );
	Tuple tuple = tuplePointer.getTuple();

	Object keyObject = null;
	BinaryObjectBuilder builder = null;
	IgniteTupleSnapshot tupleSnapshot = (IgniteTupleSnapshot) tuple.getSnapshot();
	keyObject = tupleSnapshot.getCacheKey();
	if ( tuple.getSnapshotType() == SnapshotType.UPDATE ) {
		builder = provider.createBinaryObjectBuilder( tupleSnapshot.getCacheValue() );
	}
	else {
		builder = provider.createBinaryObjectBuilder( provider.getEntityTypeName( key.getMetadata().getTable() ) );
	}
	for ( String columnName : tuple.getColumnNames() ) {
		Object value = tuple.get( columnName );
		if ( value != null ) {
			builder.setField( StringHelper.realColumnName( columnName ), value );
		}
		else {
			builder.removeField( StringHelper.realColumnName( columnName ) );
		}
	}
	BinaryObject valueObject = builder.build();
	entityCache.put( keyObject, valueObject );
	tuplePointer.setTuple( new Tuple( new IgniteTupleSnapshot( keyObject, valueObject, key.getMetadata() ), SnapshotType.UPDATE ) );
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-ignite,代碼行數:29,代碼來源:IgniteDialect.java

示例2: testRemoveFromExistingObject

import org.apache.ignite.binary.BinaryObjectBuilder; //導入方法依賴的package包/類
/**
 *
 */
public void testRemoveFromExistingObject() {
    GridBinaryTestClasses.TestObjectAllTypes obj = new GridBinaryTestClasses.TestObjectAllTypes();
    obj.setDefaultData();
    obj.enumArr = null;

    BinaryObjectBuilder builder = builder(toBinary(obj));

    builder.removeField("str");

    BinaryObject binary = builder.build();

    GridBinaryTestClasses.TestObjectAllTypes deserialzied = binary.deserialize();

    assertNull(deserialzied.str);
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:19,代碼來源:BinaryObjectBuilderDefaultMappersSelfTest.java

示例3: testRemoveFromNewObject

import org.apache.ignite.binary.BinaryObjectBuilder; //導入方法依賴的package包/類
/**
 *
 */
public void testRemoveFromNewObject() {
    BinaryObjectBuilder builder = builder(GridBinaryTestClasses.TestObjectAllTypes.class.getName());

    builder.setField("str", "a");

    builder.removeField("str");

    TestCase.assertNull(builder.build().<GridBinaryTestClasses.TestObjectAllTypes>deserialize().str);
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:13,代碼來源:BinaryObjectBuilderDefaultMappersSelfTest.java


注:本文中的org.apache.ignite.binary.BinaryObjectBuilder.removeField方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。