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


Java BooleanMemberValue类代码示例

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


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

示例1: href

import javassist.bytecode.annotation.BooleanMemberValue; //导入依赖的package包/类
@Override
public DynamicField href(boolean click, String... value) {
	Annotation annot = new Annotation(Href.class.getName(), cpool);
       annot.addMemberValue("click", new BooleanMemberValue(click, cpool));
       
       ArrayMemberValue arrayMemberValue = new ArrayMemberValue(cpool);
       MemberValue[] memberValues = new StringMemberValue[value.length];
       for(int i = 0; i < value.length; i++) {
       	memberValues[i] = new StringMemberValue(value[i], cpool);
       }
       arrayMemberValue.setValue(memberValues);
       annot.addMemberValue("value", arrayMemberValue);
       
       attr.addAnnotation(annot);
	return this;
}
 
开发者ID:xtuhcy,项目名称:gecco,代码行数:17,代码来源:JavassistDynamicField.java

示例2: addMimicAnnotation

import javassist.bytecode.annotation.BooleanMemberValue; //导入依赖的package包/类
private void addMimicAnnotation(CtClass dst, String sourceClassName,
        boolean isMimicingInterfaces, boolean isMimicingFields,
        boolean isMimicingConstructors, boolean isMimicingMethods) {
    ClassFile cf = dst.getClassFile();
    ConstPool cp = cf.getConstPool();
    AnnotationsAttribute attr = new AnnotationsAttribute(cp,
            AnnotationsAttribute.visibleTag);

    Annotation a = new Annotation(Mimic.class.getName(), cp);
    a.addMemberValue("sourceClass", new ClassMemberValue(sourceClassName,
            cp));
    a.addMemberValue("isMimicingInterfaces", new BooleanMemberValue(
            isMimicingInterfaces, cp));
    a.addMemberValue("isMimicingFields", new BooleanMemberValue(
            isMimicingFields, cp));
    a.addMemberValue("isMimicingConstructors", new BooleanMemberValue(
            isMimicingConstructors, cp));
    a.addMemberValue("isMimicingMethods", new BooleanMemberValue(
            isMimicingMethods, cp));
    attr.setAnnotation(a);
    cf.addAttribute(attr);
    cf.setVersionToJava5();
}
 
开发者ID:stephanenicolas,项目名称:mimic,代码行数:24,代码来源:MimicProcessorTest.java

示例3: getApiPathParamAnnotations

import javassist.bytecode.annotation.BooleanMemberValue; //导入依赖的package包/类
/**
 * Returns the api path parameter annotations
 * 
 * @return
 */
protected List<Annotation> getApiPathParamAnnotations() {
	List<Annotation> annotations = new ArrayList<Annotation>();
	List<String> parameters = getRoutePattern().getParameterNames();
	for (int i = 0; i < parameters.size(); i++) {
		Annotation annotation = new Annotation(ApiImplicitParam.class.getCanonicalName(), ctClass.getClassFile().getConstPool());
		annotation.addMemberValue("name", new StringMemberValue(parameters.get(i), ctClass.getClassFile().getConstPool()));
		annotation.addMemberValue("paramType", new StringMemberValue("path", ctClass.getClassFile().getConstPool()));
		annotation.addMemberValue("dataType", new StringMemberValue(String.class.getCanonicalName(), ctClass.getClassFile().getConstPool()));
		annotation.addMemberValue("value", new StringMemberValue("The " + getResourcePath().getNodePath().get(i).getEntityMetaData().getName() + " identifier", ctClass.getClassFile().getConstPool()));
		annotation.addMemberValue("required", new BooleanMemberValue(true, ctClass.getClassFile().getConstPool()));
		if (i == parameters.size() - 1) {
			annotation.addMemberValue("allowMultiple", new BooleanMemberValue(true, ctClass.getClassFile().getConstPool()));
		}
		annotations.add(annotation);
	}
	return annotations;
}
 
开发者ID:minnal,项目名称:minnal,代码行数:23,代码来源:AbstractMethodCreator.java

示例4: createMemberValue

