當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。