This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.use( function ( req, res ) { | |
| log.dis( 'Invalid path request: ' + req.path ); | |
| res.status( 404 ); | |
| // respond with html page | |
| if ( req.accepts( 'html' ) ) { | |
| res.status( 404 ) | |
| .redirect( req.protocol + '://' + req.get( 'Host' ) + '#/404' ); | |
| return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Cat { | |
| private String name; | |
| private String color; | |
| private Cat(){ } | |
| public getName(){ return this.name; } | |
| public getColor(){ return this.color; } | |
| public setName(String _name){ this.name = _name; return this; } | |
| public setColor(String _color){ this.color = _color; return this; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Cat{ | |
| // Cat fields, private access | |
| private String name; | |
| private String color; | |
| private Cat(Builder _builder){ | |
| this.name = _builder.name; | |
| this.color = _builder.color; | |
| } | |
| // Notice that there are only Accessors in this class | |
| // This can be altered if Cat's state changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1.) Constructor & Ambiguous Parameters | |
| Cat cat = new Cat("Mittens", "Orange"); | |
| // 2.) Constructor & Explicit Parameters | |
| Cat cat = new Cat(); | |
| cat.setName("Mittens"); | |
| cat.setColor("Orange"); | |
| // 3.) Builder & Explicit Parameters | |
| Cat cat = new Cat.Builder() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ... | |
| float value = new House.Builder() // ADD THIS | |
| .setBedrooms( 2 ) | |
| .setName( "Home" ) | |
| .setBathrooms( 3 ) | |
| .setSquareFeet( 1900 ) | |
| .setWindows( 4 ) | |
| .build() // ADD THIS | |
| .appraise(); | |
| // ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // setters | |
| public House setBedrooms( int _set ){ | |
| houseBedrooms = _set; | |
| return this; | |
| } | |
| public House setName( String _set ){ | |
| houseName = _set; | |
| return this; | |
| } | |
| public House setBathrooms( int _set ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ... | |
| float value = new House() | |
| .setBedrooms( 2 ) | |
| .setName( "Home" ) | |
| .setBathrooms( 3 ) | |
| .setSquareFeet( 1900 ) | |
| .setWindows( 4 ) | |
| .appraise(); | |
| // ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ... | |
| House house = new House(); | |
| house.setBedrooms( 2 ); | |
| house.setName( "Home" ); | |
| house.setBathrooms( 3 ); | |
| house.setSquareFeet( 1900 ); | |
| house.setWindows( 4 ); | |
| float value = house.appraise(); | |
| // ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // setters | |
| public void setBedrooms( int _set ){ | |
| houseBedrooms = _set; | |
| } | |
| public void setName( String _set ){ | |
| houseName = _set; | |
| } | |
| public void setBathrooms( int _set ){ | |
| houseBathrooms = _set; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ... | |
| House house = new House( 2, "Home", 3, 1900, 4 ); | |
| float value = house.appraise(); | |
| // ... |