@Override protected boolean isRelevantClass(final MetaClass clazz) { return EnvUtil.isPortableType(clazz); } }
@Override protected boolean isRelevantClass(final MetaClass clazz) { return EnvUtil.isPortableType(clazz); } }
public static Set<Class<?>> getAllPortableConcreteSubtypes(final Class<?> clazz) { final Set<Class<?>> portableSubtypes = new HashSet<>(); if (isPortableType(clazz)) { portableSubtypes.add(clazz); } for (final Class<?> subType : ScannerSingleton.getOrCreateInstance().getSubTypesOf(clazz)) { if (isPortableType(subType)) { portableSubtypes.add(subType); } } return portableSubtypes; }
public static Set<Class<?>> getAllPortableSubtypes(final Class<?> clazz) { final Set<Class<?>> portableSubtypes = new HashSet<>(); if (clazz.isInterface() || isPortableType(clazz)) { portableSubtypes.add(clazz); } for (final Class<?> subType : ScannerSingleton.getOrCreateInstance().getSubTypesOf(clazz)) { if (clazz.isInterface() || isPortableType(subType)) { portableSubtypes.add(subType); } } return portableSubtypes; }
public static Set<Class<?>> getAllPortableConcreteSubtypes(final Class<?> clazz) { final Set<Class<?>> portableSubtypes = new HashSet<>(); if (isPortableType(clazz)) { portableSubtypes.add(clazz); } for (final Class<?> subType : ScannerSingleton.getOrCreateInstance().getSubTypesOf(clazz)) { if (isPortableType(subType)) { portableSubtypes.add(subType); } } return portableSubtypes; }
@SuppressWarnings("unused") private void onEvent(@Observes Object event, EventMetadata emd) { // Check if initialized if (eventDispatcher == null) return; // Check if the event is a portable Errai CDI event and should be forwarded // to all listening clients if (EnvUtil.isPortableType(event.getClass())) { eventDispatcher.sendEventToClients(event, emd); } } }
public static Set<Class<?>> getAllPortableSubtypes(final Class<?> clazz) { final Set<Class<?>> portableSubtypes = new HashSet<>(); if (clazz.isInterface() || isPortableType(clazz)) { portableSubtypes.add(clazz); } for (final Class<?> subType : ScannerSingleton.getOrCreateInstance().getSubTypesOf(clazz)) { if (clazz.isInterface() || isPortableType(subType)) { portableSubtypes.add(subType); } } return portableSubtypes; }
/** * <p>Return a <code>@Portable RuntimeException</code> that can be captured by client side widgets.</p> * * @param e The exception that caused the error. * @return The portable exception to send to the client side. */ public RuntimeException handleException(final Exception e) { log.error(e.getMessage(), e); if (e instanceof RuntimeException && EnvUtil.isPortableType(e.getClass()) ) { return (RuntimeException) e; } return new GenericPortableException( e.getMessage(), e ); } }
/** * <p>Return a <code>@Portable RuntimeException</code> that can be captured by client side widgets.</p> * * @param e The exception that caused the error. * @return The portable exception to send to the client side. */ public RuntimeException handleException(final Exception e) { log.error(e.getMessage(), e); if (e instanceof RuntimeException && EnvUtil.isPortableType(e.getClass()) ) { return (RuntimeException) e; } return new GenericPortableException( e.getMessage(), e ); } }
/** * Retrieve the value of an Annotation's attribute * @param annotation * @param attributeName * @return */ public static Object getAnnotationAttributeValue( final Annotation annotation, final String attributeName ) { Object value = null; if ( annotation != null ) { try { value = annotation.annotationType().getMethod( attributeName ).invoke( annotation ); final Class valueType = value.getClass(); final Class componentType = valueType.getComponentType(); final Class portableType = componentType != null ? componentType : valueType; if ( !EnvUtil.isPortableType( portableType ) ) { value = value.toString(); } } catch ( Exception ex ) { //Swallow } } return value; }
/** * Helper to return a @Portable RuntimeException. * @param e * @return */ public static RuntimeException handleException(final Exception e) { logger.error("Exception thrown: " + e.getMessage(), e); if (EnvUtil.isPortableType(e.getClass())) { if (e instanceof RuntimeException) { return (RuntimeException) e; } else { return new GenericPortableException(e.getMessage(), e); } } return new GenericPortableException(e.getMessage(), e); } }
/** * Helper to return a @Portable RuntimeException. * @param e * @return */ public static RuntimeException handleException(final Exception e) { logger.error("Exception thrown: " + e.getMessage(), e); if (EnvUtil.isPortableType(e.getClass())) { if (e instanceof RuntimeException) { return (RuntimeException) e; } else { return new GenericPortableException(e.getMessage(), e); } } return new GenericPortableException(e.getMessage(), e); } }
/** * Helper to return a @Portable RuntimeException. * @param e * @return */ public static RuntimeException handleException(final Exception e) { logger.error("Exception thrown: " + e.getMessage(), e); if (EnvUtil.isPortableType(e.getClass())) { if (e instanceof RuntimeException) { return (RuntimeException) e; } else { return new GenericPortableException(e.getMessage(), e); } } return new GenericPortableException(e.getMessage(), e); } }
/** * Helper to return a @Portable RuntimeException. * @param e * @return */ public static RuntimeException handleException(final Exception e) { logger.debug("Exception thrown: " + e.getMessage(), e); if (EnvUtil.isPortableType(e.getClass())) { if (e instanceof RuntimeException) { return (RuntimeException) e; } else { return new GenericPortableException(e.getMessage(), e); } } return new GenericPortableException(e.getMessage(), e); } }
/** * Helper to return a @Portable RuntimeException. * @param e * @return */ public static RuntimeException handleException(final Exception e) { logger.debug("Exception thrown: " + e.getMessage(), e); if (EnvUtil.isPortableType(e.getClass())) { if (e instanceof RuntimeException) { return (RuntimeException) e; } else { return new GenericPortableException(e.getMessage(), e); } } return new GenericPortableException(e.getMessage(), e); } }
@SuppressWarnings({ "unchecked", "rawtypes" }) public void processObserverMethod(@Observes final ProcessObserverMethod processObserverMethod) { final Type t = processObserverMethod.getObserverMethod().getObservedType(); Class type = null; if (t instanceof Class) { type = (Class) t; } ClassScanner.setReflectionsScanning(true); if (type != null && EnvUtil.isPortableType(type) && !EnvUtil.isLocalEventType(type)) { final Set<Annotation> annotations = processObserverMethod.getObserverMethod().getObservedQualifiers(); final Annotation[] methodQualifiers = annotations.toArray(new Annotation[annotations.size()]); for (final Annotation qualifier : methodQualifiers) { eventQualifiers.put(qualifier.annotationType().getName(), qualifier); } observableEvents.add(type.getName()); } }
if (EnvUtil.isPortableType(value.getClass())) { portableValue = value; } else {
if (type == null || !EnvUtil.isPortableType(type)) { log.warn("client tried to register a non-portable type: " + type); return;
callBackBlock = getJsTypeSubscriptionCallback(decorable, controller); else if (EnvUtil.isPortableType(eventType) && !EnvUtil.isLocalEventType(eventType)) { subscribeMethod = "subscribe"; callBackBlock = getSubscriptionCallback(decorable, controller);