System for lightweight objects
View Patent ↗Creating an object is disclosed. An instance of a sharable type is created. An instance of a lightweight type is created. The sharable type is designated as a parent of the lightweight type. The instance of the sharable type is designated as a parent of the instance of the lightweight type. The instance of the sharable type may be shared by one or more other instances of the lightweight type.
1. A system for storing a lightweight type, comprising:
memory; and
a processor configured to
store an instance of a lightweight type and an instance of a sharable type;
clone an instance of the sharable type to create a new instance of a sharable type;
determine whether the sharable type associated with the lightweight type is available;
in an event that the sharable type is not available, create in the memory the sharable type;
create in the memory the lightweight type, wherein the instance of sharable type is designated as a parent of lightweight instance;
remove the instance of sharable type from being designated as the parent of the lightweight instance; and
designate the new instance of the sharable type as being a parent of the lightweight instance,
wherein the instance of the sharable type is shared by a first instance and a second instance of the lightweight type, the first instance of the lightweight type being separate from the second instance of the lightweight type;
wherein the first instance and the second instance of the lightweight type inherit behavior from the instance of the sharable type;
wherein a lightweight composite object instance comprises the instance of sharable type and one of the first instance and the second instance of the lightweight type; and
wherein the lightweight type, the sharable type, the instance of sharable type, and the first instance and the second instance of the lightweight type are stored in a database.
2. The system as in claim 1 , wherein creating the sharable type comprises creating a new sharable type.
3. The system as in claim 1 , wherein creating the sharable type comprises modifying a previously declared non-sharable type.
4. The system as in claim 1 , wherein the processor is further configured to receive an indication to create an object of the lightweight type.
5. The system as in claim 1 , wherein declaring the lightweight type comprises creating a new lightweight type.
6. The system as in claim 1 , wherein declaring the lightweight type comprises modifying a previously declared heavyweight type.
7. The system as in claim 1 , wherein declaring the lightweight type comprises creating a subtype of another lightweight type.
8. The system as in claim 1 , wherein the processor is further configured to store in a database the sharable type.
9. The system as in claim 1 , wherein the processor is further configured to create in the memory an instance of the sharable type.
10. The system as in claim 9 , wherein the instance of the sharable type is stored in a database.
11. The system as in claim 1 , wherein the processor is further configured to store in a database an instance of the lightweight type.
12. The system as in claim 11 , wherein the instance of the lightweight type is stored in a database.
13. The system as in claim 1 , wherein the lightweight type is one of a plurality of lightweight types, wherein each of the plurality of lightweight types have the sharable type designated as a parent.
14. The system as in claim 1 , wherein the instance of the sharable type has identical data for each of the first instance and the second instance of the lightweight type.
15. A method for storing a lightweight type, comprising:
storing an instance of a lightweight type and an instance of a sharable type;
cloning an instance of the sharable type to create a new instance of a sharable type;
determining whether the sharable type associated with the lightweight type is available;
in an event that the sharable type is not available, creating in memory the sharable type;
creating in the memory the lightweight type, wherein the instance of sharable type is designated as a parent of lightweight instance;
removing the instance of sharable type from being designated as the parent of the lightweight instance; and
designating the new instance of the sharable type as being a parent of the lightweight instance,
wherein the instance of the sharable type is shared by a first instance and a second instance of the lightweight type, the first instance of the lightweight type being separate from the second instance of the lightweight type;
wherein the first instance and the second instance of the lightweight type inherit behavior from the instance of the sharable type;
wherein a lightweight composite object instance comprises the instance of sharable type and one of the first instance and the second instance of the lightweight type; and
wherein the lightweight type, the sharable type, the instance of sharable type, and the first instance and the second instance of the lightweight type are stored in a database.
16. A computer program product for storing a lightweight type, the computer program product comprising a non-transitory computer readable medium stored thereon computer instructions for:
storing an instance of a lightweight type and an instance of a sharable type;
cloning an instance of the sharable type to create a new instance of a sharable type;
determining whether the sharable type associated with the lightweight type is available;
in an event that the sharable type is not available, creating in memory the sharable type;
creating in the memory the lightweight type, wherein the instance of sharable type is designated as a parent of lightweight instance;
removing the instance of sharable type from being designated as the parent of the lightweight instance; and
designating the new instance of the sharable type as being a parent of the lightweight instance,
wherein the instance of the sharable type is shared by a first instance and a second instance of the lightweight type, the first instance of the lightweight type being separate from the second instance of the lightweight type;
wherein the first instance and the second instance of the lightweight type inherit behavior from the instance of the sharable type;
wherein a lightweight composite object instance comprises the instance of sharable type and one of the first instance and the second instance of the lightweight type; and
wherein the lightweight type, the sharable type, the instance of sharable type, and the first instance and the second instance of the lightweight type are stored in a database.