import javassist.bytecode.annotation.BooleanMemberValue; //导入依赖的package包/类
private static MemberValue createMemberValue(ConstPool cp, CtClass type, Object value) throws NotFoundException {
    MemberValue memberValue = javassist.bytecode.annotation.Annotation.createMemberValue(cp, type);
    if (memberValue instanceof BooleanMemberValue)
        ((BooleanMemberValue) memberValue).setValue((Boolean) value);
    else if (memberValue instanceof ByteMemberValue)
        ((ByteMemberValue) memberValue).setValue((Byte) value);
    else if (memberValue instanceof CharMemberValue)
        ((CharMemberValue) memberValue).setValue((Character) value);
    else if (memberValue instanceof ShortMemberValue)
        ((ShortMemberValue) memberValue).setValue((Short) value);
    else if (memberValue instanceof IntegerMemberValue)
        ((IntegerMemberValue) memberValue).setValue((Integer) value);
    else if (memberValue instanceof LongMemberValue)
        ((LongMemberValue) memberValue).setValue((Long) value);
    else if (memberValue instanceof FloatMemberValue)
        ((FloatMemberValue) memberValue).setValue((Float) value);
    else if (memberValue instanceof DoubleMemberValue)
        ((DoubleMemberValue) memberValue).setValue((Double) value);
    else if (memberValue instanceof ClassMemberValue)
        ((ClassMemberValue) memberValue).setValue(((Class<?>)value).getName());
    else if (memberValue instanceof StringMemberValue)
        ((StringMemberValue) memberValue).setValue((String) value);
    else if (memberValue instanceof EnumMemberValue) 
        ((EnumMemberValue) memberValue).setValue(((Enum<?>) value).name());
    /* else if (memberValue instanceof AnnotationMemberValue) */
    else if (memberValue instanceof ArrayMemberValue) {
        CtClass arrayType = type.getComponentType();
        int len = Array.getLength(value);
        MemberValue[] members = new MemberValue[len];
        for (int i = 0; i < len; i ++) {
            members[i] = createMemberValue(cp, arrayType, Array.get(value, i));
        }
        ((ArrayMemberValue) memberValue).setValue(members);
    }
    return memberValue;
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:37,代码来源:JValidator.java

示例5: createMemberValue

import javassist.bytecode.annotation.BooleanMemberValue; //导入依赖的package包/类
private static MemberValue createMemberValue(ConstPool cp, CtClass type, Object value) throws NotFoundException {
    MemberValue memberValue = javassist.bytecode.annotation.Annotation.createMemberValue(cp, type);
    if (memberValue instanceof BooleanMemberValue)
        ((BooleanMemberValue) memberValue).setValue((Boolean) value);
    else if (memberValue instanceof ByteMemberValue)
        ((ByteMemberValue) memberValue).setValue((Byte) value);
    else if (memberValue instanceof CharMemberValue)
        ((CharMemberValue) memberValue).setValue((Character) value);
    else if (memberValue instanceof ShortMemberValue)
        ((ShortMemberValue) memberValue).setValue((Short) value);
    else if (memberValue instanceof IntegerMemberValue)
        ((IntegerMemberValue) memberValue).setValue((Integer) value);
    else if (memberValue instanceof LongMemberValue)
        ((LongMemberValue) memberValue).setValue((Long) value);
    else if (memberValue instanceof FloatMemberValue)
        ((FloatMemberValue) memberValue).setValue((Float) value);
    else if (memberValue instanceof DoubleMemberValue)
        ((DoubleMemberValue) memberValue).setValue((Double) value);
    else if (memberValue instanceof ClassMemberValue)
        ((ClassMemberValue) memberValue).setValue(((Class<?>) value).getName());
    else if (memberValue instanceof StringMemberValue)
        ((StringMemberValue) memberValue).setValue((String) value);
    else if (memberValue instanceof EnumMemberValue)
        ((EnumMemberValue) memberValue).setValue(((Enum<?>) value).name());
    /* else if (memberValue instanceof AnnotationMemberValue) */
    else if (memberValue instanceof ArrayMemberValue) {
        CtClass arrayType = type.getComponentType();
        int len = Array.getLength(value);
        MemberValue[] members = new MemberValue[len];
        for (int i = 0; i < len; i++) {
            members[i] = createMemberValue(cp, arrayType, Array.get(value, i));
        }
        ((ArrayMemberValue) memberValue).setValue(members);
    }
    return memberValue;
}
 
开发者ID:tiglabs,项目名称:jsf-sdk,代码行数:37,代码来源:Jsr303Validator.java

示例6: createMemberValue

import javassist.bytecode.annotation.BooleanMemberValue; //导入依赖的package包/类
private static MemberValue createMemberValue(ConstPool cp, CtClass type, Object value) throws NotFoundException {
	MemberValue memberValue = javassist.bytecode.annotation.Annotation.createMemberValue(cp, type);
	if (memberValue instanceof BooleanMemberValue)
		((BooleanMemberValue) memberValue).setValue((Boolean) value);
	else if (memberValue instanceof ByteMemberValue)
		((ByteMemberValue) memberValue).setValue((Byte) value);
	else if (memberValue instanceof CharMemberValue)
		((CharMemberValue) memberValue).setValue((Character) value);
	else if (memberValue instanceof ShortMemberValue)
		((ShortMemberValue) memberValue).setValue((Short) value);
	else if (memberValue instanceof IntegerMemberValue)
		((IntegerMemberValue) memberValue).setValue((Integer) value);
	else if (memberValue instanceof LongMemberValue)
		((LongMemberValue) memberValue).setValue((Long) value);
	else if (memberValue instanceof FloatMemberValue)
		((FloatMemberValue) memberValue).setValue((Float) value);
	else if (memberValue instanceof DoubleMemberValue)
		((DoubleMemberValue) memberValue).setValue((Double) value);
	else if (memberValue instanceof ClassMemberValue)
		((ClassMemberValue) memberValue).setValue(((Class<?>) value).getName());
	else if (memberValue instanceof StringMemberValue)
		((StringMemberValue) memberValue).setValue((String) value);
	else if (memberValue instanceof EnumMemberValue)
		((EnumMemberValue) memberValue).setValue(((Enum<?>) value).name());
	/* else if (memberValue instanceof AnnotationMemberValue) */
	else if (memberValue instanceof ArrayMemberValue) {
		CtClass arrayType = type.getComponentType();
		int len = Array.getLength(value);
		MemberValue[] members = new MemberValue[len];
		for (int i = 0; i < len; i++) {
			members[i] = createMemberValue(cp, arrayType, Array.get(value, i));
		}
		((ArrayMemberValue) memberValue).setValue(members);
	}
	return memberValue;
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:37,代码来源:JValidator.java

示例7: text

import javassist.bytecode.annotation.BooleanMemberValue; //导入依赖的package包/类
@Override
public DynamicField text(boolean own) {
       Annotation annot = new Annotation(Text.class.getName(), cpool);
       annot.addMemberValue("own", new BooleanMemberValue(own, cpool));
       attr.addAnnotation(annot);
	return this;
}
 
开发者ID:xtuhcy,项目名称:gecco,代码行数:8,代码来源:JavassistDynamicField.java

示例8: html

import javassist.bytecode.annotation.BooleanMemberValue; //导入依赖的package包/类
@Override
public DynamicField html(boolean outer) {
	Annotation annot = new Annotation(Html.class.getName(), cpool);
       annot.addMemberValue("outer", new BooleanMemberValue(outer, cpool));
       attr.addAnnotation(annot);
	return this;
}
 
开发者ID:xtuhcy,项目名称:gecco,代码行数:8,代码来源:JavassistDynamicField.java

示例9: disableBooleanMember

import javassist.bytecode.annotation.BooleanMemberValue; //导入依赖的package包/类
/**
 * Iterate the annotations, look for a 'required' parameter, and set it to
 * false.
 * 
 * @param field
 * @param prefix
 */
private void disableBooleanMember(
		String booleanMemberName,
		CtField field ) {

	// This is the JCommander package name
	String packageName = JCommander.class.getPackage().getName();

	AnnotationsAttribute fieldAttributes = (AnnotationsAttribute) field.getFieldInfo().getAttribute(
			AnnotationsAttribute.visibleTag);

	// Look for annotations that have a 'names' attribute, and whose package
	// starts with the expected JCommander package.
	for (Annotation annotation : fieldAttributes.getAnnotations()) {
		if (annotation.getTypeName().startsWith(
				packageName)) {
			// See if it has a 'names' member variable.
			MemberValue requiredMember = annotation.getMemberValue(booleanMemberName);

			// We have a names member!!!
			if (requiredMember != null) {
				BooleanMemberValue booleanRequiredMember = (BooleanMemberValue) requiredMember;

				// Set it to not required.
				booleanRequiredMember.setValue(false);

				// This is KEY! For some reason, the existing annotation
				// will not be modified unless
				// you call 'setAnnotation' here. I'm guessing
				// 'getAnnotation()' creates a copy.
				fieldAttributes.setAnnotation(annotation);

				// Finished processing names.
				break;
			}
		}
	}
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:45,代码来源:JCommanderTranslationMap.java

示例10: visitBooleanMemberValue

import javassist.bytecode.annotation.BooleanMemberValue; //导入依赖的package包/类
@Override
public void visitBooleanMemberValue(BooleanMemberValue node) {
  values.add(String.valueOf(node.getValue()));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:ClassPathScanner.java

示例11: visitBooleanMemberValue

import javassist.bytecode.annotation.BooleanMemberValue; //导入依赖的package包/类
@Override
public void visitBooleanMemberValue(BooleanMemberValue node) {

}
 
开发者ID:aschattney,项目名称:annotated-mvp,代码行数:5,代码来源:ByteCodeProcessor.java

示例12: addBooleanMemberVariable

import javassist.bytecode.annotation.BooleanMemberValue; //导入依赖的package包/类
protected void addBooleanMemberVariable(Annotation annot, ConstPool cpool, String propertyName, boolean value) {

		annot.addMemberValue(propertyName, new BooleanMemberValue(value, cpool));
	}
 
开发者ID:mcraken,项目名称:spring-scaffy,代码行数:5,代码来源:AnnotationBuilder.java


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