设计模式教程(Design Patterns Tutorial)笔记之二 结构型模式(Structural Patterns)
目录
· What is the Decorator Design Pattern?
· Adapter
· What is the Adapter Design Pattern?
· Facade
· What is the Facade Design Pattern?
· Bridge
· What is the Bridge Design Pattern?
· When to use the Bridge Design Pattern?
· What is the Flyweight Design Pattern?
· Proxy
· What is the Proxy Design Pattern?
Decorator
What is the Decorator Design Pattern?
• The Decorator allows you to modify an object dynamically.
• You would use it when you want the capabilities of inheritance with subclasses, but you need to add functionality at run time.
• It is more flexible than inheritance.
• Simplifies code because you add functionality using many simple classes.
• Rather than rewrite old code you can extend with new code.
Sample Code
• Pizza.java
// Blueprint for classes that will have decorators public interface Pizza { public String getDescription(); public double getCost(); } /*
public abstract class Pizza{ public abstract void setDescription(String newDescription);
public abstract String getDescription(); public abstract void setCost(double newCost);
public abstract double getCost(); // I could use getter and setter methods for every
// potential Pizza topping }
*/
• ThreeCheesePizza.java
// By going this route I'll have to create a new subclass
// for an infinite number of pizza.
// I'd also have to change prices in many classes
// when just 1 Pizza topping cost changes // Inheritance is static while composition is dynamic
// Through composition I'll be able to add new functionality
// by writing new code rather than by changing current code public class ThreeCheesePizza extends Pizza{ private String description = "Mozzarella, Fontina, Parmesan Cheese Pizza";
private double cost = 10.50; public void setDescription(String newDescription) { description = newDescription; } public String getDescription() { return description; } public void setCost(double newCost) { cost = newCost; } public double getCost() { return cost; }
}
• PlainPizza.java
// Implements the Pizza interface with only the required
// methods from the interface // Every Pizza made will start as a PlainPizza public class PlainPizza implements Pizza { public String getDescription() { return "Thin dough"; } public double getCost() { System.out.println("Cost of Dough: " + 4.00); return 4.00; } }
• ToppingDecorator.java
// Has a "Has a" relationship with Pizza. This is an
// Aggregation Relationship abstract class ToppingDecorator implements Pizza { protected Pizza tempPizza; // Assigns the type instance to this attribute
// of a Pizza // All decorators can dynamically customize the Pizza
// instance PlainPizza because of this public ToppingDecorator(Pizza newPizza){ tempPizza = newPizza; } public String getDescription() { return tempPizza.getDescription(); } public double getCost() { return tempPizza.getCost(); } }
• Mozzarella.java
public class Mozzarella extends ToppingDecorator { public Mozzarella(Pizza newPizza) { super(newPizza); System.out.println("Adding Dough"); System.out.println("Adding Moz");
} // Returns the result of calling getDescription() for
// PlainPizza and adds " mozzarella" to it public String getDescription(){ return tempPizza.getDescription() + ", mozzarella"; } public double getCost(){ System.out.println("Cost of Moz: " + .50); return tempPizza.getCost() + .50; } }
• TomatoSauce.java
public class TomatoSauce extends ToppingDecorator { public TomatoSauce(Pizza newPizza) {
super(newPizza); System.out.println("Adding Sauce");
} // Returns the result of calling getDescription() for
// PlainPizza, Mozzarella and then TomatoSauce public String getDescription(){ return tempPizza.getDescription() + ", tomato sauce"; } public double getCost(){ System.out.println("Cost of Sauce: " + .35); return tempPizza.getCost() + .35; } }
• PizzaMaker.java
public class PizzaMaker { public static void main(String[] args){ // The PlainPizza object is sent to the Mozzarella constructor
// and then to the TomatoSauce constructor Pizza basicPizza = new TomatoSauce(new Mozzarella(new PlainPizza())); System.out.println("Ingredients: " + basicPizza.getDescription()); System.out.println("Price: " + basicPizza.getCost()); } }
Adapter
What is the Adapter Design Pattern?
• Allows 2 incompatible interfaces to work together.
• Used when the client expects a (target) interface.
• The Adapter class allows the use of the available interface and the Target interface.
• Any class can work together as long as the Adapter solves the issue that all classes must implement every method defined by the shared interface.
Sample Code
• EnemyAttacker.java
// This is the Target Interface : This is what the client
// expects to work with. It is the adapters job to make new
// classes compatible with this one. public interface EnemyAttacker { public void fireWeapon(); public void driveForward(); public void assignDriver(String driverName); }
• EnemyTank.java
// EnemyTank implements EnemyAttacker perfectly
// Our job is to make classes with different methods
// from EnemyAttacker to work with the EnemyAttacker interface import java.util.Random; public class EnemyTank implements EnemyAttacker{ Random generator = new Random(); public void fireWeapon() { int attackDamage = generator.nextInt(10) + 1; System.out.println("Enemy Tank Does " + attackDamage + " Damage"); } public void driveForward() { int movement = generator.nextInt(5) + 1; System.out.println("Enemy Tank moves " + movement + " spaces"); } public void assignDriver(String driverName) { System.out.println(driverName + " is driving the tank"); } }
• EnemyRobot.java
// This is the Adaptee. The Adapter sends method calls
// to objects that use the EnemyAttacker interface
// to the right methods defined in EnemyRobot import java.util.Random; public class EnemyRobot{ Random generator = new Random(); public void smashWithHands() { int attackDamage = generator.nextInt(10) + 1; System.out.println("Enemy Robot Causes " + attackDamage + " Damage With Its Hands"); } public void walkForward() { int movement = generator.nextInt(5) + 1; System.out.println("Enemy Robot Walks Forward " + movement + " spaces"); } public void reactToHuman(String driverName) { System.out.println("Enemy Robot Tramps on " + driverName); } }
• EnemyRobotAdapter.java
// The Adapter must provide an alternative action for
// the the methods that need to be used because
// EnemyAttacker was implemented. // This adapter does this by containing an object
// of the same type as the Adaptee (EnemyRobot)
// All calls to EnemyAttacker methods are sent
// instead to methods used by EnemyRobot public class EnemyRobotAdapter implements EnemyAttacker{ EnemyRobot theRobot; public EnemyRobotAdapter(EnemyRobot newRobot){ theRobot = newRobot; } public void fireWeapon() { theRobot.smashWithHands(); } public void driveForward() { theRobot.walkForward(); } public void assignDriver(String driverName) { theRobot.reactToHuman(driverName); } }
• TestEnemyAttackers.java
public class TestEnemyAttackers{ public static void main(String[] args){ EnemyTank rx7Tank = new EnemyTank(); EnemyRobot fredTheRobot = new EnemyRobot(); EnemyAttacker robotAdapter = new EnemyRobotAdapter(fredTheRobot); System.out.println("The Robot"); fredTheRobot.reactToHuman("Paul");
fredTheRobot.walkForward();
fredTheRobot.smashWithHands();
System.out.println(); System.out.println("The Enemy Tank"); rx7Tank.assignDriver("Frank");
rx7Tank.driveForward();
rx7Tank.fireWeapon();
System.out.println(); System.out.println("The Robot with Adapter"); robotAdapter.assignDriver("Mark");
robotAdapter.driveForward();
robotAdapter.fireWeapon(); } }
Facade
What is the Facade Design Pattern?
• When you create a simplified interface that performs many other actions behind the scenes.
• Can I withdrawal $50 from the bank?
• Check if the checking account is valid.
• Check if the security code is valid.
• Check if funds are available.
• Make changes accordingly.
Sample Code
• WelcomeToBank.java
public class WelcomeToBank{ public WelcomeToBank() { System.out.println("Welcome to ABC Bank");
System.out.println("We are happy to give you your money if we can find it\n"); } }
• AccountNumberCheck.java
public class AccountNumberCheck{ private int accountNumber = 12345678; public int getAccountNumber() { return accountNumber; } public boolean accountActive(int acctNumToCheck){ if(acctNumToCheck == getAccountNumber()) { return true; } else { return false; } } }
• SecurityCodeCheck.java
public class SecurityCodeCheck { private int securityCode = 1234; public int getSecurityCode() { return securityCode; } public boolean isCodeCorrect(int secCodeToCheck){ if(secCodeToCheck == getSecurityCode()) { return true; } else { return false; } } }
• FundsCheck.java
public class FundsCheck { private double cashInAccount = 1000.00; public double getCashInAccount() { return cashInAccount; } public void decreaseCashInAccount(double cashWithdrawn) { cashInAccount -= cashWithdrawn; } public void increaseCashInAccount(double cashDeposited) { cashInAccount += cashDeposited; } public boolean haveEnoughMoney(double cashToWithdrawal) { if(cashToWithdrawal > getCashInAccount()) { System.out.println("Error: You don't have enough money");
System.out.println("Current Balance: " + getCashInAccount()); return false; } else { decreaseCashInAccount(cashToWithdrawal); System.out.println("Withdrawal Complete: Current Balance is " + getCashInAccount()); return true; } } public void makeDeposit(double cashToDeposit) { increaseCashInAccount(cashToDeposit); System.out.println("Deposit Complete: Current Balance is " + getCashInAccount()); } }
• BankAccountFacade.java
// The Facade Design Pattern decouples or separates the client
// from all of the sub components // The Facades aim is to simplify interfaces so you don't have
// to worry about what is going on under the hood public class BankAccountFacade { private int accountNumber;
private int securityCode; AccountNumberCheck acctChecker;
SecurityCodeCheck codeChecker;
FundsCheck fundChecker; WelcomeToBank bankWelcome; public BankAccountFacade(int newAcctNum, int newSecCode){ accountNumber = newAcctNum;
securityCode = newSecCode; bankWelcome = new WelcomeToBank(); acctChecker = new AccountNumberCheck();
codeChecker = new SecurityCodeCheck();
fundChecker = new FundsCheck(); } public int getAccountNumber() { return accountNumber; } public int getSecurityCode() { return securityCode; } public void withdrawCash(double cashToGet){ if(acctChecker.accountActive(getAccountNumber()) &&
codeChecker.isCodeCorrect(getSecurityCode()) &&
fundChecker.haveEnoughMoney(cashToGet)) { System.out.println("Transaction Complete\n"); } else { System.out.println("Transaction Failed\n"); } } public void depositCash(double cashToDeposit){ if(acctChecker.accountActive(getAccountNumber()) &&
codeChecker.isCodeCorrect(getSecurityCode())) { fundChecker.makeDeposit(cashToDeposit); System.out.println("Transaction Complete\n"); } else { System.out.println("Transaction Failed\n"); } } }
• TestBankAccount.java
public class TestBankAccount { public static void main(String[] args){ BankAccountFacade accessingBank = new BankAccountFacade(12345678, 1234); accessingBank.withdrawCash(50.00); accessingBank.withdrawCash(990.00); } }
Bridge
What is the Bridge Design Pattern?
• Decouple an abstraction from its implementation so that the two can vary independently.
• The Bridge Design Pattern is very poorly explained.
• Everyone seems to explain it differently.
• Progressively adding functionality while separating out major differences using abstract classes.
When to use the Bridge Design Pattern?
• When you want to be able to change both the abstractions (abstract classes) and concrete classes independently.
• When you want the first abstract class to define rules (Abstract TV).
• The concrete class adds additional rules (Concrete TV).
• An abstract class has a reference to the device and it defines abstract methods that will be defined (Abstract Remote).
• The Concrete Remote defines the abstract methods required.
Sample Code
• EntertainmentDevice.java
// Implementor
// With the Bridge Design Pattern you create 2 layers of abstraction
// In this example I'll have an abstract class representing
// different types of devices. I also have an abstract class
// that will represent different types of remote controls // This allows me to use an infinite variety of devices and remotes abstract class EntertainmentDevice { public int deviceState; public int maxSetting; public int volumeLevel = 0; public abstract void buttonFivePressed(); public abstract void buttonSixPressed(); public void deviceFeedback() { if(deviceState > maxSetting || deviceState < 0) { deviceState = 0; } System.out.println("On Channel " + deviceState); } public void buttonSevenPressed() { volumeLevel++; System.out.println("Volume at: " + volumeLevel); } public void buttonEightPressed() { volumeLevel--; System.out.println("Volume at: " + volumeLevel); } }
• TVDevice.java
// Concrete Implementor // Here is an implementation of the EntertainmentDevice
// abstract class. I'm specifying what makes it different
// from other devices public class TVDevice extends EntertainmentDevice { public TVDevice(int newDeviceState, int newMaxSetting){ deviceState = newDeviceState; maxSetting = newMaxSetting; } public void buttonFivePressed() { System.out.println("Channel Down"); deviceState--; } public void buttonSixPressed() { System.out.println("Channel Up"); deviceState++; } }
• RemoteButton.java
// Abstraction // This is an abstract class that will represent numerous
// ways to work with each device public abstract class RemoteButton{ // A reference to a generic device using aggregation private EntertainmentDevice theDevice; public RemoteButton(EntertainmentDevice newDevice){ theDevice = newDevice; } public void buttonFivePressed() { theDevice.buttonFivePressed(); } public void buttonSixPressed() { theDevice.buttonSixPressed(); } public void deviceFeedback(){ theDevice.deviceFeedback(); } public abstract void buttonNinePressed(); }
• TVRemoteMute.java
// Refined Abstraction // If I decide I want to further extend the remote I can public class TVRemoteMute extends RemoteButton{ public TVRemoteMute(EntertainmentDevice newDevice) {
super(newDevice);
} public void buttonNinePressed() { System.out.println("TV was Muted"); } }
• TVRemotePause.java
// Refined Abstraction // If I decide I want to further extend the remote I can public class TVRemotePause extends RemoteButton{ public TVRemotePause(EntertainmentDevice newDevice) {
super(newDevice);
} public void buttonNinePressed() { System.out.println("TV was Paused"); } }
• TestTheRemote.java
public class TestTheRemote{ public static void main(String[] args){ RemoteButton theTV = new TVRemoteMute(new TVDevice(1, 200)); RemoteButton theTV2 = new TVRemotePause(new TVDevice(1, 200)); // HOMEWORK -------------- RemoteButton theDVD = new DVDRemote(new DVDDevice(1,14)); // ----------------------- System.out.println("Test TV with Mute"); theTV.buttonFivePressed();
theTV.buttonSixPressed();
theTV.buttonNinePressed(); System.out.println("\nTest TV with Pause"); theTV2.buttonFivePressed();
theTV2.buttonSixPressed();
theTV2.buttonNinePressed();
theTV2.deviceFeedback(); // HOMEWORK System.out.println("\nTest DVD"); theDVD.buttonFivePressed();
theDVD.buttonSixPressed();
theDVD.buttonNinePressed();
theDVD.buttonNinePressed(); } }
Flyweight
What is the Flyweight Design Pattern?
• Used when you need to create a large number of similar objects.
• To reduce memory usage you share objects that are similar in some way rather than creating new ones.
• Intrinsic State: Color.
• Extrinsic State: Size.
Sample Code
• FlyWeightTest.java
// The Flyweight design pattern is used when you need to
// create a large number of similar objects // To reduce memory this pattern shares Objects that are
// the same rather than creating new ones import javax.swing.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random; public class FlyWeightTest extends JFrame{ private static final long serialVersionUID = 1L; JButton startDrawing; int windowWidth = 1750;
int windowHeight = 1000; // A new rectangle is created only if a new color is needed Color[] shapeColor = {Color.orange, Color.red, Color.yellow,
Color.blue, Color.pink, Color.cyan, Color.magenta,
Color.black, Color.gray}; public static void main(String[] args){ new FlyWeightTest(); } public FlyWeightTest(){ // Create the frame, position it and handle closing it this.setSize(windowWidth,windowHeight);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle("Flyweight Test"); JPanel contentPane = new JPanel(); contentPane.setLayout(new BorderLayout()); final JPanel drawingPanel = new JPanel(); startDrawing = new JButton("Button 1"); contentPane.add(drawingPanel, BorderLayout.CENTER); contentPane.add(startDrawing, BorderLayout.SOUTH); startDrawing.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) {
Graphics g = drawingPanel.getGraphics(); long startTime = System.currentTimeMillis(); for(int i=0; i < 100000; ++i) { //
// Uses rectangles stored in the HashMap to
// speed up the program MyRect rect = RectFactory.getRect(getRandColor());
rect.draw(g, getRandX(), getRandY(),
getRandX(), getRandY()); //
/*
MyRect rect = new MyRect(getRandColor(), getRandX(), getRandY(), getRandX(), getRandY());
rect.draw(g);
*/ //
/*
g.setColor(getRandColor());
g.fillRect(getRandX(), getRandY(), getRandX(), getRandY());
*/ } long endTime = System.currentTimeMillis(); System.out.println("That took " + (endTime - startTime) + " milliseconds"); }
}); this.add(contentPane); this.setVisible(true); } // Picks random x & y coordinates private int getRandX(){ return (int)(Math.random()*windowWidth); } private int getRandY(){ return (int)(Math.random()*windowHeight); } // Picks a random Color from the 9 available private Color getRandColor(){
Random randomGenerator = new Random(); int randInt = randomGenerator.nextInt(9); return shapeColor[randInt]; } }
• MyRect.java
import java.awt.*;
public class MyRect {
private Color color = Color.black;
private int x, y, x2, y2; public MyRect(Color color) { this.color = color; } public void draw(Graphics g, int upperX, int upperY, int lowerX, int lowerY) {
g.setColor(color);
g.fillRect(upperX, upperY, lowerX, lowerY);
} /* Original forces creation of a rectangle every time public MyRect(Color color, int upperX, int upperY, int lowerX, int lowerY) {
this.color = color;
this.x = upperX;
this.y = upperY;
this.x2 = lowerX;
this.y2 = lowerY;
} public void draw(Graphics g) {
g.setColor(color);
g.fillRect(x, y, x2, y2);
}
*/
}
• RectFactory.java
// This factory only creates a new rectangle if it
// uses a color not previously used // Intrinsic State: Color
// Extrinsic State: X & Y Values import java.util.HashMap;
import java.awt.Color;
public class RectFactory { // The HashMap uses the color as the key for every
// rectangle it will make up to 8 total private static final HashMap<Color, MyRect> rectsByColor = new HashMap<Color, MyRect>(); public static MyRect getRect(Color color) {
MyRect rect = (MyRect)rectsByColor.get(color); // Checks if a rectangle with a specific
// color has been made. If not it makes a
// new one, otherwise it returns one made already if(rect == null) {
rect = new MyRect(color); // Add new rectangle to HashMap rectsByColor.put(color, rect); }
return rect;
}
}
Proxy
What is the Proxy Design Pattern?
• Provide a class which will limit access to another class.
• You may do this for security reasons, because an Object is intensive to create, or is accessed from a remote location.
Sample Code
• ATMMachine.java
public class ATMMachine implements GetATMData{ public ATMState getYesCardState() { return hasCard; }
public ATMState getNoCardState() { return noCard; }
public ATMState getHasPin() { return hasCorrectPin; }
public ATMState getNoCashState() { return atmOutOfMoney; } // NEW STUFF public ATMState getATMState() { return atmState; }
public int getCashInMachine() { return cashInMachine; }
}
• GetATMData.java
// This interface will contain just those methods
// that you want the proxy to provide access to public interface GetATMData {
public ATMState getATMState();
public int getCashInMachine();
}
• ATMProxy.java
// In this situation the proxy both creates and destroys
// an ATMMachine Object public class ATMProxy implements GetATMData { // Allows the user to access getATMState in the
// Object ATMMachine public ATMState getATMState() { ATMMachine realATMMachine = new ATMMachine(); return realATMMachine.getATMState();
} // Allows the user to access getCashInMachine
// in the Object ATMMachine public int getCashInMachine() { ATMMachine realATMMachine = new ATMMachine(); return realATMMachine.getCashInMachine(); } }
• TestATMMachine.java
public class TestATMMachine { public static void main(String[] args){ ATMMachine atmMachine = new ATMMachine(); atmMachine.insertCard(); atmMachine.ejectCard(); atmMachine.insertCard(); atmMachine.insertPin(1234); atmMachine.requestCash(2000); atmMachine.insertCard(); atmMachine.insertPin(1234); // NEW STUFF : Proxy Design Pattern Code
// The interface limits access to just the methods you want
// made accessible GetATMData realATMMachine = new ATMMachine(); GetATMData atmProxy = new ATMProxy(); System.out.println("\nCurrent ATM State " + atmProxy.getATMState()); System.out.println("\nCash in ATM Machine $" + atmProxy.getCashInMachine()); // The user can't perform this action because ATMProxy doesn't
// have access to that potentially harmful method
// atmProxy.setCashInMachine(10000); } }
• ATMState.java
public interface ATMState { void insertCard();
void ejectCard();
void insertPin(int pinEntered);
void requestCash(int cashToWithdraw); }
作者:netoxi
出处:http://www.cnblogs.com/netoxi
本文版权归作者和博客园共有,欢迎转载,未经同意须保留此段声明,且在文章页面明显位置给出原文连接。欢迎指正与交流。
设计模式教程(Design Patterns Tutorial)笔记之二 结构型模式(Structural Patterns)的更多相关文章
- Java 23种设计模式详尽分析与实例解析之二--结构型模式
Java设计模式 结构型模式 适配器模式 模式动机:在软件开发中采用类似于电源适配器的设计和编码技巧被称为适配器模式.通常情况下,客户端可以通过目标类的接口访问它所提供的服务.又是,现有的类可以满足客 ...
- 结构型模式(Structural patterns)->外观模式(Facade Pattern)
动机(Motivate): 在软件开发系统中,客户程序经常会与复杂系统的内部子系统之间产生耦合,而导致客户程序随着子系统的变化而变化.那么如何简化客户程序与子系统之间的交互接口?如何将复杂系统的内部子 ...
- 设计模式之美:Structural Patterns(结构型模式)
结构型模式涉及到如何组合类和对象以获得更大的结构. 结构型类模式采用继承机制来组合接口实现. 结构型对象模式不是对接口和实现进行组合,而是描述了如何对一些对象进行组合,从而实现新功能的一些方法. 因为 ...
- 设计模式(十二): Flyweight享元模式 -- 结构型模式
说明: 相对于其它模式,Flyweight模式在PHP实现似乎没有太大的意义,因为PHP的生命周期就在一个请求,请求执行完了,php占用的资源都被释放.我们只是为了学习而简单做了介绍. 1. 概述 面 ...
- .NET设计模式(15):结构型模式专题总结(转)
摘要:结构型模式,顾名思义讨论的是类和对象的结构,它采用继承机制来组合接口或实现(类结构型模式),或者通过组合一些对象,从而实现新的功能(对象结构型模式).这些结构型模式,它们在某些方面具有很大的相似 ...
- NET设计模式 第二部分 结构性模式(14):结构型模式专题总结
——探索设计模式系列之十五 Terrylee,2006年5月 摘要:结构型模式,顾名思义讨论的是类和对象的结构,它采用继承机制来组合接口或实现(类结构型模式),或者通过组合一些对象,从而实现新的功能( ...
- NET设计模式 第三部分 结构型模式(7):适配器模式(Adapter Pattern)
适配器模式(Adapter Pattern) ——.NET设计模式系列之八 Terrylee,2006年2月 概述 在软件系统中,由于应用环境的变化,常常需要将“一些现存的对象”放在新的环境中应用,但 ...
- Java经典设计模式之七大结构型模式(附实例和详解)
博主在大三的时候有上过设计模式这一门课,但是当时很多都基本没有听懂,重点是也没有细听,因为觉得没什么卵用,硬是要搞那么复杂干嘛.因此设计模式建议工作半年以上的猿友阅读起来才会理解的比较深刻.当然,你没 ...
- Java设计模式之七大结构型模式(附实例和详解)
博主在大三的时候有上过设计模式这一门课,但是当时很多都基本没有听懂,重点是也没有细听,因为觉得没什么卵用,硬是要搞那么复杂干嘛.因此设计模式建议工作半年以上的猿友阅读起来才会理解的比较深刻.当然,你没 ...
随机推荐
- 关于requests库中文编码问题
转自:代码分析Python requests库中文编码问题 Python reqeusts在作为代理爬虫节点抓取不同字符集网站时遇到的一些问题总结. 简单说就是中文乱码的问题. 如果单纯的抓取微博 ...
- HOSTNAME问题 和yum配置163源的操作 安装lsb_release,KSH,CSH
HOSTNAME 在 /etc/hosts 里添加一行 127.0.0.1 yourhostname yum配置 来自http://www.cnblogs.com/wutengbiao/p/41889 ...
- powerDesigner 正向工程生成sql注释
找到script-->objects-->column-->add value内容如下: %:COLUMN% %:DATATYPE%[.Z:[%Compressed%? compre ...
- JSP内置对象page/pageContext/Config/Exception
Config对象 config对象实是在一个Servlet初始化时,JSP引擎向它传递信息用的,此信息包括Servlet初始化时所要用到的参数(通过属性名和属性值构成)以及服务器的有关信息(通过传递一 ...
- 长方体类Java编程题
1. 编程创建一个Box类(长方体),在Box类中定义三个变量,分别表示长方体的长(length).宽(width)和高(heigth),再定义一个方法void setBox(int l, int w ...
- PMP:3.项目经理角色
成员角色:整合指挥者 在团队中的职责:负终责 知识技能:综合技能&沟通 定义: 职能经理专注于对某个职能领域或业务部门的管理监督. 运营经理负责保证业务运营的高效性. 项目经理是由执行组织 ...
- day14_雷神_前端02
# 前端day02 1. html标签 1. span标签设置宽高 设置宽高后,字体不会发生变化. 2. 盒模型 padding是border里面的距离: margin 是border边框外头的了属于 ...
- C# MVC微信扫码支付
项目需求:学校学生网上缴费项目,刚来公司实习网上百度了各种资料,感谢很多大神避免了很多大坑. 本次扫码支付为:电脑生成二维码,手机微信扫码进行付款.建议开发前下载官方demo熟悉及后续有用到里面代码: ...
- [UWP]使用Popup构建UWP Picker
在上一篇博文<[UWP]不那么好用的ContentDialog>中我们讲到了ContentDialog在复杂场景下使用的几个令人头疼的弊端.那么,就让我们在这篇博文里开始愉快的造轮子之旅吧 ...
- 背水一战 Windows 10 (84) - 用户和账号: 微软账号的登录和注销
[源码下载] 背水一战 Windows 10 (84) - 用户和账号: 微软账号的登录和注销 作者:webabcd 介绍背水一战 Windows 10 之 用户和账号 微软账号的登录和注销 示例演示 ...