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


Java Accessors.fluent方法代码示例

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


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

示例1: shouldReturnThis0

import lombok.experimental.Accessors; //导入方法依赖的package包/类
public static boolean shouldReturnThis0(AnnotationValues<Accessors> accessors, AST<?, ?, ?> ast) {
	boolean chainForced = accessors.isExplicit("chain");
	boolean fluentForced = accessors.isExplicit("fluent");
	Accessors instance = accessors.getInstance();
	
	boolean chain = instance.chain();
	boolean fluent = instance.fluent();
	
	if (chainForced) return chain;
	
	if (!chainForced) {
		Boolean chainConfig = ast.readConfiguration(ConfigurationKeys.ACCESSORS_CHAIN);
		if (chainConfig != null) return chainConfig;
	}
	
	if (!fluentForced) {
		Boolean fluentConfig = ast.readConfiguration(ConfigurationKeys.ACCESSORS_FLUENT);
		if (fluentConfig != null) fluent = fluentConfig;
	}
	
	return chain || fluent;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:23,代码来源:HandlerUtil.java

示例2: toAccessorName

import lombok.experimental.Accessors; //导入方法依赖的package包/类
private static String toAccessorName(AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean,
		String booleanPrefix, String normalPrefix, boolean adhereToFluent) {
	
	if (fieldName.length() == 0) return null;
	
	Accessors ac = accessors.getInstance();
	fieldName = removePrefix(fieldName, ac.prefix());
	if (fieldName == null) return null;
	
	String fName = fieldName.toString();
	if (adhereToFluent && ac.fluent()) return fName;
	
	if (isBoolean && fName.startsWith("is") && fieldName.length() > 2 && !Character.isLowerCase(fieldName.charAt(2))) {
		// The field is for example named 'isRunning'.
		return booleanPrefix + fName.substring(2);
	}
	
	return buildName(isBoolean ? booleanPrefix : normalPrefix, fName);
}
 
开发者ID:redundent,项目名称:lombok,代码行数:20,代码来源:TransformationsUtil.java

示例3: toAccessorName

import lombok.experimental.Accessors; //导入方法依赖的package包/类
private static String toAccessorName(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean,
		String booleanPrefix, String normalPrefix, boolean adhereToFluent) {
	
	fieldName = fieldName.toString();
	if (fieldName.length() == 0) return null;
	
	if (Boolean.TRUE.equals(ast.readConfiguration(ConfigurationKeys.GETTER_CONSEQUENT_BOOLEAN))) isBoolean = false;
	boolean explicitPrefix = accessors != null && accessors.isExplicit("prefix");
	boolean explicitFluent = accessors != null && accessors.isExplicit("fluent");
	
	Accessors ac = (explicitPrefix || explicitFluent) ? accessors.getInstance() : null;
	
	List<String> prefix = explicitPrefix ? Arrays.asList(ac.prefix()) : ast.readConfiguration(ConfigurationKeys.ACCESSORS_PREFIX);
	boolean fluent = explicitFluent ? ac.fluent() : Boolean.TRUE.equals(ast.readConfiguration(ConfigurationKeys.ACCESSORS_FLUENT));
	
	fieldName = removePrefix(fieldName, prefix);
	if (fieldName == null) return null;
	
	String fName = fieldName.toString();
	if (adhereToFluent && fluent) return fName;
	
	if (isBoolean && fName.startsWith("is") && fieldName.length() > 2 && !Character.isLowerCase(fieldName.charAt(2))) {
		// The field is for example named 'isRunning'.
		return booleanPrefix + fName.substring(2);
	}
	
	return buildAccessorName(isBoolean ? booleanPrefix : normalPrefix, fName);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:29,代码来源:HandlerUtil.java

示例4: toAllAccessorNames

import lombok.experimental.Accessors; //导入方法依赖的package包/类
private static List<String> toAllAccessorNames(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean,
		String booleanPrefix, String normalPrefix, boolean adhereToFluent) {
	
	if (Boolean.TRUE.equals(ast.readConfiguration(ConfigurationKeys.GETTER_CONSEQUENT_BOOLEAN))) isBoolean = false;
	if (!isBoolean) {
		String accessorName = toAccessorName(ast, accessors, fieldName, false, booleanPrefix, normalPrefix, adhereToFluent);
		return (accessorName == null) ? Collections.<String>emptyList() : Collections.singletonList(accessorName);
	}
	
	boolean explicitPrefix = accessors != null && accessors.isExplicit("prefix");
	boolean explicitFluent = accessors != null && accessors.isExplicit("fluent");
	
	Accessors ac = (explicitPrefix || explicitFluent) ? accessors.getInstance() : null;
	
	List<String> prefix = explicitPrefix ? Arrays.asList(ac.prefix()) : ast.readConfiguration(ConfigurationKeys.ACCESSORS_PREFIX);
	boolean fluent = explicitFluent ? ac.fluent() : Boolean.TRUE.equals(ast.readConfiguration(ConfigurationKeys.ACCESSORS_FLUENT));
	
	fieldName = removePrefix(fieldName, prefix);
	if (fieldName == null) return Collections.emptyList();
	
	List<String> baseNames = toBaseNames(fieldName, isBoolean, fluent);
	
	Set<String> names = new HashSet<String>();
	for (String baseName : baseNames) {
		if (adhereToFluent && fluent) {
			names.add(baseName);
		} else {
			names.add(buildAccessorName(normalPrefix, baseName));
			if (!normalPrefix.equals(booleanPrefix)) names.add(buildAccessorName(booleanPrefix, baseName));
		}
	}
	
	return new ArrayList<String>(names);
	
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:36,代码来源:HandlerUtil.java

示例5: shouldReturnThis

import lombok.experimental.Accessors; //导入方法依赖的package包/类
/**
 * When generating a setter, the setter either returns void (beanspec) or Self (fluent).
 * This method scans for the {@code Accessors} annotation to figure that out.
 */
public static boolean shouldReturnThis(EclipseNode field) {
	if ((((FieldDeclaration) field.get()).modifiers & ClassFileConstants.AccStatic) != 0) return false;
	AnnotationValues<Accessors> accessors = EclipseHandlerUtil.getAccessorsForField(field);
	boolean forced = (accessors.getActualExpression("chain") != null);
	Accessors instance = accessors.getInstance();
	return instance.chain() || (instance.fluent() && !forced);
}
 
开发者ID:redundent,项目名称:lombok,代码行数:12,代码来源:EclipseHandlerUtil.java

示例6: shouldReturnThis

import lombok.experimental.Accessors; //导入方法依赖的package包/类
/**
 * When generating a setter, the setter either returns void (beanspec) or Self (fluent).
 * This method scans for the {@code Accessors} annotation to figure that out.
 */
public static boolean shouldReturnThis(JavacNode field) {
	if ((((JCVariableDecl) field.get()).mods.flags & Flags.STATIC) != 0) return false;
	
	AnnotationValues<Accessors> accessors = JavacHandlerUtil.getAccessorsForField(field);
	
	boolean forced = (accessors.getActualExpression("chain") != null);
	Accessors instance = accessors.getInstance();
	return instance.chain() || (instance.fluent() && !forced);
}
 
开发者ID:redundent,项目名称:lombok,代码行数:14,代码来源:JavacHandlerUtil.java

示例7: toAllAccessorNames

import lombok.experimental.Accessors; //导入方法依赖的package包/类
private static List<String> toAllAccessorNames(AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean,
		String booleanPrefix, String normalPrefix, boolean adhereToFluent) {
	
	if (!isBoolean) {
		String accessorName = toAccessorName(accessors, fieldName, false, booleanPrefix, normalPrefix, adhereToFluent);
		return (accessorName == null) ? Collections.<String>emptyList() : Collections.singletonList(accessorName);
	}
	
	Accessors acc = accessors.getInstance();
	fieldName = removePrefix(fieldName, acc.prefix());
	if (fieldName == null) return Collections.emptyList();
	
	List<String> baseNames = toBaseNames(fieldName, isBoolean, acc.fluent());
	
	Set<String> names = new HashSet<String>();
	for (String baseName : baseNames) {
		if (adhereToFluent && acc.fluent()) {
			names.add(baseName);
		} else {
			names.add(buildName(normalPrefix, baseName));
			if (!normalPrefix.equals(booleanPrefix)) names.add(buildName(booleanPrefix, baseName));
		}
	}
	
	return new ArrayList<String>(names);
	
}
 
开发者ID:redundent,项目名称:lombok,代码行数:28,代码来源:TransformationsUtil.java


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