org.glassfish.jersey.server.internal.LocalizationMessages Java Examples

The following examples show how to use org.glassfish.jersey.server.internal.LocalizationMessages. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClassInfo.java    From ameba with MIT License 6 votes vote down vote up
/**
 * <p>getClassForName.</p>
 *
 * @param className a {@link java.lang.String} object.
 * @return a {@link java.lang.Class} object.
 */
public Class getClassForName(final String className) {
    try {
        final OsgiRegistry osgiRegistry = ReflectionHelper.getOsgiRegistryInstance();

        if (osgiRegistry != null) {
            return osgiRegistry.classForNameWithException(className);
        } else {
            return AccessController.doPrivileged(ReflectionHelper.classForNameWithExceptionPEA(className));
        }
    } catch (final ClassNotFoundException ex) {
        throw new RuntimeException(LocalizationMessages.ERROR_SCANNING_CLASS_NOT_FOUND(className), ex);
    } catch (final PrivilegedActionException pae) {
        final Throwable cause = pae.getCause();
        if (cause instanceof ClassNotFoundException) {
            throw new RuntimeException(LocalizationMessages.ERROR_SCANNING_CLASS_NOT_FOUND(className), cause);
        } else if (cause instanceof RuntimeException) {
            throw (RuntimeException) cause;
        } else {
            throw new RuntimeException(cause);
        }
    }
}
 
Example #2
Source File: RxInvocationHandler.java    From rx-jersey with MIT License 5 votes vote down vote up
/**
 * Uses {@link AsyncContext} to suspend current request
 *
 * @return obtained {@link AsyncContext} or throws error
 */
protected AsyncContext suspend() {
    final AsyncContext asyncContext = asyncContextProvider.get();

    if (!asyncContext.suspend()) {
        throw new ProcessingException(LocalizationMessages.ERROR_SUSPENDING_ASYNC_REQUEST());
    }

    return asyncContext;
}
 
Example #3
Source File: ParamConverters.java    From ameba with MIT License 5 votes vote down vote up
@Override
public Duration fromString(String value) {
    if (value == null) {
        throw new IllegalArgumentException(
                LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")
        );
    }
    return Duration.parse(value);
}
 
Example #4
Source File: ParamConverters.java    From ameba with MIT License 5 votes vote down vote up
@Override
public String toString(Duration value) {
    if (value == null) {
        throw new IllegalArgumentException(
                LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")
        );
    }
    return value.toString();
}
 
Example #5
Source File: ParamConverters.java    From ameba with MIT License 5 votes vote down vote up
@Override
public Period fromString(String value) {
    if (value == null) {
        throw new IllegalArgumentException(
                LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")
        );
    }
    return Period.parse(value);
}
 
Example #6
Source File: ParamConverters.java    From ameba with MIT License 5 votes vote down vote up
@Override
public String toString(Period value) {
    if (value == null) {
        throw new IllegalArgumentException(
                LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")
        );
    }
    return value.toString();
}
 
Example #7
Source File: ParamConverters.java    From ameba with MIT License 5 votes vote down vote up
@Override
public Instant fromString(String value) {
    if (value == null) {
        throw new IllegalArgumentException(
                LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")
        );
    }
    return parseInstant(value);
}
 
Example #8
Source File: ParamConverters.java    From ameba with MIT License 5 votes vote down vote up
@Override
public String toString(Instant value) {
    if (value == null) {
        throw new IllegalArgumentException(
                LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")
        );
    }
    return value.toString();
}
 
Example #9
Source File: ParamConverters.java    From ameba with MIT License 5 votes vote down vote up
@Override
public LocalDate fromString(String value) {
    if (value == null) {
        throw new IllegalArgumentException(
                LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")
        );
    }

    return LocalDate.from(parseInstant(value));
}
 
Example #10
Source File: ParamConverters.java    From ameba with MIT License 5 votes vote down vote up
@Override
public String toString(LocalDate value) {
    if (value == null) {
        throw new IllegalArgumentException(
                LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")
        );
    }
    return value.toString();
}
 
Example #11
Source File: ParamConverters.java    From ameba with MIT License 5 votes vote down vote up
@Override
public LocalDateTime fromString(String value) {
    if (value == null) {
        throw new IllegalArgumentException(
                LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")
        );
    }
    return LocalDateTime.from(parseInstant(value));
}
 
Example #12
Source File: ParamConverters.java    From ameba with MIT License 5 votes vote down vote up
@Override
public String toString(LocalDateTime value) {
    if (value == null) {
        throw new IllegalArgumentException(
                LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")
        );
    }
    return value.toString();
}
 
Example #13
Source File: ParamConverters.java    From ameba with MIT License 5 votes vote down vote up
@Override
public LocalTime fromString(String value) {
    if (value == null) {
        throw new IllegalArgumentException(
                LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")
        );
    }
    return LocalTime.from(parseInstant(value));
}
 
Example #14
Source File: ParamConverters.java    From ameba with MIT License 5 votes vote down vote up
@Override
public String toString(LocalTime value) {
    if (value == null) {
        throw new IllegalArgumentException(
                LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")
        );
    }
    return value.toString();
}