org.gnome.soup.MessageFlags Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of soup Show documentation
Show all versions of soup Show documentation
Java language bindings for Soup, generated with Java-GI
The newest version!
// Java-GI - Java language bindings for GObject-Introspection-based libraries
// Copyright (C) 2022-2024 Jan-Willem Harmannij
//
// SPDX-License-Identifier: LGPL-2.1-or-later
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see .
//
// This file has been generated with Java-GI.
// Do not edit this file directly!
// Visit for more information.
//
package org.gnome.soup;
import io.github.jwharm.javagi.base.Enumeration;
import io.github.jwharm.javagi.interop.Interop;
import java.lang.IllegalStateException;
import java.lang.Override;
import javax.annotation.processing.Generated;
import org.gnome.glib.Type;
/**
* Various flags that can be set on a {@code SoupMessage} to alter its
* behavior.
*/
@Generated("io.github.jwharm.JavaGI")
public enum MessageFlags implements Enumeration {
/**
* The session should not follow redirect
* (3xx) responses received by this message.
*/
NO_REDIRECT(2),
/**
* Requests that the message should be
* sent on a newly-created connection, not reusing an existing
* persistent connection. Note that messages with non-idempotent
* {@code Message:method}s behave this way by default, unless
* {@code SOUP_MESSAGE_IDEMPOTENT} is set.
*/
NEW_CONNECTION(4),
/**
* The message is considered idempotent,
* regardless its {@code Message:method}, and allows reuse of existing
* idle connections, instead of always requiring a new one, unless
* {@code SOUP_MESSAGE_NEW_CONNECTION} is set.
*/
IDEMPOTENT(8),
/**
* The {@link AuthManager} should not use
* the credentials cache for this message, neither to use cached credentials
* to automatically authenticate this message nor to cache the credentials
* after the message is successfully authenticated. This applies to both server
* and proxy authentication. Note that {@code Message::authenticate} signal will
* be emitted, if you want to disable authentication for a message use
* {@link Message#disableFeature} passing {@code SOUP_TYPE_AUTH_MANAGER} instead.
*/
DO_NOT_USE_AUTH_CACHE(16),
/**
* Metrics will be collected for this message.
*/
COLLECT_METRICS(32);
static {
Soup.javagi$ensureInitialized();
}
private final int value;
/**
* Create a new MessageFlags for the provided value
*
* @param value the bitfield value
*/
private MessageFlags(int value) {
this.value = value;
}
/**
* Create a new MessageFlags for the provided value
*
* @param value the bitfield value
* @return the bitfield for the provided value
*/
public static MessageFlags of(int value) {
return switch(value) {
case 2 -> NO_REDIRECT;
case 4 -> NEW_CONNECTION;
case 8 -> IDEMPOTENT;
case 16 -> DO_NOT_USE_AUTH_CACHE;
case 32 -> COLLECT_METRICS;
default -> throw new IllegalStateException("Unexpected value: " + value);
} ;
}
/**
* Get the numeric value of this enum
*
* @return the enum value
*/
@Override
public int getValue() {
return value;
}
/**
* Get the GType of the MessageFlags class
*
* @return the GType
*/
public static Type getType() {
return Interop.getType("soup_message_flags_get_type");
}
}