00001 /* 00002 * Copyright (c) 2000, 2020, Oracle and/or its affiliates. 00003 * 00004 * Licensed under the Universal Permissive License v 1.0 as shown at 00005 * http://oss.oracle.com/licenses/upl. 00006 */ 00007 #ifndef COH_PORTABLE_HPP 00008 #define COH_PORTABLE_HPP 00009 00010 #include "coherence/lang.ns" 00011 00012 COH_OPEN_NAMESPACE4(coherence,io,pof,annotation) 00013 00014 /** 00015 * Portable marks a class as being eligible for use by a 00016 * PofAnnotationSerializer. This annotation is only permitted at class level 00017 * and is a marker annotation with no members. The following class illustrates 00018 * how to use Portable and PortableProperty annotations. 00019 * 00020 * @code 00021 * class Person 00022 * : public class_spec<Person> 00023 * { 00024 * friend class factory<Person>; 00025 * 00026 * public: 00027 * String::View getFirstName() const 00028 * { 00029 * return m_vsFirstName; 00030 * } 00031 * 00032 * void setFirstName(String::View vsFirstName) 00033 * { 00034 * m_vsFirstName = vsFirstName; 00035 * } 00036 * 00037 * String::View getLastName() const 00038 * { 00039 * return m_vsLastName; 00040 * } 00041 * 00042 * void setLastName(String::View vsLastName) 00043 * { 00044 * m_vsLastName = vsLastName; 00045 * } 00046 * 00047 * private: 00048 * MemberView<String> m_vsFirstName; 00049 * MemberView<String> m_vsLastName; 00050 * }; 00051 * 00052 * COH_REGISTER_CLASS(TypedClass<Person>::create() 00053 * ->annotate(Portable::create(1001)) 00054 * ->declare(COH_PROPERTY(Person, FirstName, String::View)->annotate(PortableProperty::create(0))) 00055 * ->declare(COH_PROPERTY(Person, LastName, String::View)->annotate(PortableProperty::create(1)))); 00056 * 00057 * @endcode 00058 * 00059 * @author hr 2011.06.29 00060 * 00061 * @since 3.7.1 00062 * 00063 * @see PortableProperty 00064 */ 00065 class COH_EXPORT Portable 00066 : public class_spec<Portable, 00067 extends<Object>, 00068 implements<Annotation> > 00069 { 00070 friend class factory<Portable>; 00071 00072 // ----- Annotation interface ------------------------------------------- 00073 00074 public: 00075 /** 00076 * {@inheritDoc} 00077 */ 00078 virtual Class::View annotationType() const; 00079 00080 // ----- constants ------------------------------------------------------ 00081 00082 public: 00083 /** 00084 * A convenience static method to return a reference to the Class 00085 * definition for this Portable annotation class. 00086 * 00087 * @return a Class representing the Portable definition 00088 */ 00089 static Class::View getStaticClass(); 00090 }; 00091 00092 COH_CLOSE_NAMESPACE4 00093 00094 #endif /* COH_PORTABLE_HPP */