@Test public void parse_complex() throws Exception { AttributeProcessor processor = new GravityAttributeProcessor() { @Override public void setGravity(View view, @Gravity int gravity) { } }; Value value = processor.compile(new Primitive("top|left"), null); int gravity = Gravity.TOP | Gravity.LEFT; assertThat(value.getAsInt(), is(gravity)); }
@Override public Value compile(@Nullable Value value, Context context) { if (null == value) { return NO_GRAVITY; } return ParseHelper.getGravity(value.getAsString()); }
GravityAttributeProcessor extends AttributeProcessor<V> { @Override public Value compile(@Nullable Value value, Context context) { if (null == value) { return NO_GRAVITY; } return ParseHelper.getGravity(value.getAsString()); } }
GravityAttributeProcessor extends AttributeProcessor<V> { @Override public Value compile(@Nullable Value value, Context context) { if (null == value) { return NO_GRAVITY; } return ParseHelper.getGravity(value.getAsString()); }  }
GravityAttributeProcessor extends AttributeProcessor<V> { @Override public Value compile(@Nullable Value value, Context context) { if (null == value) { return NO_GRAVITY; } return ParseHelper.getGravity(value.getAsString()); }  @Override void handleValue(V view, Value value); @Override void handleResource(V view, Resource resource); @Override void handleAttributeResource(V view, AttributeResource attribute); @Override void handleStyleResource(V view, StyleResource style); abstract void setGravity(V view, @Gravity int gravity); @Override Value compile(@Nullable Value value, Context context); }
GravityAttributeProcessor extends AttributeProcessor<V> { @Override public Value compile(@Nullable Value value, Context context) { if (null == value) { return NO_GRAVITY; } return ParseHelper.getGravity(value.getAsString()); }  @Override void handleValue(V view, Value value); @Override void handleResource(V view, Resource resource); @Override void handleAttributeResource(V view, AttributeResource attribute); @Override void handleStyleResource(V view, StyleResource style); abstract void setGravity(V view, @Gravity int gravity); @Override Value compile(@Nullable Value value, Context context); static final Primitive NO_GRAVITY; }