/*
* This code is distributed under The GNU Lesser General Public License (LGPLv3)
* Please visit GNU site for LGPLv3 http://www.gnu.org/copyleft/lesser.html
*
* Copyright Denis Pavlov 2009
* Web: http://www.genericdtoassembler.org
* SVN: https://svn.code.sf.net/p/geda-genericdto/code/trunk/
* SVN (mirror): http://geda-genericdto.googlecode.com/svn/trunk/
*/
package com.inspiresoftware.lib.dto.geda.assembler.annotations.impl;
import com.inspiresoftware.lib.dto.geda.annotations.DtoParent;
import com.inspiresoftware.lib.dto.geda.assembler.annotations.AnnotationProxy;
import com.inspiresoftware.lib.dto.geda.exception.GeDARuntimeException;
/**
* DtoParent wrapper.
*
* @since 3.0.0
*
* User: denispavlov
* Date: 13-02-21
* Time: 1:13 PM
*/
public class LocalClassLoaderDtoParentAnnotationProxy implements AnnotationProxy {
private final DtoParent annotation;
public LocalClassLoaderDtoParentAnnotationProxy(final DtoParent annotation) {
this.annotation = annotation;
}
/** {@inheritDoc} */
public boolean annotationExists() {
return true;
}
/** {@inheritDoc} */
public <T> T getValue(final String property) {
if ("value".equals(property)) {
return (T) annotation.value();
} else if ("retriever".equals(property)) {
return (T) annotation.retriever();
}
throw new GeDARuntimeException("Invalid @DtoParent annotation proxy access via property: " + property);
}
}