/** * Creates a new {@link EncoderGroup} object using a snapshot of the settings defined in this builder. * * <p> * This method can be called multiple times to produce multiple encoder groups. * * @return A new {@link EncoderGroup} object. */ public EncoderGroup build() { List<Encoder> l = new ArrayList<>(); for (Object e : encoders) l.add(beanContext.newInstance(Encoder.class, e)); return new EncoderGroup(ArrayUtils.toReverseArray(Encoder.class, l)); } }
/** * Creates a new {@link EncoderGroup} object using a snapshot of the settings defined in this builder. * * <p> * This method can be called multiple times to produce multiple encoder groups. * * @return A new {@link EncoderGroup} object. */ public EncoderGroup build() { List<Encoder> l = new ArrayList<>(); for (Object e : encoders) l.add(beanContext.newInstance(Encoder.class, e)); return new EncoderGroup(ArrayUtils.toReverseArray(Encoder.class, l)); } }
/** * Creates a new {@link EncoderGroup} object using a snapshot of the settings defined in this builder. * * <p> * This method can be called multiple times to produce multiple encoder groups. * * @return A new {@link EncoderGroup} object. */ public EncoderGroup build() { List<Encoder> l = new ArrayList<>(); for (Object e : encoders) l.add(beanContext.newInstance(Encoder.class, e)); return new EncoderGroup(ArrayUtils.toReverseArray(Encoder.class, l)); } }
/** * Creates a new {@link ParserGroup} object using a snapshot of the settings defined in this builder. * * <p> * This method can be called multiple times to produce multiple parser groups. * * @return A new {@link ParserGroup} object. */ @Override /* Context */ @SuppressWarnings("unchecked") public ParserGroup build() { List<Parser> l = new ArrayList<>(); for (Object p : parsers) { Class<? extends Parser> c = null; PropertyStore ps = getPropertyStore(); if (p instanceof Class) { c = (Class<? extends Parser>)p; l.add(ContextCache.INSTANCE.create(c, ps)); } else { l.add((Parser)p); } } return new ParserGroup(getPropertyStore(), ArrayUtils.toReverseArray(Parser.class, l)); }
/** * Creates a new {@link SerializerGroup} object using a snapshot of the settings defined in this builder. * * <p> * This method can be called multiple times to produce multiple serializer groups. * * @return A new {@link SerializerGroup} object. */ @Override /* ContextBuilder */ @SuppressWarnings("unchecked") public SerializerGroup build() { List<Serializer> l = new ArrayList<>(); for (Object s : serializers) { Class<? extends Serializer> c = null; PropertyStore ps = getPropertyStore(); if (s instanceof Class) { c = (Class<? extends Serializer>)s; l.add(ContextCache.INSTANCE.create(c, ps)); } else { l.add((Serializer)s); } } return new SerializerGroup(getPropertyStore(), ArrayUtils.toReverseArray(Serializer.class, l)); }
/** * Creates a new {@link SerializerGroup} object using a snapshot of the settings defined in this builder. * * <p> * This method can be called multiple times to produce multiple serializer groups. * * @return A new {@link SerializerGroup} object. */ @Override /* ContextBuilder */ @SuppressWarnings("unchecked") public SerializerGroup build() { List<Serializer> l = new ArrayList<>(); for (Object s : serializers) { Class<? extends Serializer> c = null; PropertyStore ps = getPropertyStore(); if (s instanceof Class) { c = (Class<? extends Serializer>)s; l.add(ContextCache.INSTANCE.create(c, ps)); } else { l.add((Serializer)s); } } return new SerializerGroup(getPropertyStore(), ArrayUtils.toReverseArray(Serializer.class, l)); }
/** * Creates a new {@link SerializerGroup} object using a snapshot of the settings defined in this builder. * * <p> * This method can be called multiple times to produce multiple serializer groups. * * @return A new {@link SerializerGroup} object. */ @Override /* ContextBuilder */ @SuppressWarnings("unchecked") public SerializerGroup build() { List<Serializer> l = new ArrayList<>(); for (Object s : serializers) { Class<? extends Serializer> c = null; PropertyStore ps = getPropertyStore(); if (s instanceof Class) { c = (Class<? extends Serializer>)s; l.add(ContextCache.INSTANCE.create(c, ps)); } else { l.add((Serializer)s); } } return new SerializerGroup(getPropertyStore(), ArrayUtils.toReverseArray(Serializer.class, l)); }
/** * Creates a new {@link ParserGroup} object using a snapshot of the settings defined in this builder. * * <p> * This method can be called multiple times to produce multiple parser groups. * * @return A new {@link ParserGroup} object. */ @Override /* Context */ @SuppressWarnings("unchecked") public ParserGroup build() { List<Parser> l = new ArrayList<>(); for (Object p : parsers) { Class<? extends Parser> c = null; PropertyStore ps = getPropertyStore(); if (p instanceof Class) { c = (Class<? extends Parser>)p; l.add(ContextCache.INSTANCE.create(c, ps)); } else { l.add((Parser)p); } } return new ParserGroup(getPropertyStore(), ArrayUtils.toReverseArray(Parser.class, l)); }
/** * Creates a new {@link ParserGroup} object using a snapshot of the settings defined in this builder. * * <p> * This method can be called multiple times to produce multiple parser groups. * * @return A new {@link ParserGroup} object. */ @Override /* Context */ @SuppressWarnings("unchecked") public ParserGroup build() { List<Parser> l = new ArrayList<>(); for (Object p : parsers) { Class<? extends Parser> c = null; PropertyStore ps = getPropertyStore(); if (p instanceof Class) { c = (Class<? extends Parser>)p; l.add(ContextCache.INSTANCE.create(c, ps)); } else { l.add((Parser)p); } } return new ParserGroup(getPropertyStore(), ArrayUtils.toReverseArray(Parser.class, l)); }
@Test public void testToReverseArray() throws Exception { String[] s = null; assertNull(toReverseArray(String.class, null)); s = new String[]{}; assertObjectEquals("[]", toReverseArray(String.class, Arrays.asList(s))); s = new String[]{"a"}; assertObjectEquals("['a']", toReverseArray(String.class, Arrays.asList(s))); s = new String[]{"a","b"}; assertObjectEquals("['b','a']", toReverseArray(String.class, Arrays.asList(s))); s = new String[]{"a","b","c"}; assertObjectEquals("['c','b','a']", toReverseArray(String.class, Arrays.asList(s))); }