@Test public void conditionsOrder() { ArrangementCompositeMatchCondition condition = new ArrangementCompositeMatchCondition(); ArrangementSettingsToken typeToPreserve = FIELD; Set<ArrangementSettingsToken> modifiersToPreserve = ContainerUtilRt.newHashSet(PUBLIC, STATIC, FINAL); condition.addOperand(new ArrangementAtomMatchCondition(typeToPreserve, typeToPreserve)); for (ArrangementSettingsToken modifier : modifiersToPreserve) { condition.addOperand(new ArrangementAtomMatchCondition(modifier, modifier)); } Element element = mySerializer.serialize(new StdArrangementEntryMatcher(condition)); assertNotNull(element); for (ArrangementSettingsToken type : StdArrangementTokens.EntryType.values()) { if (type != typeToPreserve) { condition.addOperand(new ArrangementAtomMatchCondition(type, type)); } } for (ArrangementSettingsToken modifier : StdArrangementTokens.Modifier.values()) { if (!modifiersToPreserve.contains(modifier)) { condition.addOperand(new ArrangementAtomMatchCondition(modifier, modifier)); } } for (ArrangementSettingsToken type : StdArrangementTokens.EntryType.values()) { if (type != typeToPreserve) { condition.removeOperand(new ArrangementAtomMatchCondition(type, type)); } } for (ArrangementSettingsToken modifier : StdArrangementTokens.Modifier.values()) { if (!modifiersToPreserve.contains(modifier)) { condition.removeOperand(new ArrangementAtomMatchCondition(modifier, modifier)); } } Element actual = mySerializer.serialize(new StdArrangementEntryMatcher(condition)); assertNotNull(actual); checkElements(element, actual); }
@SuppressWarnings("MethodMayBeStatic") @javax.annotation.Nullable public <T extends ArrangementEntryMatcher> Element serialize(@Nonnull T matcher) { if (matcher instanceof StdArrangementEntryMatcher) { return serialize(((StdArrangementEntryMatcher)matcher).getCondition()); } LOG.warn(String.format( "Can't serialize arrangement entry matcher of class '%s'. Reason: expected to find '%s' instance instead", matcher.getClass(), StdArrangementEntryMatcher.class )); return null; }
DefaultArrangementEntryMatcherSerializer { @SuppressWarnings("MethodMayBeStatic") @javax.annotation.Nullable public <T extends ArrangementEntryMatcher> Element serialize(@Nonnull T matcher) { if (matcher instanceof StdArrangementEntryMatcher) { return serialize(((StdArrangementEntryMatcher)matcher).getCondition()); } LOG.warn(String.format( "Can't serialize arrangement entry matcher of class '%s'. Reason: expected to find '%s' instance instead", matcher.getClass(), StdArrangementEntryMatcher.class )); return null; } }
DefaultArrangementEntryMatcherSerializer { @SuppressWarnings("MethodMayBeStatic") @javax.annotation.Nullable public <T extends ArrangementEntryMatcher> Element serialize(@Nonnull T matcher) { if (matcher instanceof StdArrangementEntryMatcher) { return serialize(((StdArrangementEntryMatcher)matcher).getCondition()); } LOG.warn(String.format( "Can't serialize arrangement entry matcher of class '%s'. Reason: expected to find '%s' instance instead", matcher.getClass(), StdArrangementEntryMatcher.class )); return null; } DefaultArrangementEntryMatcherSerializer(DefaultArrangementSettingsSerializer.Mixin mixin); }
DefaultArrangementEntryMatcherSerializer { @SuppressWarnings("MethodMayBeStatic") @javax.annotation.Nullable public <T extends ArrangementEntryMatcher> Element serialize(@Nonnull T matcher) { if (matcher instanceof StdArrangementEntryMatcher) { return serialize(((StdArrangementEntryMatcher)matcher).getCondition()); } LOG.warn(String.format( "Can't serialize arrangement entry matcher of class '%s'. Reason: expected to find '%s' instance instead", matcher.getClass(), StdArrangementEntryMatcher.class )); return null; } DefaultArrangementEntryMatcherSerializer(DefaultArrangementSettingsSerializer.Mixin mixin); @SuppressWarnings("MethodMayBeStatic") @javax.annotation.Nullable Element serialize(@Nonnull T matcher); @SuppressWarnings("MethodMayBeStatic") @javax.annotation.Nullable StdArrangementEntryMatcher deserialize(@Nonnull Element matcherElement); }
DefaultArrangementEntryMatcherSerializer { @SuppressWarnings("MethodMayBeStatic") @javax.annotation.Nullable public <T extends ArrangementEntryMatcher> Element serialize(@Nonnull T matcher) { if (matcher instanceof StdArrangementEntryMatcher) { return serialize(((StdArrangementEntryMatcher)matcher).getCondition()); } LOG.warn(String.format( "Can't serialize arrangement entry matcher of class '%s'. Reason: expected to find '%s' instance instead", matcher.getClass(), StdArrangementEntryMatcher.class )); return null; } DefaultArrangementEntryMatcherSerializer(DefaultArrangementSettingsSerializer.Mixin mixin); @SuppressWarnings("MethodMayBeStatic") @javax.annotation.Nullable Element serialize(@Nonnull T matcher); @SuppressWarnings("MethodMayBeStatic") @javax.annotation.Nullable StdArrangementEntryMatcher deserialize(@Nonnull Element matcherElement);  }