M
Marco
Hi all,
Sorry if the question has already been asked, I cannot find anything
about it. I'd like to define a pair of classes which mutually
recursive generics in their definition:
class PropertyType<PV extends PropertyValue<PT extends
PropertyType<...>>
{
Collection<PV> getValues ()
void addValue ( PV value)
}
class PropertyValue<PT extends PropertyType<PV extends
PropertyValue<...>>
{
PropertyValue ( PT type )
PT getType()
void setType ( PT type )
}
class BioProp extends PropertyType<BioValue>
class BioValue extends PropertyValue<BioProp>
At the moment I do that by writing PropertyType<PV extends
PropertyValue> and alike for the value. However, this way I have
several type safety warnings from the compiler and I wonder if there
are suggestions on the best way to deal with such a case.
Thanks in advance.
Sorry if the question has already been asked, I cannot find anything
about it. I'd like to define a pair of classes which mutually
recursive generics in their definition:
class PropertyType<PV extends PropertyValue<PT extends
PropertyType<...>>
{
Collection<PV> getValues ()
void addValue ( PV value)
}
class PropertyValue<PT extends PropertyType<PV extends
PropertyValue<...>>
{
PropertyValue ( PT type )
PT getType()
void setType ( PT type )
}
class BioProp extends PropertyType<BioValue>
class BioValue extends PropertyValue<BioProp>
At the moment I do that by writing PropertyType<PV extends
PropertyValue> and alike for the value. However, this way I have
several type safety warnings from the compiler and I wonder if there
are suggestions on the best way to deal with such a case.
Thanks in advance.