View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   package cz.cuni.amis.pogamut.udk.t3dgenerator.elements;
6   
7   import cz.cuni.amis.pogamut.unreal.t3dgenerator.annotations.FieldName;
8   import cz.cuni.amis.pogamut.unreal.t3dgenerator.annotations.UnrealBean;
9   import cz.cuni.amis.pogamut.unreal.t3dgenerator.annotations.UnrealHeaderField;
10  import cz.cuni.amis.pogamut.unreal.t3dgenerator.annotations.UnrealProperty;
11  import cz.cuni.amis.pogamut.unreal.t3dgenerator.datatypes.DynamicReference;
12  import cz.cuni.amis.pogamut.unreal.t3dgenerator.datatypes.StaticReference;
13  import cz.cuni.amis.pogamut.unreal.t3dgenerator.datatypes.UnrealReference;
14  import cz.cuni.amis.pogamut.unreal.t3dgenerator.elements.AbstractUnrealBean;
15  
16  /**
17   * Abstract predecessor for most Unreal objects.
18   * A descendant needs to use {@link UnrealBean} annotation to specify the objec type.
19   * @author Martin Cerny
20   */
21  public class AbstractBean extends AbstractUnrealBean {
22      @UnrealHeaderField
23      @UnrealProperty
24      @FieldName("ObjectArchetype")
25      private UnrealReference archetype;
26  
27      /**
28       * Get a name of default archetype for a specified className.
29       * Useful in creating archetype references.
30       * @param className
31       * @return 
32       */
33      public static String getDefaultArchetype(String className) {
34          return "Engine.Default__" + className;
35      }
36  
37      public AbstractBean() {
38      }   
39      
40      public AbstractBean(String className) {
41          this(className,getDefaultArchetype(className), null);        
42      }
43  
44      public AbstractBean(String className, UnrealReference archetype) {
45          this(className, archetype, null);
46      }
47  
48      public AbstractBean(String className, String archetypeName) {
49          this(className, archetypeName, null);
50      }
51  
52      public AbstractBean(String className, String archetypeName, String name) {
53          this(className, new StaticReference(className, archetypeName), name);
54      }
55  
56      public AbstractBean(String className, UnrealReference archetype, String name) {
57          super(className, name);
58          this.archetype = archetype;
59      }
60  
61      public UnrealReference getArchetype() {
62          return archetype;
63      }
64  }