This method set the system property if the property is null or property value is not the same with the new value

@param propName
@param propValue
@return
2574
@SuppressWarnings({ "unchecked", "rawtypes" })
    public static String setPropertyAsNeeded(final String propName, final String propValue) {

        String previousPropValue = (String) java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {
            @Override
            public String run() {
                String oldPropValue = System.getProperty(propName);
                if (propValue == null) {
                    System.clearProperty(propName);
                } else if (!propValue.equalsIgnoreCase(oldPropValue)) {
                    System.setProperty(propName, propValue);
                }
                return oldPropValue;
            }
        });
        if (tc.isDebugEnabled())
            Tr.debug(tc, propName + " property previous: " + ((previousPropValue != null) ? previousPropValue : "<null>") + " and now: " + propValue);

        return previousPropValue;
    }
584929
public synchronized void setProperty(PropertyKey key, Object value)
    {
        if (!isValidKey(key))
            throw new IllegalArgumentException("Key " + key + " is not valid for " + getMapClass());

        //
        // Validate the value argument, based upon the property type reference by the key
        //
        Class propType = key.getPropertyType();
        if (value == null)
        {
            if (propType.isPrimitive() || propType.isAnnotation())
                throw new IllegalArgumentException("Invalid null value for key " + key);
        }
        else
        {
            if (propType.isPrimitive())
                propType = (Class)_primToObject.get(propType);

            if (!propType.isAssignableFrom(value.getClass()))
            {
                throw new IllegalArgumentException("Value class (" + value.getClass() + 
                                                   ") not of expected type: " + propType);
            }
        }
        _properties.put(key, value);
        _propertySets.add(key.getPropertySet());
    }
934492
private static void setConfigurationFromSystemProperty(Configuration configuration,
      String propertyName) {
    String propertyValue = System.getProperty(propertyName);
    if (propertyValue != null && configuration.get(propertyName) == null) {
      configuration.set(propertyName, propertyValue);
    }
  }
777022
@Override
    public void set(String propName, Object value) {
        if (propName.equals("checkPoint")) {
            getCheckPoint().add(((com.ibm.wsspi.security.wim.model.CheckPointType) value));
        }
        super.set(propName, value);
    }
