/** * Init caches if not initialized. */ private void init() { if (optionalClass == null) { optionalClass = SReflect.classForName0(OPTIONAL_CLASSNAME, null); ofMethod = SReflect.getMethod(optionalClass, "of", new Class[]{Object.class}); emptyMethod = SReflect.getMethod(optionalClass, "empty", new Class[]{}); getMethod = SReflect.getMethod(optionalClass, "get", new Class[]{}); isPresentMethod = SReflect.getMethod(optionalClass, "isPresent", new Class[]{}); } }
/** * Init caches if not initialized. */ private void init() { if (optionalClass == null) { optionalClass = SReflect.classForName0(OPTIONAL_CLASSNAME, null); ofMethod = SReflect.getMethod(optionalClass, "of", new Class[]{Object.class}); emptyMethod = SReflect.getMethod(optionalClass, "empty", new Class[]{}); getMethod = SReflect.getMethod(optionalClass, "get", new Class[]{}); isPresentMethod = SReflect.getMethod(optionalClass, "isPresent", new Class[]{}); } }
/** * Init caches if not initialized. */ private void init() { if (optionalClass == null) { optionalClass = SReflect.classForName0(OPTIONAL_CLASSNAME, null); ofMethod = SReflect.getMethod(optionalClass, "of", new Class[]{Object.class}); emptyMethod = SReflect.getMethod(optionalClass, "empty", new Class[]{}); getMethod = SReflect.getMethod(optionalClass, "get", new Class[]{}); isPresentMethod = SReflect.getMethod(optionalClass, "isPresent", new Class[]{}); } }
/** * Init caches if not initialized. */ private void init() { if (optionalClass == null) { optionalClass = SReflect.classForName0(OPTIONAL_CLASSNAME, null); ofMethod = SReflect.getMethod(optionalClass, "of", new Class[]{Object.class}); emptyMethod = SReflect.getMethod(optionalClass, "empty", new Class[]{}); getMethod = SReflect.getMethod(optionalClass, "get", new Class[]{}); isPresentMethod = SReflect.getMethod(optionalClass, "isPresent", new Class[]{}); } }
/** * Get listener add method */ protected Method getAddMethod(Object object) { // Do not use Class.getMethod (slow). Method meth = SReflect.getMethod(object.getClass(), "addPropertyChangeListener", PCL); return meth; } }
/** * Remove a listener from an object. */ // Listener type must be object, because java.beans.PropertyChangeListener/jadex.commons.beans.PropertyChangeListener don't share an interface protected void removePCL(Object object, Object pcl) { if(pcl!=null) { try { // System.out.println(getTypeModel().getName()+": Deregister: "+value+", "+type); // Do not use Class.getMethod (slow). Method meth = SReflect.getMethod(object.getClass(), "removePropertyChangeListener", PCL); if(meth!=null) meth.invoke(object, new Object[]{pcl}); } catch(IllegalAccessException e){e.printStackTrace();} catch(InvocationTargetException e){e.printStackTrace();} } }
/** * Get listener add method */ @Override protected Method getAddMethod(Object object) { Method meth = super.getAddMethod(object); // check if java.beans or jadex.commons are used: if(meth == null) { // Do not use Class.getMethod (slow). meth = SReflect.getMethod(object.getClass(), "addPropertyChangeListener", JAVABEANS_PCL); } return meth; }
/** * */ protected void removePCL(Object object, Object pcl) { if(pcl!=null) { try { // System.out.println(getTypeModel().getName()+": Deregister: "+value+", "+type); // Do not use Class.getMethod (slow). Method meth = null; if(pcl instanceof jadex.commons.beans.PropertyChangeListener) { meth = SReflect.getMethod(object.getClass(), "removePropertyChangeListener", PCL); } else { meth = SReflect.getMethod(object.getClass(), "removePropertyChangeListener", JAVABEANS_PCL); } if(meth!=null) meth.invoke(object, new Object[]{pcl}); } catch(IllegalAccessException e){e.printStackTrace();} catch(InvocationTargetException e){e.printStackTrace();} } }
Method meth = SReflect.getMethod(value.getClass(), "removePropertyChangeListener", PCL); if(meth!=null)
Method meth = SReflect.getMethod(value.getClass(), "removePropertyChangeListener", PCL); if(meth!=null)
Method meth = SReflect.getMethod(value.getClass(), "addPropertyChangeListener", PCL); if(meth!=null)
Method meth = SReflect.getMethod(value.getClass(), "addPropertyChangeListener", PCL); if(meth!=null)
Method meth = SReflect.getMethod(value.getClass(), "removePropertyChangeListener", PCL); if(meth!=null)
Method meth = SReflect.getMethod(value.getClass(), "removePropertyChangeListener", PCL); if(meth!=null)
SReflect.getMethod(allinterfaces[i], method.getName(), method.getParameterTypes())!=null)
SReflect.getMethod(allinterfaces[i], method.getName(), method.getParameterTypes())!=null)
Method m = SReflect.getMethod(step.getClass(), "execute", new Class[]{IInternalAccess.class}); final Future<T> ret = m!=null ? (Future<T>)FutureFunctionality.getDelegationFuture(m.getReturnType(), new FutureFunctionality((Logger)null)) : new Future<T>();