/** * Attempt to construct a decoder instance from it's type alias based on the * packaging and naming convention used in the {@link org.milyn.javabean.decoders} package. * * @param typeAlias Decoder alias used to construct an instance by prefixing the * alias with the "decoders" package and suffixing it with the word "Decoder". * @return The DateDecoder instance, or null if no such instance is available. * @throws DataDecodeException Failed to load alias decoder. */ public static DataDecoder create(String typeAlias) throws DataDecodeException { if (typeAlias == null) { return new StringDecoder(); } String className = StringDecoder.class.getPackage().getName() + "." + typeAlias + "Decoder"; try { Class decoderType = ClassUtil.forName(className, DataDecoder.class); return newInstance(decoderType); } catch (ClassNotFoundException e) { try { Class decoderType = ClassUtil.forName(typeAlias, DataDecoder.class); return newInstance(decoderType); } catch (ClassNotFoundException e1) { throw new DataDecodeException("DataDecoder Class '" + className + "' is not available on the classpath."); } } }
/** * Attempt to construct a decoder instance from it's type alias based on the * packaging and naming convention used in the {@link org.milyn.javabean.decoders} package. * * @param typeAlias Decoder alias used to construct an instance by prefixing the * alias with the "decoders" package and suffixing it with the word "Decoder". * @return The DateDecoder instance, or null if no such instance is available. * @throws DataDecodeException Failed to load alias decoder. */ public static DataDecoder create(String typeAlias) throws DataDecodeException { if (typeAlias == null) { return new StringDecoder(); } String className = StringDecoder.class.getPackage().getName() + "." + typeAlias + "Decoder"; try { Class decoderType = ClassUtil.forName(className, DataDecoder.class); return newInstance(decoderType); } catch (ClassNotFoundException e) { try { Class decoderType = ClassUtil.forName(typeAlias, DataDecoder.class); return newInstance(decoderType); } catch (ClassNotFoundException e1) { throw new DataDecodeException("DataDecoder Class '" + className + "' is not available on the classpath."); } } }
/** * Attempt to construct a decoder instance from it's type alias based on the * packaging and naming convention used in the {@link org.milyn.javabean.decoders} package. * * @param typeAlias Decoder alias used to construct an instance by prefixing the * alias with the "decoders" package and suffixing it with the word "Decoder". * @return The DateDecoder instance, or null if no such instance is available. * @throws DataDecodeException Failed to load alias decoder. */ public static DataDecoder create(String typeAlias) throws DataDecodeException { if (typeAlias == null) { return new StringDecoder(); } String className = StringDecoder.class.getPackage().getName() + "." + typeAlias + "Decoder"; try { Class decoderType = ClassUtil.forName(className, DataDecoder.class); return newInstance(decoderType); } catch (ClassNotFoundException e) { try { Class decoderType = ClassUtil.forName(typeAlias, DataDecoder.class); return newInstance(decoderType); } catch (ClassNotFoundException e1) { throw new DataDecodeException("DataDecoder Class '" + className + "' is not available on the classpath."); } } }
public static DataDecoder create(final Class targetType) throws DataDecodeException { Class<? extends DataDecoder> decoderType = getInstance(targetType); if (decoderType != null) { if (decoderType == EnumDecoder.class) { EnumDecoder decoder = new EnumDecoder(); decoder.setEnumType(targetType); return decoder; } else { return newInstance(decoderType); } } return null; }
public static DataDecoder create(final Class targetType) throws DataDecodeException { Class<? extends DataDecoder> decoderType = getInstance(targetType); if (decoderType != null) { if (decoderType == EnumDecoder.class) { EnumDecoder decoder = new EnumDecoder(); decoder.setEnumType(targetType); return decoder; } else { return newInstance(decoderType); } } return null; }
public static DataDecoder create(final Class targetType) throws DataDecodeException { Class<? extends DataDecoder> decoderType = getInstance(targetType); if (decoderType != null) { if (decoderType == EnumDecoder.class) { EnumDecoder decoder = new EnumDecoder(); decoder.setEnumType(targetType); return decoder; } else { return newInstance(decoderType); } } return null; }