View RSS Feed

All Blog Entries

  1. Self Made Observable Pattern

    by , 03-03-2012 at 11:50 PM
    Java Code:
    package observerPatternSelfMade;
    
    public class MyObservableClass implements MyObservableInterface {
    
    	
    	
    	@Override
    	public void registerObserver(MyObserverInterface o) {
    		observers.add(o);
    	}
    
    	@Override
    	public void removeObserver(MyObserverInterface o) {
    		observers.remove(o);
    	}
    
    	@Override
    	public void notifyObservers() {
    		
    		for(int i = 0; i<observers.size();i++)
    ...
    Categories
    Uncategorized
  2. Strategy Pattern Example

    by , 03-03-2012 at 11:20 PM
    Java Code:
    package strategyPattern;
    
    public class Warrior {
    	
    	private AttackBehaviour attackBehaviour;
    	public String name;
    
    	void setAttackBehaviour(AttackBehaviour aB) {
    		this.attackBehaviour = aB;
    	}
    	
    	void attack() {
    		attackBehaviour.attack();
    	}
    }
    
    package strategyPattern;
    
    public interface AttackBehaviour {
    	
    	void attack();
    
    }
    
    package
    ...
    Categories
    Uncategorized
  3. Using the Observable - Observer class , interface in JAVA. Observer Pattern example.

    by , 03-03-2012 at 11:00 PM
    Java Code:
    package observerPatternBuiltIn;
    
    import java.util.Observable;
    
    public class MyObservable extends Observable {
    	
    	int integerToBeObserved;
    	
    	public void setInt(int i) {
    		integerToBeObserved = i;
    		setChanged();
    		notifyObservers();
    	}
    	
    	public int getInt() {
    		return integerToBeObserved;
    	}
    
    }
    
    
    package observerPatternBuiltIn;
    
    import
    ...
    Categories
    Uncategorized
  4. Decorator Pattern Example

    by , 03-03-2012 at 10:27 PM
    Java Code:
    package decoratorPattern;
    
    public abstract class Beverage {
    	
    	String description;
    	int size;
    	
    	public Beverage(int size) {
    		this.size = size;
    	}
    		
    	public String getDescription() {
    		
    		String mySize = null;
    		
    		if(size == 1)
    			mySize = "Small";
    		else if(size==2)
    			mySize="Medium";
    		else if(size==3)
    			mySize="Large";
    ...
    Categories
    Uncategorized
  5. How to set value to entity?

    by , 03-03-2012 at 08:42 AM
    Quote Originally Posted by heart_throbber View Post
    Hi all,
    I have 2 DTOs & 2 Entities, 1 controller & 1 service implementation over here.

    Now, my problem is at the service implementation setStates. I dont know how to set states to address entity from addressDTO's getStatesList. because address entity includes state entity while addressDTO using stateDTO .

    My Address Entity:
    Java Code:
    public class Address
    {
        private List<State> states;
    
        public List<State>
    ...
    Categories
    Uncategorized
Page 19 of 48 FirstFirst ... 9171819202129 ... LastLast