| /** |
| * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| */ |
| package org.eclipse.osbp.dsl.tests.carstore.entities; |
| |
| import java.io.Serializable; |
| import javax.persistence.Basic; |
| import javax.persistence.Embeddable; |
| import javax.persistence.Transient; |
| import org.eclipse.osbp.dsl.common.datatypes.IBean; |
| import org.eclipse.osbp.runtime.common.annotations.Dirty; |
| import org.eclipse.osbp.runtime.common.annotations.Dispose; |
| |
| @Embeddable |
| @SuppressWarnings("all") |
| public class Address implements Serializable, IBean { |
| @Transient |
| @Dispose |
| private boolean disposed; |
| |
| @Dirty |
| private transient boolean dirty; |
| |
| @Basic |
| private String streetname; |
| |
| @Basic |
| private String postalcode; |
| |
| /** |
| * @return true, if the object is disposed. |
| * Disposed means, that it is prepared for garbage collection and may not be used anymore. |
| * Accessing objects that are already disposed will cause runtime exceptions. |
| * |
| */ |
| @Dispose |
| public boolean isDisposed() { |
| return this.disposed; |
| } |
| |
| /** |
| * @return true, if the object is dirty. |
| * |
| */ |
| public boolean isDirty() { |
| return dirty; |
| } |
| |
| /** |
| * Sets the dirty state of this object. |
| * |
| */ |
| public void setDirty(final boolean dirty) { |
| this.dirty = dirty; |
| } |
| |
| /** |
| * Checks whether the object is disposed. |
| * @throws RuntimeException if the object is disposed. |
| */ |
| private void checkDisposed() { |
| if (isDisposed()) { |
| throw new RuntimeException("Object already disposed: " + this); |
| } |
| } |
| |
| /** |
| * Calling dispose will destroy that instance. The internal state will be |
| * set to 'disposed' and methods of that object must not be used anymore. |
| * Each call will result in runtime exceptions.<br> |
| * If this object keeps composition containments, these will be disposed too. |
| * So the whole composition containment tree will be disposed on calling this method. |
| */ |
| @Dispose |
| public void dispose() { |
| if (isDisposed()) { |
| return; |
| } |
| disposed = true; |
| } |
| |
| /** |
| * @return Returns the streetname property or <code>null</code> if not present. |
| */ |
| public String getStreetname() { |
| checkDisposed(); |
| return this.streetname; |
| } |
| |
| /** |
| * Sets the streetname property to this instance. |
| */ |
| public void setStreetname(final String streetname) { |
| checkDisposed(); |
| this.streetname = streetname; |
| } |
| |
| /** |
| * @return Returns the postalcode property or <code>null</code> if not present. |
| */ |
| public String getPostalcode() { |
| checkDisposed(); |
| return this.postalcode; |
| } |
| |
| /** |
| * Sets the postalcode property to this instance. |
| */ |
| public void setPostalcode(final String postalcode) { |
| checkDisposed(); |
| this.postalcode = postalcode; |
| } |
| } |