Generated Code Proxycode proxy
In my library Transfuse I use a code generator to build a handful of classes that look up resources. Each of these look up classes are proxied by a static utility class so they may be referenced before the generated class is built. For instance, the ParcelsParcels
class can be used to wrap an object with a generated ParcelableParcelable
class:
ParcelsParcels
proxies a generated class called Transfuse$Parcels
.
ParcelsParcels
:
My question is the following: isIs this technique of loading the generated class using the static initialization block optimal? As you can see, if the class is not found (not generated possibly) then the ParcelRepository
instance ends up being nullnull
and wrap()
would always return nullnull
. Should wrap()
throw a runtime exception if an instance is not found instead?
Generated Code Proxy
In my library Transfuse I use a code generator to build a handful of classes that look up resources. Each of these look up classes are proxied by a static utility class so they may be referenced before the generated class is built. For instance, the Parcels class can be used to wrap an object with a generated Parcelable class:
Parcels proxies a generated class called Transfuse$Parcels
.
Parcels:
My question is the following: is this technique of loading the generated class using the static initialization block optimal? As you can see, if the class is not found (not generated possibly) then the ParcelRepository
instance ends up being null and wrap()
would always return null. Should wrap()
throw a runtime exception if instance is not found instead?
Generated code proxy
In my library Transfuse I use a code generator to build a handful of classes that look up resources. Each of these look up classes are proxied by a static utility class so they may be referenced before the generated class is built. For instance, the Parcels
class can be used to wrap an object with a generated Parcelable
class:
Parcels
proxies a generated class called Transfuse$Parcels
.
Parcels
:
Is this technique of loading the generated class using the static initialization block optimal? As you can see, if the class is not found (not generated possibly) then the ParcelRepository
instance ends up being null
and wrap()
would always return null
. Should wrap()
throw a runtime exception if an instance is not found instead?
Parcels proxies a generated class called Transfuse$ParcelsTransfuse$Parcels
.
Transfuse$ParcelsTransfuse$Parcels
:
My question is the following: is this technique of loading the generated class using the static initialization block optimal? As you can see, if the class is not found (not generated possibly) then the ParcelRepositoryParcelRepository
instance ends up being null and wrap()wrap()
would always return null. Should wrap()wrap()
throw a runtime exception if instance is not found instead?
Any guidance is appreciated.
Parcels proxies a generated class called Transfuse$Parcels.
Transfuse$Parcels:
My question is the following: is this technique of loading the generated class using the static initialization block optimal? As you can see, if the class is not found (not generated possibly) then the ParcelRepository instance ends up being null and wrap() would always return null. Should wrap() throw a runtime exception if instance is not found instead?
Any guidance is appreciated.
Parcels proxies a generated class called Transfuse$Parcels
.
Transfuse$Parcels
:
My question is the following: is this technique of loading the generated class using the static initialization block optimal? As you can see, if the class is not found (not generated possibly) then the ParcelRepository
instance ends up being null and wrap()
would always return null. Should wrap()
throw a runtime exception if instance is not found instead?