本文整理匯總了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 ) );
}
示例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);
}
示例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);
}