简体   繁体   中英

Implementing bounded generic with java

I have an interface

public interface TransferObjectUtil<B extends BusinessObject,T> {

    public T to(B domain);

    public B from(T transferObject);
}

I am implementing the class for this as

public class ReflectionBasedTransferObjectUtil<B extends BusinessObject, T> implements
    **TransferObjectUtil<B extends BusinessObject, T>** {

For the portion within the ** in the above line the compiler complains that for B extends BusinessObject is not allowed. Why would it be so ?

I am just starting with generics, so pardon me for my novice question.

您使用仿制药的位置有点错误/过于急于尝试,请尝试这样

public class ReflectionBasedTransferObjectUtil<B extends BusinessObject, T> implements TransferObjectUtil<B, T> {

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM