当前位置: 首页>>代码示例>>Java>>正文


Java FieldAccess.PREFER_FIELD属性代码示例

本文整理汇总了Java中lombok.javac.handlers.JavacHandlerUtil.FieldAccess.PREFER_FIELD属性的典型用法代码示例。如果您正苦于以下问题:Java FieldAccess.PREFER_FIELD属性的具体用法?Java FieldAccess.PREFER_FIELD怎么用?Java FieldAccess.PREFER_FIELD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在lombok.javac.handlers.JavacHandlerUtil.FieldAccess的用法示例。


在下文中一共展示了FieldAccess.PREFER_FIELD属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handle

@Override public void handle(AnnotationValues<EqualsAndHashCode> annotation, JCAnnotation ast, JavacNode annotationNode) {
	deleteAnnotationIfNeccessary(annotationNode, EqualsAndHashCode.class);
	EqualsAndHashCode ann = annotation.getInstance();
	List<String> excludes = List.from(ann.exclude());
	List<String> includes = List.from(ann.of());
	JavacNode typeNode = annotationNode.up();
	
	checkForBogusFieldNames(typeNode, annotation);
	
	Boolean callSuper = ann.callSuper();
	if (!annotation.isExplicit("callSuper")) callSuper = null;
	if (!annotation.isExplicit("exclude")) excludes = null;
	if (!annotation.isExplicit("of")) includes = null;
	
	if (excludes != null && includes != null) {
		excludes = null;
		annotation.setWarning("exclude", "exclude and of are mutually exclusive; the 'exclude' parameter will be ignored.");
	}
	
	FieldAccess fieldAccess = ann.doNotUseGetters() ? FieldAccess.PREFER_FIELD : FieldAccess.GETTER;
	
	generateMethods(typeNode, annotationNode, excludes, includes, callSuper, true, fieldAccess);
}
 
开发者ID:redundent,项目名称:lombok,代码行数:23,代码来源:HandleEqualsAndHashCode.java

示例2: handle

@Override public void handle(AnnotationValues<EqualsAndHashCode> annotation, JCAnnotation ast, JavacNode annotationNode) {
	handleFlagUsage(annotationNode, ConfigurationKeys.EQUALS_AND_HASH_CODE_FLAG_USAGE, "@EqualsAndHashCode");
	
	deleteAnnotationIfNeccessary(annotationNode, EqualsAndHashCode.class);
	EqualsAndHashCode ann = annotation.getInstance();
	List<String> excludes = List.from(ann.exclude());
	List<String> includes = List.from(ann.of());
	JavacNode typeNode = annotationNode.up();
	List<JCAnnotation> onParam = unboxAndRemoveAnnotationParameter(ast, "onParam", "@EqualsAndHashCode(onParam=", annotationNode);
	checkForBogusFieldNames(typeNode, annotation);
	
	Boolean callSuper = ann.callSuper();
	if (!annotation.isExplicit("callSuper")) callSuper = null;
	if (!annotation.isExplicit("exclude")) excludes = null;
	if (!annotation.isExplicit("of")) includes = null;
	
	if (excludes != null && includes != null) {
		excludes = null;
		annotation.setWarning("exclude", "exclude and of are mutually exclusive; the 'exclude' parameter will be ignored.");
	}
	
	Boolean doNotUseGettersConfiguration = annotationNode.getAst().readConfiguration(ConfigurationKeys.EQUALS_AND_HASH_CODE_DO_NOT_USE_GETTERS);
	boolean doNotUseGetters = annotation.isExplicit("doNotUseGetters") || doNotUseGettersConfiguration == null ? ann.doNotUseGetters() : doNotUseGettersConfiguration;
	FieldAccess fieldAccess = doNotUseGetters ? FieldAccess.PREFER_FIELD : FieldAccess.GETTER;
	
	generateMethods(typeNode, annotationNode, excludes, includes, callSuper, true, fieldAccess, onParam);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:27,代码来源:HandleEqualsAndHashCode.java


注:本文中的lombok.javac.handlers.JavacHandlerUtil.FieldAccess.PREFER_FIELD属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。