Java Code Examples for com.google.common.collect.ImmutableClassToInstanceMap#Builder
The following examples show how to use
com.google.common.collect.ImmutableClassToInstanceMap#Builder .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UTemplater.java From Refaster with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") public static ImmutableClassToInstanceMap<Annotation> annotationMap(Symbol symbol) { ImmutableClassToInstanceMap.Builder<Annotation> builder = ImmutableClassToInstanceMap.builder(); for (Compound compound : symbol.getAnnotationMirrors()) { Name qualifiedAnnotationType = ((TypeElement) compound.getAnnotationType().asElement()).getQualifiedName(); try { Class<? extends Annotation> annotationClazz = Class.forName(qualifiedAnnotationType.toString()).asSubclass(Annotation.class); builder.put((Class) annotationClazz, AnnotationProxyMaker.generateAnnotation(compound, annotationClazz)); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Unrecognized annotation type", e); } } return builder.build(); }
Example 2
Source File: VirtualChestActionDispatcher.java From VirtualChest with GNU Lesser General Public License v3.0 | 5 votes |
private static ClassToInstanceMap<Context> getContextMap(UUID actionUUID, Player player, VirtualChestHandheldItem itemTemplate) { ImmutableClassToInstanceMap.Builder<Context> contextBuilder = ImmutableClassToInstanceMap.builder(); contextBuilder.put(Context.HANDHELD_ITEM, new HandheldItemContext(itemTemplate::matchItem)); contextBuilder.put(Context.ACTION_UUID, new ActionUUIDContext(actionUUID)); contextBuilder.put(Context.PLAYER, new PlayerContext(player)); return contextBuilder.build(); }
Example 3
Source File: BugCheckerTransformer.java From Refaster with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public ImmutableClassToInstanceMap<Annotation> annotations() { ImmutableClassToInstanceMap.Builder<Annotation> builder = ImmutableClassToInstanceMap.builder(); for (Annotation annotation : checker().getClass().getDeclaredAnnotations()) { builder.put((Class) annotation.annotationType(), annotation); } return builder.build(); }