update copyright
[fedora-idea.git] / xml / dom-openapi / src / com / intellij / util / xml / ui / DomFixedWrapper.java
blob7597791f266aeebfb4a4d54bd12a128713324a6c
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.util.xml.ui;
18 import com.intellij.util.xml.DomElement;
19 import com.intellij.util.xml.GenericDomValue;
20 import org.jetbrains.annotations.NotNull;
22 import java.lang.reflect.InvocationTargetException;
24 /**
25 * @author peter
27 public class DomFixedWrapper<T> extends DomWrapper<T>{
28 private final GenericDomValue myDomElement;
30 public DomFixedWrapper(final GenericDomValue<? extends T> domElement) {
31 myDomElement = domElement;
34 public DomElement getWrappedElement() {
35 return myDomElement;
38 public void setValue(final T value) throws IllegalAccessException, InvocationTargetException {
39 DomUIFactory.SET_VALUE_METHOD.invoke(getWrappedElement(), value);
42 public T getValue() throws IllegalAccessException, InvocationTargetException {
43 final DomElement element = getWrappedElement();
44 return element.isValid() ? (T)DomUIFactory.GET_VALUE_METHOD.invoke(element) : null;
47 @NotNull
48 public DomElement getExistingDomElement() {
49 return myDomElement;