use of com.github.benmanes.caffeine.cache.node.NodeContext in project caffeine by ben-manes.
the class NodeFactoryGenerator method addNodeSpec.
private void addNodeSpec(String className, boolean isFinal, Set<Feature> features) {
TypeName superClass;
Set<Feature> parentFeatures;
Set<Feature> generateFeatures;
if (features.size() == 2) {
parentFeatures = ImmutableSet.of();
generateFeatures = features;
superClass = TypeName.OBJECT;
} else {
parentFeatures = ImmutableSet.copyOf(Iterables.limit(features, features.size() - 1));
generateFeatures = ImmutableSet.of(Iterables.getLast(features));
superClass = ParameterizedTypeName.get(ClassName.get(PACKAGE_NAME + ".NodeFactory", encode(Feature.makeClassName(parentFeatures))), kTypeVar, vTypeVar);
}
NodeContext context = new NodeContext(superClass, className, isFinal, parentFeatures, generateFeatures);
for (NodeRule rule : rules) {
rule.accept(context);
}
nodeFactory.addType(context.nodeSubtype.build());
addEnumConstant(className, features);
}
Aggregations