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


Java AnnotationDefinition.getValuePairs方法代码示例

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


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

示例1: buildAnnotation

import org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition; //导入方法依赖的package包/类
@Override
public Annotation buildAnnotation(AnnotationDefinition annotationDefinition, Object annotationToken) throws ModelDriverException {

    org.kie.soup.project.datamodel.oracle.Annotation oracleAnnotationToken = (org.kie.soup.project.datamodel.oracle.Annotation)annotationToken;
    AnnotationImpl annotation = new AnnotationImpl(annotationDefinition);
    if (annotationDefinition.isMarker()) {
        return annotation;
    } else if (oracleAnnotationToken.getParameters() != null) {
        Object currentAttributeValue;
        for (AnnotationValuePairDefinition annotationMember : annotationDefinition.getValuePairs()) {
            currentAttributeValue = oracleAnnotationToken.getParameters().get(annotationMember.getName());
            if (currentAttributeValue != null) {
                annotation.setValue(annotationMember.getName(), currentAttributeValue);
            }
        }
    }

    return annotation;
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:20,代码来源:DefaultDataModelOracleAnnotationDriver.java

示例2: addAnnotation

import org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition; //导入方法依赖的package包/类
public AnnotationSource<?> addAnnotation(AnnotationTargetSource annotationTargetSource,
                                         Annotation annotation) {

    AnnotationSource<?> newAnnotationSource = annotationTargetSource.addAnnotation();
    newAnnotationSource.setName(annotation.getClassName());

    AnnotationDefinition annotationDefinition = annotation.getAnnotationDefinition();
    if (!annotationDefinition.isMarker()) {
        for (AnnotationValuePairDefinition memberDefinition : annotationDefinition.getValuePairs()) {
            Object value = annotation.getValue(memberDefinition.getName());
            if (value != null) {
                addMemberValue(newAnnotationSource,
                               memberDefinition,
                               value);
            }
        }
    }
    return newAnnotationSource;
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:20,代码来源:JavaRoasterModelDriver.java

示例3: buildAnnotation

import org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition; //导入方法依赖的package包/类
@Override
public Annotation buildAnnotation( AnnotationDefinition annotationDefinition, Object annotationToken ) throws ModelDriverException {

    AnnotationSource javaAnnotationToken = ( AnnotationSource ) annotationToken;
    AnnotationImpl annotation = new AnnotationImpl( annotationDefinition );
    if ( annotationDefinition.isMarker() ) {
        return annotation;
    } else {
        if ( javaAnnotationToken.getValues() != null ) {
            List<ValuePair> values = javaAnnotationToken.getValues();

            if ( values != null && values.size() > 0 ) {
                for ( AnnotationValuePairDefinition valuePairDefinition : annotationDefinition.getValuePairs() ) {
                    Object annotationValue = buildAnnotationValue( javaAnnotationToken, valuePairDefinition );
                    if ( annotationValue != null ) {
                        annotation.setValue( valuePairDefinition.getName(), annotationValue );
                    }
                }
            }
        }
    }
    return annotation;
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:24,代码来源:DefaultJavaRoasterModelAnnotationDriver.java

示例4: updateValuePairPages

import org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition; //导入方法依赖的package包/类
private void updateValuePairPages(AnnotationDefinition annotationDefinition) {
    clearCurrentValuePairEditorPages();
    pages.clear();
    pages.add(searchAnnotationPage);
    this.annotationDefinition = annotationDefinition;

    if (annotationDefinition != null) {
        for (AnnotationValuePairDefinition valuePairDefinition : annotationDefinition.getValuePairs()) {
            pages.add(createValuePairEditorPage(valuePairDefinition));
        }
    }
    super.start();
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:14,代码来源:CreateAnnotationWizard.java

示例5: resolveAnnotationSource

import org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition; //导入方法依赖的package包/类
public org.kie.workbench.common.services.datamodeller.driver.model.AnnotationSource resolveAnnotationSource(Annotation annotation) {
    org.kie.workbench.common.services.datamodeller.driver.model.AnnotationSource annotationSource =
            new org.kie.workbench.common.services.datamodeller.driver.model.AnnotationSource();

    //TODO this method can be optimized and likely migrated to Roaster. Should be reviewed when we evaluate
    //the removal of Velocity.

    GenerationTools generationTools = new GenerationTools();
    AnnotationDefinition annotationDefinition;

    StringBuilder annotationCode = new StringBuilder();
    annotationCode.append("@");
    annotationCode.append(annotation.getClassName());

    if ((annotationDefinition = annotation.getAnnotationDefinition()) != null) {

        if (!annotationDefinition.isMarker()) {
            annotationCode.append(generationTools.resolveAnnotationType(annotation));
        }

        if (annotationDefinition.getValuePairs() != null) {
            Object value;
            String valuePairCode;
            for (AnnotationValuePairDefinition valuePairDefinition : annotationDefinition.getValuePairs()) {
                if ((value = annotation.getValue(valuePairDefinition.getName())) != null) {
                    valuePairCode = generationTools.resolveMemberTypeExpression(valuePairDefinition,
                                                                                value);
                } else {
                    valuePairCode = null;
                }
                annotationSource.withValuePairSource(valuePairDefinition.getName(),
                                                     valuePairCode);
            }
        }
    }

    annotationSource.withSource(annotationCode.toString());
    return annotationSource;
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:40,代码来源:JavaRoasterModelDriver.java

示例6: resolveAnnotationType

import org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition; //导入方法依赖的package包/类
public String resolveAnnotationType( Annotation annotation ) {
    StringBuffer type = new StringBuffer();
    AnnotationDefinition annotationDefinition = annotation.getAnnotationDefinition();

    if ( annotationDefinition == null ) {
        logger.warn( "Annotation definition for annotation: " + annotation + " is not defined." );
        return type.toString();
    }

    if ( annotationDefinition.isMarker() ) {
        return type.toString();
    }

    //finally we can process annotation members.
    Object memberValue;
    int memberCount = 0;
    for ( AnnotationValuePairDefinition memberDefinition : annotationDefinition.getValuePairs() ) {
        if ( ( memberValue = annotation.getValue( memberDefinition.getName() ) ) != null ) {
            //a value has been set for this member.
            if ( memberCount == 0 ) {
                type.append( "(" );
            }
            if ( memberCount > 0 ) {
                type.append( ", " );
            }
            type.append( resolveMemberType( memberDefinition, memberValue ) );
            memberCount++;
        }
    }
    if ( memberCount > 0 ) {
        type.append( ")" );
    }

    return type.toString();
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:36,代码来源:GenerationTools.java


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