@Test public void shouldBeCompatibleWithSubclass () { final RuntimeSchemaField field1 = new RuntimeSchemaField( "field1", Double.class ); final RuntimeSchemaField field2 = new RuntimeSchemaField( "field1", Number.class ); assertTrue( field1.isCompatibleWith( field2 ) ); }
public boolean isCompatibleWith ( final RuntimeSchemaField other ) { return other != null && name.equals( other.name ) && other.type.isAssignableFrom( this.type ); }
RuntimeSchemaField { public boolean isCompatibleWith ( final RuntimeSchemaField other ) { return other != null && name.equals( other.name ) && other.type.isAssignableFrom( this.type ); } }
RuntimeSchemaField { public boolean isCompatibleWith ( final RuntimeSchemaField other ) { return other != null && name.equals( other.name ) && other.type.isAssignableFrom( this.type ); } RuntimeSchemaField( final String name, final Class<?> type ); }
RuntimeSchemaField { public boolean isCompatibleWith ( final RuntimeSchemaField other ) { return other != null && name.equals( other.name ) && other.type.isAssignableFrom( this.type ); } RuntimeSchemaField( final String name, final Class<?> type ); String getName(); Class<?> getType(); boolean isCompatibleWith( final RuntimeSchemaField other ); @Override boolean equals( final Object o ); @Override int hashCode(); @Override String toString(); }
RuntimeSchemaField { public boolean isCompatibleWith ( final RuntimeSchemaField other ) { return other != null && name.equals( other.name ) && other.type.isAssignableFrom( this.type ); } RuntimeSchemaField( final String name, final Class<?> type ); String getName(); Class<?> getType(); boolean isCompatibleWith( final RuntimeSchemaField other ); @Override boolean equals( final Object o ); @Override int hashCode(); @Override String toString(); final String name; final Class<?> type; }