Search Java Code Snippets


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





#Java - Code Snippets for '#.ElementValue' - 2 code snippet(s) found

 Sample 1. Code Sample / Example / Snippet of org.apache.bcel.generic.ElementValuePairGen

    public AnnotationEntryGen createFruitAnnotationEntry(final ConstantPoolGen cp,

final String aFruit, final boolean visibility)

{

final SimpleElementValueGen evg = new SimpleElementValueGen(

ElementValueGen.STRING, cp, aFruit);

final ElementValuePairGen nvGen = new ElementValuePairGen("fruit", evg, cp);

final ObjectType t = new ObjectType("SimpleStringAnnotation");

final List<ElementValuePairGen> elements = new ArrayList<>();

elements.add(nvGen);

return new AnnotationEntryGen(t, elements, visibility, cp);

}


   Like      Feedback      org.apache.bcel.generic.ElementValuePairGen


 Sample 2. Code Sample / Example / Snippet of org.apache.bcel.classfile.ElementValuePair

    private void assertArrayElementValue(final int nExpectedArrayValues, final AnnotationEntry anno)

{

final ElementValuePair elementValuePair = anno.getElementValuePairs()[0];

assertEquals("value", elementValuePair.getNameString());

final ArrayElementValue ev = (ArrayElementValue) elementValuePair.getValue();

final ElementValue[] eva = ev.getElementValuesArray();

assertEquals(nExpectedArrayValues, eva.length);

}


   Like      Feedback      org.apache.bcel.classfile.ElementValuePair



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