Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Riena/Core

< Riena
Revision as of 22:41, 2 March 2010 by Stefan.Liebig.compeople.de (Talk | contribs) (StringUtils)

Logging with Log4j

See package org.eclipse.riena.core.logging.

Accessing files on disk with RienaLocations

The class org.eclipse.riena.core.RienaLocations with static methods getDataArea() and getDataArea(Bundle) should be the single place that manages and knows about where to read/write files on disk.

Always use RienaLocations when you need to read or write application-specific data (e.g. user settings or custom caches) to/from disk.

Caching

See package org.eclipse.riena.core.cache.

Util classes

All in package org.eclipse.riena.core.util. See the source files for a complete list of methods and the inline Javadoc for more information.

ArraysUtil

Helper for arrays.

public static <T> T[] copyRange(T[] source, int from, int to)
Copy from the given source array from index from to index to into a newly-created array of the same type with size to - from.

IOUtils

Helper for I/O operations, e.g.

public static void copyFile(File from, File to) throws IOException

Iter

This helper provides conversions from classes only implementing Iterator or Enumeration such that they can be used within the extended for()-loop (foreach). All the able() methods can be used with a null parameter. So, explicitly checking for null is not necessary! Note: All these methods induce a small performance penalty.

String[] strings = null;
for (String s : Iter.able(strings)) {
	...
}
StringTokenizer st = new StringTokenizer("this is a test");
for (String str : Iter.able(st, String.class)) {
	...
}

Nop

Use this to explicitly document do-nothing behavior, e.g. in empty try-catch clauses:

Nop.reason("do nothing, can happen if some other bundle registered this service");

PropertiesUtils

Helps with converting string representation of maps and lists to their Java counterparts.

ReflectionUtils

Provides static methods that allow a grovvy-like experience for calling methods, setting and getting fields and creating instances. Both on accessible, i.e. public and inaccessible elements. And everything without fiddling around with the reflection API.

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, octave, oobas, oorexx, oracle11, oracle8, otj, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, rails, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, spark, sparql, sql, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
URL url = new URL("file:c:\\");
ReflectionUtils.invokeHidden(sysloader, "addURL", url);

StringUtils

Offers static convenience methods like:

public static boolean isGiven(final CharSequence sequence)
the counterpart to isEmpty(...)
public static boolean isEmpty(final CharSequence sequence)
public static boolean isDeepEmpty(final String string)
like isEmpty, with the difference that whitespace-only strings are considered empty.
public static boolean equals(final CharSequence sequence1, final CharSequence sequence2)
null-safe equals

Back to the top