1013118
public void setObjectProperty(String objectType, String propertyType, String propertyValue) {
        logger.debug("objectType: " + objectType);
        logger.debug("propType: " + propertyType);
        logger.debug("property: " + propertyValue);

        if (objectType == null) {
            logger.error("Cannot add property for null object");
            return;
        }
        if (propertyType == null) {
            logger.error("Cannot add property for null property type");
            return;
        }
        if (propertyValue == null) {
            logger.warn("Will not add null property");
            return;
        }

        if (objectType.equals("Molecule")) {
            if (propertyType.equals("id")) {
                currentMolecule.setID(propertyValue);
            } else if (propertyType.equals("inchi")) {
                currentMolecule.setProperty("iupac.nist.chemical.identifier", propertyValue);
            }
        } else if (objectType.equals("PseudoAtom")) {
            if (propertyType.equals("label")) {
                if (!(currentAtom instanceof IPseudoAtom)) {
                    currentAtom = builder.newInstance(IPseudoAtom.class, currentAtom);
                }
                ((IPseudoAtom) currentAtom).setLabel(propertyValue);
            }
        } else if (objectType.equals("Atom")) {
            if (propertyType.equals("type")) {
                if (propertyValue.equals("R") && !(currentAtom instanceof IPseudoAtom)) {
                    currentAtom = builder.newInstance(IPseudoAtom.class, currentAtom);
                }
                currentAtom.setSymbol(propertyValue);
            } else if (propertyType.equals("x2")) {
                Point2d coord = currentAtom.getPoint2d();
                if (coord == null) coord = new Point2d();
                coord.x = Double.parseDouble(propertyValue);
                currentAtom.setPoint2d(coord);
            } else if (propertyType.equals("y2")) {
                Point2d coord = currentAtom.getPoint2d();
                if (coord == null) coord = new Point2d();
                coord.y = Double.parseDouble(propertyValue);
                currentAtom.setPoint2d(coord);
            } else if (propertyType.equals("x3")) {
                Point3d coord = currentAtom.getPoint3d();
                if (coord == null) coord = new Point3d();
                coord.x = Double.parseDouble(propertyValue);
                currentAtom.setPoint3d(coord);
            } else if (propertyType.equals("y3")) {
                Point3d coord = currentAtom.getPoint3d();
                if (coord == null) coord = new Point3d();
                coord.y = Double.parseDouble(propertyValue);
                currentAtom.setPoint3d(coord);
            } else if (propertyType.equals("z3")) {
                Point3d coord = currentAtom.getPoint3d();
                if (coord == null) coord = new Point3d();
                coord.z = Double.parseDouble(propertyValue);
                currentAtom.setPoint3d(coord);
            } else if (propertyType.equals("xFract")) {
                Point3d coord = currentAtom.getFractionalPoint3d();
                if (coord == null) coord = new Point3d();
                coord.x = Double.parseDouble(propertyValue);
                currentAtom.setFractionalPoint3d(coord);
            } else if (propertyType.equals("yFract")) {
                Point3d coord = currentAtom.getFractionalPoint3d();
                if (coord == null) coord = new Point3d();
                coord.y = Double.parseDouble(propertyValue);
                currentAtom.setFractionalPoint3d(coord);
            } else if (propertyType.equals("zFract")) {
                Point3d coord = currentAtom.getFractionalPoint3d();
                if (coord == null) coord = new Point3d();
                coord.z = Double.parseDouble(propertyValue);
                currentAtom.setFractionalPoint3d(coord);
            } else if (propertyType.equals("formalCharge")) {
                currentAtom.setFormalCharge(Integer.parseInt(propertyValue));
            } else if (propertyType.equals("charge") || propertyType.equals("partialCharge")) {
                currentAtom.setCharge(Double.parseDouble(propertyValue));
            } else if (propertyType.equals("hydrogenCount")) {
                currentAtom.setImplicitHydrogenCount(Integer.parseInt(propertyValue));
            } else if (propertyType.equals("dictRef")) {
                currentAtom.setProperty("org.openscience.cdk.dict", propertyValue);
            } else if (propertyType.equals("atomicNumber")) {
                currentAtom.setAtomicNumber(Integer.parseInt(propertyValue));
            } else if (propertyType.equals("massNumber")) {
                currentAtom.setMassNumber((int) Double.parseDouble(propertyValue));
            } else if (propertyType.equals("id")) {
                logger.debug("id: ", propertyValue);
                currentAtom.setID(propertyValue);
                atomEnumeration.put(propertyValue, numberOfAtoms);
            }
        } else if (objectType.equals("Bond")) {
            if (propertyType.equals("atom1")) {
                bond_a1 = Integer.parseInt(propertyValue);
            } else if (propertyType.equals("atom2")) {
                bond_a2 = Integer.parseInt(propertyValue);
            } else if (propertyType.equals("id")) {
                logger.debug("id: " + propertyValue);
                bond_id = propertyValue;
            } else if (propertyType.equals("order")) {
                try {
                    Double order = Double.parseDouble(propertyValue);
                    if (order == 1.0) {
                        bond_order = IBond.Order.SINGLE;
                    } else if (order == 2.0) {
                        bond_order = IBond.Order.DOUBLE;
                    } else if (order == 3.0) {
                        bond_order = IBond.Order.TRIPLE;
                    } else if (order == 4.0) {
                        bond_order = IBond.Order.QUADRUPLE;
                    } else {
                        bond_order = IBond.Order.SINGLE;
                    }
                } catch (Exception e) {
                    logger.error("Cannot convert to double: " + propertyValue);
                    bond_order = IBond.Order.SINGLE;
                }
            } else if (propertyType.equals("stereo")) {
                if (propertyValue.equals("H")) {
                    bond_stereo = IBond.Stereo.DOWN;
                } else if (propertyValue.equals("W")) {
                    bond_stereo = IBond.Stereo.UP;
                }
            }
        }
        logger.debug("Object property set...");
    }
