alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Friki example source code file (LocalWikiLink.java)

This example Friki source code file (LocalWikiLink.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Friki tags/keywords

abstractstringfetcher, abstractstringfetcher, container, initialisable, localwikilink, localwikilink, object, object, string, string

The Friki LocalWikiLink.java source code

package wiki;

import org.stringtree.factory.AbstractStringFetcher;
import org.stringtree.factory.Container;
import org.stringtree.factory.Fetcher;
import org.stringtree.juicer.Initialisable;

import com.efsol.friki.NamePreserver;

public class LocalWikiLink 
	extends AbstractStringFetcher
	implements Initialisable
{
	private Container pages;

	public LocalWikiLink(Container pages)
	{
		this.pages = pages;
	}

	public LocalWikiLink()
	{
		this(null);
	}
	
	public Object getObject(String key)
	{
		String ret = "";

		if (pages.contains(key))
		{
			ret = "\nview{" + key + "," + NamePreserver.escape(key) + "}\n";
		}
		else
		{
			ret = "\nedit{" + key + "," + NamePreserver.escape(key) + "}\n";
		}
		return ret;
	}

	public void init(Fetcher context)
	{
		pages = (Container)context.getObject("wiki.pages");
	}
}

Other Friki examples (source code examples)

Here is a short list of links related to this Friki LocalWikiLink.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.