本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}