### Question:
JAXBEncoderDecoder { public static Class<?> getClassFromType(Type t) { if (t instanceof Class) { return (Class<?>)t; } else if (t instanceof GenericArrayType) { GenericArrayType g = (GenericArrayType)t; return Array.newInstance(getClassFromType(g.getGenericComponentType()), 0).getClass(); } else if (t instanceof ParameterizedType) { ParameterizedType p = (ParameterizedType)t; return getClassFromType(p.getRawType()); } assert false; throw new IllegalArgumentException("Cannot get Class object from unknown Type"); } private  JAXBEncoderDecoder(); static void marshall(Marshaller marshaller,
                                Object elValue,
                                MessagePartInfo part,
                                Object source); static void marshalWithBridge(QName qname,
                                         Class<?> cls,
                                         Annotation[] anns,
                                         Set<Class<?>> ctxClasses,
                                         Object elValue,
                                         Object source, AttachmentMarshaller am); static Object unmarshalWithBridge(QName qname,
                                             Class<?> cls,
                                             Annotation[] anns,
                                             Set<Class<?>> ctxClasses,
                                             Object source,
                                             AttachmentUnmarshaller am); static void marshallException(Marshaller marshaller, Exception elValue,
                                         MessagePartInfo part, Object source); static Exception unmarshallException(Unmarshaller u,
                                                Object source,
                                                MessagePartInfo part); static void marshallNullElement(Marshaller marshaller,
                                           Object source,
                                           MessagePartInfo part); static Object unmarshall(Unmarshaller u,
                                    Object source,
                                    MessagePartInfo part,
                                    boolean unwrap); static Object unmarshall(final Unmarshaller u,
                                    final Object source,
                                    final QName elName,
                                    final Class<?> clazz,
                                    final boolean unwrap); static Object getElementValue(Object obj); static Class<?> getClassFromType(Type t); static List<Object> unmarshallArray(Unmarshaller u, Object source,
                                               QName elName, Class<?> clazz,
                                               List<Object> ret);  }### Answer:
@Test public void testGetClassFromType() throws Exception { Method testByte = getMethod("testByte"); Type[] genericParameterTypes = testByte.getGenericParameterTypes(); Class<?>[] paramTypes = testByte.getParameterTypes(); int idx = 0; for (Type t : genericParameterTypes) { Class<?> cls = JAXBEncoderDecoder.getClassFromType(t); assertEquals(cls, paramTypes[idx]); idx++; } Method testBase64Binary = getMethod("testBase64Binary"); genericParameterTypes = testBase64Binary.getGenericParameterTypes(); paramTypes = testBase64Binary.getParameterTypes(); idx = 0; for (Type t : genericParameterTypes) { Class<?> cls = JAXBEncoderDecoder.getClassFromType(t); assertEquals(cls, paramTypes[idx]); idx++; } }