template.interface_java.txt Maven / Gradle / Ivy
/* Source generated by codegenj (https://github.com/olir/codegenj) - DO NOT EDIT!
*
* This license does not apply to any contained documentation in the source!
*
* This generated output is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
* In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the
* software to the public domain. We make this dedication for the benefit
* of the public at large and to the detriment of our heirs and
* successors. We intend this dedication to be an overt act of
* relinquishment in perpetuity of all present and future rights to this
* software under copyright law.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* For more information, please refer to
*/
$$$interface.pcode$$$
import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import java.util.Collections;
import de.serviceflow.codegenj.ObjectManager;
import de.serviceflow.codegenj.ObjectManager.DBusInterface;
import java.io.IOException;
/**
* D-Bus JNI Interface class for $$$interface.name$$$
*/
public class $$$interface.uname$$$ extends DBusInterface {
static {
System.loadLibrary("$$$library$$$"); // Load native library lib$$$library$$$.so at runtime
}
private Object _proxy;
public $$$interface.uname$$$(Object proxy) {
_proxy = proxy;
_init();
}
public native void _init();
public native void _destroy();
###for de.serviceflow.codegenj.CollectorAPI###
static private Map $$$vname$$$Map = null;
static public void add$$$cname$$$Object(String path, Object proxy) {
$$$cinterfacename$$$ n = new $$$cinterfacename$$$(proxy);
if (path==null)
path = ObjectManager.getInstance().getObjectPath(proxy);
$$$vname$$$Map.put(path, n);
n.setObjectPath(path);
}
static public void remove$$$cname$$$Object(String path, Object proxy) {
if (path==null)
path = ObjectManager.getInstance().getObjectPath(proxy);
$$$cinterfacename$$$ n = $$$vname$$$Map.get(path);
n._destroy();
$$$vname$$$Map.remove(path);
}
static public void initialize$$$cname$$$Mapping() {
$$$vname$$$Map = Collections.synchronizedMap(new HashMap());
if ($$$opmode$$$) {
Object [] newProxies = ObjectManager.getInstance().getProxyObjects("$$$cinterfacename$$$", $$$opmode$$$);
for (Object proxy : newProxies) {
add$$$cname$$$Object(null, proxy);
}
System.out.println("*** $$$vname$$$Map initialized, count="+(newProxies.length));
}
}
public List<$$$cinterfacename$$$> $$$mname$$$() {
if (!$$$opmode$$$) {
$$$vname$$$Map.clear();
Object [] newProxies = ObjectManager.getInstance().getProxyObjects("$$$cinterfacename$$$", $$$opmode$$$);
for (Object proxy : newProxies) {
add$$$cname$$$Object(null, proxy);
}
//System.out.println("*** $$$vname$$$Map updated, count="+(newProxies.length));
}
List<$$$cinterfacename$$$> resultList = new ArrayList<$$$cinterfacename$$$>();
String prefix = getObjectPath();
if (prefix.length()>0 && prefix.charAt(prefix.length()-1)!='/') {
prefix = prefix + '/';
}
//System.out.println(" ** $$$vname$$$Map: searching at prefix="+prefix);
for (Map.Entry entry : $$$vname$$$Map.entrySet()) {
String key = entry.getKey();
// System.out.println(" * key="+key);
if (key.startsWith(prefix)) {
resultList.add(entry.getValue());
}
}
return resultList;
}
###end###
###for properties###
###case read###
/**
* Reads property $$$property.name$$$.
*
*$$$method.comment$$$
*
* @return the property value.
*/
public native $$$method.javareturntype$$$ $$$method.jname$$$();
###end###
###case write###
/**
* Writes property $$$property.name$$$.
*
*$$$method.comment$$$
*
* @param $$$property.name$$$ the new value.
*/
public native void $$$method.jname$$$($$$method.javaargs$$$);
###end###
###end###
###for method###
/**
* $$$method.name$$$:
*
* $$$method.comment$$$
*/
public native $$$method.javareturntype$$$ $$$method.jname$$$($$$method.javaargs$$$) throws IOException;
###end
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy