Search Java Code Snippets

  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.

Java - Code Samples

 Sample 1. Code Sample / Example / Snippet of org.apache.bcel.classfile.SimpleElementValue

    public void testMethodAnnotations() throws ClassNotFoundException


final JavaClass clazz = getTestClass(PACKAGE_BASE_NAME+".data.SimpleAnnotation");

final Method m = getMethod(clazz, "fruit");

final AnnotationDefault a = (AnnotationDefault) findAttribute(

"AnnotationDefault", m.getAttributes());

final SimpleElementValue val = (SimpleElementValue) a.getDefaultValue();

assertTrue("Should be STRING but is " + val.getElementValueType(), val

.getElementValueType() == ElementValue.STRING);

assertTrue("Should have default of bananas but default is "

+ val.getValueString(), val.getValueString().equals("bananas"));


   Like      Feedback      org.apache.bcel.classfile.SimpleElementValue

Subscribe to Java News and Posts. Get latest updates and posts on Java from
Enter your email address:
Delivered by FeedBurner

comments powered by Disqus