@Nullable public MapItem getMapItemForSection(int itemType) { for (MapItem mapItem: getMapItems()) { if (mapItem.getType() == itemType) { return mapItem; } } return null; }
@Nonnull public String getName() { return ItemType.getItemTypeName(getType()); }
@Nullable public MapItem getMapItemForSection(int itemType) { for (MapItem mapItem: getMapItems()) { if (mapItem.getType() == itemType) { return mapItem; } } return null; }
@Nullable public MapItem getMapItemForSection(int itemType) { for (MapItem mapItem: getMapItems()) { if (mapItem.getType() == itemType) { return mapItem; } } return null; }
@Nonnull public String getName() { return ItemType.getItemTypeName(getType()); }
@Nonnull public String getName() { return ItemType.getItemTypeName(getType()); }
public SectionAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { this.annotator = annotator; this.dexFile = annotator.dexFile; this.itemType = mapItem.getType(); this.sectionOffset = mapItem.getOffset(); this.itemCount = mapItem.getItemCount(); }
public SectionAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { this.annotator = annotator; this.dexFile = annotator.dexFile; this.itemType = mapItem.getType(); this.sectionOffset = mapItem.getOffset(); this.itemCount = mapItem.getItemCount(); }
public SectionAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { this.annotator = annotator; this.dexFile = annotator.dexFile; this.itemType = mapItem.getType(); this.sectionOffset = mapItem.getOffset(); this.itemCount = mapItem.getItemCount(); }
switch (mapItem.getType()) { case ItemType.HEADER_ITEM: annotators.put(mapItem.getType(), HeaderItem.makeAnnotator(this, mapItem)); break; case ItemType.STRING_ID_ITEM: annotators.put(mapItem.getType(), StringIdItem.makeAnnotator(this, mapItem)); break; case ItemType.TYPE_ID_ITEM: annotators.put(mapItem.getType(), TypeIdItem.makeAnnotator(this, mapItem)); break; case ItemType.PROTO_ID_ITEM: annotators.put(mapItem.getType(), ProtoIdItem.makeAnnotator(this, mapItem)); break; case ItemType.FIELD_ID_ITEM: annotators.put(mapItem.getType(), FieldIdItem.makeAnnotator(this, mapItem)); break; case ItemType.METHOD_ID_ITEM: annotators.put(mapItem.getType(), MethodIdItem.makeAnnotator(this, mapItem)); break; case ItemType.CLASS_DEF_ITEM: annotators.put(mapItem.getType(), ClassDefItem.makeAnnotator(this, mapItem)); break; case ItemType.MAP_LIST: annotators.put(mapItem.getType(), MapItem.makeAnnotator(this, mapItem)); break; case ItemType.TYPE_LIST: annotators.put(mapItem.getType(), TypeListItem.makeAnnotator(this, mapItem)); break; case ItemType.ANNOTATION_SET_REF_LIST:
switch (mapItem.getType()) { case ItemType.HEADER_ITEM: annotators.put(mapItem.getType(), HeaderItem.makeAnnotator(this, mapItem)); break; case ItemType.STRING_ID_ITEM: annotators.put(mapItem.getType(), StringIdItem.makeAnnotator(this, mapItem)); break; case ItemType.TYPE_ID_ITEM: annotators.put(mapItem.getType(), TypeIdItem.makeAnnotator(this, mapItem)); break; case ItemType.PROTO_ID_ITEM: annotators.put(mapItem.getType(), ProtoIdItem.makeAnnotator(this, mapItem)); break; case ItemType.FIELD_ID_ITEM: annotators.put(mapItem.getType(), FieldIdItem.makeAnnotator(this, mapItem)); break; case ItemType.METHOD_ID_ITEM: annotators.put(mapItem.getType(), MethodIdItem.makeAnnotator(this, mapItem)); break; case ItemType.CLASS_DEF_ITEM: annotators.put(mapItem.getType(), ClassDefItem.makeAnnotator(this, mapItem)); break; case ItemType.MAP_LIST: annotators.put(mapItem.getType(), MapItem.makeAnnotator(this, mapItem)); break; case ItemType.TYPE_LIST: annotators.put(mapItem.getType(), TypeListItem.makeAnnotator(this, mapItem)); break; case ItemType.ANNOTATION_SET_REF_LIST:
switch (mapItem.getType()) { case ItemType.HEADER_ITEM: annotators.put(mapItem.getType(), HeaderItem.makeAnnotator(this, mapItem)); break; case ItemType.STRING_ID_ITEM: annotators.put(mapItem.getType(), StringIdItem.makeAnnotator(this, mapItem)); break; case ItemType.TYPE_ID_ITEM: annotators.put(mapItem.getType(), TypeIdItem.makeAnnotator(this, mapItem)); break; case ItemType.PROTO_ID_ITEM: annotators.put(mapItem.getType(), ProtoIdItem.makeAnnotator(this, mapItem)); break; case ItemType.FIELD_ID_ITEM: annotators.put(mapItem.getType(), FieldIdItem.makeAnnotator(this, mapItem)); break; case ItemType.METHOD_ID_ITEM: annotators.put(mapItem.getType(), MethodIdItem.makeAnnotator(this, mapItem)); break; case ItemType.CLASS_DEF_ITEM: annotators.put(mapItem.getType(), ClassDefItem.makeAnnotator(this, mapItem)); break; case ItemType.MAP_LIST: annotators.put(mapItem.getType(), MapItem.makeAnnotator(this, mapItem)); break; case ItemType.TYPE_LIST: annotators.put(mapItem.getType(), TypeListItem.makeAnnotator(this, mapItem)); break; case ItemType.ANNOTATION_SET_REF_LIST:
public void writeAnnotations(Writer out) throws IOException { List<MapItem> mapItems = dexFile.getMapItems(); // sort the map items based on the order defined by sectionAnnotationOrder Ordering<MapItem> ordering = Ordering.from(new Comparator<MapItem>() { @Override public int compare(MapItem o1, MapItem o2) { return Ints.compare(sectionAnnotationOrder.get(o1.getType()), sectionAnnotationOrder.get(o2.getType())); } }); mapItems = ordering.immutableSortedCopy(mapItems); try { for (MapItem mapItem: mapItems) { SectionAnnotator annotator = annotators.get(mapItem.getType()); annotator.annotateSection(this); } } finally { dexFile.writeAnnotations(out, this); } }
public void writeAnnotations(Writer out) throws IOException { List<MapItem> mapItems = dexFile.getMapItems(); // sort the map items based on the order defined by sectionAnnotationOrder Ordering<MapItem> ordering = Ordering.from(new Comparator<MapItem>() { @Override public int compare(MapItem o1, MapItem o2) { return Ints.compare(sectionAnnotationOrder.get(o1.getType()), sectionAnnotationOrder.get(o2.getType())); } }); mapItems = ordering.immutableSortedCopy(mapItems); try { for (MapItem mapItem: mapItems) { SectionAnnotator annotator = annotators.get(mapItem.getType()); annotator.annotateSection(this); } } finally { dexFile.writeAnnotations(out, this); } }
public void writeAnnotations(Writer out) throws IOException { List<MapItem> mapItems = dexFile.getMapItems(); // sort the map items based on the order defined by sectionAnnotationOrder Ordering<MapItem> ordering = Ordering.from(new Comparator<MapItem>() { @Override public int compare(MapItem o1, MapItem o2) { return Ints.compare(sectionAnnotationOrder.get(o1.getType()), sectionAnnotationOrder.get(o2.getType())); } }); mapItems = ordering.immutableSortedCopy(mapItems); try { for (MapItem mapItem: mapItems) { SectionAnnotator annotator = annotators.get(mapItem.getType()); annotator.annotateSection(this); } } finally { dexFile.writeAnnotations(out, this); } }