| /** |
| * Copyright (c) 2011, 2014 - 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 |
| */ |
| package org.eclipse.osbp.entitydsl.documentation.demo; |
| |
| import javax.persistence.Column; |
| import javax.persistence.DiscriminatorValue; |
| import javax.persistence.Entity; |
| import org.eclipse.osbp.dsl.common.datatypes.IEntity; |
| import org.eclipse.osbp.entitydsl.documentation.demo.Foo; |
| import org.eclipse.osbp.runtime.common.annotations.Dispose; |
| |
| @Entity |
| @DiscriminatorValue(value = "BAR") |
| @SuppressWarnings("all") |
| public class Bar extends Foo implements IEntity { |
| @Column(name = "NUMBER") |
| private Long number; |
| |
| /** |
| * 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; |
| } |
| super.dispose(); |
| } |
| |
| /** |
| * Returns the number property or <code>null</code> if not present. |
| */ |
| public Long getNumber() { |
| checkDisposed(); |
| return this.number; |
| } |
| |
| /** |
| * Sets the number property to this instance. |
| */ |
| public void setNumber(final Long number) { |
| checkDisposed(); |
| this.number = number; |
| } |
| |
| public String getnumberasstring() { |
| return Long.toString((this.number).longValue()); |
| } |
| } |