jodd-bean/src/main/java/jodd/introspector/Properties.java
protected void addProperty(final HashMap<String, PropertyDescriptor> map, final String name, final MethodDescriptor methodDescriptor, final boolean isSetter) {
		MethodDescriptor setterMethod = isSetter ? methodDescriptor : null;
		MethodDescriptor getterMethod = isSetter ? null : methodDescriptor;

		PropertyDescriptor existing = map.get(name);

		if (existing == null) {
			// new property, just add it
			PropertyDescriptor propertyDescriptor = createPropertyDescriptor(name, getterMethod, setterMethod);

			map.put(name, propertyDescriptor);
			return;
		}

		// property exist

		if (!isSetter) {
			// use existing setter
			setterMethod = existing.getWriteMethodDescriptor();

			// check existing
			MethodDescriptor existingMethodDescriptor = existing.getReadMethodDescriptor();
			if (existingMethodDescriptor != null) {
				// check for special case of double get/is

				// getter with the same name already exist
				String methodName = methodDescriptor.getMethod().getName();
				String existingMethodName = existingMethodDescriptor.getMethod().getName();

				if (
						existingMethodName.startsWith(METHOD_IS_PREFIX) &&
						methodName.startsWith(METHOD_GET_PREFIX)) {

					// ignore getter when ister exist
					return;
				}
			}
		} else {
			// setter
			// use existing getter
			getterMethod = existing.getReadMethodDescriptor();

			if (getterMethod != null) {
				Class returnType = getterMethod.getMethod().getReturnType();

				if (setterMethod != null) {
					Class parameterType = setterMethod.getMethod().getParameterTypes()[0];

					if (returnType != parameterType) {
						// getter's type is different then setter's
						return;
					}

				}
			}
		}

		PropertyDescriptor propertyDescriptor = createPropertyDescriptor(name, getterMethod, setterMethod);

		map.put(name, propertyDescriptor);
	}
protected void addProperty(final HashMap<String, PropertyDescriptor> map, final String name, final MethodDescriptor methodDescriptor, final boolean isSetter) {
		MethodDescriptor setterMethod = isSetter ? methodDescriptor : null;
		MethodDescriptor getterMethod = isSetter ? null : methodDescriptor;

		PropertyDescriptor existing = map.get(name);

		if (existing == null) {
			// new property, just add it
			PropertyDescriptor propertyDescriptor = createPropertyDescriptor(name, getterMethod, setterMethod);

			map.put(name, propertyDescriptor);
			return;
		}

		// property exist

		if (!isSetter) {
			// use existing setter
			setterMethod = existing.getWriteMethodDescriptor();

			// check existing
			MethodDescriptor existingMethodDescriptor = existing.getReadMethodDescriptor();
			if (existingMethodDescriptor != null) {
				// check for special case of double get/is

				// getter with the same name already exist
				String methodName = methodDescriptor.getMethod().getName();
				String existingMethodName = existingMethodDescriptor.getMethod().getName();

				if (
						existingMethodName.startsWith(METHOD_IS_PREFIX) &&
						methodName.startsWith(METHOD_GET_PREFIX)) {

					// ignore getter when ister exist
					return;
				}
			}
		} else {
			// setter
			// use existing getter
			getterMethod = existing.getReadMethodDescriptor();

			if (getterMethod != null) {
				Class returnType = getterMethod.getMethod().getReturnType();

				if (setterMethod != null) {
					Class parameterType = setterMethod.getMethod().getParameterTypes()[0];

					if (returnType != parameterType) {
						// getter's type is different then setter's
						return;
					}

				}
			}
		}

		PropertyDescriptor propertyDescriptor = createPropertyDescriptor(name, getterMethod, setterMethod);

		map.put(name, propertyDescriptor);
	}
protected void addProperty ( final HashMap < String , PropertyDescriptor > map , final String name , final MethodDescriptor methodDescriptor , final boolean isSetter ) { MethodDescriptor setterMethod = isSetter ? methodDescriptor : null ; MethodDescriptor getterMethod = isSetter ? null : methodDescriptor ; PropertyDescriptor existing = map . get ( name ) ; if ( existing == null ) { // new property, just add it PropertyDescriptor propertyDescriptor = createPropertyDescriptor ( name , getterMethod , setterMethod ) ; map . put ( name , propertyDescriptor ) ; return ; } // property exist if ( ! isSetter ) { // use existing setter setterMethod = existing . getWriteMethodDescriptor ( ) ; // check existing MethodDescriptor existingMethodDescriptor = existing . getReadMethodDescriptor ( ) ; if ( existingMethodDescriptor != null ) { // check for special case of double get/is // getter with the same name already exist String methodName = methodDescriptor . getMethod ( ) . getName ( ) ; String existingMethodName = existingMethodDescriptor . getMethod ( ) . getName ( ) ; if ( existingMethodName . startsWith ( METHOD_IS_PREFIX ) && methodName . startsWith ( METHOD_GET_PREFIX ) ) { // ignore getter when ister exist return ; } } } else { // setter // use existing getter getterMethod = existing . getReadMethodDescriptor ( ) ; if ( getterMethod != null ) { Class returnType = getterMethod . getMethod ( ) . getReturnType ( ) ; if ( setterMethod != null ) { Class parameterType = setterMethod . getMethod ( ) . getParameterTypes ( ) [ 0 ] ; if ( returnType != parameterType ) { // getter's type is different then setter's return ; } } } } PropertyDescriptor propertyDescriptor = createPropertyDescriptor ( name , getterMethod , setterMethod ) ; map . put ( name , propertyDescriptor ) ; }
Adds a setter and/or getter method to the property.
If property is already defined, the new, updated, definition will be created.
Adds a setter and / or getter method to the property . If property is already defined the new updated definition will be created .