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