Skip to content

Instantly share code, notes, and snippets.

View bmaggi's full-sized avatar

Benoit Maggi bmaggi

  • Bordeaux, France
View GitHub Profile
@bmaggi
bmaggi / pom.xml
Created December 17, 2015 12:53
Papyrus Rcptt test after release
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test-sysml14-nexus-deployement</groupId>
<artifactId>test-sysml14-nexus-deployement</artifactId>
<packaging>rcpttTest</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>test-sysml14-nexus-deployement</name>
<pluginRepositories>
@bmaggi
bmaggi / Account.java
Created July 8, 2016 12:01
Introspection example to change private field and call private method
public class Account {
// #1 : Safe private field...
private long myMoney;
public Account() {
this.myMoney = 100;
}
public long getMoney(){
@bmaggi
bmaggi / StringArrayStringStore.java
Created January 19, 2017 20:47
Utility class to store a String Array as String and get it back (don't work with ", ")
import java.util.Arrays;
/**
* Utility class to store a String Array as String and get it back
*/
public class StringArrayStringStore {
private String backup;
public String[] storeRestore(String[] datas) {
@bmaggi
bmaggi / InstanceOfTest
Created March 22, 2017 09:06
A simple class test to prove that null is not an instance
import org.junit.Assert;
import org.junit.Test;
/**
* A simple class test to prove that null is not an instance
* (aka useless: test!= null && test instanceOf MyClass)
*
* @author Benoit Maggi
*/
@bmaggi
bmaggi / DiagnosticUtil
Created June 22, 2017 11:22
Pretty print for an EMF Diagnostic
import java.util.List;
import org.eclipse.emf.common.util.Diagnostic;
public class DiagnosticUtil {
// pretty print for an EMF Diagnostic
public static String print(Diagnostic diagnostic) {
List<Diagnostic> children = diagnostic.getChildren();
StringBuilder stringBuilder = new StringBuilder(diagnostic.getMessage());
@bmaggi
bmaggi / ArchitectureValidationTest.java
Created October 27, 2017 06:52
Example of Test to check that Emf id is identical to id field (very useful when reviewing code in Gerrit)
/*****************************************************************************
* Copyright (c) 2017 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
@bmaggi
bmaggi / PredicateFilter.java
Created November 6, 2017 13:04
A simple example to use predicate to filter data structure
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
* A simple example to use predicate to filter data structure
* @author Benoit Maggi
*/
@bmaggi
bmaggi / NoGenericPredicateFilter.java
Created November 6, 2017 14:19
A simple way to use predicate to filter data structure (also catch the exception)
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
* A simple way to use predicate to filter data structure
*
* @author Benoit Maggi
@bmaggi
bmaggi / SetPapyrusIcon.java
Last active January 10, 2018 09:45
A utility to set all icon/eannotation for Papyrus images in a profile.
package org.eclipse.papyrus.sysml.tests;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
@bmaggi
bmaggi / gist:34ffd351d11137192ac8d5909fbcc74a
Created February 8, 2018 08:27 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: