/** * Returns true if this attribute accessor has been initialized and now stores a reference to the * class's attribute. An attribute accessor can become uninitialized on serialization. */ public boolean isInitialized(){ return (this.getMethod != null || isReadOnly()) && (this.setMethod != null || isWriteOnly()); }
/** * Returns true if this attribute accessor has been initialized and now stores a reference to the * class's attribute. An attribute accessor can become uninitialized on serialization. */ public boolean isInitialized(){ return (this.getMethod != null || isReadOnly()) && (this.setMethod != null || isWriteOnly()); }
/** * Returns true if this attribute accessor has been initialized and now stores a reference to the * class's attribute. An attribute accessor can become uninitialized on serialization. */ @Override public boolean isInitialized(){ return (this.getMethod != null || isReadOnly()) && (this.setMethod != null || isWriteOnly()); }
/** * Set get and set method after creating these methods by using * get and set method names */ protected void initializeAttributes(Class theJavaClass, Class[] getParameterTypes) throws DescriptorException { if (getAttributeName() == null) { throw DescriptorException.attributeNameNotSpecified(); } try { setGetMethod(Helper.getDeclaredMethod(theJavaClass, getGetMethodName(), getParameterTypes)); // The parameter type for the set method must always be the return type of the get method. if(!isWriteOnly()) { setSetMethod(Helper.getDeclaredMethod(theJavaClass, getSetMethodName(), getSetMethodParameterTypes())); } } catch (NoSuchMethodException ex) { DescriptorException descriptorException = DescriptorException.noSuchMethodWhileInitializingAttributesInMethodAccessor(getSetMethodName(), getGetMethodName(), theJavaClass.getName()); descriptorException.setInternalException(ex); throw descriptorException; } catch (SecurityException exception) { DescriptorException descriptorException = DescriptorException.securityWhileInitializingAttributesInMethodAccessor(getSetMethodName(), getGetMethodName(), theJavaClass.getName()); descriptorException.setInternalException(exception); throw descriptorException; } }
/** * Set get and set method after creating these methods by using * get and set method names */ protected void initializeAttributes(Class theJavaClass, Class[] getParameterTypes) throws DescriptorException { if (getAttributeName() == null) { throw DescriptorException.attributeNameNotSpecified(); } try { setGetMethod(Helper.getDeclaredMethod(theJavaClass, getGetMethodName(), getParameterTypes)); // The parameter type for the set method must always be the return type of the get method. if(!isWriteOnly()) { setSetMethod(Helper.getDeclaredMethod(theJavaClass, getSetMethodName(), getSetMethodParameterTypes())); } } catch (NoSuchMethodException ex) { DescriptorException descriptorException = DescriptorException.noSuchMethodWhileInitializingAttributesInMethodAccessor(getSetMethodName(), getGetMethodName(), theJavaClass.getName()); descriptorException.setInternalException(ex); throw descriptorException; } catch (SecurityException exception) { DescriptorException descriptorException = DescriptorException.securityWhileInitializingAttributesInMethodAccessor(getSetMethodName(), getGetMethodName(), theJavaClass.getName()); descriptorException.setInternalException(exception); throw descriptorException; } }
/** * Set get and set method after creating these methods by using * get and set method names */ public void initializeAttributes(Class theJavaClass) throws DescriptorException { if (getAttributeName() == null) { throw DescriptorException.attributeNameNotSpecified(); } try { setGetMethod(Helper.getDeclaredMethod(theJavaClass, getGetMethodName(), (Class[])null)); // The parameter type for the set method must always be the return type of the get method. if(!isWriteOnly()) { Class[] parameterTypes = new Class[1]; parameterTypes[0] = getGetMethodReturnType(); setSetMethod(Helper.getDeclaredMethod(theJavaClass, getSetMethodName(), parameterTypes)); } } catch (NoSuchMethodException ex) { DescriptorException descriptorException = DescriptorException.noSuchMethodWhileInitializingAttributesInMethodAccessor(getSetMethodName(), getGetMethodName(), theJavaClass.getName()); descriptorException.setInternalException(ex); throw descriptorException; } catch (SecurityException exception) { DescriptorException descriptorException = DescriptorException.securityWhileInitializingAttributesInMethodAccessor(getSetMethodName(), getGetMethodName(), theJavaClass.getName()); descriptorException.setInternalException(exception); throw descriptorException; } }