SimpleDciEntity.java

  1. /*
  2.  * #%L
  3.  * *********************************************************************************************************************
  4.  *
  5.  * SteelBlue
  6.  * http://steelblue.tidalwave.it - git clone git@bitbucket.org:tidalwave/steelblue-src.git
  7.  * %%
  8.  * Copyright (C) 2015 - 2015 Tidalwave s.a.s. (http://tidalwave.it)
  9.  * %%
  10.  *
  11.  * *********************************************************************************************************************
  12.  *
  13.  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  14.  * the License. You may obtain a copy of the License at
  15.  *
  16.  *     http://www.apache.org/licenses/LICENSE-2.0
  17.  *
  18.  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  19.  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
  20.  * specific language governing permissions and limitations under the License.
  21.  *
  22.  * *********************************************************************************************************************
  23.  *
  24.  *
  25.  *
  26.  * *********************************************************************************************************************
  27.  * #L%
  28.  */
  29. package it.tidalwave.role.ui.javafx.example.large.data;

  30. import javax.annotation.Nonnull;
  31. import it.tidalwave.util.As;
  32. import it.tidalwave.util.spi.AsSupport;
  33. import it.tidalwave.role.ui.Displayable;
  34. import lombok.experimental.Delegate;
  35. import lombok.Getter;
  36. import lombok.ToString;

  37. /***********************************************************************************************************************
  38.  *
  39.  * A simple datum class with a DCI role: {@link Displayable}, which contains the entity display name,
  40.  *
  41.  * @stereotype  Datum
  42.  *
  43.  * @author  Fabrizio Giudici (Fabrizio.Giudici@tidalwave.it)
  44.  *
  45.  **********************************************************************************************************************/
  46. @Getter @ToString(exclude = "asDelegate")
  47. public class SimpleDciEntity implements As
  48.   {
  49.     @Delegate
  50.     private final AsSupport asDelegate;

  51.     @Nonnull
  52.     private final String name;

  53.     private final int attribute1;

  54.     private final int attribute2;

  55.     public SimpleDciEntity (@Nonnull final String id, final int attribute1, final int attribute2)
  56.       {
  57.         this.name = id;
  58.         this.attribute1 = attribute1;
  59.         this.attribute2 = attribute2;
  60.         asDelegate = new AsSupport(this, Displayable.of(name));
  61.       }
  62.   }