/** * Returns a {@link SafeUri} constructed from a trusted string, i.e., without * sanitizing the string. No checks are performed. The calling code should be * carefully reviewed to ensure the argument meets the SafeUri contract. * * @param s the input String * @return a SafeUri instance */ @SuppressIsSafeUriCastCheck public static SafeUri fromTrustedString(String s) { SafeUriHostedModeUtils.maybeCheckValidUri(s); return new SafeUriString(s); }
/** * Returns a {@link SafeUri} constructed from a value that is fully under * the control of the program, e.g., a constant. * * <p> * The string is not sanitized and no checks are performed. The assumption * that the resulting value adheres to the {@link SafeUri} type contract * is entirely based on the argument being fully under program control and * not being derived from a program input. * * <p> * <strong>Convention of use:</strong> This method must only be invoked on * values that are fully under the program's control, such as string literals. * * @param s the input String * @return a SafeUri instance */ @SuppressIsSafeUriCastCheck public static SafeUri fromSafeConstant(String s) { SafeUriHostedModeUtils.maybeCheckValidUri(s); return new SafeUriString(s); }
/** * Returns a {@link SafeUri} constructed from a trusted string, i.e., without * sanitizing the string. No checks are performed. The calling code should be * carefully reviewed to ensure the argument meets the SafeUri contract. * * @param s the input String * @return a SafeUri instance */ public static SafeUri fromTrustedString(String s) { SafeUriHostedModeUtils.maybeCheckValidUri(s); return new SafeUriString(s); }
/** * Returns a {@link SafeUri} constructed from a trusted string, i.e., without * sanitizing the string. No checks are performed. The calling code should be * carefully reviewed to ensure the argument meets the SafeUri contract. * * @param s the input String * @return a SafeUri instance */ public static SafeUri fromTrustedString(String s) { SafeUriHostedModeUtils.maybeCheckValidUri(s); return new SafeUriString(s); }
/** * Returns a {@link SafeUri} constructed from a value that is fully under * the control of the program, e.g., a constant. * * <p> * The string is not sanitized and no checks are performed. The assumption * that the resulting value adheres to the {@link SafeUri} type contract * is entirely based on the argument being fully under program control and * not being derived from a program input. * * <p> * <strong>Convention of use:</strong> This method must only be invoked on * values that are fully under the program's control, such as string literals. * * @param s the input String * @return a SafeUri instance */ public static SafeUri fromSafeConstant(String s) { SafeUriHostedModeUtils.maybeCheckValidUri(s); return new SafeUriString(s); }
/** * Returns a {@link SafeUri} constructed from a value that is fully under * the control of the program, e.g., a constant. * * <p> * The string is not sanitized and no checks are performed. The assumption * that the resulting value adheres to the {@link SafeUri} type contract * is entirely based on the argument being fully under program control and * not being derived from a program input. * * <p> * <strong>Convention of use:</strong> This method must only be invoked on * values that are fully under the program's control, such as string literals. * * @param s the input String * @return a SafeUri instance */ public static SafeUri fromSafeConstant(String s) { SafeUriHostedModeUtils.maybeCheckValidUri(s); return new SafeUriString(s); }