/** * Gets a reference to an actor that has the {@literal@}NoIdentity annotation. * * @param actorInterface the actor interface * @param <T> the interface type * @return an actor reference */ static <T extends Actor> T getReference(Class<T> actorInterface) { if (!actorInterface.isAnnotationPresent(NoIdentity.class)) { throw new IllegalArgumentException("Not annotated with " + NoIdentity.class); } return DefaultDescriptorFactory.ref(actorInterface, null); }
/** * Gets a reference to an actor. * * @param actorInterface the actor interface * @param id the actor id * @param <T> the interface type * @return an actor reference */ static <T extends Actor> T getReference(Class<T> actorInterface, String id) { if (actorInterface.isAnnotationPresent(NoIdentity.class)) { throw new IllegalArgumentException("Shouldn't supply ids for Actors annotated with " + NoIdentity.class); } else if(StringUtils.isBlank(id)) { throw new IllegalArgumentException("Actor ids may not be null or \"\"."); } return DefaultDescriptorFactory.ref(actorInterface, id); }
@SuppressWarnings("unchecked") public static <T extends Actor> T ref(int interfaceId, String id) { final Class classById = instance.findClassById(interfaceId); if (classById == null) { throw new UncheckedException("Class not found, id: " + interfaceId); } return (T) ref(classById, id); }
/** * Gets a reference to an actor that has the {@literal@}NoIdentity annotation. * * @param actorInterface the actor interface * @param <T> the interface type * @return an actor reference */ static <T extends Actor> T getReference(Class<T> actorInterface) { if (!actorInterface.isAnnotationPresent(NoIdentity.class)) { throw new IllegalArgumentException("Not annotated with " + NoIdentity.class); } return DefaultDescriptorFactory.ref(actorInterface, null); }
/** * Gets a reference to an actor. * * @param actorInterface the actor interface * @param id the actor id * @param <T> the interface type * @return an actor reference */ static <T extends Actor> T getReference(Class<T> actorInterface, String id) { if (actorInterface.isAnnotationPresent(NoIdentity.class)) { throw new IllegalArgumentException("Shouldn't supply ids for Actors annotated with " + NoIdentity.class); } else if(StringUtils.isBlank(id)) { throw new IllegalArgumentException("Actor ids may not be null or \"\"."); } return DefaultDescriptorFactory.ref(actorInterface, id); }
@SuppressWarnings("unchecked") public static <T extends Actor> T ref(int interfaceId, String id) { final Class classById = instance.findClassById(interfaceId); if (classById == null) { throw new UncheckedException("Class not found, id: " + interfaceId); } return (T) ref(classById, id); }