/** * Assert that an object is <code>null</code> . * <pre class="code">Assert.isNull(value);</pre> * @param object the object to check * @throws IllegalArgumentException if the object is not <code>null</code> */ public static void isNull(Object object) { isNull(object, "[Assertion failed] - the object argument must be null"); }
public Map<String, String> createUnmaterializedReference (String resourceName, Resource resource){ Assert.notNull(resource, "Resource argument cannot be null."); Assert.isNull(resource.getHref(), "Resource "+ resourceName +" must be unmaterialized and not have an 'href' property."); Map<String, String> reference = ResourceUtil.filterNonStringvaluesWithiResourceDirtyProperties(resource); return reference; } }
public Map<String, String> createUnmaterializedReference (String resourceName, Resource resource){ Assert.notNull(resource, "Resource argument cannot be null."); Assert.isNull(resource.getHref(), "Resource "+ resourceName +" must be unmaterialized and not have an 'href' property."); Map<String, String> reference = ResourceUtil.filterNonStringvaluesWithiResourceDirtyProperties(resource); return reference; } }
/** * This method is able to set a Reference to a resource (<code>value</code>) even though resource has not yet an href value * <p>Note that this is method is analogous to the {@link #setResourceProperty(ResourceReference, Resource)} method (in fact * it relies on it when the resource alredy has an href value) but this method does not complain when the href of the resource is missing.</p> * * @param property the property whose value is going to be set to <code>value</code> * @param value the value to be set to <code>property</code> * @since 1.1.0 */ protected <T extends Resource> void setMaterializableResourceProperty(ResourceReference<T> property, Resource value) { Assert.notNull(property, "Property argument cannot be null."); Assert.isNull(value.getHref(), "Resource must not have an 'href' property "); if (((AbstractResource) value).isMaterialized()) { setResourceProperty(property, value); } else { String name = property.getName(); Map<String, String> reference = this.referenceFactory.createUnmaterializedReference(name, value); setProperty(name, reference); } }
/** * This method is able to set a Reference to a resource (<code>value</code>) even though resource has not yet an href value * <p>Note that this is method is analogous to the {@link #setResourceProperty(ResourceReference, Resource)} method (in fact * it relies on it when the resource alredy has an href value) but this method does not complain when the href of the resource is missing.</p> * * @param property the property whose value is going to be set to <code>value</code> * @param value the value to be set to <code>property</code> * @since 1.1.0 */ protected <T extends Resource> void setMaterializableResourceProperty(ResourceReference<T> property, Resource value) { Assert.notNull(property, "Property argument cannot be null."); Assert.isNull(value.getHref(), "Resource must not have an 'href' property "); if (((AbstractResource) value).isMaterialized()) { setResourceProperty(property, value); } else { String name = property.getName(); Map<String, String> reference = this.referenceFactory.createUnmaterializedReference(name, value); setProperty(name, reference); } }