Java 8 ReflectionException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ReflectionException class.

This code example shows how to use the following methods:sleep
            echo(">>> START the CounterMonitor"); 
            counterMonitor.start();
 
            // Wait for granularity period (multiplied by 2 for sure) 
            // 
            Thread.sleep(granularityperiod * 2);
 
            // Check if notification was received 
            // 
            if (messageReceived) {
                echo("\tOK: CounterMonitor got RUNTIME_ERROR notification!"); 
            } else { 
                echo("\tKO: CounterMonitor did not get " + 
                     "RUNTIME_ERROR notification!"); 
                return 1; 
            } 
        } finally { 
            messageReceived = false;
            if (counterMonitor != null)
                counterMonitor.stop();

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
            null);	 
    } 
 
	@Override 
	public synchronized Object invoke(String name, Object[] args, String[] sig) throws MBeanException, ReflectionException {
		throw new ReflectionException(new NoSuchMethodException(name));	
	} 
 
	@Override 
	public synchronized void setAttribute(Attribute attr) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
		String name = attr.getName();
		if(name != null)
			_propMap.put(name, attr.getValue());
	} 
 
	@Override 
	public synchronized AttributeList setAttributes(AttributeList list) {
		Attribute[] attrs = (Attribute[]) list.toArray(new Attribute[0]);
		AttributeList retList = new AttributeList();
        for (Attribute attr : attrs) {
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
            return null; 
        } else if (actionName.equals("reload") && (params == null || params.length == 0)) {
            manager.reload();
            return null; 
        } 
        throw new ReflectionException(new NoSuchMethodException(actionName));
    } 
 
    @Delegate 
    public MBeanInfo getMBeanInfo() {
        List<MBeanAttributeInfo> attributesInfo = new ArrayList<MBeanAttributeInfo>();
        Set<String> propertyNames = manager.propertyNames();
        for (String name : propertyNames)
            attributesInfo.add(new MBeanAttributeInfo(name, "java.lang.String", name, true, true, false));
 
        MBeanAttributeInfo[] attributes = attributesInfo.toArray(new MBeanAttributeInfo[propertyNames.size()]);
 
        MBeanParameterInfo key = new MBeanParameterInfo("key", "java.lang.String", "Key of the property");
        MBeanParameterInfo value = new MBeanParameterInfo("value", "java.lang.String", "Value of the property");
 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        } 
        catch (Error err) {
            throw new RuntimeErrorException(err, "Error occured while invoking " + toSimpleName(method));
        } 
        catch (Exception e) {
            throw new ReflectionException(e, "Exception occured while invoking " + toSimpleName(method));
        } 
    } 
 
    private static String toSimpleName(Method method)
    { 
        return method.getName() + "()";
    } 
 
    public static boolean isGetter(Method method)
    { 
        String methodName = method.getName();
        return (methodName.startsWith("get") || methodName.startsWith("is")) && isValidGetter(method);
    } 
 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
      { 
         throw new ReflectionException(x);
      } 
      catch (IllegalAccessException x)
      { 
         throw new ReflectionException(x);
      } 
      catch (IllegalArgumentException x)
      { 
         throw new InvalidAttributeValueException(x.toString());
      } 
      catch (InvocationTargetException x)
      { 
         Throwable t = x.getTargetException();
         if (t instanceof RuntimeException)
            throw new RuntimeMBeanException((RuntimeException)t);
         else if (t instanceof Exception) throw new MBeanException((Exception)t);
         throw new RuntimeErrorException((Error)t);
      } 
   } 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    // Check for a recognized operation name and call the corresponding operation 
 
    if(operationName.equals("addLoggerMBean")) {
      return addLoggerMBean((String)params[0]);
    } else { 
      throw new ReflectionException(
	    new NoSuchMethodException(operationName),
	    "Cannot find the operation " + operationName + " in " + dClassName);
    } 
 
  } 
 
 
  public 
  Object getAttribute(String attributeName) throws AttributeNotFoundException,
                                                    MBeanException,
                                                    ReflectionException {
 
    // Check attributeName is not null to avoid NullPointerException later on 
    if (attributeName == null) {
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        } 
        catch (Error err) {
            throw new RuntimeErrorException(err, "Error occurred while invoking " + toSimpleName(method));
        } 
        catch (Exception e) {
            throw new ReflectionException(e, "Exception occurred while invoking " + toSimpleName(method));
        } 
    } 
 
    private static String toSimpleName(Method method)
    { 
        return new Signature(method).toString();
    } 
 
    public static boolean isGetter(Method method)
    { 
        String methodName = method.getName();
        return (methodName.startsWith("get") || methodName.startsWith("is")) && isValidGetter(method);
    } 
 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
            try { 
                return mc.call(params);
            } catch (NoSuchMethodException e) {
                throw new ReflectionException(e);
            } catch (IllegalAccessException e) {
                throw new ReflectionException(e);
            } catch (InvocationTargetException e) {
                throw new MBeanException(e);
            } 
        } else { 
            throw new ReflectionException(new NoSuchMethodException(
                operationName), "Cannot find the operation " + operationName
                    + " in " + m_className);
        } 
    } 
 
    /** 
     * Changes specified attribute value. 
     * 
     * @param attribute the attribute with new value to be changed 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        return new MBeanInfo(this.getClass().getName(), "Dynamic MBean", attrs, null, null, null);
    } 
 
    @Override 
    public synchronized Object invoke(String name, Object[] args, String[] sig) throws MBeanException, ReflectionException {
        throw new ReflectionException(new NoSuchMethodException(name));
    } 
 
    @Override 
    public synchronized void setAttribute(Attribute attr) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
        String name = attr.getName();
        if (name != null)
            _propMap.put(name, attr.getValue());
    } 
 
    @Override 
    public synchronized AttributeList setAttributes(AttributeList list) {
        Attribute[] attrs = list.toArray(new Attribute[0]);
        AttributeList retList = new AttributeList();
        for (Attribute attr : attrs) {
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 ReflectionException Methods: