use of soot.tagkit.AnnotationIntElem in project robovm by robovm.
the class AttributesEncoder method encodeAnnotationElementValue.
private PackedStructureConstant encodeAnnotationElementValue(AnnotationElem ae) {
PackedStructureType type = getAnnotationElementType(ae);
Value kind = new IntegerConstant((byte) ae.getKind());
if (ae instanceof AnnotationIntElem) {
AnnotationIntElem aie = (AnnotationIntElem) ae;
return new PackedStructureConstant(type, kind, new IntegerConstant(aie.getValue()));
} else if (ae instanceof AnnotationLongElem) {
AnnotationLongElem ale = (AnnotationLongElem) ae;
return new PackedStructureConstant(type, kind, new IntegerConstant(ale.getValue()));
} else if (ae instanceof AnnotationFloatElem) {
AnnotationFloatElem afe = (AnnotationFloatElem) ae;
return new PackedStructureConstant(type, kind, new FloatingPointConstant(afe.getValue()));
} else if (ae instanceof AnnotationDoubleElem) {
AnnotationDoubleElem ade = (AnnotationDoubleElem) ae;
return new PackedStructureConstant(type, kind, new FloatingPointConstant(ade.getValue()));
} else if (ae instanceof AnnotationStringElem) {
AnnotationStringElem ase = (AnnotationStringElem) ae;
return new PackedStructureConstant(type, kind, getStringOrNull(ase.getValue()));
} else if (ae instanceof AnnotationClassElem) {
AnnotationClassElem ace = (AnnotationClassElem) ae;
addDependencyIfNeeded(ace.getDesc());
return new PackedStructureConstant(type, kind, getStringOrNull(ace.getDesc()));
} else if (ae instanceof AnnotationEnumElem) {
AnnotationEnumElem aee = (AnnotationEnumElem) ae;
addDependencyIfNeeded(aee.getTypeName());
return new PackedStructureConstant(type, kind, getStringOrNull(aee.getTypeName()), getStringOrNull(aee.getConstantName()));
} else if (ae instanceof AnnotationArrayElem) {
AnnotationArrayElem aae = (AnnotationArrayElem) ae;
Value[] values = new Value[aae.getNumValues() + 2];
values[0] = kind;
values[1] = new IntegerConstant((char) aae.getNumValues());
for (int i = 0; i < aae.getNumValues(); i++) {
values[i + 2] = encodeAnnotationElementValue(aae.getValueAt(i));
}
return new PackedStructureConstant(type, values);
} else if (ae instanceof AnnotationAnnotationElem) {
AnnotationAnnotationElem aae = (AnnotationAnnotationElem) ae;
return new PackedStructureConstant(type, kind, encodeAnnotationTagValue(aae.getValue()));
}
throw new IllegalArgumentException("Unknown AnnotationElem type: " + ae.getClass());
}
Aggregations