<p>Throw <code>IllegalArgumentException</code> if the specified
component identifier is non-<code>null</code> and not
syntactically valid.  </p>

@param id The component identifier to test
329616
private static void validateId(String id) {

        if (id == null) {
            return;
        }
        int n = id.length();
        if (n < 1) {
            throw new IllegalArgumentException("Empty id attribute is not allowed");
        }
        for (int i = 0; i < n; i++) {
            char c = id.charAt(i);
            if (i == 0) {
                if (!Character.isLetter(c) && (c != '_')) {
                    throw new IllegalArgumentException(id);
                }
            } else {
                if (!Character.isLetter(c) &&
                        !Character.isDigit(c) &&
                        (c != '-') && (c != '_')) {
                    throw new IllegalArgumentException(id);
                }
            }
        }

    }
489993
@SuppressWarnings("unchecked")
    public <T extends XPathBuilder> T setId(final String id) {
        this.id = id;
        return (T) this;
    }
880730
protected void assertArgumentNotNull(String argumentName, Object value) {
        if (argumentName == null) {
            String msg = "The argument name should not be null: argName=null value=" + value;
            throw new IllegalArgumentException(msg);
        }
        if (value == null) {
            String msg = "The value should not be null: argName=" + argumentName;
            throw new IllegalArgumentException(msg);
        }
    }
387626
public E getById(String id) {
        if (id == null) {
            for (E element : this) {
                if (element != null && element.getId() == null) {
                    return element;
                }
            }
        } else {
            for (E element : this) {
                if (element != null && id.equals(element.getId())) {
                    return element;
                }
            }
        }
        return null;
    }
1358935
public void addClassToId(final Class<?> clazz, final String id) {
        Assert.notNull(clazz, "Class cannot be null");
        Assert.hasText(id, "Alias (id) cannot be null or contain only whitespaces");

        if (classToId.containsKey(clazz)) {
            throw new IllegalArgumentException("Class " + clazz + " has already defined alias (id) " + classToId.get(clazz)
                    + " cannot set another alias " + id);
        }

        if (idToClass.containsKey(id)) {
            throw new IllegalArgumentException("Alias (id) " + id + " is used by another class " + idToClass.get(id)
                    + " and cannot be used by " + clazz);
        }

        classToId.put(clazz, id);
        idToClass.put(id, clazz);
    }
1236948
@Override
	public String isValidID(String id) {
		Data data;
		try {
			data = identities.find(id, identities.reuse());
		} catch (IOException e) {
			return getName() + " could not lookup " + id + ": " + e.getLocalizedMessage();
		}
		return data==null?id + "is not an Identity in " + getName():null;
	}
707371
protected String exceptionMessage(String id, String messageTemplate, Object... parameters) {
    String formattedTemplate = formatMessageTemplate(id, messageTemplate);
    if(parameters == null || parameters.length == 0) {
      return formattedTemplate;

    } else {
      return MessageFormatter.arrayFormat(formattedTemplate, parameters).getMessage();

    }
  }
584547
public static void validateNull( Object object, String identifier )
        throws PostConditionException
    {
        if( object == null )
        {
            return;
        }
        throw new PostConditionException( identifier + " was NOT NULL." );
    }
215017
public ErrorEventDefinitionBuilder errorEventDefinition(String id) {
    ErrorEventDefinition errorEventDefinition = createEmptyErrorEventDefinition();
    if (id != null) {
      errorEventDefinition.setId(id);
    }

    element.getEventDefinitions().add(errorEventDefinition);
    return new ErrorEventDefinitionBuilder(modelInstance, errorEventDefinition);
  }
1243648
protected T _jdoLoad(
                    final K id
                    )
    {
        if (id == null) {
            return null;
        }

        Object  p_object = null;
        try {
            p_object = getCastorTemplate().load( _objectType, id );
        } catch (DataAccessException ex) {
            Throwable  cause = ex.getMostSpecificCause();
            if (ObjectNotFoundException.class.isInstance( cause )) {
                p_object = null;
            } else {
                throw new PersistenceException( cause );
            }
        }


        T  typedObject = _objectType.cast( p_object );
//        _afterLoad( typedObject );

        return typedObject;
    }
1068658
@Override
    public void setID(String id) {
        _ID = id;
        if (_store != null) {
            _store.setID(id);
        }
    }
822140
public boolean tryGetIdFromInstance(Object entity, Reference<String> idHolder) {
        if (entity == null) {
            throw new IllegalArgumentException("Entity cannot be null");
        }
        try {
            Field identityProperty = getIdentityProperty(entity.getClass());
            if (identityProperty != null) {
                Object value = FieldUtils.readField(identityProperty, entity, true);
                if (value instanceof String) {
                    idHolder.value = (String)value;
                    return true;
                }
            }
            idHolder.value = null;
            return false;
        } catch (IllegalAccessException e) {
            throw new IllegalStateException(e);
        }
    }
903532
public static boolean isValidRandomIdentifier( String identifier ) {
        if (identifier.length() == UUID_LENGTH) {
            // It's the right length, but see if it's a UUID ...
            try {
                UUID.fromString(identifier);
                return true;
            } catch (IllegalArgumentException e) {
                // Nope
                return false;
            }
        }
        return false;
    }
583741
protected void setId(String id) {
		if (!StringUtils.hasText(id)) {
			id = null;
		}
		this.id = id;
	}
1144165
public final void setId(final ID id) {
    Assert.notNull(id, "The identifier for Rule ({0}) cannot be null!", getClass().getName());
    this.id = id;
  }
907578
public static void validateNotNull( Object object, String identifier )
        throws PostConditionException
    {
        if( object == null )
        {
            throw new PostConditionException( identifier + " was NULL." );
        }
    }
615139
public static void assertPropertyIdentifiers( Collection<String> properties) throws IllegalArgumentException
    {
    if( properties != null)
      {
      for( String property : properties)
        {
        assertIdentifier( property);
        }
      }
    }