Skip to content

Method: IntegerType(long)

1: package de.fhdw.wtf.persistence.meta;
2:
3: /**
4: * A class to represent the Type Integer in the Metamodell. Theese are all integer numbers: ...-2, -1, 0, 1, 2,...
5: *
6: */
7: public final class IntegerType extends Type {
8:         
9:         /**
10:          * Static Identifier for type name.
11:          */
12:         public static final String INTEGER_NAME = "Integer";
13:         
14:         /**
15:          * The Id of Integer by Contract.
16:          */
17:         public static final long Integer_ID = 2;
18:         
19:         /**
20:          * The singleton Instance of Integer is stored in this field.
21:          */
22:         private static IntegerType instance;
23:         
24:         /**
25:          * This Method provides the only instance of the class Integer Type.
26:          *
27:          * @return The Integer Type.
28:          */
29:         public static synchronized IntegerType getInstance() {
30:                 if (instance == null) {
31:                         instance = new IntegerType(Integer_ID);
32:                 }
33:                 return instance;
34:         }
35:         
36:         /**
37:          * Private constructor for a new Integer Type.
38:          *
39:          * @param id
40:          * The Id of integer which is determined by the classfacade.
41:          */
42:         private IntegerType(final long id) {
43:                 super(id, INTEGER_NAME, false, false);
44:         }
45:         
46:         @Override
47:         public void accept(final TypeVisitor typeVisitor) {
48:                 typeVisitor.handleBaseType(this);
49:                 
50:         }
51:         
52:         @Override
53:         public <X> X accept(final TypeVisitorReturn<X> typeVisitor) {
54:                 return typeVisitor.handleBaseType(this);
55:         }
56:         
57:         @Override
58:         public <Exc extends Exception> void accept(final TypeVisitorException<Exc> typeVisitor) throws Exc {
59:                 typeVisitor.handleBaseType(this);
60:         }
61:         
62:         @Override
63:         public <X, Y extends Exception> X accept(final TypeVisitorReturnException<X, Y> typeVisitorReturnException)
64:                         throws Y {
65:                 return typeVisitorReturnException.handleBaseType(this);
66:         }
67:         
68:         @Override
69:         public boolean isTheSameAs(final java.lang.Object other) {
70:                 return other instanceof IntegerType;
71:         }
72:         
73: }