• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RuleSource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.gradle.model.RuleSource的典型用法代码示例。如果您正苦于以下问题:Java RuleSource类的具体用法?Java RuleSource怎么用?Java RuleSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: registration

import org.gradle.model.RuleSource; //导入依赖的package包/类
@Nullable
@Override
public <R, S> ExtractedModelRule registration(MethodRuleDefinition<R, S> ruleDefinition, MethodModelRuleExtractionContext context) {
    validateIsVoidMethod(ruleDefinition, context);
    if (ruleDefinition.getReferences().size() < 2) {
        context.add(ruleDefinition, "A method " + getDescription() + " must have at least two parameters");
        return null;
    }

    ModelType<?> ruleType = ruleDefinition.getReferences().get(0).getType();
    if (!RULE_SOURCE_MODEL_TYPE.isAssignableFrom(ruleType)) {
        context.add(ruleDefinition, "The first parameter of a method " + getDescription() + " must be a subtype of " + RuleSource.class.getName());
    }
    if (context.hasProblems()) {
        return null;
    }

    ModelType<? extends RuleSource> ruleSourceType = ruleType.asSubtype(RULE_SOURCE_MODEL_TYPE);
    RuleApplicationScope ruleApplicationScope = RuleApplicationScope.fromRuleDefinition(context, ruleDefinition, 1);
    return new ExtractedRuleSourceDefinitionRule(ruleDefinition, ruleSourceType, context.getRuleExtractor(), ruleApplicationScope);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:22,代码来源:RuleDefinitionRuleExtractor.java


示例2: configureMatching

import org.gradle.model.RuleSource; //导入依赖的package包/类
@Override
public ModelRegistry configureMatching(final ModelSpec predicate, final Class<? extends RuleSource> rules) {
    registerListener(new DelegatingListener(predicate) {
        @Override
        public String toString() {
            return "configure matching " + predicate + " apply " + rules.getSimpleName();
        }

        @Override
        public void onDiscovered(ModelNodeInternal node) {
            if (predicate.matches(node)) {
                node.applyToSelf(rules);
            }
        }
    });
    return this;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:DefaultModelRegistry.java


示例3: getDeclaredSources

import org.gradle.model.RuleSource; //导入依赖的package包/类
public Iterable<Class<? extends RuleSource>> getDeclaredSources(Class<?> container) {
    try {
        return FluentIterable.from(cache.get(container))
                .transform(new Function<Reference<Class<? extends RuleSource>>, Class<? extends RuleSource>>() {
                    @Override
                    public Class<? extends RuleSource> apply(Reference<Class<? extends RuleSource>> input) {
                        return input.get();
                    }
                })
                .filter(Predicates.notNull());
    } catch (ExecutionException e) {
        throw UncheckedException.throwAsUncheckedException(e);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:15,代码来源:ModelRuleSourceDetector.java


示例4: RuleSourceApplicationAction

import org.gradle.model.RuleSource; //导入依赖的package包/类
public RuleSourceApplicationAction(ModelReference<?> targetReference, ModelRuleDescriptor descriptor, List<ModelReference<?>> inputs, ModelType<? extends RuleSource> ruleSourceType, ModelRuleExtractor ruleExtractor) {
    this.targetReference = targetReference;
    this.descriptor = descriptor;
    this.inputs = inputs;
    this.ruleSourceType = ruleSourceType;
    this.ruleExtractor = ruleExtractor;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:RuleDefinitionRuleExtractor.java


示例5: getSchema

import org.gradle.model.RuleSource; //导入依赖的package包/类
private <T> StructSchema<T> getSchema(Class<T> source, RuleSourceValidationProblemCollector problems) {
    if (!RuleSource.class.isAssignableFrom(source) || !source.getSuperclass().equals(RuleSource.class)) {
        problems.add("Rule source classes must directly extend " + RuleSource.class.getName());
    }

    ModelSchema<T> schema = schemaStore.getSchema(source);
    if (!(schema instanceof StructSchema)) {
        return null;
    }

    validateClass(source, problems);
    return (StructSchema<T>) schema;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:14,代码来源:ModelRuleExtractor.java


示例6: named

import org.gradle.model.RuleSource; //导入依赖的package包/类
@Override
public void named(String name, Class<? extends RuleSource> ruleSource) {
    viewState.assertCanMutate();
    ModelRuleDescriptor descriptor = sourceDescriptor.append("named(%s, %s)", name, ruleSource.getName());
    ModelReference<T> subject = ModelReference.of(modelNode.getPath().child(name), elementType);
    modelNode.defineRulesForLink(ModelActionRole.Defaults, new FilteringActionWrapper<T>(elementFilter, subject, DirectNodeNoInputsModelAction.of(subject, descriptor, new ApplyRuleSource(ruleSource))));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:NodeBackedModelMap.java


示例7: applyRules

import org.gradle.model.RuleSource; //导入依赖的package包/类
public void applyRules(@Nullable String pluginId, Class<?> clazz) {
    ModelRegistry modelRegistry = target.getModelRegistry();
    Iterable<Class<? extends RuleSource>> declaredSources = ruleDetector.getDeclaredSources(clazz);
    for (Class<? extends RuleSource> ruleSource : declaredSources) {
        ExtractedRuleSource<?> rules = ruleInspector.extract(ruleSource);
        for (Class<?> dependency : rules.getRequiredPlugins()) {
            target.getPluginManager().apply(dependency);
        }
        modelRegistry.getRoot().applyToSelf(rules);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:RuleBasedPluginApplicator.java


示例8: getDeclaredSources

import org.gradle.model.RuleSource; //导入依赖的package包/类
public Set<Class<?>> getDeclaredSources(Class<?> container) {
    Class<?>[] declaredClasses = container.getDeclaredClasses();
    if (declaredClasses.length == 0) {
        return Collections.emptySet();
    } else {
        ImmutableSet.Builder<Class<?>> found = ImmutableSet.builder();
        for (Class<?> declaredClass : declaredClasses) {
            if (declaredClass.isAnnotationPresent(RuleSource.class)) {
                found.add(declaredClass);
            }
        }

        return found.build();
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:16,代码来源:ModelRuleInspector.java


示例9: named

import org.gradle.model.RuleSource; //导入依赖的package包/类
@Override
public void named(String name, Class<? extends RuleSource> ruleSource) {
    throw new UnsupportedOperationException();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:DomainObjectCollectionBackedModelMap.java


示例10: withType

import org.gradle.model.RuleSource; //导入依赖的package包/类
@Override
public <S> void withType(Class<S> type, Class<? extends RuleSource> rules) {
    throw new UnsupportedOperationException();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:DomainObjectCollectionBackedModelMap.java


示例11: isRuleSource

import org.gradle.model.RuleSource; //导入依赖的package包/类
private boolean isRuleSource(Class<?> clazz) {
    return RuleSource.class.isAssignableFrom(clazz);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:ModelRuleSourceDetector.java


示例12: ExtractedRuleSourceDefinitionRule

import org.gradle.model.RuleSource; //导入依赖的package包/类
public ExtractedRuleSourceDefinitionRule(MethodRuleDefinition<?, ?> ruleDefinition, ModelType<? extends RuleSource> ruleSourceType, ModelRuleExtractor ruleExtractor, RuleApplicationScope ruleApplicationScope) {
    super(ruleDefinition);
    this.ruleSourceType = ruleSourceType;
    this.ruleExtractor = ruleExtractor;
    this.ruleApplicationScope = ruleApplicationScope;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:7,代码来源:RuleDefinitionRuleExtractor.java


示例13: applyTo

import org.gradle.model.RuleSource; //导入依赖的package包/类
@Override
public void applyTo(NodePredicate predicate, Class<? extends RuleSource> rules) {
    throw new UnsupportedOperationException();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:ModelReferenceNode.java


示例14: applyTo

import org.gradle.model.RuleSource; //导入依赖的package包/类
@Override
public void applyTo(NodePredicate predicate, Class<? extends RuleSource> rules) {
    modelRegistry.configureMatching(predicate.scope(getPath()), rules);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:ModelElementNode.java


示例15: applyToSelf

import org.gradle.model.RuleSource; //导入依赖的package包/类
@Override
public void applyToSelf(Class<? extends RuleSource> rulesClass) {
    ExtractedRuleSource<?> rules = modelRegistry.newRuleSource(rulesClass);
    rules.assertNoPlugins();
    rules.apply(modelRegistry, this);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:7,代码来源:ModelNodeInternal.java


示例16: newRuleSource

import org.gradle.model.RuleSource; //导入依赖的package包/类
@Override
public ExtractedRuleSource<?> newRuleSource(Class<? extends RuleSource> rules) {
    return ruleExtractor.extract(rules);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:DefaultModelRegistry.java


示例17: withType

import org.gradle.model.RuleSource; //导入依赖的package包/类
@Override
public <S> void withType(Class<S> type, Class<? extends RuleSource> rules) {
    viewState.assertCanMutate();
    modelNode.applyTo(allLinks(elementFilter.withType(type)), rules);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:6,代码来源:NodeBackedModelMap.java


示例18: ApplyRuleSource

import org.gradle.model.RuleSource; //导入依赖的package包/类
public ApplyRuleSource(Class<? extends RuleSource> rules) {
    this.rules = ModelType.of(rules);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:NodeBackedModelMap.java


示例19: configureMatching

import org.gradle.model.RuleSource; //导入依赖的package包/类
/**
 * Registers a listener and applies the given {@link RuleSource} whenever a node that matches the spec is discovered.
 * Matching nodes that are already discovered when {@code configureMatching()} is called are bound directly.
 * Unlike with {@link #configure(ModelActionRole, ModelAction)}, {@link #bindAllReferences()} will <em>not</em> fail
 * if no nodes match the given spec.
 */
ModelRegistry configureMatching(ModelSpec spec, Class<? extends RuleSource> rules);
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:ModelRegistry.java


示例20: applyToSelf

import org.gradle.model.RuleSource; //导入依赖的package包/类
/**
 * Applies the rules defined in the given rule source to this node.
 */
void applyToSelf(Class<? extends RuleSource> rules);
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:MutableModelNode.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java QualifiedName类代码示例发布时间:2022-05-23
下一篇:
Java TimePeriodType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap