blob: f9c8ec4a6633658e1db19c68e2cd196e6aba81f5 [file] [log] [blame]
---
title: Performing put, get, and localDestroy Operations with a PDX Domain Object
---
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
This topic demonstrates how you can perform operations on a PDX domain object after you have implemented PDX serializable in your domain class.
For example, you can perform operations like put, get, and localDestroy with the domain class you defined for PDX serialization in the [PdxSerializable Example](pdxserializable-interface.html#pdx-serializable-example).
To perform operations, you could write the following application code:
1. Register the PDX domain class.
``` pre
Serializable::registerPdxType(PdxObject::createDeserializable);
```
2. Create the PDX domain object `PdxObject`.
``` pre
CacheablePtr pdxobj(new PdxObject(100, "Value-1"));
CacheableKeyPtr keyport = CacheableKey::create("ABC");
```
3. Here's an example of a put operation.
``` pre
rptr->put(keyport, pdxobj);
```
4. Here's an example of locally destroying the entry.
``` pre
rptr->localDestroy(keyport);
```
5. Here's an example of a get operation.
``` pre
PdxObject *obj2 = dynamic_cast<PdxObject *> ((rptr->get(keyport)).ptr());
LOGINFO("Debug:Returned ID = %d", obj2->getID());
```