1217605
public void set(String propName, Object value) {
        if (propName.equals("roles")) {
            getRoles().add(((String) value));
        }
        if (propName.equals("entitlements")) {
            getEntitlements().add(((com.ibm.wsspi.security.wim.model.EntitlementType) value));
        }
        if (propName.equals("entitlementCheckResult")) {
            setEntitlementCheckResult(((Boolean) value));
        }
    }
653674
public static String getProperty(final String propName) {
        try {
            return System.getProperty(propName);
        } catch (final SecurityException e) {
            return null;
        }
    }
732337
public String getProperty(String propName, String defaultValue) {
        return props.getProperty(propName, defaultValue);
    }
449480
public Object get(String propName) {
        if (propName.equals("key")) {
            return getKey();
        }
        if (propName.equals("value")) {
            return getValue();
        }
        return null;
    }
504894
@Override
  public void setSystemProperty(String propertyName, String value) {
    if (Strings.isNullOrEmpty(propertyName)) {
      throw new IllegalArgumentException("Property name can't be empty.");
    }

    execute(
        "-selendroid-setAndroidOsSystemProperty",
        ImmutableMap.of(
            "propertyName", propertyName,
            "value", value));
  }
883963
public void set(String propName, Object value) {
        if (propName.equals(PROP_IDENTIFIER)) {
            setIdentifier(((IdentifierType) value));
        }
        if (propName.equals(PROP_VIEW_IDENTIFIERS)) {
            getViewIdentifiers().add(((com.ibm.wsspi.security.wim.model.ViewIdentifierType) value));
        }
        if (propName.equals(PROP_PARENT)) {
            setParent(((Entity) value));
        }
        if (propName.equals(PROP_CHILDREN)) {
            getChildren().add(((com.ibm.wsspi.security.wim.model.Entity) value));
        }
        if (propName.equals(PROP_GROUPS)) {
            getGroups().add(((com.ibm.wsspi.security.wim.model.Group) value));
        }
        if (propName.equals(PROP_CREATE_TIMESTAMP)) {
            setCreateTimestamp(((Date) value));
        }
        if (propName.equals(PROP_MODIFY_TIMESTAMP)) {
            setModifyTimestamp(((Date) value));
        }
        if (propName.equals(PROP_ENTITLEMENT_INFO)) {
            setEntitlementInfo(((EntitlementInfoType) value));
        }
        if (propName.equals(PROP_CHANGE_TYPE)) {
            setChangeType(((String) value));
        }
    }
583726
public void set(String propName, Object value) {
        if (propName.equals("method")) {
            setMethod(((String) value));
        }
        if (propName.equals("object")) {
            setObject(((String) value));
        }
        if (propName.equals("attribute")) {
            setAttribute(((String) value));
        }
    }
944468
public void set(String propName, Object value) {
        if (propName.equals("nickName")) {
            setNickName(((String) value));
        }
        if (propName.equals("street")) {
            getStreet().add(((String) value));
        }
        if (propName.equals("city")) {
            setCity(((String) value));
        }
        if (propName.equals("stateOrProvinceName")) {
            setStateOrProvinceName(((String) value));
        }
        if (propName.equals("postalCode")) {
            setPostalCode(((String) value));
        }
        if (propName.equals("countryName")) {
            setCountryName(((String) value));
        }
    }
191409
public String getConfigProperty(String propertyName, String defaultValue) {
        return getConfig().getString(propertyName, defaultValue);
    }
430445
private void setActiveProjectProperty(final String propertyName, final String propertyValue) {
        final Project activeProject = getProject();
        if (activeProject != null) {
            activeProject.setProperty(propertyName, propertyValue);
        }
    }
1172616
public static <T> T getProperty(Object obj, String propName) {
        return getFieldValue(obj, propName);
    }
1307208
public void setProperty(final String propertyName, final List<String> values) {
        Preconditions.checkNotNull(propertyName);
        if (values == null) {
            properties.put(propertyName, null);
            return;
        }
        properties.put(propertyName, values);
    }