001 package org.mesopotamia.lang.java; 002 003 import org.mesopotamia.MesopotamiaException; 004 import org.mesopotamia.NodeData; 005 import org.mesopotamia.RepositoryLanguage; 006 import org.mesopotamia.Scan; 007 import org.w3c.dom.Element; 008 009 import biz.hammurapi.util.Visitable; 010 import biz.hammurapi.util.Visitor; 011 012 public class AnnotationMemberValuePair extends JavaLanguageElement implements AnnotationArgument { 013 014 public AnnotationMemberValuePair(NodeData xData, Class<?> context, Scan scan, 015 RepositoryLanguage language, Object environment) throws MesopotamiaException { 016 super(xData, context, scan, language, environment); 017 018 // Select attributes 019 Name = selectSingleElementText(Identifier.class, "IDENT[0]"); 020 Value = selectSingleElement( 021 AnnotationMemberValueInitializer.class, "*[1]"); 022 023 } 024 025 public void toDom(Element holder) { 026 super.toDom(holder); 027 028 // Serialize attributes 029 setAttribute(holder, "Name", Name); 030 setElement(holder, "Value", Value); 031 } 032 033 // Attributes 034 private String Name; 035 036 private AnnotationMemberValueInitializer Value; 037 038 // Accessors 039 public String getName() { 040 return Name; 041 } 042 043 public AnnotationMemberValueInitializer getValue() { 044 return Value; 045 } 046 047 protected void acceptChildren(Visitor visitor) { 048 super.acceptChildren(visitor); 049 // Visiting non-text attributes 050 if (Value instanceof Visitable) { 051 ((Visitable) Value).accept(visitor); 052 } 053 } 054 055 }