@Override public Object createExternal(Class<?> subjectType, ObjectInput input) throws IOException, ClassNotFoundException { return this.externalizer.readObject(input); } }
@Override public void writeObject(ObjectOutput output, T object) throws IOException { this.externalizer.writeObject(output, object); }
@Override public Class<Object> getTargetClass() { return this.externalizer.getTargetClass(); }
@Override public void writeObject(ObjectOutput output, MonthDay monthDay) throws IOException { DefaultExternalizer.MONTH.cast(Month.class).writeObject(output, monthDay.getMonth()); IndexSerializer.UNSIGNED_BYTE.writeInt(output, monthDay.getDayOfMonth()); }
@Override public void writeObject(Marshaller marshaller, Object object) throws IOException { this.serializer.writeInt(marshaller, this.index); this.externalizer.writeObject(marshaller, object); } }
@Override public LocalDateTime readObject(ObjectInput input) throws IOException, ClassNotFoundException { LocalDate date = DefaultExternalizer.LOCAL_DATE.cast(LocalDate.class).readObject(input); LocalTime time = DefaultExternalizer.LOCAL_TIME.cast(LocalTime.class).readObject(input); return LocalDateTime.of(date, time); }
@Override public void writeObject(ObjectOutput output, LocalDateTime dateTime) throws IOException { DefaultExternalizer.LOCAL_DATE.cast(LocalDate.class).writeObject(output, dateTime.toLocalDate()); DefaultExternalizer.LOCAL_TIME.cast(LocalTime.class).writeObject(output, dateTime.toLocalTime()); }
@Override public void writeObject(ObjectOutput output, HashableMarshalledValue<T> object) throws IOException { this.externalizer.writeObject(output, object); output.writeInt(object.hashCode()); }
public void test() throws ClassNotFoundException, IOException { for (E value : EnumSet.allOf(this.targetClass)) { this.test(value); } } }
@Override public Object readObject(ObjectInput input) throws IOException, ClassNotFoundException { return this.externalizer.readObject(input); }
@Override public void writeExternal(Object subject, ObjectOutput output) throws IOException { this.externalizer.writeObject(output, subject); }
@Override public URL readObject(ObjectInput input) throws IOException, ClassNotFoundException { return DefaultExternalizer.URI.cast(URI.class).readObject(input).toURL(); }
@Override public Set<Class<? extends T>> getTypeClasses() { return Collections.singleton(this.externalizer.getTargetClass()); }
@Override public T readObject(ObjectInput input) throws IOException, ClassNotFoundException { return this.externalizer.readObject(input); }
@Override public void writeObject(ObjectOutput output, Object object) throws IOException { this.externalizer.writeObject(output, object); }
public EnumExternalizerTester(Externalizer<E> externalizer) { super(externalizer, Assert::assertSame); this.targetClass = externalizer.getTargetClass(); }
@Override public InfinispanBeanGroupEntry<I, T> readObject(ObjectInput input) throws IOException, ClassNotFoundException { return new InfinispanBeanGroupEntry<>(this.externalizer.readObject(input)); }
@Override public void writeObject(ObjectOutput output, InfinispanBeanGroupEntry<I, T> entry) throws IOException { SimpleMarshalledValue<Map<I, T>> value = (SimpleMarshalledValue<Map<I, T>>) entry.getBeans(); this.externalizer.writeObject(output, value); }
/** * Cast this externalizer to its target type. * @param type the externalizer type * @return the externalizer */ @SuppressWarnings("unchecked") public <T> Externalizer<T> cast(Class<T> type) { if (!type.isAssignableFrom(this.externalizer.getTargetClass())) { throw new IllegalArgumentException(type.getName()); } return (Externalizer<T>) this.externalizer; } }
private ExternalizerObjectTable(IntSerializer indexSerializer, List<Externalizer<Object>> externalizers) { this.indexSerializer = indexSerializer; this.externalizers = externalizers; ListIterator<Externalizer<Object>> iterator = externalizers.listIterator(); while (iterator.hasNext()) { this.indexes.putIfAbsent(iterator.next().getTargetClass(), iterator.previousIndex()); } }