Class Util


  • @Deprecated
    public class Util
    extends java.lang.Object
    Deprecated.
    Will be removed in next minor release.
    This class contains utility methods.
    • Constructor Summary

      Constructors 
      Constructor Description
      Util()
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void append​(java.lang.Appendable stb, java.lang.CharSequence string, boolean convertBraces)
      Deprecated.
      appends the given String to the StringBuilder.
      static void append​(java.lang.Appendable stb, java.lang.CharSequence string, boolean convertBraces, int startIndex)
      Deprecated.
      appends the given String to the StringBuilder.
      static void append​(java.lang.Appendable stb, java.lang.CharSequence string, boolean convertBraces, int startIndex, int endIndex)
      Deprecated.
      appends the given String to the StringBuilder.
      static void append​(java.lang.StringBuilder stb, java.lang.Object[] array)
      Deprecated.
      appends the array elements to the StringBuilder, separated by ", ".
      private static boolean checkClassAndInterfacesForAnnotation​(java.lang.Class<?> jaxRsClass, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
      Deprecated.
      Indicates if the given class (and its implemented interfaces) are annotated with the given annotation.
      static void checkClassConcrete​(java.lang.Class<?> jaxRsClass, java.lang.String typeName)
      Deprecated.
      Checks, if the class is concrete.
      static void copyResponseHeaders​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> jaxRsHeaders, Response restletResponse)
      Deprecated.
      Copies headers into a response.
      static Series<Header> copyResponseHeaders​(Response restletResponse)
      Deprecated.
      Copies the headers of the given Response into the given Series.
      static <A> java.util.Collection<A> createColl​(A... objects)
      Deprecated.
      Creates an modifiable Collection with the given Objects in it, and no other objects.
      static <A> java.util.List<A> createList​(A... objects)
      Deprecated.
      Creates an modifiable List with the given Object in it, and no other objects.
      static java.util.Map<java.lang.String,​java.lang.String> createMap​(java.lang.String... keysAndValues)
      Deprecated.
      Creates a map with the given keys and values.
      static <A> java.util.Set<A> createSet​(A... objects)
      Deprecated.
      Creates an modifiable Set with the given Object in it, and no other objects.
      static boolean doesImplement​(java.lang.Class<?> clazz, java.lang.Class<?> interfaze)
      Deprecated.
      Checks, if the given class implements the given interface.
      static boolean endsWith​(java.lang.CharSequence charSequence, char character)
      Deprecated.
      Checks, if the given CharSequence ends with the given character.
      static boolean equals​(java.lang.Object object1, java.lang.Object object2)
      Deprecated.
      Check if the given objects are equal.
      static java.lang.String formatDate​(java.util.Date date, boolean cookie)
      Deprecated.
      Converts the given Date into a String.
      static java.lang.String formatDimensions​(java.util.Set<Dimension> dimensions)
      Deprecated.
      Formats the given Set of Dimensions to a String for the HTTP Vary header.
      private static java.lang.Class<?> getArrayClass​(java.lang.reflect.Type genCompType, java.lang.reflect.Type forMessage)
      Deprecated.
       
      static java.lang.String getCharsetName​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> httpHeaders, CharacterSet defaultCs)
      Deprecated.
      Returns the character set as String of the given http headers (e.g.
      static <A> A getFirstElement​(java.lang.Iterable<A> coll)
      Deprecated.
      Returns the first element of the given Iterable.
      static <A> A getFirstElement​(java.util.Collection<A> coll)
      Deprecated.
      Returns the first element of the given collection.
      static <A> A getFirstElement​(java.util.List<A> list)
      Deprecated.
      Returns the first element of the List.
      static <A> A getFirstElementOrNull​(java.lang.Iterable<A> coll)
      Deprecated.
      Returns the first element of the given Iterable.
      static <K,​V>
      java.util.Map.Entry<K,​V>
      getFirstEntry​(java.util.Map<K,​V> map)
      Deprecated.
      Returns the first entry of the given Map.
      static <K,​V>
      K
      getFirstKey​(java.util.Map<K,​V> map)
      Deprecated.
      Returns the key of the first entry of the given Map.
      static <K,​V>
      V
      getFirstValue​(java.util.Map<K,​V> map)
      Deprecated.
      Returns the value of the first entry of the given Map.
      static java.lang.Class<?> getGenericClass​(java.lang.Class<?> clazz, java.lang.Class<?> implInterface)
      Deprecated.
       
      private static java.lang.Class<?> getGenericClass​(java.lang.Class<?> clazz, java.lang.Class<?> implInterface, java.lang.reflect.Type[] gsatp)
      Deprecated.
       
      static java.lang.Class<?> getGenericClass​(java.lang.reflect.Type genericType)
      Deprecated.
      Example: in List<String> -> out: String.class
      static Series<Header> getHttpHeaders​(Request request)
      Deprecated.
      Returns the HTTP headers of the Restlet Request as Series .
      static Series<Header> getHttpHeaders​(Response response)
      Deprecated.
      Returns the HTTP headers of the Restlet Response as Series.
      static javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getJaxRsHttpHeaders​(Request request)
      Deprecated.
      Returns the request headers as MultivaluedMap.
      static <A> A getLastElement​(java.lang.Iterable<A> iterable)
      Deprecated.
      Returns the last element of the given Iterable.
      static <A> A getLastElement​(java.util.Iterator<A> iter)
      Deprecated.
      Returns the last element of the given Iterator.
      static <A> A getLastElement​(java.util.List<A> list)
      Deprecated.
      Returns the last element of the given List.
      static <A> A getLastElementOrNull​(java.lang.Iterable<A> iterable)
      Deprecated.
      Returns the last element of the given Iterable, or null, if the iterable is empty.
      static <A> A getLastElementOrNull​(java.util.Iterator<A> iter)
      Deprecated.
      Returns the last element of the given Iterator, or null, if the iterator is empty.
      static MediaType getMediaType​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> httpHeaders)
      Deprecated.
      Returns the Restlet MediaType of the given http headers (e.g.
      static java.util.Collection<java.lang.reflect.Method> getMethodsByName​(java.lang.Class<?> clazz, java.lang.String methodName)
      Deprecated.
      Returns all public Methods of the class with the given name (case-sensitive)
      static <A> A getOnlyElement​(java.util.Collection<A> list)
      Deprecated.
      Returns the only element of the list, or null, if the List is null or empty.
      static java.lang.String getOnlyMetadataName​(java.util.List<? extends Metadata> metadatas)
      Deprecated.
      Returns the Name of the only element of the list of the given Metadata.
      static javax.ws.rs.Path getPathAnnotation​(java.lang.Class<?> jaxRsClass)
      Deprecated.
      Returns the @Path annotation of the given root resource class.
      static javax.ws.rs.Path getPathAnnotation​(java.lang.reflect.Method method)
      Deprecated.
      Returns the @Path annotation of the given sub resource locator.
      static javax.ws.rs.Path getPathAnnotationOrNull​(java.lang.reflect.Method method)
      Deprecated.
      Returns the @Path annotation of the given sub resource locator.
      static java.lang.String getPathTemplateWithoutRegExps​(java.lang.Class<?> resource)
      Deprecated.
      Returns the perhaps decoded template of the path annotation.
      static java.lang.String getPathTemplateWithoutRegExps​(java.lang.reflect.Method method)
      Deprecated.
      Returns the path template of the given sub resource locator or sub resource method.
      static java.lang.String getPathTemplateWithoutRegExps​(java.lang.String pathTemplate, javax.ws.rs.Path pathForExcMess)
      Deprecated.
       
      static java.lang.String getPathTemplateWithoutRegExps​(javax.ws.rs.Path path)
      Deprecated.
      Returns the path from the annotation.
      static CharacterSet getSupportedCharSet​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> httpResponseHeaders)
      Deprecated.
      Returns the character set of the http response headers.
      static CharacterSet getSupportedCharSet​(CharacterSet characterSet)
      Deprecated.
      Returns the given character set, if it is supported on this system.
      static int indexBeginMatrixOfLastSegment​(java.lang.CharSequence path)
      Deprecated.
      Returns the index of the first ";" in the last path segment.
      static int indexOfBetween​(java.lang.CharSequence charSequence, char c, int beginIndex, int endIndex)
      Deprecated.
      Returns the index of the first occurrence of the given character between the given indexes.
      static void inject​(java.lang.Object resource, java.lang.reflect.AccessibleObject fieldOrBeanSetter, java.lang.Object toInject)
      Deprecated.
      Injects the given toInject in the resource field or the given bean setter.
      static void inject​(java.lang.Object resource, java.lang.reflect.Field field, java.lang.Object toInject)
      Deprecated.
      Inject the given toInject into the given field in the given resource (or whatever)
      static void inject​(java.lang.Object resource, java.lang.reflect.Method beanSetter, java.lang.Object toInject)
      Deprecated.
      Injects the given toInject in the resource with the given bean setter.
      static void invokeMethod​(java.lang.Object object, java.lang.reflect.Method javaMethod, java.lang.Object... args)
      Deprecated.
      Invokes the given method without parameters.
      static boolean isEmpty​(java.lang.Object[] array)
      Deprecated.
      Tests, if the given array is empty or null.
      static boolean isEmpty​(java.util.List<?> list)
      Deprecated.
      Checks, if the list is empty or null.
      static boolean isEmptyOrSlash​(java.lang.String string)
      Deprecated.
      Tests, if the given String is null, empty or "/".
      static boolean isNotEmpty​(java.util.List<?> list)
      Deprecated.
      Checks, if the list contains elements.
      static boolean isProvider​(java.lang.Class<?> jaxRsClass)
      Deprecated.
      Checks, if the given class is a JAX-RS provider.
      static boolean isRootResourceClass​(java.lang.Class<?> jaxRsClass)
      Deprecated.
      Checks, if the given class is a JAX-RS root resource class.
      private static CharacterSet logUnsupportedCharSet​(java.lang.String charsetName)
      Deprecated.
      Logs a message that the wished character set is not supported and UTF-8 is used.
      static boolean notEndsWith​(java.lang.CharSequence charSequence, char character)
      Deprecated.
      Checks, if the given CharSequence ends with the given character.
      static boolean notStartsWith​(java.lang.CharSequence charSequence, char character)
      Deprecated.
      Checks, if the given CharSequence starts with the given character.
      private static int processTemplVarname​(java.lang.String pathTemplate, int braceIndex, java.lang.StringBuilder stb, javax.ws.rs.Path pathForExcMess)
      Deprecated.
       
      static java.util.List<MediaType> sortByConcreteness​(java.util.Collection<MediaType> mediaTypes)
      Deprecated.
      Returns a new List, which contains all MediaTypes of the given List, sorted by it's concreteness, the concrete MediaType at the beginning.
      static int specificness​(MediaType mediaType)
      Deprecated.
      Returns the specificness of the given MediaType: 1 for any concrete type (contains no star) 0 for the types (anything/*) -1 for '*/*
      static boolean startsWith​(java.lang.CharSequence charSequence, char character)
      Deprecated.
      Checks, if the given CharSequence starts with the given character.
      static java.lang.Object[] toArray​(java.util.Collection<?> coll, java.lang.Class<?> arrayType)
      Deprecated.
      Creates an Array of the given type.
      static java.lang.String toString​(java.util.Collection<?> collection, java.lang.String delimiter)
      Deprecated.
      Concatenate the members of the Set to a String, separated with the given delimiter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • JAX_RS_DEFAULT_CHARACTER_SET

        public static final CharacterSet JAX_RS_DEFAULT_CHARACTER_SET
        Deprecated.
        The default character set to be used, if no character set is given.
      • JAX_RS_DEFAULT_CHARACTER_SET_AS_STRING

        public static final java.lang.String JAX_RS_DEFAULT_CHARACTER_SET_AS_STRING
        Deprecated.
        The default character set to be used, if no character set is given, as String
        See Also:
        JAX_RS_DEFAULT_CHARACTER_SET
      • MEDIA_TYPE_COMP

        public static final java.util.Comparator<MediaType> MEDIA_TYPE_COMP
        Deprecated.
        This comparator sorts the concrete MediaTypes to the beginning and the unconcrete to the end. The last is '*/*'
      • ORG_RESTLET_EXT_JAXRS_HTTP_HEADERS

        public static final java.lang.String ORG_RESTLET_EXT_JAXRS_HTTP_HEADERS
        Deprecated.
        The name of the header MultivaluedMap<String, String> in the attribute map.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Util

        public Util()
        Deprecated.
    • Method Detail

      • append

        public static void append​(java.lang.Appendable stb,
                                  java.lang.CharSequence string,
                                  boolean convertBraces)
                           throws java.io.IOException
        Deprecated.
        appends the given String to the StringBuilder. If convertBraces is true, all "{" and "}" are converted to "%7B" and "%7D"
        Parameters:
        stb - the Appendable to append on
        string - the CharSequence to append
        convertBraces - if true, all braces are converted, if false then not.
        Throws:
        java.io.IOException - If the Appendable have a problem
      • append

        public static void append​(java.lang.Appendable stb,
                                  java.lang.CharSequence string,
                                  boolean convertBraces,
                                  int startIndex)
                           throws java.io.IOException
        Deprecated.
        appends the given String to the StringBuilder. If convertBraces is true, all "{" and "}" are converted to "%7B" and "%7D"
        Parameters:
        stb - the Appendable to append on
        string - the CharSequence to append
        convertBraces - if true, all braces are converted, if false then not.
        startIndex -
        Throws:
        java.io.IOException - If the Appendable have a problem
      • append

        public static void append​(java.lang.Appendable stb,
                                  java.lang.CharSequence string,
                                  boolean convertBraces,
                                  int startIndex,
                                  int endIndex)
                           throws java.io.IOException
        Deprecated.
        appends the given String to the StringBuilder. If convertBraces is true, all "{" and "}" are converted to "%7B" and "%7D"
        Parameters:
        stb - the Appendable to append on
        string - the CharSequence to append
        convertBraces - if true, all braces are converted, if false then not.
        startIndex -
        endIndex -
        Throws:
        java.io.IOException - If the Appendable have a problem
      • append

        public static void append​(java.lang.StringBuilder stb,
                                  java.lang.Object[] array)
        Deprecated.
        appends the array elements to the StringBuilder, separated by ", ".
        Parameters:
        stb - The StringBuilder to append the array elements.
        array - The array to append to the StringBuilder.
      • checkClassAndInterfacesForAnnotation

        private static boolean checkClassAndInterfacesForAnnotation​(java.lang.Class<?> jaxRsClass,
                                                                    java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
        Deprecated.
        Indicates if the given class (and its implemented interfaces) are annotated with the given annotation.
        Parameters:
        jaxRsClass - The class to check.
        annotationClass - The class of the annotation .
        Returns:
        True if the given class (and its implemented interfaces) are annotated with the given annotation.
      • checkClassConcrete

        public static void checkClassConcrete​(java.lang.Class<?> jaxRsClass,
                                              java.lang.String typeName)
                                       throws java.lang.IllegalArgumentException
        Deprecated.
        Checks, if the class is concrete.
        Parameters:
        jaxRsClass - JAX-RS root resource class or JAX-RS provider.
        typeName - for the exception message "root resource class" or "provider"
        Throws:
        java.lang.IllegalArgumentException - if the class is not concrete.
      • copyResponseHeaders

        public static void copyResponseHeaders​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> jaxRsHeaders,
                                               Response restletResponse)
        Deprecated.
        Copies headers into a response.
        Parameters:
        jaxRsHeaders - Headers of an JAX-RS-Response.
        restletResponse - Restlet Response to copy the headers in.
        See Also:
        Response.getMetadata()
      • copyResponseHeaders

        public static Series<Header> copyResponseHeaders​(Response restletResponse)
        Deprecated.
        Copies the headers of the given Response into the given Series.
        Parameters:
        restletResponse - The response to update. Should contain a Representation to copy the representation headers from it.
        Returns:
        The copied headers.
      • createColl

        @SafeVarargs
        public static <A> java.util.Collection<A> createColl​(A... objects)
        Deprecated.
        Creates an modifiable Collection with the given Objects in it, and no other objects. nulls will be ignored.
        Type Parameters:
        A -
        Parameters:
        objects -
        Returns:
        Returns the created list with the given objects in it.
      • createList

        @SafeVarargs
        public static <A> java.util.List<A> createList​(A... objects)
        Deprecated.
        Creates an modifiable List with the given Object in it, and no other objects. If the given object is null, than an empty List will returned
        Type Parameters:
        A -
        Parameters:
        objects -
        Returns:
        Returns the created list with the given object in it or an empty list, if the given object is null.
      • createMap

        public static java.util.Map<java.lang.String,​java.lang.String> createMap​(java.lang.String... keysAndValues)
        Deprecated.
        Creates a map with the given keys and values.
        Parameters:
        keysAndValues - first element is key1, second element value1, third element key2, forth element value2 and so on.
        Returns:
        the created Map
      • createSet

        @SafeVarargs
        public static <A> java.util.Set<A> createSet​(A... objects)
        Deprecated.
        Creates an modifiable Set with the given Object in it, and no other objects. If the given object is null, than an empty Set will returned.
        Type Parameters:
        A -
        Parameters:
        objects -
        Returns:
        the created Set
      • doesImplement

        public static boolean doesImplement​(java.lang.Class<?> clazz,
                                            java.lang.Class<?> interfaze)
        Deprecated.
        Checks, if the given class implements the given interface.
        Parameters:
        clazz -
        interfaze -
        Returns:
        true, if the class implements the given interface, otherwise false. if the clazz or interfaze is null, false is returned
      • endsWith

        public static boolean endsWith​(java.lang.CharSequence charSequence,
                                       char character)
        Deprecated.
        Checks, if the given CharSequence ends with the given character.
        Parameters:
        charSequence -
        character -
        Returns:
        true, if the given charSequence ends with the given character, otherwise false.
        See Also:
        notEndsWith(CharSequence, char), startsWith(CharSequence, char)
      • equals

        public static boolean equals​(java.lang.Object object1,
                                     java.lang.Object object2)
        Deprecated.
        Check if the given objects are equal. Can deal with null references. if both elements are null, than the result is true.
        Parameters:
        object1 -
        object2 -
        Returns:
        true, if the objects are equal.
      • formatDate

        public static java.lang.String formatDate​(java.util.Date date,
                                                  boolean cookie)
        Deprecated.
        Converts the given Date into a String. Copied from org.restlet.engine.Call.
        Parameters:
        date - Date to format
        cookie - if true, using RFC 1036 format, otherwise RFC 1123 format.
        Returns:
        The formated date
      • formatDimensions

        public static java.lang.String formatDimensions​(java.util.Set<Dimension> dimensions)
        Deprecated.
        Formats the given Set of Dimensions to a String for the HTTP Vary header.
        Parameters:
        dimensions - the dimensions to format.
        Returns:
        the Vary header or null, if dimensions is null or empty.
      • getArrayClass

        private static java.lang.Class<?> getArrayClass​(java.lang.reflect.Type genCompType,
                                                        java.lang.reflect.Type forMessage)
                                                 throws java.lang.NegativeArraySizeException,
                                                        ImplementationException
        Deprecated.
        Parameters:
        genCompType -
        forMessage -
        Throws:
        java.lang.NegativeArraySizeException
        ImplementationException
      • getCharsetName

        public static java.lang.String getCharsetName​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> httpHeaders,
                                                      CharacterSet defaultCs)
        Deprecated.
        Returns the character set as String of the given http headers (e.g. from a JAX-RS Response).
        Parameters:
        httpHeaders - the JAX-RS Response
        defaultCs - the character set to return, if no one could be found.
        Returns:
        the Restlet CharacterSet of the given http headers, or the given defaultCs as String if the header "Content-Type" is not available or has no parameter "charset". Returns only null, if the given defaultCs is null.
        See Also:
        getSupportedCharSet(MultivaluedMap)
      • getFirstElement

        public static <A> A getFirstElement​(java.util.Collection<A> coll)
                                     throws java.util.NoSuchElementException
        Deprecated.
        Returns the first element of the given collection. Throws an exception if the collection is empty.
        Type Parameters:
        A -
        Parameters:
        coll -
        Returns:
        Returns the first Element of the collection
        Throws:
        java.util.NoSuchElementException - If the collection is empty.
      • getFirstElement

        public static <A> A getFirstElement​(java.lang.Iterable<A> coll)
                                     throws java.util.NoSuchElementException
        Deprecated.
        Returns the first element of the given Iterable. Throws an exception if the Iterable is empty.
        Type Parameters:
        A -
        Parameters:
        coll -
        Returns:
        Returns the first Element of the collection
        Throws:
        java.util.NoSuchElementException - If the collection is empty
      • getFirstElement

        public static <A> A getFirstElement​(java.util.List<A> list)
                                     throws java.lang.IndexOutOfBoundsException
        Deprecated.
        Returns the first element of the List. Throws an exception if the list is empty.
        Type Parameters:
        A -
        Parameters:
        list -
        Returns:
        Returns the first Element of the collection
        Throws:
        java.lang.IndexOutOfBoundsException - If the list is empty
      • getFirstElementOrNull

        public static <A> A getFirstElementOrNull​(java.lang.Iterable<A> coll)
        Deprecated.
        Returns the first element of the given Iterable. Returns null, if the Iterable is empty.
        Type Parameters:
        A -
        Parameters:
        coll -
        Returns:
        the first element of the collection, or null if the iterable is empty.
      • getFirstEntry

        public static <K,​V> java.util.Map.Entry<K,​V> getFirstEntry​(java.util.Map<K,​V> map)
                                                                        throws java.util.NoSuchElementException
        Deprecated.
        Returns the first entry of the given Map. Throws an exception if the Map is empty.
        Type Parameters:
        K -
        V -
        Parameters:
        map -
        Returns:
        the first entry of the given Map.
        Throws:
        java.util.NoSuchElementException - If the map is empty.
      • getFirstKey

        public static <K,​V> K getFirstKey​(java.util.Map<K,​V> map)
                                         throws java.util.NoSuchElementException
        Deprecated.
        Returns the key of the first entry of the given Map. Throws an exception if the Map is empty.
        Type Parameters:
        K -
        V -
        Parameters:
        map -
        Returns:
        the key of the first entry of the given Map.
        Throws:
        java.util.NoSuchElementException - If the map is empty.
      • getFirstValue

        public static <K,​V> V getFirstValue​(java.util.Map<K,​V> map)
                                           throws java.util.NoSuchElementException
        Deprecated.
        Returns the value of the first entry of the given Map. Throws an exception if the Map is empty.
        Type Parameters:
        K -
        V -
        Parameters:
        map -
        Returns:
        the value of the first entry of the given Map.
        Throws:
        java.util.NoSuchElementException - If the map is empty.
      • getGenericClass

        public static java.lang.Class<?> getGenericClass​(java.lang.Class<?> clazz,
                                                         java.lang.Class<?> implInterface)
        Deprecated.
        Parameters:
        clazz - The class which implemented interface should be checked.
        implInterface - the interface from which the generic type should be returned.
        Returns:
        the type parameter of the given class.
      • getGenericClass

        private static java.lang.Class<?> getGenericClass​(java.lang.Class<?> clazz,
                                                          java.lang.Class<?> implInterface,
                                                          java.lang.reflect.Type[] gsatp)
        Deprecated.
      • getGenericClass

        public static java.lang.Class<?> getGenericClass​(java.lang.reflect.Type genericType)
        Deprecated.
        Example: in List<String> -> out: String.class
        Parameters:
        genericType -
        Returns:
        otherwise null
      • getHttpHeaders

        public static Series<Header> getHttpHeaders​(Request request)
        Deprecated.
        Returns the HTTP headers of the Restlet Request as Series .
        Parameters:
        request -
        Returns:
        Returns the HTTP headers of the Request.
      • getHttpHeaders

        public static Series<Header> getHttpHeaders​(Response response)
        Deprecated.
        Returns the HTTP headers of the Restlet Response as Series.
        Parameters:
        response -
        Returns:
        Returns the HTTP headers of the Response.
      • getJaxRsHttpHeaders

        public static javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getJaxRsHttpHeaders​(Request request)
        Deprecated.
        Returns the request headers as MultivaluedMap.
        Parameters:
        request -
        Returns:
        the request headers as MultivaluedMap.
      • getLastElement

        public static <A> A getLastElement​(java.lang.Iterable<A> iterable)
                                    throws java.lang.IndexOutOfBoundsException,
                                           java.util.NoSuchElementException
        Deprecated.
        Returns the last element of the given Iterable. Throws an exception if the given iterable is empty.
        Type Parameters:
        A -
        Parameters:
        iterable -
        Returns:
        Returns the last element of the Iterable
        Throws:
        java.lang.IndexOutOfBoundsException - If the Iterable is a List and its is empty.
        java.util.NoSuchElementException - If the Iterable is empty and the Iterable is not a List.
      • getLastElement

        public static <A> A getLastElement​(java.util.Iterator<A> iter)
                                    throws java.util.NoSuchElementException
        Deprecated.
        Returns the last element of the given Iterator. Throws an exception if the given iterator is empty.
        Type Parameters:
        A -
        Parameters:
        iter -
        Returns:
        Returns the last element of the Iterator.
        Throws:
        java.util.NoSuchElementException - If the Iterator is empty.
      • getLastElement

        public static <A> A getLastElement​(java.util.List<A> list)
                                    throws java.lang.IndexOutOfBoundsException
        Deprecated.
        Returns the last element of the given List. Throws an exception if the given list is empty.
        Type Parameters:
        A -
        Parameters:
        list -
        Returns:
        Returns the last element of the list
        Throws:
        java.lang.IndexOutOfBoundsException - If the list is empty
      • getLastElementOrNull

        public static <A> A getLastElementOrNull​(java.lang.Iterable<A> iterable)
        Deprecated.
        Returns the last element of the given Iterable, or null, if the iterable is empty. Returns null, if the iterable is empty.
        Type Parameters:
        A -
        Parameters:
        iterable -
        Returns:
        Returns the last Element of the Iterable, or null if it is empty.
      • getLastElementOrNull

        public static <A> A getLastElementOrNull​(java.util.Iterator<A> iter)
        Deprecated.
        Returns the last element of the given Iterator, or null, if the iterator is empty. Returns null, if the iterator is empty.
        Type Parameters:
        A -
        Parameters:
        iter -
        Returns:
        Returns the last Element of the Iterator.
      • getMediaType

        public static MediaType getMediaType​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> httpHeaders)
        Deprecated.
        Returns the Restlet MediaType of the given http headers (e.g. from a JAX-RS Response).
        Parameters:
        httpHeaders - the JAX-RS Response
        Returns:
        the Restlet MediaType of the given http headers, or null, if the header "Content-Type" is not available.
      • getMethodsByName

        public static java.util.Collection<java.lang.reflect.Method> getMethodsByName​(java.lang.Class<?> clazz,
                                                                                      java.lang.String methodName)
                                                                               throws java.lang.IllegalArgumentException
        Deprecated.
        Returns all public Methods of the class with the given name (case-sensitive)
        Parameters:
        clazz - The Class to search the Methods.
        methodName - The name of the Method to search.
        Returns:
        Returns a Collection all of Methods with the given name. Never returns null. If no methods are found an empty Collection will be returned. The method Iterator.remove() of this collection is supported.
        Throws:
        java.lang.IllegalArgumentException - if the clazz or the method name is null.
      • getOnlyElement

        public static <A> A getOnlyElement​(java.util.Collection<A> list)
                                    throws java.lang.IllegalArgumentException
        Deprecated.
        Returns the only element of the list, or null, if the List is null or empty.
        Type Parameters:
        A -
        Parameters:
        list - a List with at most one element
        Returns:
        The element of the List, or null, if there is no element.
        Throws:
        java.lang.IllegalArgumentException - if the list contains more than one element.
      • getOnlyMetadataName

        public static java.lang.String getOnlyMetadataName​(java.util.List<? extends Metadata> metadatas)
        Deprecated.
        Returns the Name of the only element of the list of the given Metadata. Returns null, if the list is empty or null.
        Parameters:
        metadatas -
        Returns:
        the name of the Metadata
        See Also:
        #getOnlyElement(List)
      • getPathAnnotation

        public static javax.ws.rs.Path getPathAnnotation​(java.lang.Class<?> jaxRsClass)
                                                  throws MissingAnnotationException,
                                                         java.lang.IllegalArgumentException
        Deprecated.
        Returns the @Path annotation of the given root resource class.
        Parameters:
        jaxRsClass - the root resource class.
        Returns:
        the @Path annotation of the given root resource class.
        Throws:
        MissingAnnotationException - if the path annotation is missing
        java.lang.IllegalArgumentException - if the jaxRsClass is null.
      • getPathAnnotation

        public static javax.ws.rs.Path getPathAnnotation​(java.lang.reflect.Method method)
                                                  throws java.lang.IllegalArgumentException,
                                                         MissingAnnotationException
        Deprecated.
        Returns the @Path annotation of the given sub resource locator. Throws an exception if no @Path annotation is available.
        Parameters:
        method - the java method to get the @Path from
        Returns:
        the @Path annotation.
        Throws:
        java.lang.IllegalArgumentException - if null was given.
        MissingAnnotationException - if the annotation is not present.
      • getPathAnnotationOrNull

        public static javax.ws.rs.Path getPathAnnotationOrNull​(java.lang.reflect.Method method)
                                                        throws java.lang.IllegalArgumentException
        Deprecated.
        Returns the @Path annotation of the given sub resource locator. Returns null if no @Path annotation is available.
        Parameters:
        method - the java method to get the @Path from
        Returns:
        the @Path annotation or null, if not present.
        Throws:
        java.lang.IllegalArgumentException - if the method is null.
      • getPathTemplateWithoutRegExps

        public static java.lang.String getPathTemplateWithoutRegExps​(javax.ws.rs.Path path)
                                                              throws IllegalPathException
        Deprecated.
        Returns the path from the annotation. It will be encoded if necessary. If it should not be encoded, this method checks, if all characters are valid.
        Parameters:
        path - The Path annotation. Must not be null.
        Returns:
        the encoded path template
        Throws:
        IllegalPathException
        See Also:
        Path#encode()
      • getPathTemplateWithoutRegExps

        public static java.lang.String getPathTemplateWithoutRegExps​(java.lang.String pathTemplate,
                                                                     javax.ws.rs.Path pathForExcMess)
                                                              throws IllegalPathException
        Deprecated.
        Parameters:
        pathTemplate -
        pathForExcMess -
        Returns:
         
        Throws:
        IllegalPathException
      • getSupportedCharSet

        public static CharacterSet getSupportedCharSet​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> httpResponseHeaders)
        Deprecated.
        Returns the character set of the http response headers. If no character set is available or it is not supported, UFT-8 is returned.
        Parameters:
        httpResponseHeaders -
        Returns:
        a supported CharacterSet, never null.
        See Also:
        getCharsetName(MultivaluedMap, CharacterSet)
      • indexBeginMatrixOfLastSegment

        public static int indexBeginMatrixOfLastSegment​(java.lang.CharSequence path)
        Deprecated.
        Returns the index of the first ";" in the last path segment.
        Parameters:
        path - the path, without a query.
        Returns:
        the index of the first ";" in the last path segment. Returns -1, if no ';' is available.
      • indexOfBetween

        public static int indexOfBetween​(java.lang.CharSequence charSequence,
                                         char c,
                                         int beginIndex,
                                         int endIndex)
        Deprecated.
        Returns the index of the first occurrence of the given character between the given indexes.
        Parameters:
        charSequence - the char sequence to look in
        c - the character to look for.
        beginIndex -
        endIndex -
        Returns:
        the index of the given character between the given indexes, or -1 if the character could not be found in the given range.
        See Also:
        String.indexOf(String, int), String.substring(int, int)
      • inject

        public static void inject​(java.lang.Object resource,
                                  java.lang.reflect.AccessibleObject fieldOrBeanSetter,
                                  java.lang.Object toInject)
                           throws java.lang.reflect.InvocationTargetException,
                                  java.lang.IllegalArgumentException,
                                  InjectException
        Deprecated.
        Injects the given toInject in the resource field or the given bean setter.
        Parameters:
        resource -
        fieldOrBeanSetter -
        toInject -
        Throws:
        java.lang.reflect.InvocationTargetException
        java.lang.IllegalArgumentException
        InjectException
      • inject

        public static void inject​(java.lang.Object resource,
                                  java.lang.reflect.Field field,
                                  java.lang.Object toInject)
                           throws InjectException
        Deprecated.
        Inject the given toInject into the given field in the given resource (or whatever)
        Parameters:
        resource - the concrete Object to inject the other object in. If the field is static, thsi object may be null.
        field - the field to inject the third parameter in.
        toInject - the object to inject in the first parameter object.
        Throws:
        InjectException - if the injection was not possible. See Throwable.getCause() for the reason.
      • inject

        public static void inject​(java.lang.Object resource,
                                  java.lang.reflect.Method beanSetter,
                                  java.lang.Object toInject)
                           throws java.lang.reflect.InvocationTargetException,
                                  java.lang.IllegalArgumentException,
                                  InjectException
        Deprecated.
        Injects the given toInject in the resource with the given bean setter.
        Parameters:
        resource -
        beanSetter -
        toInject -
        Throws:
        java.lang.reflect.InvocationTargetException
        java.lang.IllegalArgumentException
        InjectException
      • invokeMethod

        public static void invokeMethod​(java.lang.Object object,
                                        java.lang.reflect.Method javaMethod,
                                        java.lang.Object... args)
                                 throws MethodInvokeException,
                                        java.lang.reflect.InvocationTargetException,
                                        java.lang.IllegalArgumentException
        Deprecated.
        Invokes the given method without parameters. This constraint is not checked; but the method could also be called, if access is normally not allowed.
        If no javaMethod is given, nothing happens.
        Parameters:
        object - the object to call the method on.
        javaMethod - the method to call
        args - the arguments of the method
        Throws:
        MethodInvokeException
        java.lang.reflect.InvocationTargetException
        java.lang.IllegalArgumentException - if at least one argument does not match the required method parameters.
        See Also:
        inject(Object, Field, Object), #findPostConstructMethod(Class), #findPreDestroyMethod(Class)
      • isEmpty

        public static boolean isEmpty​(java.util.List<?> list)
        Deprecated.
        Checks, if the list is empty or null.
        Parameters:
        list -
        Returns:
        true, if the list is empty or null, or false, if the list contains elements.
        See Also:
        isEmpty(Object[])
      • isEmpty

        public static boolean isEmpty​(java.lang.Object[] array)
        Deprecated.
        Tests, if the given array is empty or null. Will not throw a NullPointerException.
        Parameters:
        array -
        Returns:
        Returns true, if the given array ist null or has zero elements, otherwise false.
        See Also:
        isEmpty(List)
      • isEmptyOrSlash

        public static boolean isEmptyOrSlash​(java.lang.String string)
        Deprecated.
        Tests, if the given String is null, empty or "/". Will not throw a NullPointerException.
        Parameters:
        string -
        Returns:
        Returns true, if the given string ist null, empty or equals "/", otherwise false.
      • isNotEmpty

        public static boolean isNotEmpty​(java.util.List<?> list)
        Deprecated.
        Checks, if the list contains elements.
        Parameters:
        list -
        Returns:
        true, if the list contains elements, or false, if the list is empty or null.
      • isProvider

        public static boolean isProvider​(java.lang.Class<?> jaxRsClass)
        Deprecated.
        Checks, if the given class is a JAX-RS provider.
        Parameters:
        jaxRsClass - the class to check
        Returns:
        true, if the class is a JAX-RS provider, otherwise false.
      • isRootResourceClass

        public static boolean isRootResourceClass​(java.lang.Class<?> jaxRsClass)
        Deprecated.
        Checks, if the given class is a JAX-RS root resource class.
        Parameters:
        jaxRsClass - the class to check
        Returns:
        true, if the class is a JAX-RS root resource class, otherwise false.
      • logUnsupportedCharSet

        private static CharacterSet logUnsupportedCharSet​(java.lang.String charsetName)
        Deprecated.
        Logs a message that the wished character set is not supported and UTF-8 is used.
        Parameters:
        csn -
        Returns:
        UFT-8
      • notEndsWith

        public static boolean notEndsWith​(java.lang.CharSequence charSequence,
                                          char character)
        Deprecated.
        Checks, if the given CharSequence ends with the given character.
        Parameters:
        charSequence -
        character -
        Returns:
        true, if the given charSequence ends with the given character, otherwise false.
        See Also:
        endsWith(CharSequence, char), notStartsWith(CharSequence, char)
      • notStartsWith

        public static boolean notStartsWith​(java.lang.CharSequence charSequence,
                                            char character)
        Deprecated.
        Checks, if the given CharSequence starts with the given character.
        Parameters:
        charSequence -
        character -
        Returns:
        true, if the given charSequence starts with the given character, otherwise false.
        See Also:
        startsWith(CharSequence, char), notEndsWith(CharSequence, char)
      • processTemplVarname

        private static int processTemplVarname​(java.lang.String pathTemplate,
                                               int braceIndex,
                                               java.lang.StringBuilder stb,
                                               javax.ws.rs.Path pathForExcMess)
                                        throws IllegalPathException
        Deprecated.
        Parameters:
        pathTemplate -
        braceIndex -
        stb -
        pathForExcMess -
        Throws:
        IllegalPathException
      • sortByConcreteness

        public static java.util.List<MediaType> sortByConcreteness​(java.util.Collection<MediaType> mediaTypes)
        Deprecated.
        Returns a new List, which contains all MediaTypes of the given List, sorted by it's concreteness, the concrete MediaType at the beginning.
        Parameters:
        mediaTypes -
        Returns:
        the sorted media types
        See Also:
        specificness(org.restlet.data.MediaType)
      • specificness

        public static int specificness​(MediaType mediaType)
        Deprecated.
        Returns the specificness of the given MediaType:
        • 1 for any concrete type (contains no star)
        • 0 for the types (anything/*)
        • -1 for '*/*
        Parameters:
        mediaType -
        Returns:
        1, 0 or -1
        See Also:
        #isConcrete(org.restlet.data.MediaType), sortByConcreteness(Collection)
      • startsWith

        public static boolean startsWith​(java.lang.CharSequence charSequence,
                                         char character)
        Deprecated.
        Checks, if the given CharSequence starts with the given character.
        Parameters:
        charSequence -
        character -
        Returns:
        true, if the given charSequence starts with the given character, otherwise false.
        See Also:
        notStartsWith(CharSequence, char), endsWith(CharSequence, char)
      • toArray

        public static java.lang.Object[] toArray​(java.util.Collection<?> coll,
                                                 java.lang.Class<?> arrayType)
        Deprecated.
        Creates an Array of the given type.
        Parameters:
        coll -
        arrayType -
        Returns:
        the object array
        Throws:
        java.lang.NegativeArraySizeException
      • toString

        public static java.lang.String toString​(java.util.Collection<?> collection,
                                                java.lang.String delimiter)
        Deprecated.
        Concatenate the members of the Set to a String, separated with the given delimiter.
        Parameters:
        collection -
        delimiter -
        Returns:
        the concatenated