Source:
public BootstrapWriteRequest(final LwM2mPath target, final LwM2mNode node, ContentFormat format) { super(target); Validate.notNull(node); if (getPath().isResource()) { if (!(node instanceof LwM2mResource)) { throw new IllegalArgumentException(String.format("path '%s' and node type '%s' does not match", target.toString(), node.getClass().getSimpleName())); } } else if (getPath().isObjectInstance()) { if (!(node instanceof LwM2mObjectInstance)) { throw new IllegalArgumentException(String.format("path '%s' and node type '%s' does not match", target.toString(), node.getClass().getSimpleName())); } } else if (getPath().isObject()) { if (!(node instanceof LwM2mObject)) { throw new IllegalArgumentException(String.format("path '%s' and node type '%s' does not match", target.toString(), node.getClass().getSimpleName())); } } if (ContentFormat.TEXT == format || ContentFormat.OPAQUE == format) { if (!getPath().isResource()) { throw new IllegalArgumentException( String.format("%s format must be used only for single resources", format.toString())); } else { LwM2mResource resource = (LwM2mResource) node; if (resource.isMultiInstances()) { throw new IllegalArgumentException( String.format("%s format must be used only for single resources", format.toString())); } else { if (resource.getType() == Type.OPAQUE && format == ContentFormat.TEXT) { throw new IllegalArgumentException(String.format( "TEXT format must not be used for byte array single resources", format.toString())); } else if (resource.getType() != Type.OPAQUE && format == ContentFormat.OPAQUE) { throw new IllegalArgumentException(String.format( "OPAQUE format must be used only for byte array single resources", format.toString())); } } } } this.node = node; if (format == null) { this.contentFormat = ContentFormat.TLV; } else { this.contentFormat = format; } }

Target:
public BootstrapWriteRequest(final LwM2mPath target, final LwM2mNode node, ContentFormat format) { super(target); Validate.notNull(node); if (getPath().isResource()) { if (!(node instanceof LwM2mResource)) { throw new IllegalArgumentException(String.format("path '%s' and node type '%s' does not match", target.toString(), node.getClass().getSimpleName())); } } else if (getPath().isObjectInstance()) { if (!(node instanceof LwM2mObjectInstance)) { throw new IllegalArgumentException(String.format("path '%s' and node type '%s' does not match", target.toString(), node.getClass().getSimpleName())); } } else if (getPath().isObject()) { if (!(node instanceof LwM2mObject)) { throw new IllegalArgumentException(String.format("path '%s' and node type '%s' does not match", target.toString(), node.getClass().getSimpleName())); } } if (ContentFormat.TEXT == format || ContentFormat.OPAQUE == format) { if (!getPath().isResource()) { throw new IllegalArgumentException( String.format("%s format must be used only for single resources", format.toString())); } else { LwM2mResource resource = (LwM2mResource) node; if (resource.isMultiInstances()) { throw new IllegalArgumentException( String.format("%s format must be used only for single resources", format.toString())); } else { if (resource.getType() == Type.OPAQUE && format == ContentFormat.TEXT) { throw new IllegalArgumentException( "TEXT format must not be used for byte array single resources"); } else if (resource.getType() != Type.OPAQUE && format == ContentFormat.OPAQUE) { throw new IllegalArgumentException( "OPAQUE format must be used only for byte array single resources"); } } } } this.node = node; if (format == null) { this.contentFormat = ContentFormat.TLV; } else { this.contentFormat = format; } }