java - Type symbol not found in inner class -
[edit: I've re-written the code to make it easier to re-handle and hand over this issue I'm working on this particular part of the code: However, in the return statement, the builder starts the error "Can not get new instant", it seems as if BuilderClazz was not recognized as class object. How can I work it out? Edit: Solution (thanks for the dcharms!) The above code is partial code with the simplification of the code I was working below given code Has been simplified yet but all the components have been included in it and include solutions provided by solution dcharms. You can not instantify a new object like this Note: It assumes that you are using Constructor first. You may be able to use the
class SimpleFactory {public SimpleFactory build (return) {return null} } Class SimpleFactoryBuilder {Public Object Build (Final Class Builder Clause) {Return New SimpleFrench ({@ Override Public Simplefactor Build () {New Builderclose. New Instance (); }}; }}
package com.example.tests; Interface IProduct {}; Interface ISIMPAFactory {Public IP Product MakePodt (); } Class Product Impulse IProduct {} Class SimpleFactoryBuilder {public ISimpleFactory buildFactory} {IUPPL's new IIMFFactor (IIPPL) {@ Override Public IP Product Make-Product ()} {Try {works} from the following line : Thanks Dicker! Returns (IP Product) ProductMakerClazz.getConstructors () [0]. New Instances (); // The following line - no-work // Return to new product i} Hold (exception e) {// Dealing with simplified error: getConstructors () and new Instances () can throw 5 types of exceptions! Return tap; }}}; }} Public Sector Main {Public Stable Zero Main (String [] Args) {SimpleFactoryBuilder sfb = New SimpleFactoryBuilder (); ISimpleFactory SF = sfb.buildFactory (ProductImpl.class); IProduct product = sf.makeProduct (); }}
Builder is a
class object instead try the following:
return builder .gate converse () [0] .new instance (one input);
getConstructor () , but I'm not sure how it will behave with the normal type.
Comments
Post a Comment