本文整理汇总了Java中org.eclipse.xtend.lib.macro.declaration.AnnotationReference类的典型用法代码示例。如果您正苦于以下问题:Java AnnotationReference类的具体用法?Java AnnotationReference怎么用?Java AnnotationReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnnotationReference类属于org.eclipse.xtend.lib.macro.declaration包,在下文中一共展示了AnnotationReference类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doTransform
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
@Override
public void doTransform(final MutableClassDeclaration clazz, @Extension final TransformationContext ctx) {
final TypeReference toStringBuilder = ctx.newTypeReference(ToStringBuilder.class);
final Procedure1<MutableMethodDeclaration> _function = (MutableMethodDeclaration it) -> {
AnnotationReference _newAnnotationReference = ctx.newAnnotationReference(Override.class);
it.addAnnotation(_newAnnotationReference);
TypeReference _string = ctx.getString();
it.setReturnType(_string);
final CompilationStrategy _function_1 = (CompilationStrategy.CompilationContext it_1) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("String result = new ");
String _javaCode = it_1.toJavaCode(toStringBuilder);
_builder.append(_javaCode, "");
_builder.append("(this).addAllFields().toString();");
_builder.newLineIfNotEmpty();
_builder.append("return result;");
_builder.newLine();
return _builder;
};
it.setBody(_function_1);
};
clazz.addMethod("toString", _function);
}
开发者ID:East196,项目名称:maker,代码行数:24,代码来源:ToStringCompilationParticipant.java
示例2: _transform
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
protected void _transform(final MutableClassDeclaration it, @Extension final TransformationContext context) {
AnnotationReference _findAnnotation = it.findAnnotation(context.findTypeGlobally(Data.class));
boolean _tripleNotEquals = (_findAnnotation != null);
if (_tripleNotEquals) {
return;
}
AnnotationReference _findAnnotation_1 = it.findAnnotation(context.findTypeGlobally(Accessors.class));
boolean _tripleNotEquals_1 = (_findAnnotation_1 != null);
if (_tripleNotEquals_1) {
return;
}
@Extension
final FinalFieldsConstructorProcessor.Util util = new FinalFieldsConstructorProcessor.Util(context);
util.addFinalFieldsConstructor(it);
}
开发者ID:eclipse,项目名称:xtext-lib,代码行数:16,代码来源:FinalFieldsConstructorProcessor.java
示例3: getToStringConfig
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
public ToStringConfiguration getToStringConfig(final ClassDeclaration it) {
ToStringConfiguration _xblockexpression = null;
{
final AnnotationReference anno = it.findAnnotation(this.context.findTypeGlobally(ToString.class));
ToStringConfiguration _xifexpression = null;
if ((anno == null)) {
_xifexpression = null;
} else {
_xifexpression = new ToStringConfiguration(anno);
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
开发者ID:eclipse,项目名称:xtext-lib,代码行数:15,代码来源:ToStringProcessor.java
示例4: addGetter
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
public void addGetter(final MutableFieldDeclaration field, final Visibility visibility) {
this.validateGetter(field);
field.markAsRead();
final MutableTypeDeclaration _declaringType = field.getDeclaringType();
final String _getterName = this.getGetterName(field);
final Procedure1<MutableMethodDeclaration> _function = new Procedure1<MutableMethodDeclaration>() {
@Override
public void apply(final MutableMethodDeclaration it) {
final Element _primarySourceElement = Util.this.context.getPrimarySourceElement(field);
Util.this.context.setPrimarySourceElement(it, _primarySourceElement);
final AnnotationReference _newAnnotationReference = Util.this.context.newAnnotationReference(Pure.class);
it.addAnnotation(_newAnnotationReference);
final TypeReference _type = field.getType();
final TypeReference _orObject = Util.this.orObject(_type);
it.setReturnType(_orObject);
final StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(final StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("return ");
final Object _fieldOwner = Util.this.fieldOwner(field);
_builder.append(_fieldOwner, "");
_builder.append(".");
final String _simpleName = field.getSimpleName();
_builder.append(_simpleName, "");
_builder.append(";");
}
};
it.setBody(_client);
final boolean _isStatic = field.isStatic();
it.setStatic(_isStatic);
it.setVisibility(visibility);
}
};
_declaringType.addMethod(_getterName, _function);
}
开发者ID:CymricNPG,项目名称:abattle,代码行数:36,代码来源:DirtyAccessorsProcessor.java
示例5: doRegisterGlobals
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
public void doRegisterGlobals(final ClassDeclaration annotatedClass, final RegisterGlobalsContext context) {
try {
Iterable<? extends AnnotationReference> _annotations = annotatedClass.getAnnotations();
final Function1<AnnotationReference,Boolean> _function = new Function1<AnnotationReference,Boolean>() {
public Boolean apply(final AnnotationReference it) {
Object _value = it.getValue("className");
boolean _notEquals = (!Objects.equal(_value, null));
return Boolean.valueOf(_notEquals);
}
};
AnnotationReference _findFirst = IterableExtensions.findFirst(_annotations, _function);
Object classNam = _findFirst.getValue("className");
Class<? extends Object> _class = classNam.getClass();
Method _method = _class.getMethod("getSimpleName");
Object _invoke = _method.invoke(classNam);
final String className = ((String) _invoke);
String _qualifiedName = annotatedClass.getQualifiedName();
String _plus = (_qualifiedName + className);
String _plus_1 = (_plus + "AspectProperties");
context.registerClass(_plus_1);
String _qualifiedName_1 = annotatedClass.getQualifiedName();
String _plus_2 = (_qualifiedName_1 + className);
String _plus_3 = (_plus_2 + "AspectContext");
context.registerClass(_plus_3);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
开发者ID:damien-cremilleux,项目名称:TP4INFO,代码行数:29,代码来源:AspectProcessor.java
示例6: getAccessorsAnnotation
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
public AnnotationReference getAccessorsAnnotation(final AnnotationTarget it) {
return it.findAnnotation(this.context.findTypeGlobally(Accessors.class));
}
开发者ID:eclipse,项目名称:xtext-lib,代码行数:4,代码来源:AccessorsProcessor.java
示例7: ToStringConfiguration
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
public ToStringConfiguration(final AnnotationReference annotation) {
this.skipNulls = annotation.getBooleanValue("skipNulls");
this.singleLine = annotation.getBooleanValue("singleLine");
this.hideFieldNames = annotation.getBooleanValue("hideFieldNames");
this.verbatimValues = annotation.getBooleanValue("verbatimValues");
}
开发者ID:eclipse,项目名称:xtext-lib,代码行数:7,代码来源:ToStringConfiguration.java
示例8: newAnnotationReference
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
public AnnotationReference newAnnotationReference(final String annotationTypeName) {
return this.delegate.newAnnotationReference(annotationTypeName);
}
开发者ID:eclipse,项目名称:lsp4j,代码行数:4,代码来源:JsonRpcDataTransformationContext.java
示例9: maximumSize
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
protected final int maximumSize() {
AnnotationReference _cacheAnnotation = this.cacheAnnotation();
return _cacheAnnotation.getIntValue("maximumSize");
}
开发者ID:East196,项目名称:maker,代码行数:5,代码来源:ParametrizedMethodMemoizer.java
示例10: expireAfterWrite
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
protected final int expireAfterWrite() {
AnnotationReference _cacheAnnotation = this.cacheAnnotation();
return _cacheAnnotation.getIntValue("expireAfterWrite");
}
开发者ID:East196,项目名称:maker,代码行数:5,代码来源:ParametrizedMethodMemoizer.java
示例11: expireAfterAccess
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
protected final int expireAfterAccess() {
AnnotationReference _cacheAnnotation = this.cacheAnnotation();
return _cacheAnnotation.getIntValue("expireAfterAccess");
}
开发者ID:East196,项目名称:maker,代码行数:5,代码来源:ParametrizedMethodMemoizer.java
示例12: timeUnit
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
protected final String timeUnit() {
AnnotationReference _cacheAnnotation = this.cacheAnnotation();
EnumerationValueDeclaration _enumValue = _cacheAnnotation.getEnumValue("timeUnit");
return _enumValue.getSimpleName();
}
开发者ID:East196,项目名称:maker,代码行数:6,代码来源:ParametrizedMethodMemoizer.java
示例13: cacheAnnotation
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
protected final AnnotationReference cacheAnnotation() {
Type _findTypeGlobally = this.context.findTypeGlobally(Cached.class);
return this.method.findAnnotation(_findTypeGlobally);
}
开发者ID:East196,项目名称:maker,代码行数:5,代码来源:ParametrizedMethodMemoizer.java
示例14: getAccessorsAnnotation
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
public AnnotationReference getAccessorsAnnotation(final AnnotationTarget it) {
final Type _findTypeGlobally = this.context.findTypeGlobally(DirtyAccessors.class);
return it.findAnnotation(_findTypeGlobally);
}
开发者ID:CymricNPG,项目名称:abattle,代码行数:5,代码来源:DirtyAccessorsProcessor.java
示例15: doGenerateCode
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
/**
* use an additional code generator to produce the .k3_aspect_mapping.properties file
*/
public void doGenerateCode(final List<? extends ClassDeclaration> annotatedSourceElements, @Extension final CodeGenerationContext context) {
try {
int _size = annotatedSourceElements.size();
boolean _greaterThan = (_size > 0);
if (_greaterThan) {
ClassDeclaration _get = annotatedSourceElements.get(0);
CompilationUnit _compilationUnit = _get.getCompilationUnit();
final Path filePath = _compilationUnit.getFilePath();
Path _projectFolder = context.getProjectFolder(filePath);
_projectFolder.getLastSegment();
Path _projectFolder_1 = context.getProjectFolder(filePath);
Path _projectFolder_2 = context.getProjectFolder(filePath);
String _lastSegment = _projectFolder_2.getLastSegment();
String _plus = ("/META-INF/xtend-gen/" + _lastSegment);
String _plus_1 = (_plus + ".k3_aspect_mapping.properties");
final Path file = _projectFolder_1.append(_plus_1);
context.delete(file);
}
for (final ClassDeclaration clazz : annotatedSourceElements) {
{
CompilationUnit _compilationUnit_1 = clazz.getCompilationUnit();
final Path filePath_1 = _compilationUnit_1.getFilePath();
Path _projectFolder_3 = context.getProjectFolder(filePath_1);
_projectFolder_3.getLastSegment();
Path _projectFolder_4 = context.getProjectFolder(filePath_1);
Path _projectFolder_5 = context.getProjectFolder(filePath_1);
String _lastSegment_1 = _projectFolder_5.getLastSegment();
String _plus_2 = ("/META-INF/xtend-gen/" + _lastSegment_1);
String _plus_3 = (_plus_2 + ".k3_aspect_mapping.properties");
final Path file_1 = _projectFolder_4.append(_plus_3);
Iterable<? extends AnnotationReference> _annotations = clazz.getAnnotations();
final Function1<AnnotationReference,Boolean> _function = new Function1<AnnotationReference,Boolean>() {
public Boolean apply(final AnnotationReference it) {
Object _value = it.getValue("className");
boolean _notEquals = (!Objects.equal(_value, null));
return Boolean.valueOf(_notEquals);
}
};
AnnotationReference _findFirst = IterableExtensions.findFirst(_annotations, _function);
final Object aspectizedclassNam = _findFirst.getValue("className");
Class<? extends Object> _class = aspectizedclassNam.getClass();
Method _method = _class.getMethod("getQualifiedName");
Object _invoke = _method.invoke(aspectizedclassNam);
final String aspectizedclassName = ((String) _invoke);
boolean _exists = context.exists(file_1);
if (_exists) {
StringConcatenation _builder = new StringConcatenation();
CharSequence _contents = context.getContents(file_1);
_builder.append(_contents, "");
_builder.newLineIfNotEmpty();
_builder.append(aspectizedclassName, "");
_builder.append(" = ");
String _qualifiedName = clazz.getQualifiedName();
_builder.append(_qualifiedName, "");
_builder.newLineIfNotEmpty();
context.setContents(file_1, _builder);
} else {
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append(aspectizedclassName, "");
_builder_1.append(" = ");
String _qualifiedName_1 = clazz.getQualifiedName();
_builder_1.append(_qualifiedName_1, "");
_builder_1.newLineIfNotEmpty();
context.setContents(file_1, _builder_1);
}
}
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
开发者ID:damien-cremilleux,项目名称:TP4INFO,代码行数:75,代码来源:AspectProcessor.java
示例16: setAnnotationValue
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
/**
* Sets the given value for the given annotation element name.
*
* @param name a valid name of a property of the annotation type.
* @param value a non-null value array without any null entries
* @throws IllegalArgumentException
* if the name does not point to a valid member of the
* referenced annotation type.
*/
void setAnnotationValue(String name, AnnotationReference... value);
开发者ID:eclipse,项目名称:xtext-lib,代码行数:11,代码来源:AnnotationReferenceBuildContext.java
示例17: newAnnotationReference
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference; //导入依赖的package包/类
/**
* Creates a new annotation reference for the given name.
*
* @param annotationTypeName the name of the annotation type to point to, must be a valid java identifier
* @return a {@link AnnotationReference} pointing to the type with the give name, or <code>null</code> if no such annotation type could be found.
* @throws IllegalArgumentException if the <code>name</code> is not a valid java identifier
*/
AnnotationReference newAnnotationReference(String annotationTypeName);
开发者ID:eclipse,项目名称:xtext-lib,代码行数:9,代码来源:AnnotationReferenceProvider.java
注:本文中的org.eclipse.xtend.lib.macro.declaration.AnnotationReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论