Repository: ignite Updated Branches: refs/heads/ignite-1282 5338eb8d8 -> 1118a01f5
Ignite-1282 - Ignite object interface. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4134f64e Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4134f64e Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4134f64e Branch: refs/heads/ignite-1282 Commit: 4134f64e7bc430606d4964cd929537160914ba1d Parents: 9d67c20 Author: Alexey Goncharuk <[email protected]> Authored: Thu Oct 29 13:14:59 2015 +0300 Committer: Alexey Goncharuk <[email protected]> Committed: Thu Oct 29 13:14:59 2015 +0300 ---------------------------------------------------------------------- .../org/apache/ignite/cache/IgniteObject.java | 60 ++++++++++++++++++++ .../apache/ignite/portable/PortableObject.java | 12 ++-- 2 files changed, 66 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/4134f64e/modules/core/src/main/java/org/apache/ignite/cache/IgniteObject.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/IgniteObject.java b/modules/core/src/main/java/org/apache/ignite/cache/IgniteObject.java new file mode 100644 index 0000000..ab926ce --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/cache/IgniteObject.java @@ -0,0 +1,60 @@ +/* + * 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. + */ + +package org.apache.ignite.cache; + +import java.io.Serializable; +import org.apache.ignite.portable.PortableException; +import org.jetbrains.annotations.Nullable; + +/** + * Ignite object. Abstracted representation of a binary object form. + */ +public interface IgniteObject extends Serializable { + /** + * Gets object type ID. + * + * @return Type ID. + */ + public int typeId(); + + /** + * Gets field value. + * + * @param fieldName Field name. + * @return Field value. + * @throws PortableException In case of any other error. + */ + @Nullable public <F> F field(String fieldName) throws PortableException; + + /** + * Checks whether field is set. + * + * @param fieldName Field name. + * @return {@code true} if field is set. + */ + public boolean hasField(String fieldName); + + /** + * Gets fully deserialized instance of portable object. + * + * @return Fully deserialized instance of portable object. + * @throws org.apache.ignite.portable.PortableInvalidClassException If class doesn't exist. + * @throws PortableException In case of any other error. + */ + @Nullable public <T> T deserialize() throws PortableException; +} http://git-wip-us.apache.org/repos/asf/ignite/blob/4134f64e/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java index 66b8f76..92b25aa 100644 --- a/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java +++ b/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java @@ -17,12 +17,12 @@ package org.apache.ignite.portable; -import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.TreeMap; import org.apache.ignite.IgnitePortables; +import org.apache.ignite.cache.IgniteObject; import org.apache.ignite.marshaller.portable.PortableMarshaller; import org.jetbrains.annotations.Nullable; @@ -103,13 +103,13 @@ import org.jetbrains.annotations.Nullable; * methods. Having metadata also allows for proper formatting of {@code PortableObject.toString()} method, * even when portable objects are kept in binary format only, which may be necessary for audit reasons. */ -public interface PortableObject extends Serializable, Cloneable { +public interface PortableObject extends IgniteObject, Cloneable { /** * Gets portable object type ID. * * @return Type ID. */ - public int typeId(); + @Override public int typeId(); /** * Gets meta data for this portable object. @@ -126,7 +126,7 @@ public interface PortableObject extends Serializable, Cloneable { * @return Field value. * @throws PortableException In case of any other error. */ - @Nullable public <F> F field(String fieldName) throws PortableException; + @Override @Nullable public <F> F field(String fieldName) throws PortableException; /** * Checks whether field is set. @@ -134,7 +134,7 @@ public interface PortableObject extends Serializable, Cloneable { * @param fieldName Field name. * @return {@code true} if field is set. */ - public boolean hasField(String fieldName); + @Override public boolean hasField(String fieldName); /** * Gets fully deserialized instance of portable object. @@ -143,7 +143,7 @@ public interface PortableObject extends Serializable, Cloneable { * @throws PortableInvalidClassException If class doesn't exist. * @throws PortableException In case of any other error. */ - @Nullable public <T> T deserialize() throws PortableException; + @Override @Nullable public <T> T deserialize() throws PortableException; /** * Copies this portable object.
