blob: 77e9656cd849f3e5feefa803148ef64103cb5c42 [file] [log] [blame]
/*
* Copyright (c) 2010-2020 BSI Business Systems Integration AG.
* 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:
* BSI Business Systems Integration AG - initial API and implementation
*/
package org.eclipse.scout.sdk.core.model.ecj;
import org.eclipse.scout.sdk.core.model.api.IAnnotationElement;
import org.eclipse.scout.sdk.core.model.api.IMetaValue;
import org.eclipse.scout.sdk.core.model.api.ISourceRange;
import org.eclipse.scout.sdk.core.model.api.internal.AnnotationElementImplementor;
import org.eclipse.scout.sdk.core.model.ecj.metavalue.MetaValueFactory;
import org.eclipse.scout.sdk.core.model.spi.AbstractJavaEnvironment;
import org.eclipse.scout.sdk.core.model.spi.AnnotationElementSpi;
import org.eclipse.scout.sdk.core.model.spi.AnnotationSpi;
import org.eclipse.scout.sdk.core.model.spi.JavaElementSpi;
import org.eclipse.scout.sdk.core.util.Ensure;
public class NullAnnotationElementWithEcj extends AbstractJavaElementWithEcj<IAnnotationElement> implements AnnotationElementSpi {
private final AnnotationSpi m_owner;
private final String m_name;
private final boolean m_syntheticDefaultValue;
protected NullAnnotationElementWithEcj(AbstractJavaEnvironment env, AnnotationSpi owner, String name, boolean syntheticDefaultValue) {
super(env);
m_owner = Ensure.notNull(owner);
m_name = Ensure.notBlank(name);
m_syntheticDefaultValue = syntheticDefaultValue;
}
@Override
protected IAnnotationElement internalCreateApi() {
return new AnnotationElementImplementor(this);
}
@Override
public JavaElementSpi internalFindNewElement() {
//not supported
return null;
}
@Override
public IMetaValue getMetaValue() {
return MetaValueFactory.createNull();
}
@Override
public AnnotationSpi getDeclaringAnnotation() {
return m_owner;
}
@Override
public boolean isDefaultValue() {
return m_syntheticDefaultValue;
}
@Override
public String getElementName() {
return m_name;
}
@Override
public ISourceRange getSourceOfExpression() {
return null;
}
@Override
public ISourceRange getSource() {
return null;
}
}