Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 0eaddca3e6c96e264cb4064fea6c4a6ebb603935 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/**
 * Copyright (c) 2006 IBM Corporation and others.
 * 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: 
 *   IBM - Initial API and implementation
 */
package org.eclipse.emf.codegen.merge.java.facade.ast;

import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration;

import org.eclipse.emf.codegen.merge.java.facade.JAnnotationTypeMember;

public class ASTJAnnotationTypeMember extends ASTJMember<AnnotationTypeMemberDeclaration> implements JAnnotationTypeMember
{
  /**
   * Cached default value
   * @see #getDefaultValue()
   * @see #setDefaultValue(String)
   */
  protected String defaultValue = UNITIALIZED_STRING;
  
  /**
   * Cached type
   * @see #getType()
   * @see #setType(String)
   */
  protected String type = UNITIALIZED_STRING;
  
  /**
   * @param annotationTypeMemberDeclaration
   */
  public ASTJAnnotationTypeMember(AnnotationTypeMemberDeclaration annotationTypeMemberDeclaration)
  {
    super(annotationTypeMemberDeclaration);
  }
  
  @Override
  public void dispose()
  {
    defaultValue = null;
    type = null;
    super.dispose();
  }

  public String getDefaultValue()
  {
    if (defaultValue == UNITIALIZED_STRING)
    {
      defaultValue = getFacadeHelper().toString(getASTNode().getDefault());
      if (defaultValue == null)
      {
        defaultValue = "";
      }
    }
    return defaultValue;
  }

  public void setDefaultValue(String defaultValue)
  {
    this.defaultValue = defaultValue;
    setTrackedNodeProperty(getASTNode(), defaultValue, AnnotationTypeMemberDeclaration.DEFAULT_PROPERTY, ASTNode.SIMPLE_NAME);
  }

  public String getType()
  {
    if (type == UNITIALIZED_STRING)
    {
      type = getFacadeHelper().toString(getASTNode().getType());
    }
    return type;
  }

  public void setType(String type)
  {
    this.type = type;
    setTrackedNodeProperty(getASTNode(), type, AnnotationTypeMemberDeclaration.TYPE_PROPERTY, ASTNode.SIMPLE_TYPE);
  }

  public String getName()
  {
    if (name == UNITIALIZED_STRING)
    {
      name = ASTFacadeHelper.toString(getASTNode().getName());
    }
    return name;
  }
  
  public void setName(String name)
  {
    this.name = name;
    setNodeProperty(getASTNode(), name, AnnotationTypeMemberDeclaration.NAME_PROPERTY, ASTNode.SIMPLE_NAME);
  }
}

Back to the top